From 74f060acbc6439ea78495bbc280dd2a187d14e06 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Fri, 24 Aug 2018 22:57:05 +0800 Subject: [PATCH] x11_wait_for blocks execution in raspbian --- source/gui/detail/native_window_interface.cpp | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/source/gui/detail/native_window_interface.cpp b/source/gui/detail/native_window_interface.cpp index d6f4b99b..ef0b1935 100644 --- a/source/gui/detail/native_window_interface.cpp +++ b/source/gui/detail/native_window_interface.cpp @@ -745,6 +745,14 @@ namespace nana{ { nana::detail::platform_scope_guard psg; Display* disp = restrict::spec.open_display(); + + //Returns if the requested visibility is same with the current status. + //In some X-Server versions/implementations, XMapWindow() doesn't generate + //a ConfigureNotify if the requested visibility is same with the current status. + //It causes that x11_wait_for always waiting for the ConfigureNotify. + if(show == is_window_visible(wd)) + return; + if(show) { ::XMapWindow(disp, reinterpret_cast(wd)); @@ -1050,6 +1058,16 @@ namespace nana{ XSizeHints hints; nana::detail::platform_scope_guard psg; + + //Returns if the requested rectangle is same with the current rectangle. + //In some X-Server versions/implementations, XMapWindow() doesn't generate + //a ConfigureNotify if the requested rectangle is same with the current rectangle. + //It causes that x11_wait_for always waiting for the ConfigureNotify. + rectangle current_r; + get_window_rect(wd, current_r); + if(r == current_r) + return true; + ::XGetWMNormalHints(disp, reinterpret_cast(wd), &hints, &supplied); if((hints.flags & (PMinSize | PMaxSize)) && (hints.min_width == hints.max_width) && (hints.min_height == hints.max_height)) { @@ -1239,6 +1257,15 @@ namespace nana{ auto disp = restrict::spec.open_display(); nana::detail::platform_scope_guard psg; + //Returns if the requested size is same with the current size. + //In some X-Server versions/implementations, XMapWindow() doesn't generate + //a ConfigureNotify if the requested size is same with the current size. + //It causes that x11_wait_for always waiting for the ConfigureNotify. + rectangle current_r; + get_window_rect(wd, current_r); + if(current_r.dimension() == sz) + return true; + //Check the XSizeHints for testing whether the window is sizable. XSizeHints hints; long supplied; @@ -1274,6 +1301,9 @@ namespace nana{ unsigned border, depth; nana::detail::platform_scope_guard psg; ::XGetGeometry(restrict::spec.open_display(), reinterpret_cast(wd), &root, &x, &y, &r.width, &r.height, &border, &depth); + + auto pos = window_position(wd); + r.position(pos); #endif }