summaryrefslogtreecommitdiff
path: root/plugingui/nativewindow_x11.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-03-12 17:08:07 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2017-03-23 20:17:52 +0100
commit54d0e5d4b13b18668b1c044f197fe528bb43d4a2 (patch)
tree201f88f96619d0cf3a5d2f3b1cc5805e5846d100 /plugingui/nativewindow_x11.cc
parentbc661e52f925cdf5fe1effdbae2f81bd796eac32 (diff)
Track and propagate parent window size changes.
Diffstat (limited to 'plugingui/nativewindow_x11.cc')
-rw-r--r--plugingui/nativewindow_x11.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/plugingui/nativewindow_x11.cc b/plugingui/nativewindow_x11.cc
index 1482d47..de2f1d1 100644
--- a/plugingui/nativewindow_x11.cc
+++ b/plugingui/nativewindow_x11.cc
@@ -58,21 +58,23 @@ NativeWindowX11::NativeWindowX11(void* native_window, Window& window)
visual = DefaultVisual(display, screen);
depth = DefaultDepth(display, screen);
- ::Window parentWindow;
if(native_window)
{
- parentWindow = (::Window)native_window;
+ parent_window = (::Window)native_window;
+
+ // Track size changes on the parent window
+ XSelectInput(display, parent_window, StructureNotifyMask);
}
else
{
- parentWindow = DefaultRootWindow(display);
+ parent_window = DefaultRootWindow(display);
}
// Create the window
XSetWindowAttributes swa;
swa.backing_store = Always;
xwindow = XCreateWindow(display,
- parentWindow,
+ parent_window,
0, 0, //window.x(), window.y(),
1, 1, //window.width(), window.height(),
0, // border
@@ -302,6 +304,14 @@ void NativeWindowX11::translateXMessage(XEvent& xevent)
case ConfigureNotify:
//DEBUG(x11, "ConfigureNotify");
+
+ // The parent window size changed, reflect the new size in our own window.
+ if(xevent.xconfigure.window == parent_window)
+ {
+ resize(xevent.xconfigure.width, xevent.xconfigure.height);
+ return;
+ }
+
{
if((window.width() != (std::size_t)xevent.xconfigure.width) ||
(window.height() != (std::size_t)xevent.xconfigure.height))