Browse Source

Grab Esc key from X11 UIs

tags/1.9.4
falkTX 10 years ago
parent
commit
3acae77936
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      source/backend/plugin/CarlaPluginUi.cpp

+ 5
- 2
source/backend/plugin/CarlaPluginUi.cpp View File

@@ -28,6 +28,8 @@
// -----------------------------------------------------
// X11

static const int X11Key_Escape = 9;

class X11PluginUi : public CarlaPluginUi
{
public:
@@ -57,6 +59,8 @@ public:

CARLA_SAFE_ASSERT_RETURN(fWindow != 0,);

XGrabKey(fDisplay, X11Key_Escape, AnyModifier, fWindow, 1, GrabModeAsync, GrabModeAsync);

Atom wmDelete = XInternAtom(fDisplay, "WM_DELETE_WINDOW", True);
XSetWMProtocols(fDisplay, fWindow, &wmDelete, 1);

@@ -137,8 +141,7 @@ public:
break;

case KeyRelease:
//carla_stdout("got key release %i", event.xkey.keycode);
if (event.xkey.keycode == 9) // Escape
if (event.xkey.keycode == X11Key_Escape)
{
fIsVisible = false;
CARLA_SAFE_ASSERT_CONTINUE(fCallback != nullptr);


Loading…
Cancel
Save