Problem with SDL window (cant click-n-drag it!)

hi,

im having this annoying problem with my SDL window lately. im making a 2d game
with OpenGL and using SDL for window creation/input handling / etc.

in my game, i use the mouse for movement. that is, when you click somewhere,
your character walks to where you clicked.anyway, the bug is this - sometimes,
not ALL the time, but sometimes, when i go to click and drag the window (you
know, when you “grab” the top bar of the window to move the window around?) - i
can’t do it. instead of it “grabbing” the window like it should, instead my
character starts walking towards where i clicked!

btw, i even tried doing this, in my Is_Move_Clicked() function:

int x,y;
SDL_GetMouseState(&x,&y);

//if we clicked outside of the window, return false
if(x < 0 || y < 0)
return false;

but even this doesn’t work! the window is still not grabbed! like i said, it
doesnt happen all the time, just sometimes.

lastly, i found a “fix” to it. if i minimize the window or just bring it out of
focus, the bug goes away and i can drag the window again. so strange…

thanks a lot for any help!

'lo Drew,On 01/12/2004, Drew Ferraro, you wrote:

sometimes, not ALL the time, but sometimes, when i go to
click and drag the window (you know, when you “grab” the top bar of
the window to move the window around?) - i can’t do it.

I’ve had the same problem with my OpenGL game and SDL 1.2.7.

SDL 1.2.6 doesn’t have this problem, so I’m still using it.

Also with SDL 1.2.7 the window disappears in some conditions (after
alt-tabbing from fullscreen IIRC).


Please remove “.ARGL.invalid” from my email when replying.
Incoming HTML mails are automatically deleted.

'lo Drew,

sometimes, not ALL the time, but sometimes, when i go to
click and drag the window (you know, when you “grab” the top bar of
the window to move the window around?) - i can’t do it.

I’ve had the same problem with my OpenGL game and SDL 1.2.7.

SDL 1.2.6 doesn’t have this problem, so I’m still using it.

Also with SDL 1.2.7 the window disappears in some conditions (after
alt-tabbing from fullscreen IIRC).

Do you see this problem with SDL from CVS?
http://www.libsdl.org/cvs/SDL-1.2.tar.gz

Thanks!
-Sam Lantinga, Software Engineer, Blizzard Entertainment> On 01/12/2004, Drew Ferraro, you wrote:

Sorry, a pre-compiled DLL will probably be more helpful:
http://www.libsdl.org/cvs/SDL.dll

See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment

'lo Sam,On 02/12/2004, Sam Lantinga, you wrote:

Do you see this problem with SDL from CVS?

Thanks for providing the dll! (and giving me the opportunity to report
this bug… :slight_smile: )

I made a few tests with the new dll, and:

  • I always could drag the window. Seems good :).

  • It seems that once SDL_SetVideoMode() has been called once with
    SDL_FULLSCREEN, then calling it without SDL_FULLSCREEN results in an
    invisible window. There is the associated button in Windows’ taskbar,
    keyboard events are still handled, but there is no window to be seen.
    This already happened with SDL 1.2.7, but not with 1.2.6.

I haven’t written a special test program… It just happens when I
switch from fullscreen to window in my game (switching from window to
fullscreen first works fine). With the little doc I found about how to
do this (and handle alt-tab), I had to resort to black magic, so maybe
I’m doing something wrong elsewhere. I’m just closing the display then
opening a new one (SDL_QuitSubSystem(SDL_INIT_VIDEO) then
SDL_InitSubSystem(SDL_INIT_VIDEO), SDL_SetVideoMode(), etc.)

This is under Windows 98, with a Radeon 9200 SE (drivers updated two
weeks ago).

Thanks,

Please remove “.ARGL.invalid” from my email when replying.
Incoming HTML mails are automatically deleted.

Olivier Fabre wrote:

I’m just closing the display then
opening a new one (SDL_QuitSubSystem(SDL_INIT_VIDEO) then
SDL_InitSubSystem(SDL_INIT_VIDEO), SDL_SetVideoMode(), etc.)

can you try commenting out the (SDL_QuitSubSystem(SDL_INIT_VIDEO)
and the SDL_InitSubSystem(SDL_INIT_VIDEO)?

just do the SDL_SetVideoMode() to change to a new mode…

-LIM-

'lo Jonathan,On 02/12/2004, Jonathan Atkins, you wrote:

can you try commenting out the (SDL_QuitSubSystem(SDL_INIT_VIDEO)
and the SDL_InitSubSystem(SDL_INIT_VIDEO)?

just do the SDL_SetVideoMode() to change to a new mode…

Ok, I tried this. Several changes:

  • When switching from fullscreen to windowed, the window IS shown.

But:

  • When I switch to fullscreen, the display is blinking like if one
    buffer contained my game and the other one Windows’ desktop. (this also
    happens when I alt-tab from fullscreen and back)

  • I have noticed once, after a few switches, the “can’t click the
    dragbar” bug. (the mouse pointer only appears outside of the window
    frame, not when it is on top of it - note that I’m using
    SDL_ShowCursor(0), if that matters.)

  • I then also noticed a bug where the mouse pointer was constrained
    inside the window. I am using SDL_WM_GrabInput(), but only when the RMB
    is pressed, and this bug never happened with SDL 1.2.6 AFAIR.

This is in my input handling function (called every frame):

mouseButtons = SDL_GetRelativeMouseState( (int*)&g_MouseDeltaX,
(int*)&g_MouseDeltaY );
if( mouseButtons & SDL_BUTTON_RMASK )
SDL_WM_GrabInput( SDL_GRAB_ON );
else
SDL_WM_GrabInput( SDL_GRAB_OFF );


Please remove “.ARGL.invalid” from my email when replying.
Incoming HTML mails are automatically deleted.

thanks Sam,

i got the new DLL and so far haven’t had it happen. however, like i said, it
only was happening sometimes, and i couldnt seem to get it to reproduce. i’ll
let you know if it happends again.

is the new dll all i need?

also, i noticed my old DLL was 1.2.4 (from 2002). does this effect anything?
maybe 1.2.4 didnt have this bug and its something else causing my problem? well,
i guess ill find out soon enough. thanks again.