From e73c2bf4ea3dcc72e32e1814e5cc6d64ed377e0f Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 26 Jan 2012 08:27:08 +0000 Subject: [PATCH] win32: Use the Stage state tracking --- clutter/win32/clutter-event-win32.c | 28 ++++++++------------------ clutter/win32/clutter-stage-win32.c | 31 +++++++++++++++-------------- clutter/win32/clutter-stage-win32.h | 1 - 3 files changed, 24 insertions(+), 36 deletions(-) diff --git a/clutter/win32/clutter-event-win32.c b/clutter/win32/clutter-event-win32.c index 197f665ad..7274c8c4d 100644 --- a/clutter/win32/clutter-event-win32.c +++ b/clutter/win32/clutter-event-win32.c @@ -412,30 +412,18 @@ clutter_win32_handle_event (const MSG *msg) case WM_ACTIVATE: if (msg->wParam == WA_INACTIVE) { - if (stage_win32->state & CLUTTER_STAGE_STATE_ACTIVATED) + if (_clutter_stage_is_activated (stage_win32->wrapper)) { - ClutterEvent *event = clutter_event_new (CLUTTER_STAGE_STATE); - - stage_win32->state &= ~CLUTTER_STAGE_STATE_ACTIVATED; - - event->any.stage = stage; - event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED; - event->stage_state.new_state = stage_win32->state; - - take_and_queue_event (event); + _clutter_stage_update_state (stage_win32->wrapper, + CLUTTER_STAGE_STATE_ACTIVATED, + 0); } } - else if (!(stage_win32->state & CLUTTER_STAGE_STATE_ACTIVATED)) + else if (!_clutter_stage_is_activated (stage_win32->wrapper)) { - ClutterEvent *event = clutter_event_new (CLUTTER_STAGE_STATE); - - stage_win32->state |= CLUTTER_STAGE_STATE_ACTIVATED; - - event->any.stage = stage; - event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED; - event->stage_state.new_state = stage_win32->state; - - take_and_queue_event (event); + _clutter_stage_update_state (stage_win32->wrapper, + 0, + CLUTTER_STAGE_STATE_ACTIVATED); } break; diff --git a/clutter/win32/clutter-stage-win32.c b/clutter/win32/clutter-stage-win32.c index e89c81769..ef80c764c 100644 --- a/clutter/win32/clutter-stage-win32.c +++ b/clutter/win32/clutter-stage-win32.c @@ -92,7 +92,7 @@ clutter_stage_win32_get_geometry (ClutterStageWindow *stage_window, { ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (stage_window); - if ((stage_win32->state & CLUTTER_STAGE_STATE_FULLSCREEN)) + if (_clutter_stage_is_fullscreen (stage_win32->wrapper)) { geometry->width = stage_win32->fullscreen_rect.right - stage_win32->fullscreen_rect.left; @@ -177,7 +177,7 @@ clutter_stage_win32_resize (ClutterStageWindow *stage_window, if (width != stage_win32->win_width || height != stage_win32->win_height) { /* Ignore size requests if we are in full screen mode */ - if ((stage_win32->state & CLUTTER_STAGE_STATE_FULLSCREEN) == 0) + if (!_clutter_stage_is_fullscreen (stage_win32->wrapper)) { stage_win32->win_width = width; stage_win32->win_height = height; @@ -272,7 +272,7 @@ get_window_style (ClutterStageWin32 *stage_win32) ClutterStage *wrapper = stage_win32->wrapper; /* Fullscreen mode shouldn't have any borders */ - if ((stage_win32->state & CLUTTER_STAGE_STATE_FULLSCREEN)) + if (_clutter_stage_is_fullscreen (wrapper)) return WS_POPUP; /* Otherwise it's an overlapped window but if it isn't resizable then it shouldn't have a thick frame */ @@ -323,11 +323,6 @@ clutter_stage_win32_set_fullscreen (ClutterStageWindow *stage_window, LONG old_style = GetWindowLongW (hwnd, GWL_STYLE); ClutterStageStateEvent event; - if (value) - stage_win32->state |= CLUTTER_STAGE_STATE_FULLSCREEN; - else - stage_win32->state &= ~CLUTTER_STAGE_STATE_FULLSCREEN; - if (hwnd) { /* Update the window style but preserve the visibility */ @@ -364,12 +359,18 @@ clutter_stage_win32_set_fullscreen (ClutterStageWindow *stage_window, } /* Report the state change */ - memset (&event, 0, sizeof (event)); - event.type = CLUTTER_STAGE_STATE; - event.stage = CLUTTER_STAGE (stage_win32->wrapper); - event.new_state = stage_win32->state; - event.changed_mask = CLUTTER_STAGE_STATE_FULLSCREEN; - clutter_event_put ((ClutterEvent *) &event); + if (value) + { + _clutter_stage_update_state (stage_win32->wrapper, + 0, + CLUTTER_STAGE_STATE_FULLSCREEN); + } + else + { + _clutter_stage_update_state (stage_win32->wrapper, + CLUTTER_STAGE_STATE_FULLSCREEN, + 0); + } } static ATOM @@ -431,7 +432,7 @@ clutter_stage_win32_realize (ClutterStageWindow *stage_window) /* If we're in fullscreen mode then use the fullscreen rect instead */ - if ((stage_win32->state & CLUTTER_STAGE_STATE_FULLSCREEN)) + if (_clutter_stage_is_fullscreen (stage_win32->wrapper)) { get_fullscreen_rect (stage_win32); win_xpos = stage_win32->fullscreen_rect.left; diff --git a/clutter/win32/clutter-stage-win32.h b/clutter/win32/clutter-stage-win32.h index 241893634..0aa259796 100644 --- a/clutter/win32/clutter-stage-win32.h +++ b/clutter/win32/clutter-stage-win32.h @@ -54,7 +54,6 @@ struct _ClutterStageWin32 wchar_t *wtitle; ClutterBackendWin32 *backend; - ClutterStageState state; ClutterStage *wrapper;