*ScatterCtrl: Fixed problem (not completely)

git-svn-id: svn://ultimatepp.org/upp/trunk@7924 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2014-11-23 16:51:13 +00:00
parent 5db8f4ab87
commit fb5b039de2
3 changed files with 36 additions and 11 deletions

View file

@ -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);

View file

@ -7,6 +7,7 @@ uses
GridCtrl;
file
ScatterCtrlX.cpp,
ScatterCtrl.cpp,
ScatterCtrl.h,
Properties.cpp,

View 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