mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
*ScatterCtrl: Fixed problem (not completely)
git-svn-id: svn://ultimatepp.org/upp/trunk@7924 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
5db8f4ab87
commit
fb5b039de2
3 changed files with 36 additions and 11 deletions
|
|
@ -205,6 +205,10 @@ void ScatterCtrl::AddMouseBehavior(bool ctrl, bool alt, bool shift, bool left, b
|
|||
mouseBehavior << MouseBehavior(ctrl, alt, shift, left, middle, middlewheel, right, action);
|
||||
}
|
||||
|
||||
#ifdef PLATFORM_POSIX
|
||||
int GetKeyCodeX(int key);
|
||||
#endif
|
||||
|
||||
void ScatterCtrl::AddKeyBehavior(bool ctrl, bool alt, bool shift, int key, bool isVirtualKey, ScatterAction action)
|
||||
{
|
||||
if (!isVirtualKey) {
|
||||
|
|
@ -213,17 +217,7 @@ void ScatterCtrl::AddKeyBehavior(bool ctrl, bool alt, bool shift, int key, bool
|
|||
key = VkKeyScanExW(key, hKeyboardLayout) + K_DELTA;
|
||||
}
|
||||
#else
|
||||
XDisplay dpy;
|
||||
if (!(dpy = XOpenDisplay(NULL)))
|
||||
return;
|
||||
|
||||
if (key > 0x00ff)
|
||||
key = key | 0x01000000;
|
||||
|
||||
key = XKeysymToKeycode(dpy, key) + K_DELTA;
|
||||
|
||||
XFlush(dpy);
|
||||
XCloseDisplay(dpy);
|
||||
key = GetKeyCodeX(key);
|
||||
}
|
||||
#endif
|
||||
keyBehavior << KeyBehavior(ctrl, alt, shift, key, isVirtualKey, action);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ uses
|
|||
GridCtrl;
|
||||
|
||||
file
|
||||
ScatterCtrlX.cpp,
|
||||
ScatterCtrl.cpp,
|
||||
ScatterCtrl.h,
|
||||
Properties.cpp,
|
||||
|
|
|
|||
30
uppsrc/ScatterCtrl/ScatterCtrlX.cpp
Normal file
30
uppsrc/ScatterCtrl/ScatterCtrlX.cpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#include <CtrlCore/CtrlCore.h>
|
||||
|
||||
#ifdef PLATFORM_POSIX
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/Xfuncs.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
int GetKeyCodeX(int key) {
|
||||
_XDisplay *dpy = XOpenDisplay(NULL);
|
||||
if (!dpy)
|
||||
return Null;
|
||||
|
||||
if (key > 0x00ff)
|
||||
key = key | 0x01000000;
|
||||
|
||||
key = XKeysymToKeycode(dpy, key) + K_DELTA;
|
||||
|
||||
XFlush(dpy);
|
||||
XCloseDisplay(dpy);
|
||||
return key;
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue