static struct frame *pending_autoraise_frame;
-/* This is a frame waiting for an event matching mask, within XTread_socket. */
-
-static struct {
- struct frame *f;
- int eventtype;
-} pending_event_wait;
-
#ifdef USE_X_TOOLKIT
/* The application context for Xt use. */
XtAppContext Xt_app_con;
static void x_new_focus_frame (struct x_display_info *, struct frame *);
static void x_focus_changed (int, int, struct x_display_info *,
struct frame *, struct input_event *);
-static void x_detect_focus_change (struct x_display_info *,
- XEvent *, struct input_event *);
static void XTframe_rehighlight (struct frame *);
static void x_frame_rehighlight (struct x_display_info *);
static void x_draw_hollow_cursor (struct window *, struct glyph_row *);
Returns FOCUS_IN_EVENT event in *BUFP. */
static void
-x_detect_focus_change (struct x_display_info *dpyinfo, XEvent *event, struct input_event *bufp)
+x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame,
+ XEvent *event, struct input_event *bufp)
{
- struct frame *frame;
-
- frame = x_any_window_to_frame (dpyinfo, event->xany.window);
- if (! frame)
+ if (!frame)
return;
switch (event->type)
int count = 0;
int do_help = 0;
ptrdiff_t nbytes = 0;
- struct frame *f = NULL;
+ struct frame *any, *f = NULL;
struct coding_system coding;
XEvent event = *eventptr;
Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
inev.ie.kind = NO_EVENT;
inev.ie.arg = Qnil;
- if (pending_event_wait.eventtype == event.type)
- pending_event_wait.eventtype = 0; /* Indicates we got it. */
+ any = x_any_window_to_frame (dpyinfo, event.xany.window);
+
+ if (any && any->wait_event_type == event.type)
+ any->wait_event_type = 0; /* Indicates we got it. */
switch (event.type)
{
if (event.xclient.data.l[0]
== dpyinfo->Xatom_wm_take_focus)
{
- /* Use x_any_window_to_frame because this
- could be the shell widget window
- if the frame has no title bar. */
- f = x_any_window_to_frame (dpyinfo, event.xclient.window);
+ /* Use the value returned by x_any_window_to_frame
+ because this could be the shell widget window
+ if the frame has no title bar. */
+ f = any;
#ifdef HAVE_X_I18N
/* Not quite sure this is needed -pd */
if (f && FRAME_XIC (f))
if (event.xclient.data.l[0]
== dpyinfo->Xatom_wm_delete_window)
{
- f = x_any_window_to_frame (dpyinfo,
- event.xclient.window);
+ f = any;
if (!f)
goto OTHER; /* May be a dialog that is to be removed */
if (event.xclient.message_type
== dpyinfo->Xatom_editres)
{
- f = x_any_window_to_frame (dpyinfo, event.xclient.window);
+ f = any;
if (f)
_XEditResCheckMessages (f->output_data.x->widget, NULL,
&event, NULL);
{
enum xembed_message msg = event.xclient.data.l[1];
if (msg == XEMBED_FOCUS_IN || msg == XEMBED_FOCUS_OUT)
- x_detect_focus_change (dpyinfo, &event, &inev.ie);
+ x_detect_focus_change (dpyinfo, any, &event, &inev.ie);
*finish = X_EVENT_GOTO_OUT;
goto done;
xft_settings_event (dpyinfo, &event);
- f = x_any_window_to_frame (dpyinfo, event.xclient.window);
+ f = any;
if (!f)
goto OTHER;
if (x_handle_dnd_message (f, &event.xclient, dpyinfo, &inev.ie))
goto OTHER;
#endif
- f = x_any_window_to_frame (dpyinfo, event.xkey.window);
+ f = any;
#if ! defined (USE_GTK)
/* If mouse-highlight is an integer, input clears out
case EnterNotify:
dpyinfo->last_user_time = event.xcrossing.time;
- x_detect_focus_change (dpyinfo, &event, &inev.ie);
+ x_detect_focus_change (dpyinfo, any, &event, &inev.ie);
- f = x_any_window_to_frame (dpyinfo, event.xcrossing.window);
+ f = any;
if (f && x_mouse_click_focus_ignore_position)
ignore_next_mouse_click_timeout = event.xmotion.time + 200;
goto OTHER;
case FocusIn:
- x_detect_focus_change (dpyinfo, &event, &inev.ie);
+ x_detect_focus_change (dpyinfo, any, &event, &inev.ie);
goto OTHER;
case LeaveNotify:
dpyinfo->last_user_time = event.xcrossing.time;
- x_detect_focus_change (dpyinfo, &event, &inev.ie);
+ x_detect_focus_change (dpyinfo, any, &event, &inev.ie);
f = x_top_window_to_frame (dpyinfo, event.xcrossing.window);
if (f)
goto OTHER;
case FocusOut:
- x_detect_focus_change (dpyinfo, &event, &inev.ie);
+ x_detect_focus_change (dpyinfo, any, &event, &inev.ie);
goto OTHER;
case MotionNotify:
f = x_top_window_to_frame (dpyinfo, event.xconfigure.window);
#ifdef USE_GTK
if (!f
- && (f = x_any_window_to_frame (dpyinfo, event.xconfigure.window))
+ && (f = any)
&& event.xconfigure.window == FRAME_X_WINDOW (f))
{
xg_frame_resized (f, event.xconfigure.width,
struct timespec tmo, tmo_at, time_now;
int fd = ConnectionNumber (FRAME_X_DISPLAY (f));
- pending_event_wait.f = f;
- pending_event_wait.eventtype = eventtype;
+ f->wait_event_type = eventtype;
/* Set timeout to 0.1 second. Hopefully not noticeable.
Maybe it should be configurable. */
tmo = make_timespec (0, 100 * 1000 * 1000);
tmo_at = timespec_add (current_timespec (), tmo);
- while (pending_event_wait.eventtype)
+ while (f->wait_event_type)
{
pending_signals = 1;
totally_unblock_input ();
if (pselect (fd + 1, &fds, NULL, NULL, &tmo, NULL) == 0)
break; /* Timeout */
}
- pending_event_wait.f = 0;
- pending_event_wait.eventtype = 0;
+
+ f->wait_event_type = 0;
}
#endif
pending_autoraise_frame = 0;
- pending_event_wait.f = 0;
- pending_event_wait.eventtype = 0;
/* Note that there is no real way portable across R3/R4 to get the
original error handler. */