reversed some parts of wxGetKeyState for linkage reasons...
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24873 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
f9c135f5ec
commit
7b70a3257f
@ -80,8 +80,13 @@ WXDLLIMPEXP_BASE wxChar* copystring(const wxChar *s);
|
||||
// Sound the bell
|
||||
WXDLLIMPEXP_BASE void wxBell();
|
||||
|
||||
#if defined(__WXGTK__) || defined(__WXMSW__) || defined(__WXMAC__) || defined(__X__)
|
||||
#if defined(__WXMSW__) || defined(__WXMAC__)
|
||||
// Get the state of a key (true if pressed, false if not)
|
||||
// This is generally most useful getting the state of
|
||||
// Caps Lock, Num Lock and Scroll Lock...
|
||||
|
||||
// Note - There is a X11/GTK version which will be here
|
||||
// soon
|
||||
WXDLLIMPEXP_BASE bool wxGetKeyState(wxKeyCode key);
|
||||
#endif
|
||||
|
||||
|
@ -15,12 +15,10 @@
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/unix/utilsx11.h"
|
||||
#include "wx/x11/privx.h"
|
||||
#include "wx/iconbndl.h"
|
||||
#include "wx/image.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/utils.h"
|
||||
|
||||
#ifdef __VMS
|
||||
#pragma message disable nosimpint
|
||||
@ -508,27 +506,5 @@ void wxSetFullScreenStateX11(WXDisplay* display, WXWindow rootWindow,
|
||||
}
|
||||
}
|
||||
|
||||
bool wxGetKeyState(wxKeyCode key)
|
||||
{
|
||||
Display *pDisplay = (Display*) wxGetDisplay();
|
||||
int iKey = wxCharCodeWXToX(key);
|
||||
int iKeyMask = 0;
|
||||
Window wDummy1, wDummy2;
|
||||
int iDummy3, iDummy4, iDummy5, iDummy6;
|
||||
unsigned int iMask;
|
||||
XModifierKeymap* map = XGetModifierMapping(pDisplay);
|
||||
KeyCode keyCode = XKeysymToKeycode(pDisplay,iKey);
|
||||
if(keyCode == NoSymbol) return false;
|
||||
for(int i = 0; i < 8; ++i) {
|
||||
if( map->modifiermap[map->max_keypermod * i] == keyCode) {
|
||||
iKeyMask = 1 << i;
|
||||
}
|
||||
}
|
||||
XQueryPointer(pDisplay, DefaultRootWindow(pDisplay), &wDummy1, &wDummy2,
|
||||
&iDummy3, &iDummy4, &iDummy5, &iDummy6, &iMask );
|
||||
XFreeModifiermap(map);
|
||||
return (iMask & iKeyMask) != 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user