x11display: Time out waiting for ConfigureNotify event

Fixes #1087
This commit is contained in:
rdb 2022-11-07 12:56:03 +01:00
parent db6ea00967
commit 0a827cf65c
5 changed files with 29 additions and 9 deletions

View File

@ -80,7 +80,7 @@ begin_frame(FrameMode mode, Thread *current_thread) {
if (_gsg == nullptr) {
return false;
}
if (_awaiting_configure) {
if (_awaiting_configure_since != -1) {
// Don't attempt to draw while we have just reconfigured the window and we
// haven't got the notification back yet.
return false;

View File

@ -60,7 +60,7 @@ begin_frame(FrameMode mode, Thread *current_thread) {
if (_gsg == nullptr) {
return false;
}
if (_awaiting_configure) {
if (_awaiting_configure_since != -1) {
// Don't attempt to draw while we have just reconfigured the window and we
// haven't got the notification back yet.
return false;

View File

@ -86,7 +86,7 @@ begin_frame(FrameMode mode, Thread *current_thread) {
if (_gsg == nullptr) {
return false;
}
if (_awaiting_configure) {
if (_awaiting_configure_since != -1) {
// Don't attempt to draw while we have just reconfigured the window and we
// haven't got the notification back yet.
return false;
@ -238,7 +238,7 @@ process_events() {
break;
case ConfigureNotify:
_awaiting_configure = false;
_awaiting_configure_since = -1;
if (_properties.get_fixed_size()) {
// If the window properties indicate a fixed size only, undo any
// attempt by the user to change them. In X, there doesn't appear to

View File

@ -115,7 +115,7 @@ x11GraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
_XRRSetScreenConfig = x11_pipe->_XRRSetScreenConfig;
}
_awaiting_configure = false;
_awaiting_configure_since = -1;
_dga_mouse_enabled = false;
_override_redirect = False;
_wm_delete_window = x11_pipe->_wm_delete_window;
@ -238,7 +238,7 @@ begin_frame(FrameMode mode, Thread *current_thread) {
if (_gsg == nullptr) {
return false;
}
if (_awaiting_configure) {
if (_awaiting_configure_since != -1) {
// Don't attempt to draw while we have just reconfigured the window and we
// haven't got the notification back yet.
return false;
@ -481,7 +481,14 @@ process_events() {
if (got_configure_event) {
// Now handle the last configure event we found.
_awaiting_configure = false;
if (x11display_cat.is_debug() && _awaiting_configure_since != -1) {
unsigned long elapsed = (unsigned long)(clock() - _awaiting_configure_since) / (CLOCKS_PER_SEC / 10000);
x11display_cat.debug()
<< "Received ConfigureNotify event after "
<< (elapsed / 10) << "." << (elapsed % 10) << " ms\n";
}
_awaiting_configure_since = -1;
// Is this the inner corner or the outer corner? The Xlib docs say it
// should be the outer corner, but it appears to be the inner corner on my
@ -523,6 +530,19 @@ process_events() {
changed_properties = true;
}
else if (_awaiting_configure_since != -1) {
unsigned long elapsed = (clock() - _awaiting_configure_since);
if (elapsed > CLOCKS_PER_SEC / 10) {
// Accept that we're never going to get that configure notify event.
if (x11display_cat.is_debug()) {
elapsed /= (CLOCKS_PER_SEC / 10000);
x11display_cat.debug()
<< "Giving up on waiting for ConfigureNotify event after "
<< (elapsed / 10) << "." << (elapsed % 10) << " ms\n";
}
_awaiting_configure_since = -1;
}
}
if (properties.has_foreground() && (
_properties.get_mouse_mode() == WindowProperties::M_confined ||
@ -949,7 +969,7 @@ set_properties_now(WindowProperties &properties) {
XReconfigureWMWindow(_display, _xwindow, _screen, value_mask, &changes);
// Don't draw anything until this is done reconfiguring.
_awaiting_configure = true;
_awaiting_configure_since = clock();
}
}

View File

@ -90,7 +90,7 @@ protected:
GraphicsWindowInputDevice *_input;
long _event_mask;
bool _awaiting_configure;
clock_t _awaiting_configure_since;
bool _dga_mouse_enabled;
Bool _override_redirect;
Atom _wm_delete_window;