Browse Source

Only call XSetInputFocus on viewable windows

Fixes crash for bridge-lv2-x11 from CLI

Signed-off-by: falkTX <falktx@gmail.com>
tags/v2.1-alpha1-winvst
falkTX 7 years ago
parent
commit
0d96a87fb4
1 changed files with 11 additions and 3 deletions
  1. +11
    -3
      source/utils/CarlaPluginUI.cpp

+ 11
- 3
source/utils/CarlaPluginUI.cpp View File

@@ -281,9 +281,17 @@ public:
CARLA_SAFE_ASSERT_RETURN(fDisplay != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDisplay != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHostWindow != 0,); CARLA_SAFE_ASSERT_RETURN(fHostWindow != 0,);


XRaiseWindow(fDisplay, fHostWindow);
XSetInputFocus(fDisplay, fHostWindow, RevertToPointerRoot, CurrentTime);
XFlush(fDisplay);
XWindowAttributes wa;
carla_zeroStruct(wa);

CARLA_SAFE_ASSERT_RETURN(XGetWindowAttributes(fDisplay, fHostWindow, &wa),);

if (wa.map_state == IsViewable)
{
XRaiseWindow(fDisplay, fHostWindow);
XSetInputFocus(fDisplay, fHostWindow, RevertToPointerRoot, CurrentTime);
XFlush(fDisplay);
}
} }


void setSize(const uint width, const uint height, const bool forceUpdate) override void setSize(const uint width, const uint height, const bool forceUpdate) override


Loading…
Cancel
Save