Browse Source

Give keyboard focus to X11 plugin UIs

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.3.1
falkTX 3 years ago
parent
commit
f7320fe493
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 13 additions and 1 deletions
  1. +13
    -1
      source/utils/CarlaPluginUI.cpp

+ 13
- 1
source/utils/CarlaPluginUI.cpp View File

@@ -78,7 +78,7 @@ public:
carla_zeroStruct(attr); carla_zeroStruct(attr);


attr.border_pixel = 0; attr.border_pixel = 0;
attr.event_mask = KeyPressMask|KeyReleaseMask;
attr.event_mask = KeyPressMask|KeyReleaseMask|FocusChangeMask;


if (fIsResizable) if (fIsResizable)
attr.event_mask |= StructureNotifyMask; attr.event_mask |= StructureNotifyMask;
@@ -238,9 +238,14 @@ public:
carla_zeroStruct(sizeHints); carla_zeroStruct(sizeHints);


if (XGetNormalHints(fDisplay, fChildWindow, &sizeHints) && !gErrorTriggered) if (XGetNormalHints(fDisplay, fChildWindow, &sizeHints) && !gErrorTriggered)
{
XSetNormalHints(fDisplay, fHostWindow, &sizeHints); XSetNormalHints(fDisplay, fHostWindow, &sizeHints);
}
else else
{
carla_stdout("Caught errors while accessing child window");
fChildWindow = 0; fChildWindow = 0;
}


fChildWindowConfigured = true; fChildWindowConfigured = true;
XSetErrorHandler(oldErrorHandler); XSetErrorHandler(oldErrorHandler);
@@ -274,6 +279,13 @@ public:
fCallback->handlePluginUIClosed(); fCallback->handlePluginUIClosed();
} }
break; break;

case FocusIn:
if (fChildWindow == 0)
fChildWindow = getChildWindow();
if (fChildWindow != 0)
XSetInputFocus(fDisplay, fChildWindow, RevertToNone, CurrentTime);
break;
} }


if (type != nullptr) if (type != nullptr)


Loading…
Cancel
Save