From baed360360debdbe4926f69be41108890f394540 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 17 Sep 2013 12:24:20 +0400 Subject: [PATCH] * xterm.h (struct x_display_info): New member x_pending_autoraise_frame, going to replace... * xterm.c (pending_autoraise_frame): ...static variable. (x_new_focus_frame, XTread_socket): Adjust users. * w32term.h (struct w32_display_info): New member w32_pending_autoraise_frame, going to replace... * w32term.c (pending_autoraise_frame): ...global variable. (x_new_focus_frame, w32_read_socket): Adjust users. --- src/ChangeLog | 11 +++++++++++ src/w32term.c | 16 ++++++---------- src/w32term.h | 3 +++ src/xterm.c | 37 ++++++++++++++----------------------- src/xterm.h | 3 +++ 5 files changed, 37 insertions(+), 33 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 00b59e89e67..5763940a247 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2013-09-17 Dmitry Antipov + + * xterm.h (struct x_display_info): New member + x_pending_autoraise_frame, going to replace... + * xterm.c (pending_autoraise_frame): ...static variable. + (x_new_focus_frame, XTread_socket): Adjust users. + * w32term.h (struct w32_display_info): New member + w32_pending_autoraise_frame, going to replace... + * w32term.c (pending_autoraise_frame): ...global variable. + (x_new_focus_frame, w32_read_socket): Adjust users. + 2013-09-17 Glenn Morris * xdisp.c (message_dolog): If we create *Messages*, diff --git a/src/w32term.c b/src/w32term.c index af73e66d882..912fb3cc68c 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -149,9 +149,6 @@ BOOL (WINAPI *pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD); #define SM_CYVIRTUALSCREEN 79 #endif -/* This is a frame waiting to be autoraised, within w32_read_socket. */ -struct frame *pending_autoraise_frame; - /* The handle of the frame that currently owns the system caret. */ HWND w32_system_caret_hwnd; int w32_system_caret_height; @@ -2823,9 +2820,9 @@ x_new_focus_frame (struct w32_display_info *dpyinfo, struct frame *frame) x_lower_frame (old_focus); if (dpyinfo->w32_focus_frame && dpyinfo->w32_focus_frame->auto_raise) - pending_autoraise_frame = dpyinfo->w32_focus_frame; + dpyinfo->w32_pending_autoraise_frame = dpyinfo->w32_focus_frame; else - pending_autoraise_frame = 0; + dpyinfo->w32_pending_autoraise_frame = NULL; } x_frame_rehighlight (dpyinfo); @@ -4981,12 +4978,11 @@ w32_read_socket (struct terminal *terminal, } /* If the focus was just given to an autoraising frame, - raise it now. */ - /* ??? This ought to be able to handle more than one such frame. */ - if (pending_autoraise_frame) + raise it now. FIXME: handle more than one such frame. */ + if (dpyinfo->w32_pending_autoraise_frame) { - x_raise_frame (pending_autoraise_frame); - pending_autoraise_frame = 0; + x_raise_frame (dpyinfo->w32_pending_autoraise_frame); + dpyinfo->w32_pending_autoraise_frame = NULL; } /* Check which frames are still visible, if we have enqueued any user diff --git a/src/w32term.h b/src/w32term.h index 1cbadadc84e..99253627e64 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -179,6 +179,9 @@ struct w32_display_info frame. It differs from w32_focus_frame when we're using a global minibuffer. */ struct frame *x_highlight_frame; + + /* The frame waiting to be auto-raised in w32_read_socket. */ + struct frame *w32_pending_autoraise_frame; }; /* This is a chain of structures for all the displays currently in use. */ diff --git a/src/xterm.c b/src/xterm.c index 44f0efab019..1adc5b3d03f 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -155,10 +155,6 @@ struct x_display_info *x_display_list; Lisp_Object x_display_name_list; -/* This is a frame waiting to be auto-raised, within XTread_socket. */ - -static struct frame *pending_autoraise_frame; - #ifdef USE_X_TOOLKIT /* The application context for Xt use. */ @@ -3299,9 +3295,9 @@ x_new_focus_frame (struct x_display_info *dpyinfo, struct frame *frame) x_lower_frame (old_focus); if (dpyinfo->x_focus_frame && dpyinfo->x_focus_frame->auto_raise) - pending_autoraise_frame = dpyinfo->x_focus_frame; + dpyinfo->x_pending_autoraise_frame = dpyinfo->x_focus_frame; else - pending_autoraise_frame = 0; + dpyinfo->x_pending_autoraise_frame = NULL; } x_frame_rehighlight (dpyinfo); @@ -7088,6 +7084,7 @@ XTread_socket (struct terminal *terminal, struct input_event *hold_quit) { int count = 0; int event_found = 0; + struct x_display_info *dpyinfo = terminal->display_info.x; block_input (); @@ -7095,36 +7092,33 @@ XTread_socket (struct terminal *terminal, struct input_event *hold_quit) input_signal_count++; /* For debugging, this gives a way to fake an I/O error. */ - if (terminal->display_info.x == XTread_socket_fake_io_error) + if (dpyinfo == XTread_socket_fake_io_error) { XTread_socket_fake_io_error = 0; - x_io_error_quitter (terminal->display_info.x->display); + x_io_error_quitter (dpyinfo->display); } #ifndef USE_GTK - while (XPending (terminal->display_info.x->display)) + while (XPending (dpyinfo->display)) { int finish; XEvent event; - XNextEvent (terminal->display_info.x->display, &event); + XNextEvent (dpyinfo->display, &event); #ifdef HAVE_X_I18N /* Filter events for the current X input method. */ - if (x_filter_event (terminal->display_info.x, &event)) + if (x_filter_event (dpyinfo, &event)) continue; #endif event_found = 1; - count += handle_one_xevent (terminal->display_info.x, - &event, &finish, hold_quit); + count += handle_one_xevent (dpyinfo, &event, &finish, hold_quit); if (finish == X_EVENT_GOTO_OUT) - goto out; + break; } - out:; - #else /* USE_GTK */ /* For GTK we must use the GTK event loop. But XEvents gets passed @@ -7174,12 +7168,11 @@ XTread_socket (struct terminal *terminal, struct input_event *hold_quit) } /* If the focus was just given to an auto-raising frame, - raise it now. */ - /* ??? This ought to be able to handle more than one such frame. */ - if (pending_autoraise_frame) + raise it now. FIXME: handle more than one such frame. */ + if (dpyinfo->x_pending_autoraise_frame) { - x_raise_frame (pending_autoraise_frame); - pending_autoraise_frame = 0; + x_raise_frame (dpyinfo->x_pending_autoraise_frame); + dpyinfo->x_pending_autoraise_frame = NULL; } unblock_input (); @@ -10651,8 +10644,6 @@ x_initialize (void) #endif #endif - pending_autoraise_frame = 0; - /* Note that there is no real way portable across R3/R4 to get the original error handler. */ XSetErrorHandler (x_error_handler); diff --git a/src/xterm.h b/src/xterm.h index 28b72969972..382cf30e1d6 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -302,6 +302,9 @@ struct x_display_info minibuffer. */ struct frame *x_highlight_frame; + /* The frame waiting to be auto-raised in XTread_socket. */ + struct frame *x_pending_autoraise_frame; + /* Time of last user interaction as returned in X events on this display. */ Time last_user_time; -- 2.39.2