[Pipmak-Devel] Two Bugs

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Pipmak-Devel] Two Bugs

Aidan Gauland
Hello,

 I have (I think) fixed the bug with the mouse grabbing.  If I remove
the call to SDL_WM_GrabInput() that's right before the main for(;;)
loop, then it seems to always be possible to get the mouse out of the
window, even with edge resistance.

 Also, when I bring up the save game dialog with the 'S' key, Pipmak
doesn't give me my mouse back, and I have to go to a virtual console and
kill Pipmak.  If I add a call to SDL_WM_GrabInput() to ungrab the mouse
in the Lua C function which is called when the 'S' key is pressed, that
seems to solve this problem.

 I can not be sure that I have fixed this bugs, and haven't simply
masked them, nor can I be sure that I haven't broken something somewhere
else.  But what the heck, here are the patches with my modifications, (I
also added parentheses around the tests for an if statement (you'll see
where), just to suppress a complier warning.  No other reason.) let me
know what you think.

 -Aidan

startGrab.patch.bz2 (738 bytes) Download Attachment
saveDialogUnGrab.patch.bz2 (437 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Pipmak-Devel] Two Bugs

Urs Holzer-2
Hi

Aidan Gauland wrote:
>  I have (I think) fixed the bug with the mouse grabbing.  If I remove
> the call to SDL_WM_GrabInput() that's right before the main for(;;)
> loop, then it seems to always be possible to get the mouse out of the
> window, even with edge resistance.

Yes, your patch fixes the problem on my machine: Debian linux etch
(using KDE). Good work! (I think that it is anyway better behaviour not
to grab the mouse when Pipmak starts and the mouse is outside the
window.)

>  Also, when I bring up the save game dialog with the 'S' key, Pipmak
> doesn't give me my mouse back, and I have to go to a virtual console
> and
> kill Pipmak.  If I add a call to SDL_WM_GrabInput() to ungrab the
> mouse in the Lua C function which is called when the 'S' key is
> pressed, that seems to solve this problem.

I experience the same problem and again, your patch fixes it.





Reply | Threaded
Open this post in threaded view
|

Re: [Pipmak-Devel] Two Bugs

cwalther
Administrator
In reply to this post by Aidan Gauland
Aidan Gauland wrote:
> I have (I think) fixed the bug with the mouse grabbing.  If I remove the
> call to SDL_WM_GrabInput() that's right before the main for(;;) loop,
> then it seems to always be possible to get the mouse out of the window,
> even with edge resistance.

Thanks, I've committed that. That grab must have been a relic from the
past, the automatic grab when the mouse moves inside the window is
indeed sufficient.

> Also, when I bring up the save game dialog with the 'S' key, Pipmak
> doesn't give me my mouse back, and I have to go to a virtual console and
> kill Pipmak.  If I add a call to SDL_WM_GrabInput() to ungrab the mouse
> in the Lua C function which is called when the 'S' key is pressed, that
> seems to solve this problem.

Right, that was an oversight. The other two dialogs (open project and
open saved game) have the ungrab. For some reason it worked here on Mac
OS X without it. This is committed, thanks!

> I also added parentheses around the tests for an if statement (you'll
> see where), just to suppress a complier warning.  No other reason.

GCC doesn't trust us to know that 'and' is stronger than 'or'? Oh
well... applied.

  -Christian



Reply | Threaded
Open this post in threaded view
|

Re: [Pipmak-Devel] Two Bugs

Aidan Gauland
  Ahhh, one other thing: If the user brings up a dialog, and then dismisses it, Pipmak seems to do the same thing with grabbing the mouse, even if it's not in the window, and then it is impossible to get the mouse out of the window, until the user brings up another dialog, and closes it when it is over the Pipmak window (so the mouse will be in the Pipmak window when it regrabs the mouse).

 I did a case-insensitive search for a call to SDL_WMGrabInput(), but only found the one in main.c for the mouse motion event, and two in pipmakLuaLib.c before dialogs are opened.  So how is Pipmak grabbing the mouse without calling that function?

 Oh, and I have the -Wall option set for GCC, because I'm still learning about syntatical gotchas in C.  I don't think it gives warnings about parentheses around logical operators normally.

 -Aidan

Christian Walther wrote:
Aidan Gauland wrote:
  
I have (I think) fixed the bug with the mouse grabbing.  If I remove the 
call to SDL_WM_GrabInput() that's right before the main for(;;) loop, 
then it seems to always be possible to get the mouse out of the window, 
even with edge resistance.
    

Thanks, I've committed that. That grab must have been a relic from the 
past, the automatic grab when the mouse moves inside the window is 
indeed sufficient.

  
Also, when I bring up the save game dialog with the 'S' key, Pipmak 
doesn't give me my mouse back, and I have to go to a virtual console and 
kill Pipmak.  If I add a call to SDL_WM_GrabInput() to ungrab the mouse 
in the Lua C function which is called when the 'S' key is pressed, that 
seems to solve this problem.
    

Right, that was an oversight. The other two dialogs (open project and 
open saved game) have the ungrab. For some reason it worked here on Mac 
OS X without it. This is committed, thanks!

  
I also added parentheses around the tests for an if statement (you'll 
see where), just to suppress a complier warning.  No other reason.
    

GCC doesn't trust us to know that 'and' is stronger than 'or'? Oh 
well... applied.

  -Christian


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Pipmak-Devel mailing list
[hidden email]
<a class="moz-txt-link-freetext"
 href="news://news.gmane.org/gmane.games.devel.pipmak.devel">news://news.gmane.org/gmane.games.devel.pipmak.devel
https://lists.sourceforge.net/lists/listinfo/pipmak-devel

  
Reply | Threaded
Open this post in threaded view
|

Re: [Pipmak-Devel] Two Bugs

cwalther
Administrator
Aidan Gauland wrote:
>   Ahhh, one other thing: If the user brings up a dialog, and then
> dismisses it, Pipmak seems to do the same thing with grabbing the mouse,
> even if it's not in the window, and then it is impossible to get the
> mouse out of the window, until the user brings up another dialog, and
> closes it when it is over the Pipmak window (so the mouse will be in the
> Pipmak window when it regrabs the mouse).

I can't reproduce this - everything seems to work correctly here on
Fedora Core 4 with SDL 1.2.13 (perhaps I should try with a less ancient
distro some time). So I'm afraid you're on your own with fixing this...

>  I did a case-insensitive search for a call to SDL_WMGrabInput(), but
> only found the one in main.c for the mouse motion event, and two in
> pipmakLuaLib.c before dialogs are opened.  So how is Pipmak grabbing the
> mouse without calling that function?

I have 8 total occurences of SDL_WM_GrabInput (2 in pipmakLuaLib.c, 6 in
main.c), but none that would explain your observation.

>  Oh, and I have the -Wall option set for GCC, because I'm still learning
> about syntatical gotchas in C.  I don't think it gives warnings about
> parentheses around logical operators normally.

I thought I had -Wall too, but it turns out I only had -Wmost, which
explicitly excludes -Wparentheses. I'll change that to -Wall and see how
far I get until it annoys me.

  -Christian



Reply | Threaded
Open this post in threaded view
|

Re: [Pipmak-Devel] Two Bugs

Urs Holzer-2
In reply to this post by Aidan Gauland

> Ahhh, one other thing: If the user brings up a dialog, and then
> dismisses it, Pipmak seems to do the same thing with grabbing the
> mouse, even if it's not in the window, and then it is impossible to
> get the mouse out of the window, until the user brings up another
> dialog, and closes it when it is over the Pipmak window (so the mouse
> will be in the Pipmak window when it regrabs the mouse).<br>

I can reproduce this here on debian linux etch with SDL 1.2.11. The
mouse gets locked in when I hit S while the mouse is _inside_ the
pipmak window and then klick the cancel button with the mouse at a
place that is _outside_ of pipmak's window.