1. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Game "window" does not respect given dimensions [935]

Discussion in 'Archive' started by mari_kiri, Nov 11, 2013.

  1. mari_kiri

    mari_kiri Catapult Fodder

    Messages:
    5
    Category: KAG Client
    Operating system: Linux (but could apply to other OSes)
    Build number: 935
    Description:
    I have a tiling window manager. (Namely, dwm.) Every time I want to run KAG, I have to hide the bar up the top, make sure everything else on the given tag is marked floating, and then I can click "Play". Otherwise, the bottom gets cut off.

    I cannot resize the window to alleviate this problem.

    Of course, I can always do some hacks to dwm to get this to work, but it would be nice if you could make it either respect hints or handle resizing gracefully.

    Steps to reproduce:
    1. Use a tiling window manager.
    2. Pretend this bug doesn't exist and don't prepare for it.
    3. Open KAG.
    4. Enjoy having a clipped window forever. Or until you close KAG, and then reopen it carefully.

    - <3 -

    I don't know if Irrlicht will relay window resize messages to your program, so I think the only way to fix this bug properly is to fix Irrlicht. Fortunately, at least that is open source.

    I think I'll go about hacking dwm once I've found the window class.

    The best way to fix this, if you're willing to fix Irrlicht, is to properly mark the window as non-resizeable from the get-go, so dwm will mark it as floating and not try to resize it or anything. I don't know how this is done, sorry.

    EDIT: I've tried modding dwm but so far there's been no success. It appears to not set the window name early enough.
     
    Last edited: Nov 11, 2013
  2. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    When i was using dwm I just flagged KAG to be run as floating anyway, unfortunately it wasn't an easy thing to fix in the engine when I was looking into it.

    There's no window "class" in dwm, you just set up a set of "hints" for KAG as far as i remember. Being C code there aren't really "classes" anyway. If I get some time later and am able to test I might be able to post the relevant changes here, but i'm not running linux at the moment :^)

    We do get resize events from irrlicht but the engine isn't particularly "ready" for the window being resized at runtime (to the point where the resolution controls are set in the pre-game launcher, haha) - the code changes there would be nontrivial.

    As far as I'm aware we are flagging the window as non-resizable, but irrlicht might not be setting the flag that dwm is looking for. Do you happen to know the flag that it checks for that sort of thing?
     
  3. mari_kiri

    mari_kiri Catapult Fodder

    Messages:
    5
    I'm noseying through the dwm code right now.

    There's a chance it might have something to do with setting the fullscreen flag (updatewindowtype in dwm is the function I'm looking at). But if I tick the "fullscreen" box in setup, while it does alleviate this issue, I cannot switch between tags - I'm stuck with KAG glued to my face.

    The "manage" function in dwm might be where it applies the "is floating" behaviour.

    Looking through the Irrlicht demos, I haven't found a way to force Irrlicht to actually float windows. I can look at SDL's code to see how it ensures stuff floats, because as long as you don't set the resizable flag, the windows SDL produce will float.

    EDIT: AHA.

    Code:
    static void X11_SetSizeHints(_THIS, int w, int h, Uint32 flags)
    {
            XSizeHints *hints;
    
            hints = XAllocSizeHints();
            if ( hints ) {
                    if (!(flags & SDL_RESIZABLE)) {
                            hints->min_width = hints->max_width = w;
                            hints->min_height = hints->max_height = h;
                            hints->flags = PMaxSize | PMinSize;
                    }
    
    (SDL: src/video/x11/SDL_x11video.c)

    Note, this must be set on window creation. I think. I could still be wrong.

    Further EDIT: Relevant code in dwm.c "updatesizehints":
    Code:
    	c->isfixed = (c->maxw && c->minw && c->maxh && c->minh
    	             && c->maxw == c->minw && c->maxh == c->minh);
    
    EDIT 2: A little test.
    Code:
    #include <stdio.h>
    
    #include <SDL.h>
    
    int main(int argc, char *argv[])
    {
    	SDL_Init(SDL_INIT_TIMER | SDL_INIT_VIDEO);
    	SDL_SetVideoMode(640, 480, 32, SDL_RESIZABLE);
    	SDL_Delay(800);
    	SDL_SetVideoMode(640, 480, 32, 0);
    	SDL_Delay(800);
    	SDL_SetVideoMode(640, 480, 32, SDL_RESIZABLE);
    	SDL_Delay(800);
    
    	return 0;
    }
    
    It looks like there's a bug in dwm - you have to manually float the window for the size to correct itself between the second and third mode sets.
     
    Last edited: Nov 11, 2013
  4. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Odd that dwm doesn't allow you to swap off the KAG window, it's not doing anything "special" there

    I'll have a look into hacking those hints in (assuming they're absent) later on today.