diff options
Diffstat (limited to 'src/xterm.c')
-rw-r--r-- | src/xterm.c | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/src/xterm.c b/src/xterm.c index af652a0d856..ec605f5e914 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -18621,7 +18621,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, /* Set the provided time as the user time, which is required for SetInputFocus to work correctly after taking the input focus. */ - x_display_set_last_user_time (dpyinfo, event->xclient.data.l[1], + + /* Time can be sign extended if retrieved from a client message. + Make sure it is always 32 bits, or systems with 64-bit longs + will crash after 24 days of X server uptime. (bug#59480) */ + x_display_set_last_user_time (dpyinfo, (event->xclient.data.l[1] + & 0xffffffff), true, true); goto done; } @@ -21425,7 +21430,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (!NILP (tab_bar_arg)) inev.ie.arg = tab_bar_arg; } - if (FRAME_X_EMBEDDED_P (f)) + + if (FRAME_X_EMBEDDED_P (f) + && !FRAME_NO_ACCEPT_FOCUS (f)) xembed_send_message (f, event->xbutton.time, XEMBED_REQUEST_FOCUS, 0, 0, 0); } @@ -23193,7 +23200,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (!NILP (tab_bar_arg)) inev.ie.arg = tab_bar_arg; } - if (FRAME_X_EMBEDDED_P (f)) + + if (FRAME_X_EMBEDDED_P (f) + && !FRAME_NO_ACCEPT_FOCUS (f)) xembed_send_message (f, xev->time, XEMBED_REQUEST_FOCUS, 0, 0, 0); } @@ -25456,6 +25465,17 @@ x_clean_failable_requests (struct x_display_info *dpyinfo) + (last - first)); } +/* Protect a section of X requests: ignore errors generated by X + requests made from now until `x_stop_ignoring_errors'. Each call + must be paired with a call to `x_stop_ignoring_errors', and + recursive calls inside the protected section are not allowed. + + The advantage over x_catch_errors followed by + x_uncatch_errors_after_check is that this function does not sync to + catch errors if requests were made. It should be used instead of + those two functions for catching errors around requests that do not + require a reply. */ + void x_ignore_errors_for_next_request (struct x_display_info *dpyinfo) { @@ -25463,7 +25483,13 @@ x_ignore_errors_for_next_request (struct x_display_info *dpyinfo) unsigned long next_request; #ifdef HAVE_GTK3 GdkDisplay *gdpy; +#endif + /* This code is not reentrant, so be sure nothing calls it + recursively in response to input. */ + block_input (); + +#ifdef HAVE_GTK3 /* GTK 3 tends to override our own error handler inside certain callbacks, which this can be called from. Instead of trying to restore our own, add a trap for the following requests with @@ -25532,6 +25558,8 @@ x_stop_ignoring_errors (struct x_display_info *dpyinfo) if (gdpy) gdk_x11_display_error_trap_pop_ignored (gdpy); #endif + + unblock_input (); } /* Undo the last x_catch_errors call. @@ -27517,9 +27545,14 @@ static void x_raise_frame (struct frame *f) { block_input (); + if (FRAME_VISIBLE_P (f)) - XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); - XFlush (FRAME_X_DISPLAY (f)); + { + XRaiseWindow (FRAME_X_DISPLAY (f), + FRAME_OUTER_WINDOW (f)); + XFlush (FRAME_X_DISPLAY (f)); + } + unblock_input (); } @@ -27567,8 +27600,6 @@ x_lower_frame (struct frame *f) XLowerWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); - XFlush (FRAME_X_DISPLAY (f)); - #ifdef HAVE_XWIDGETS /* Make sure any X windows owned by xwidget views of the parent still display below the lowered frame. */ @@ -27576,6 +27607,8 @@ x_lower_frame (struct frame *f) if (FRAME_PARENT_FRAME (f)) lower_frame_xwidget_views (FRAME_PARENT_FRAME (f)); #endif + + XFlush (FRAME_X_DISPLAY (f)); } static void @@ -27826,6 +27859,10 @@ x_focus_frame (struct frame *f, bool noactivate) struct x_display_info *dpyinfo; Time time; + /* The code below is not reentrant wrt to dpyinfo->x_focus_frame and + friends being set. */ + block_input (); + dpyinfo = FRAME_DISPLAY_INFO (f); if (FRAME_X_EMBEDDED_P (f)) @@ -27856,7 +27893,7 @@ x_focus_frame (struct frame *f, bool noactivate) the current workspace, and mapping it, etc, before moving input focus to the frame. */ x_ewmh_activate_frame (f); - return; + goto out; } if (NILP (Vx_no_window_manager)) @@ -27890,6 +27927,9 @@ x_focus_frame (struct frame *f, bool noactivate) matter. */ CurrentTime); } + + out: + unblock_input (); } |