win32: Use the Stage state tracking

This commit is contained in:
Emmanuele Bassi 2012-01-26 08:27:08 +00:00
parent 12e4f300a7
commit e73c2bf4ea
3 changed files with 24 additions and 36 deletions

View File

@ -412,30 +412,18 @@ clutter_win32_handle_event (const MSG *msg)
case WM_ACTIVATE: case WM_ACTIVATE:
if (msg->wParam == WA_INACTIVE) 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); _clutter_stage_update_state (stage_win32->wrapper,
CLUTTER_STAGE_STATE_ACTIVATED,
stage_win32->state &= ~CLUTTER_STAGE_STATE_ACTIVATED; 0);
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);
} }
} }
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); _clutter_stage_update_state (stage_win32->wrapper,
0,
stage_win32->state |= CLUTTER_STAGE_STATE_ACTIVATED; 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);
} }
break; break;

View File

@ -92,7 +92,7 @@ clutter_stage_win32_get_geometry (ClutterStageWindow *stage_window,
{ {
ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (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 geometry->width = stage_win32->fullscreen_rect.right
- stage_win32->fullscreen_rect.left; - 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) if (width != stage_win32->win_width || height != stage_win32->win_height)
{ {
/* Ignore size requests if we are in full screen mode */ /* 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_width = width;
stage_win32->win_height = height; stage_win32->win_height = height;
@ -272,7 +272,7 @@ get_window_style (ClutterStageWin32 *stage_win32)
ClutterStage *wrapper = stage_win32->wrapper; ClutterStage *wrapper = stage_win32->wrapper;
/* Fullscreen mode shouldn't have any borders */ /* Fullscreen mode shouldn't have any borders */
if ((stage_win32->state & CLUTTER_STAGE_STATE_FULLSCREEN)) if (_clutter_stage_is_fullscreen (wrapper))
return WS_POPUP; return WS_POPUP;
/* Otherwise it's an overlapped window but if it isn't resizable /* Otherwise it's an overlapped window but if it isn't resizable
then it shouldn't have a thick frame */ 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); LONG old_style = GetWindowLongW (hwnd, GWL_STYLE);
ClutterStageStateEvent event; ClutterStageStateEvent event;
if (value)
stage_win32->state |= CLUTTER_STAGE_STATE_FULLSCREEN;
else
stage_win32->state &= ~CLUTTER_STAGE_STATE_FULLSCREEN;
if (hwnd) if (hwnd)
{ {
/* Update the window style but preserve the visibility */ /* Update the window style but preserve the visibility */
@ -364,12 +359,18 @@ clutter_stage_win32_set_fullscreen (ClutterStageWindow *stage_window,
} }
/* Report the state change */ /* Report the state change */
memset (&event, 0, sizeof (event)); if (value)
event.type = CLUTTER_STAGE_STATE; {
event.stage = CLUTTER_STAGE (stage_win32->wrapper); _clutter_stage_update_state (stage_win32->wrapper,
event.new_state = stage_win32->state; 0,
event.changed_mask = CLUTTER_STAGE_STATE_FULLSCREEN; CLUTTER_STAGE_STATE_FULLSCREEN);
clutter_event_put ((ClutterEvent *) &event); }
else
{
_clutter_stage_update_state (stage_win32->wrapper,
CLUTTER_STAGE_STATE_FULLSCREEN,
0);
}
} }
static ATOM static ATOM
@ -431,7 +432,7 @@ clutter_stage_win32_realize (ClutterStageWindow *stage_window)
/* If we're in fullscreen mode then use the fullscreen rect /* If we're in fullscreen mode then use the fullscreen rect
instead */ instead */
if ((stage_win32->state & CLUTTER_STAGE_STATE_FULLSCREEN)) if (_clutter_stage_is_fullscreen (stage_win32->wrapper))
{ {
get_fullscreen_rect (stage_win32); get_fullscreen_rect (stage_win32);
win_xpos = stage_win32->fullscreen_rect.left; win_xpos = stage_win32->fullscreen_rect.left;

View File

@ -54,7 +54,6 @@ struct _ClutterStageWin32
wchar_t *wtitle; wchar_t *wtitle;
ClutterBackendWin32 *backend; ClutterBackendWin32 *backend;
ClutterStageState state;
ClutterStage *wrapper; ClutterStage *wrapper;