This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Quick fix for missing WM_KEYUP messages on window exits in multiwindow mode (part of RE: Multiwindows problem)


Howdy Colin, nice work...

---------- Original Message -------------
Subject: Quick fix for missing WM_KEYUP messages on window exits  in multiwindow mode (part of RE: Multiwindows problem)
The 'best' minimal quick fix I have for the missed WM_KEYUP events on exits
from xterms etc. in multiwindow is:-
..
+    case WM_SETFOCUS:
+      if (hwndScreen == NULL)
+        break;
+      winKeybdReleaseKeys ();
+      return 0;
It's a hack, it works for me, but it does not get to gripes with the
ultimate cause of the problem.
I will put more time and effort into this ASAP, with a view to fixing
problems, not adding to the work-arounds!
------------------------------------

The root cause is simple:  you don't get WM_KEYUP or WM_[LRM]BUTTONUP
messages when you are not the foreground app.  You clicked in an Xwin.exe
window, held down the Y key, then clicked in notepad and released the Y
key.  Xwin.exe gets the WM_KEYDOWN(X), notepad.exe gets WM_KEYUP(Y).
Xwin.exe send a keydown message to the server, so the server in the mean
while has gone and started auto-repeating "Y" in the foreground X11 win.
Same idea for the mouse buttons.

Most Windoze apps don't care about WM_KEYDOWN/UP, they let Windoze
morph them into WM_KEY messages so they don't have this kind of
problem...

I'll probably not get a chance to try it for a while, but I think a
better place for this would be a WM_KILLFOCUS, because when you switch
apps you don't get a WM_SETFOCUS, only the WM_KILLFOCUS and
WM_ACTIVATEAPP, but the winKeybdReleaseKeys() sure sounds like the
function you'll want to be calling!  If there's an equivalent for
mouse buttons that should fix the Xterm scrolling.

One thing to make sure this patch doesn't do it kill drag-n-drop.  If
the WM changes the focus when a mouse leaves/enters a window then if
you are dragging a file from window X to window Y you'll send a "user
released the button" message to the app which'll think you dropped
the file/data onto the root window and just cancel the operation...

-- 
-Earle F. Philhower, III
 earle@ziplabel.com
 http://www.ziplabel.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]