broadway: Send focus out events

This commit is contained in:
Alexander Larsson 2013-11-13 12:10:29 +01:00
parent 6917746c8e
commit ca89f5ab93
3 changed files with 18 additions and 6 deletions

View File

@ -122,7 +122,8 @@ typedef struct {
typedef struct {
BroadwayInputBaseMsg base;
gint32 id;
gint32 new_id;
gint32 old_id;
} BroadwayInputFocusMsg;
typedef union {

View File

@ -1545,15 +1545,16 @@ broadway_server_focus_window (BroadwayServer *server,
if (server->focused_window_id == new_focused_window)
return;
/* Keep track of the new focused window */
server->focused_window_id = new_focused_window;
memset (&focus_msg, 0, sizeof (focus_msg));
focus_msg.base.type = BROADWAY_EVENT_FOCUS;
focus_msg.base.time = broadway_server_get_last_seen_time (server);
focus_msg.focus.id = new_focused_window;
focus_msg.focus.old_id = server->focused_window_id;
focus_msg.focus.new_id = new_focused_window;
broadway_events_got_input (&focus_msg, -1);
/* Keep track of the new focused window */
server->focused_window_id = new_focused_window;
}
guint32

View File

@ -345,7 +345,17 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
break;
case BROADWAY_EVENT_FOCUS:
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.id));
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.old_id));
if (window)
{
event = gdk_event_new (GDK_FOCUS_CHANGE);
event->focus_change.window = g_object_ref (window);
event->focus_change.in = FALSE;
gdk_event_set_device (event, display->core_pointer);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
}
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.new_id));
if (window)
{
event = gdk_event_new (GDK_FOCUS_CHANGE);