Fixed bug on Win32 where programs would stop paying attention to keys.
What actually happens is that GetKeyState() returns garbage for the "windoze" keys if you hit them to pop up the start menu. It now calls GetAsyncKeyState(), which works. Also this version calls TranslateEvent on all events before calling DispatchEvent(), which is apparently what Win32 expects. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@948 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
a2b5dfc5d5
commit
e7f42fa15f
@ -9,7 +9,7 @@
|
||||
|
|
||||
+----<B>Fl_Input_</B>
|
||||
|
|
||||
+----<A href=functions.html#Fl_Input>Fl_Input</A>
|
||||
+----<A href=Fl_Input.html#Fl_Input>Fl_Input</A>, <A href=Fl_Output.html#Fl_Output>Fl_Output</A>
|
||||
</PRE>
|
||||
</UL>
|
||||
<H3>Include Files</H3>
|
||||
@ -169,4 +169,4 @@ position()</TT> and <TT>mark()</TT> are equal.
|
||||
non-zero if any change was made.
|
||||
<H4><A name=Fl_Input_.copy_cuts>int Fl_Input_::copy_cuts()</A></H4>
|
||||
Copy all the previous contiguous cuts from the undo information to the
|
||||
clipboard. This is used to make ^K work. </BODY></HTML>
|
||||
clipboard. This is used to make ^K work. </BODY></HTML>
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_win32.cxx,v 1.33.2.16 1999/11/12 00:19:12 mike Exp $"
|
||||
// "$Id: Fl_win32.cxx,v 1.33.2.17 1999/12/15 04:58:27 bill Exp $"
|
||||
//
|
||||
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -32,7 +32,6 @@
|
||||
#include <FL/win32.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
@ -109,9 +108,9 @@ void Fl::remove_fd(int n, int events) {
|
||||
j++;
|
||||
}
|
||||
nfds = j;
|
||||
if (events & POLLIN) FD_CLR(n, &fdsets[0]);
|
||||
if (events & POLLOUT) FD_CLR(n, &fdsets[1]);
|
||||
if (events & POLLERR) FD_CLR(n, &fdsets[2]);
|
||||
if (events & POLLIN) FD_CLR(unsigned(n), &fdsets[0]);
|
||||
if (events & POLLOUT) FD_CLR(unsigned(n), &fdsets[1]);
|
||||
if (events & POLLERR) FD_CLR(unsigned(n), &fdsets[2]);
|
||||
}
|
||||
|
||||
void Fl::remove_fd(int n) {
|
||||
@ -195,6 +194,7 @@ double fl_wait(int timeout_flag, double time) {
|
||||
|
||||
// execute it, them execute any other messages that become ready during it:
|
||||
while (have_message) {
|
||||
TranslateMessage(&fl_msg);
|
||||
DispatchMessage(&fl_msg);
|
||||
have_message = PeekMessage(&fl_msg, NULL, 0, 0, PM_REMOVE);
|
||||
}
|
||||
@ -389,7 +389,6 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||
|
||||
Fl_Window *window = fl_find(hWnd);
|
||||
|
||||
STUPID_MICROSOFT:
|
||||
if (window) switch (uMsg) {
|
||||
|
||||
case WM_QUIT: // this should not happen?
|
||||
@ -460,23 +459,16 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
// save the keysym until we figure out the characters:
|
||||
Fl::e_keysym = ms2fltk(wParam,lParam&(1<<24));
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
TranslateMessage(&fl_msg); // always returns 1!!!
|
||||
// TranslateMessage is supposed to return true only if it turns
|
||||
// into another message, but it seems to always return 1 on my
|
||||
// NT machine. So I will instead peek to see if there is a
|
||||
// character message in the queue, I hope this can only happen
|
||||
// if the translation worked:
|
||||
// save the keysym until we figure out the characters:
|
||||
Fl::e_keysym = ms2fltk(wParam,lParam&(1<<24));
|
||||
// See if TranslateMessage turned it into a WM_*CHAR message:
|
||||
if (PeekMessage(&fl_msg, hWnd, WM_CHAR, WM_SYSDEADCHAR, 1)) {
|
||||
uMsg = fl_msg.message;
|
||||
wParam = fl_msg.wParam;
|
||||
lParam = fl_msg.lParam;
|
||||
goto STUPID_MICROSOFT;
|
||||
}
|
||||
// otherwise use it as a 0-character key...
|
||||
case WM_DEADCHAR:
|
||||
case WM_SYSDEADCHAR:
|
||||
case WM_CHAR:
|
||||
@ -491,7 +483,12 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||
if ((lParam&(1<<29)) //same as GetKeyState(VK_MENU)
|
||||
&& uMsg != WM_CHAR) state |= FL_ALT;
|
||||
if (GetKeyState(VK_NUMLOCK)) state |= FL_NUM_LOCK;
|
||||
if (GetKeyState(VK_LWIN)&~1 || GetKeyState(VK_RWIN)&~1) state |= FL_META;
|
||||
if (GetKeyState(VK_LWIN)&~1 || GetKeyState(VK_RWIN)&~1) {
|
||||
// WIN32 bug? GetKeyState returns garbage if the user hit the
|
||||
// meta key to pop up start menu. Sigh.
|
||||
if ((GetAsyncKeyState(VK_LWIN)|GetAsyncKeyState(VK_RWIN))&~1)
|
||||
state |= FL_META;
|
||||
}
|
||||
if (GetKeyState(VK_SCROLL)) state |= FL_SCROLL_LOCK;
|
||||
Fl::e_state = state;}
|
||||
if (lParam & (1<<31)) goto DEFAULT; // ignore up events after fixing shift
|
||||
@ -899,5 +896,5 @@ void Fl_Window::make_current() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_win32.cxx,v 1.33.2.16 1999/11/12 00:19:12 mike Exp $".
|
||||
// End of "$Id: Fl_win32.cxx,v 1.33.2.17 1999/12/15 04:58:27 bill Exp $".
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user