Discussion:
[Pipmak-Devel] About the mouse un-grabbing in Pipmak
Aidan Gauland
2007-12-31 21:52:43 UTC
Permalink
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
Christian Walther
2008-01-01 10:35:37 UTC
Permalink
Hello Aidan

Thanks for looking into this problem!
Post by Aidan Gauland
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?
Post by Aidan Gauland
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).
Post by Aidan Gauland
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
Aidan Gauland
2008-01-02 01:51:19 UTC
Permalink
Christian Walther
2008-01-02 10:12:25 UTC
Permalink
Post by Christian Walther
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

Urs Holzer
2008-01-01 17:01:22 UTC
Permalink
Hi
Post by Aidan Gauland
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.
Loading...