From 8c184f53cb3d01ef8cbefbf856e173b7f6555a45 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 26 Jan 2012 08:27:25 +0000 Subject: [PATCH] gdk: Use the Stage state tracking --- clutter/gdk/clutter-event-gdk.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/clutter/gdk/clutter-event-gdk.c b/clutter/gdk/clutter-event-gdk.c index 5d8f1a781..4e0e22fb8 100644 --- a/clutter/gdk/clutter-event-gdk.c +++ b/clutter/gdk/clutter-event-gdk.c @@ -226,12 +226,10 @@ clutter_gdk_handle_event (GdkEvent *gdk_event) break; case GDK_FOCUS_CHANGE: - event = clutter_event_new (CLUTTER_STAGE_STATE); - event->stage_state.time = 0; /* XXX: there is no timestamp in this GdkEvent */ - event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED; - event->stage_state.new_state = gdk_event->focus_change.in - ? CLUTTER_STAGE_STATE_ACTIVATED - : 0; + if (gdk_event->focus_change.in) + _clutter_stage_update_state (stage, 0, CLUTTER_STAGE_STATE_ACTIVATED); + else + _clutter_stage_update_state (stage, CLUTTER_STAGE_STATE_ACTIVATED, 0); break; case GDK_CONFIGURE: @@ -263,23 +261,15 @@ clutter_gdk_handle_event (GdkEvent *gdk_event) break; case GDK_WINDOW_STATE: - event = clutter_event_new (CLUTTER_STAGE_STATE); - event->stage_state.changed_mask = 0; - event->stage_state.new_state = 0; - if (gdk_event->window_state.changed_mask & GDK_WINDOW_STATE_WITHDRAWN) - { - event->stage_state.changed_mask |= CLUTTER_STAGE_STATE_OFFSCREEN; - event->stage_state.new_state |= (gdk_event->window_state.new_window_state & GDK_WINDOW_STATE_WITHDRAWN) - ? CLUTTER_STAGE_STATE_OFFSCREEN - : 0; - } - if (gdk_event->window_state.changed_mask & GDK_WINDOW_STATE_FULLSCREEN) { - event->stage_state.changed_mask |= CLUTTER_STAGE_STATE_FULLSCREEN; - event->stage_state.new_state |= (gdk_event->window_state.new_window_state & GDK_WINDOW_STATE_FULLSCREEN) - ? CLUTTER_STAGE_STATE_FULLSCREEN - : 0; + gboolean is_fullscreen; + + is_fullscreen = (gdk_event->window_state.new_window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0; + if (is_fullscreen) + _clutter_stage_update_state (stage, 0, CLUTTER_STAGE_STATE_FULLSCREEN); + else + _clutter_stage_update_state (stage, CLUTTER_STAGE_STATE_FULLSCREEN, 0); } break;