From b9773f6eecea38e6a5aa28745cc6fe79aa2d441f Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 12 Mar 2016 10:54:52 +0100 Subject: Add parent widget pointer for contained plugin windows. Remove threaded event handling and make all event handling depend on processEcvents being called with a regular (~50ms) interval. --- plugingui/nativewindow_x11.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'plugingui/nativewindow_x11.cc') diff --git a/plugingui/nativewindow_x11.cc b/plugingui/nativewindow_x11.cc index ae1907c..8088d93 100644 --- a/plugingui/nativewindow_x11.cc +++ b/plugingui/nativewindow_x11.cc @@ -35,16 +35,10 @@ namespace GUI { -NativeWindowX11::NativeWindowX11(Window& window) +NativeWindowX11::NativeWindowX11(void* native_window, Window& window) : buffer(nullptr) , window(window) { - auto status = XInitThreads(); - if(status) - { - ERR(X11, "Could not initialise threaded Xlib calls (XInitThreads)"); - } - display = XOpenDisplay(nullptr); if(display == nullptr) { @@ -57,12 +51,20 @@ NativeWindowX11::NativeWindowX11(Window& window) // Get some colors int blackColor = BlackPixel(display, screen); - ::Window rootWindow = DefaultRootWindow(display); + ::Window parentWindow; + if(native_window) + { + parentWindow = (::Window)native_window; + } + else + { + parentWindow = DefaultRootWindow(display); + } // Create the window unsigned long border = 0; xwindow = XCreateSimpleWindow(display, - rootWindow, + parentWindow, window.x(), window.y(), window.width(), window.height(), border, -- cgit v1.2.3