mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 14:16:09 -06:00
30 lines
No EOL
478 B
C++
30 lines
No EOL
478 B
C++
#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>
|
|
|
|
using namespace Upp;
|
|
|
|
int GetKeyCodeX(int key) {
|
|
_XDisplay *dpy = XOpenDisplay(NULL);
|
|
if (!dpy)
|
|
return Null;
|
|
|
|
if (key > 0x00ff)
|
|
key = key | 0x01000000;
|
|
|
|
key = XKeysymToKeycode(dpy, key);
|
|
key += K_DELTA;
|
|
|
|
XFlush(dpy);
|
|
XCloseDisplay(dpy);
|
|
return key;
|
|
}
|
|
|
|
#endif |