forked from AuroraMiddleware/gtk
main: Warn if GDK sends us bad focus events
The new rule for focus events from the windowing system is: We only want them for toplevels. If you put focus on popups, we don't want to know about it, and you still need to deliver key events to the toplevel.
This commit is contained in:
parent
6342287288
commit
bc4f744562
@ -1658,6 +1658,20 @@ is_key_event (GdkEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_focus_event (GdkEvent *event)
|
||||
{
|
||||
switch ((guint) event->any.type)
|
||||
{
|
||||
case GDK_FOCUS_CHANGE:
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
set_widget_active_state (GtkWidget *target,
|
||||
const gboolean release)
|
||||
@ -1887,6 +1901,14 @@ gtk_main_do_event (GdkEvent *event)
|
||||
|
||||
target_widget = handle_key_event (event);
|
||||
}
|
||||
else if (is_focus_event (event))
|
||||
{
|
||||
if (!GTK_IS_WINDOW (target_widget))
|
||||
{
|
||||
g_message ("Ignoring an unexpected focus event from GDK on a non-toplevel surface.");
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (!target_widget)
|
||||
goto cleanup;
|
||||
|
Loading…
Reference in New Issue
Block a user