About the mouse un-grabbing in Pipmak

View: New views
5 Messages — Rating Filter:   Alert me  

About the mouse un-grabbing in Pipmak

by Aidan Gauland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

 On my system, Pipmak doesn't always let me have my mouse back.  I could
not figure out what was causing this, but I think it might be that the
way Pipmak tries to tell how fast the user is moving the mouse against
the edge of the window doesn't work well with the window manager I'm
using (metacity).  Anyway, I have managed write a patch for Pipmak that
removes the code for releasing the mouse based on mouse motion events,
and adds a Lua function that releases the mouse when called.  It also
makes the "G" key a key-binding for this new Lua function in the
"defaults.lua" file.  But Pipmak still uses the same method for grabbing
the mouse.  Not only does this solve my problem with Pipmak not giving
my mouse back, so I can get back to my other programs, but I also think
it might be more portable across different window managers, than the
current behaviour of Pipmak.

 Is anyone else interested in this patch, and if so, how should I submit
this as a contribution to the Pipmak project?

Regards,
Aidan Gauland

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Pipmak-Devel mailing list
Pipmak-Devel@...
news://news.gmane.org/gmane.games.devel.pipmak.devel
https://lists.sourceforge.net/lists/listinfo/pipmak-devel

Re: About the mouse un-grabbing in Pipmak

by Christian Walther :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Aidan

Thanks for looking into this problem!

> I have managed write a patch for Pipmak that
> removes the code for releasing the mouse based on mouse motion events,
> and adds a Lua function that releases the mouse when called.  It also
> makes the "G" key a key-binding for this new Lua function in the
> "defaults.lua" file.

Hmm. I'm not too happy with that solution, to be honest. How are users
supposed to find that out?

And for those that automatic ungrabbing works (like me), wouldn't it be
better to have it continue to just work, rather than forcing them to go
to the keyboard every time?

> Not only does this solve my problem with Pipmak not giving
> my mouse back, so I can get back to my other programs, but I also think
> it might be more portable across different window managers, than the
> current behaviour of Pipmak.

Have you tried basing the ungrabbing on the actual speed of the mouse
(i.e. taking timing into account), rather than just the pixel delta as
it is currently done? That's what would seem the proper solution to me.

Or as a more general question, what are your usual pixel deltas when you
slam the mouse against the window edge?

Another solution may be to ungrab when the unclamped mouse position has
gone a certain distance outside the window, so speed wouldn't matter
(but we'd still have the edge resistance that is necessary to reach the
edge on Windows and X11).

>  Is anyone else interested in this patch, and if so, how should I submit
> this as a contribution to the Pipmak project?

Please post it either to this mailing list, or to the patch tracker at
<http://sourceforge.net/tracker/?group_id=112801&atid=663294>.

  -Christian


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Pipmak-Devel mailing list
Pipmak-Devel@...
news://news.gmane.org/gmane.games.devel.pipmak.devel
https://lists.sourceforge.net/lists/listinfo/pipmak-devel

Re: About the mouse un-grabbing in Pipmak

by Urs Holzer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

>  On my system, Pipmak doesn't always let me have my mouse back.  I
>  could
> not figure out what was causing this, but I think it might be that the
> way Pipmak tries to tell how fast the user is moving the mouse against
> the edge of the window doesn't work well with the window manager I'm
> using (metacity).  [..]

I have the same problem using KDM (KDE's window manager) on Debian
Linux. The funny thing is that it works sometimes. When I start Pipmak
it either works always or never until I quit pipmak. So I usually have
to close and restart Pipmak four or five times until it works and if it
works, it works always until I close Pipmak.




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Pipmak-Devel mailing list
Pipmak-Devel@...
news://news.gmane.org/gmane.games.devel.pipmak.devel
https://lists.sourceforge.net/lists/listinfo/pipmak-devel

Re: About the mouse un-grabbing in Pipmak

by Aidan Gauland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello Aidan

Thanks for looking into this problem!

  
I have managed write a patch for Pipmak that 
removes the code for releasing the mouse based on mouse motion events, 
and adds a Lua function that releases the mouse when called.  It also 
makes the "G" key a key-binding for this new Lua function in the 
"defaults.lua" file.
    

Hmm. I'm not too happy with that solution, to be honest. How are users 
supposed to find that out?

  
Well, I knew that the node with the list of key-bindings would have to be updated.
And for those that automatic ungrabbing works (like me), wouldn't it be 
better to have it continue to just work, rather than forcing them to go 
to the keyboard every time?

  
Not only does this solve my problem with Pipmak not giving 
my mouse back, so I can get back to my other programs, but I also think 
it might be more portable across different window managers, than the 
current behaviour of Pipmak.
    

Have you tried basing the ungrabbing on the actual speed of the mouse 
(i.e. taking timing into account), rather than just the pixel delta as 
it is currently done? That's what would seem the proper solution to me.

Or as a more general question, what are your usual pixel deltas when you 
slam the mouse against the window edge?

Another solution may be to ungrab when the unclamped mouse position has 
gone a certain distance outside the window, so speed wouldn't matter 
(but we'd still have the edge resistance that is necessary to reach the 
edge on Windows and X11).
  
These both sound like great ideas, but I am by no means an experienced C programmer, and I don't have a very good SDL reference (I only have the SDL man  pages), so could you please point me in the direction of a detailed SDL reference, or tell me how to get the coordinates for the unclamped mouse from within Pipmak.
  
 Is anyone else interested in this patch, and if so, how should I submit 
this as a contribution to the Pipmak project?
    

Please post it either to this mailing list, or to the patch tracker at 
<http://sourceforge.net/tracker/?group_id=112801&atid=663294>.

  -Christian
  
I will attach the patch I have made, to this message, as a quick fix for people having this problem, but I would like to continue working on improving Pipmak's current behaviour.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Pipmak-Devel mailing list
Pipmak-Devel@...
news://news.gmane.org/gmane.games.devel.pipmak.devel
https://lists.sourceforge.net/lists/listinfo/pipmak-devel

  


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Pipmak-Devel mailing list
Pipmak-Devel@...
news://news.gmane.org/gmane.games.devel.pipmak.devel
https://lists.sourceforge.net/lists/listinfo/pipmak-devel

mouseGrabMod.patch.bz2 (2K) Download Attachment

Re: About the mouse un-grabbing in Pipmak

by Christian Walther :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Aidan Gauland wrote:
>> Hmm. I'm not too happy with that solution, to be honest. How are users
>> supposed to find that out?
>>
> Well, I knew that the node with the list of key-bindings would have to
> be updated.

Sure, but that's not enough IMHO. I don't think people will go and check
the preferences screen to find out how to get their mouse back. And what
about that point in the future when the preliminary key bindings are
gone and there's a real GUI preferences screen?

Your solution just seems like an unacceptable regression in user
experience to me (compared to a working auto-ungrab - of course the bug
that prevents you and Urs from ungrabbing needs to be fixed). I'd rather
fix this right than incorporate a workaround, even temporarily, that
makes it worse where it worked before.

Perhaps I need to explain why we grab the mouse at all in joystick mode
- here's what I wrote about it in the commit message of rev. 123:
   Reworked mouse motion handling once more: The new seamless switching
between mouse modes (see demo r124) made SDL's deficiencies (jumps in
mouse position when grabbing or ungrabbing) really apparent. Now, the
mouse is always grabbed in both mouse modes; in windowed mode, it can be
ungrabbed by moving it out of the window against a slight edge
resistance (which has the added benefit of making it easier to reach the
edges of the window, e.g. for the inventory, on Windows and X11, where
SDL sends no mouse events when the mouse is outside of the window).

> could you please point me in the direction of a detailed SDL reference

The most up-to-date SDL documentation is here:
<http://www.libsdl.org/cgi/docwiki.cgi/SDL_20API>. It's probably not
much more elaborate than the man pages, though.

> or tell me how to get the coordinates for the unclamped mouse from within Pipmak.

You can't get these directly from SDL, you need to keep track of them in
your own variables by adding up the deltas from SDL_MOUSEMOTION events
(these are unclamped when the mouse is grabbed). How to best keep this
in sync with mouseX/mouseY is another question.

> I will attach the patch I have made, to this message, as a quick fix for
> people having this problem

Thanks! As I alluded above, I won't apply it in its current form until
I'm convinced that there's no better way to fix the problem. Some
general comments nonetheless:

- If you don't mind, please use unified diff format next time ('diff -u'
if you use diff, 'svn diff' produces it by default). It's what most
people are most familiar with.

- Please use only tabs for indentation (you replaced some of them with
spaces).

> Sorry, I forgot to say this in my last message: you will need to pass
> the -p 1 option to patch when you apply the patch I sent.

That's apparent from the paths in the patch.

> I would like to continue working on improving Pipmak's current behaviour.

Very welcome! Don't hesitate to come here for help. If you're quick (or
if I'm slow), we might get your changes into the 0.2.7 release I'm
currently working on. (I originally planned to have it done this week,
but I'm starting to doubt it. I'm currently putting the final touches on
the Lua command line, next up are Andrea's bugs, and the demo project
also needs expansion to include the new features.)

  -Christian


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Pipmak-Devel mailing list
Pipmak-Devel@...
news://news.gmane.org/gmane.games.devel.pipmak.devel
https://lists.sourceforge.net/lists/listinfo/pipmak-devel