tomassedovic / tcod-rs

Rust bindings for libtcod 1.6.3 (the Doryen library/roguelike toolkit)
Do What The F*ck You Want To Public License
229 stars 45 forks source link

Running tcod application disabled KDE compositor effects #301

Closed Bravo555 closed 4 years ago

Bravo555 commented 4 years ago

A tcod application seems to be disabling compositor effects as long as it's running. The effect is visible here: image image

I thought that maybe SDL is responsible for such undesirable behaviour so I tried to make a minimal SDL example to reproduce this behaviour:

#include <iostream>
#include <SDL2/SDL.h>

int main(int argc, char** argv) {
    if(SDL_Init(SDL_INIT_VIDEO) != 0) {
        std::cerr << "failed to init: " << SDL_GetError() << std::endl;
        return 1;
    }
    SDL_Window* win = SDL_CreateWindow("Hello world", 0, 0, 800, 600, SDL_WINDOW_SHOWN);
    SDL_Renderer *ren = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);

    bool quit = false;
    SDL_Event e;

    while(!quit) {
        SDL_RenderClear(ren);
        while(SDL_PollEvent(&e)) {
            switch(e.type) {
                case SDL_QUIT:
                    quit = true;
                    break;
            }
        }

        SDL_RenderPresent(ren);
    }
    SDL_DestroyRenderer(ren);
    SDL_DestroyWindow(win);
    SDL_Quit();

    return 0;
}

And to my surprise, the same build of the code one time disables compositor, and another time it doesn't... It seems to just be completely random. I compile the code with g++ main.cpp -lSDL2. I'm using the OpenGL 3.1 compositor in KDE. Do you happen to know what could be causing the issue? I'd happily look into that, should you give me a few pointers where to start.

L3nn0x commented 4 years ago

I don't think anyone here will be able to help, we are just providing a rust interface to tcod.

Your best bet would be to take it to the SDL forums and see what they say.

tomassedovic commented 4 years ago

Yeah, I'm afraid I don't really have anything useful to say here either, sorry!

We've written the bindings to libtcod and as far as most of the people working on them, SDL is basically a libtcod's implementation detail. I certainly don't have knowledge that could help here and I haven't used KDE for over a decade.

Bravo555 commented 4 years ago

Thanks for responses! I guess then, as this is not an issue with libtcod itself but rather with its dependency, there's nothing to fix here and the issue can be closed.