{
PGTK_TRACE("enter_notify_event");
union buffered_input_event inev;
- struct frame *focus_frame = pgtk_any_window_to_frame(gtk_widget_get_window(widget));
+ struct frame *frame = pgtk_any_window_to_frame(gtk_widget_get_window(widget));
+ if (frame == NULL)
+ return FALSE;
+ struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame);
+ struct frame *focus_frame = dpyinfo->x_focus_frame;
int focus_state
= focus_frame ? focus_frame->output_data.pgtk->focus_state : 0;
inev.ie.kind = NO_EVENT;
inev.ie.arg = Qnil;
- if (!(focus_state & FOCUS_EXPLICIT))
+ if (event->crossing.detail != GDK_NOTIFY_INFERIOR
+ && event->crossing.focus
+ && ! (focus_state & FOCUS_EXPLICIT))
x_focus_changed (TRUE,
FOCUS_IMPLICIT,
- FRAME_DISPLAY_INFO(focus_frame), focus_frame, &inev);
+ dpyinfo, frame, &inev);
if (inev.ie.kind != NO_EVENT)
evq_enqueue (&inev);
return TRUE;
{
PGTK_TRACE("leave_notify_event");
union buffered_input_event inev;
- struct frame *focus_frame = pgtk_any_window_to_frame(gtk_widget_get_window(widget));
+ struct frame *frame = pgtk_any_window_to_frame(gtk_widget_get_window(widget));
+ if (frame == NULL)
+ return FALSE;
+ struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame);
+ struct frame *focus_frame = dpyinfo->x_focus_frame;
int focus_state
= focus_frame ? focus_frame->output_data.pgtk->focus_state : 0;
inev.ie.kind = NO_EVENT;
inev.ie.arg = Qnil;
- if (!(focus_state & FOCUS_EXPLICIT))
+ if (event->crossing.detail != GDK_NOTIFY_INFERIOR
+ && event->crossing.focus
+ && ! (focus_state & FOCUS_EXPLICIT))
x_focus_changed (FALSE,
FOCUS_IMPLICIT,
- FRAME_DISPLAY_INFO(focus_frame), focus_frame, &inev);
+ dpyinfo, frame, &inev);
if (inev.ie.kind != NO_EVENT)
evq_enqueue (&inev);
return TRUE;
inev.ie.kind = NO_EVENT;
inev.ie.arg = Qnil;
- x_focus_changed (TRUE, FOCUS_IMPLICIT,
+ x_focus_changed (TRUE, FOCUS_EXPLICIT,
FRAME_DISPLAY_INFO(frame), frame, &inev);
if (inev.ie.kind != NO_EVENT)
evq_enqueue (&inev);
inev.ie.kind = NO_EVENT;
inev.ie.arg = Qnil;
- x_focus_changed (FALSE, FOCUS_IMPLICIT,
+ x_focus_changed (FALSE, FOCUS_EXPLICIT,
FRAME_DISPLAY_INFO(frame), frame, &inev);
if (inev.ie.kind != NO_EVENT)
evq_enqueue(&inev);