Merge branch 'stage-state'
* stage-state: docs: Update ClutterStageState flags wayland: Use the Stage state tracking gdk: Use the Stage state tracking win32: Use the Stage state tracking x11: Use the Stage state tracking osx: Use the Stage state tracking stage: Add state tracking
This commit is contained in:
commit
fdf89a9e06
@ -742,10 +742,10 @@ typedef enum { /*< prefix=CLUTTER_SCROLL >*/
|
||||
/**
|
||||
* ClutterStageState:
|
||||
* @CLUTTER_STAGE_STATE_FULLSCREEN: Fullscreen mask
|
||||
* @CLUTTER_STAGE_STATE_OFFSCREEN: Offscreen mask
|
||||
* @CLUTTER_STAGE_STATE_OFFSCREEN: Offscreen mask (deprecated)
|
||||
* @CLUTTER_STAGE_STATE_ACTIVATED: Activated mask
|
||||
*
|
||||
* Stage state masks
|
||||
* Stage state masks, used by the #ClutterEvent of type %CLUTTER_STAGE_STATE.
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
|
@ -109,6 +109,13 @@ ClutterActor * _clutter_stage_get_drag_actor (ClutterStage *sta
|
||||
void _clutter_stage_remove_drag_actor (ClutterStage *stage,
|
||||
ClutterInputDevice *device);
|
||||
|
||||
ClutterStageState _clutter_stage_get_state (ClutterStage *stage);
|
||||
gboolean _clutter_stage_is_activated (ClutterStage *stage);
|
||||
gboolean _clutter_stage_is_fullscreen (ClutterStage *stage);
|
||||
gboolean _clutter_stage_update_state (ClutterStage *stage,
|
||||
ClutterStageState unset_state,
|
||||
ClutterStageState set_state);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */
|
||||
|
@ -127,6 +127,7 @@ struct _ClutterStagePrivate
|
||||
CoglMatrix inverse_projection;
|
||||
CoglMatrix view;
|
||||
float viewport[4];
|
||||
|
||||
ClutterFog fog;
|
||||
|
||||
gchar *title;
|
||||
@ -159,6 +160,8 @@ struct _ClutterStagePrivate
|
||||
gulong redraw_count;
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
ClutterStageState current_state;
|
||||
|
||||
guint relayout_pending : 1;
|
||||
guint redraw_pending : 1;
|
||||
guint is_fullscreen : 1;
|
||||
@ -4397,3 +4400,87 @@ _clutter_stage_remove_drag_actor (ClutterStage *stage,
|
||||
if (g_hash_table_size (drag_actors) == 0)
|
||||
g_object_set_data (G_OBJECT (stage), "__clutter_stage_drag_actors", NULL);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* _clutter_stage_get_state:
|
||||
* @stage: a #ClutterStage
|
||||
*
|
||||
* Retrieves the current #ClutterStageState flags associated to the @stage.
|
||||
*
|
||||
* Return value: a bitwise OR of #ClutterStageState flags
|
||||
*/
|
||||
ClutterStageState
|
||||
_clutter_stage_get_state (ClutterStage *stage)
|
||||
{
|
||||
return stage->priv->current_state;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* _clutter_stage_is_activated:
|
||||
* @stage: a #ClutterStage
|
||||
*
|
||||
* Checks whether the @stage state includes %CLUTTER_STAGE_STATE_ACTIVATED.
|
||||
*
|
||||
* Return value: %TRUE if the @stage is active
|
||||
*/
|
||||
gboolean
|
||||
_clutter_stage_is_activated (ClutterStage *stage)
|
||||
{
|
||||
return (stage->priv->current_state & CLUTTER_STAGE_STATE_ACTIVATED) != 0;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* _clutter_stage_is_fullscreen:
|
||||
* @stage: a #ClutterStage
|
||||
*
|
||||
* Checks whether the @stage state includes %CLUTTER_STAGE_STATE_FULLSCREEN.
|
||||
*
|
||||
* Return value: %TRUE if the @stage is fullscreen
|
||||
*/
|
||||
gboolean
|
||||
_clutter_stage_is_fullscreen (ClutterStage *stage)
|
||||
{
|
||||
return (stage->priv->current_state & CLUTTER_STAGE_STATE_FULLSCREEN) != 0;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* _clutter_stage_update_state:
|
||||
* @stage: a #ClutterStage
|
||||
* @unset_flags: flags to unset
|
||||
* @set_flags: flags to set
|
||||
*
|
||||
* Updates the state of @stage, by unsetting the @unset_flags and setting
|
||||
* the @set_flags.
|
||||
*
|
||||
* If the stage state has been changed, this function will queue a
|
||||
* #ClutterEvent of type %CLUTTER_STAGE_STATE.
|
||||
*
|
||||
* Return value: %TRUE if the state was updated, and %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
_clutter_stage_update_state (ClutterStage *stage,
|
||||
ClutterStageState unset_flags,
|
||||
ClutterStageState set_flags)
|
||||
{
|
||||
ClutterStageState new_state;
|
||||
ClutterEvent *event;
|
||||
|
||||
new_state = stage->priv->current_state;
|
||||
new_state |= set_flags;
|
||||
new_state &= ~unset_flags;
|
||||
|
||||
if (new_state == stage->priv->current_state)
|
||||
return FALSE;
|
||||
|
||||
event = clutter_event_new (CLUTTER_STAGE_STATE);
|
||||
clutter_event_set_stage (event, stage);
|
||||
|
||||
event->stage_state.new_state = new_state;
|
||||
event->stage_state.changed_mask = new_state ^ stage->priv->current_state;
|
||||
|
||||
stage->priv->current_state = new_state;
|
||||
|
||||
_clutter_event_push (event, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -50,12 +50,6 @@ G_DEFINE_TYPE_WITH_CODE (ClutterStageOSX,
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
|
||||
clutter_stage_window_iface_init))
|
||||
|
||||
/* FIXME: this should be in clutter-stage.c */
|
||||
static void
|
||||
clutter_stage_osx_state_update (ClutterStageOSX *self,
|
||||
ClutterStageState unset_flags,
|
||||
ClutterStageState set_flags);
|
||||
|
||||
static ClutterActor *
|
||||
clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
|
||||
|
||||
@ -87,7 +81,7 @@ clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
|
||||
CLUTTER_NOTE (BACKEND, "[%p] windowShouldClose", self->stage_osx);
|
||||
|
||||
event.type = CLUTTER_DELETE;
|
||||
event.any.stage = CLUTTER_STAGE (self->stage_osx->wrapper);
|
||||
event.any.stage = self->stage_osx->wrapper;
|
||||
clutter_event_put (&event);
|
||||
|
||||
return NO;
|
||||
@ -104,26 +98,34 @@ clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
|
||||
|
||||
- (void) windowDidBecomeKey:(NSNotification*)aNotification
|
||||
{
|
||||
ClutterStage *stage;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] windowDidBecomeKey", self->stage_osx);
|
||||
|
||||
if (self->stage_osx->stage_state & CLUTTER_STAGE_STATE_FULLSCREEN)
|
||||
stage = self->stage_osx->wrapper;
|
||||
|
||||
if (_clutter_stage_is_fullscreen (stage))
|
||||
[self setLevel: CLUTTER_OSX_FULLSCREEN_WINDOW_LEVEL];
|
||||
|
||||
clutter_stage_osx_state_update (self->stage_osx, 0, CLUTTER_STAGE_STATE_ACTIVATED);
|
||||
_clutter_stage_update_state (stage, 0, CLUTTER_STAGE_STATE_ACTIVATED);
|
||||
}
|
||||
|
||||
- (void) windowDidResignKey:(NSNotification*)aNotification
|
||||
{
|
||||
ClutterStage *stage;
|
||||
|
||||
CLUTTER_NOTE (BACKEND, "[%p] windowDidResignKey", self->stage_osx);
|
||||
|
||||
if (self->stage_osx->stage_state & CLUTTER_STAGE_STATE_FULLSCREEN)
|
||||
stage = self->stage_osx->wrapper;
|
||||
|
||||
if (_clutter_stage_is_fullscreen (stage))
|
||||
{
|
||||
[self setLevel: NSNormalWindowLevel];
|
||||
if (!self->stage_osx->isHiding)
|
||||
[self orderBack: nil];
|
||||
}
|
||||
|
||||
clutter_stage_osx_state_update (self->stage_osx, CLUTTER_STAGE_STATE_ACTIVATED, 0);
|
||||
_clutter_stage_update_state (stage, CLUTTER_STAGE_STATE_ACTIVATED, 0);
|
||||
}
|
||||
|
||||
- (NSSize) windowWillResize:(NSWindow *) sender toSize:(NSSize) frameSize
|
||||
@ -143,7 +145,7 @@ clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
|
||||
|
||||
- (void)windowDidChangeScreen:(NSNotification *)notification
|
||||
{
|
||||
clutter_stage_ensure_redraw (CLUTTER_STAGE (self->stage_osx->wrapper));
|
||||
clutter_stage_ensure_redraw (self->stage_osx->wrapper);
|
||||
}
|
||||
@end
|
||||
|
||||
@ -244,28 +246,6 @@ EVENT_HANDLER(tabletProximity)
|
||||
@end
|
||||
|
||||
/*************************************************************************/
|
||||
static void
|
||||
clutter_stage_osx_state_update (ClutterStageOSX *self,
|
||||
ClutterStageState unset_flags,
|
||||
ClutterStageState set_flags)
|
||||
{
|
||||
ClutterStageStateEvent event;
|
||||
|
||||
event.new_state = self->stage_state;
|
||||
event.new_state |= set_flags;
|
||||
event.new_state &= ~unset_flags;
|
||||
|
||||
if (event.new_state == self->stage_state)
|
||||
return;
|
||||
|
||||
event.changed_mask = event.new_state ^ self->stage_state;
|
||||
|
||||
self->stage_state = event.new_state;
|
||||
|
||||
event.type = CLUTTER_STAGE_STATE;
|
||||
event.stage = CLUTTER_STAGE (self->wrapper);
|
||||
clutter_event_put ((ClutterEvent*)&event);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_osx_save_frame (ClutterStageOSX *self)
|
||||
@ -281,7 +261,7 @@ clutter_stage_osx_set_frame (ClutterStageOSX *self)
|
||||
{
|
||||
g_assert (self->window != NULL);
|
||||
|
||||
if (self->stage_state & CLUTTER_STAGE_STATE_FULLSCREEN)
|
||||
if (_clutter_stage_is_fullscreen (self->wrapper))
|
||||
{
|
||||
/* Raise above the menubar (and dock) covering the whole screen.
|
||||
*
|
||||
@ -528,11 +508,17 @@ clutter_stage_osx_set_fullscreen (ClutterStageWindow *stage_window,
|
||||
*/
|
||||
if (fullscreen)
|
||||
{
|
||||
clutter_stage_osx_state_update (self, 0, CLUTTER_STAGE_STATE_FULLSCREEN);
|
||||
_clutter_stage_update_state (CLUTTER_STAGE (self->wrapper),
|
||||
0,
|
||||
CLUTTER_STAGE_STATE_FULLSCREEN);
|
||||
clutter_stage_osx_save_frame (self);
|
||||
}
|
||||
else
|
||||
clutter_stage_osx_state_update (self, CLUTTER_STAGE_STATE_FULLSCREEN, 0);
|
||||
{
|
||||
_clutter_stage_update_state (CLUTTER_STAGE (self->wrapper),
|
||||
CLUTTER_STAGE_STATE_FULLSCREEN,
|
||||
0);
|
||||
}
|
||||
|
||||
clutter_stage_osx_set_frame (self);
|
||||
|
||||
|
@ -65,8 +65,6 @@ struct _ClutterStageOSX
|
||||
gint requisition_width;
|
||||
gint requisition_height;
|
||||
|
||||
ClutterStageState stage_state;
|
||||
|
||||
gboolean acceptFocus;
|
||||
gboolean isHiding;
|
||||
gboolean haveRealized;
|
||||
|
@ -211,7 +211,6 @@ clutter_wayland_handle_keyboard_focus (void *data,
|
||||
{
|
||||
ClutterInputDeviceWayland *device = data;
|
||||
ClutterStageCogl *stage_cogl;
|
||||
ClutterEvent *event;
|
||||
uint32_t *k, *end;
|
||||
|
||||
if (device->keyboard_focus)
|
||||
@ -219,14 +218,9 @@ clutter_wayland_handle_keyboard_focus (void *data,
|
||||
stage_cogl = device->keyboard_focus;
|
||||
device->keyboard_focus = NULL;
|
||||
|
||||
event = clutter_event_new (CLUTTER_STAGE_STATE);
|
||||
event->stage_state.time = _time;
|
||||
event->stage_state.stage = stage_cogl->wrapper;
|
||||
event->stage_state.stage = stage_cogl->wrapper;
|
||||
event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED;
|
||||
event->stage_state.new_state = 0;
|
||||
|
||||
_clutter_event_push (event, FALSE);
|
||||
_clutter_stage_update_state (stage_cogl->wrapper,
|
||||
CLUTTER_STAGE_STATE_ACTIVATED,
|
||||
0);
|
||||
}
|
||||
|
||||
if (surface)
|
||||
@ -234,17 +228,14 @@ clutter_wayland_handle_keyboard_focus (void *data,
|
||||
stage_cogl = wl_surface_get_user_data (surface);
|
||||
device->keyboard_focus = stage_cogl;
|
||||
|
||||
event = clutter_event_new (CLUTTER_STAGE_STATE);
|
||||
event->stage_state.stage = stage_cogl->wrapper;
|
||||
event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED;
|
||||
event->stage_state.new_state = CLUTTER_STAGE_STATE_ACTIVATED;
|
||||
_clutter_stage_update_state (stage_cogl->wrapper,
|
||||
0,
|
||||
CLUTTER_STAGE_STATE_ACTIVATED);
|
||||
|
||||
end = (uint32_t *)((guint8 *)keys->data + keys->size);
|
||||
device->modifier_state = 0;
|
||||
for (k = keys->data; k < end; k++)
|
||||
device->modifier_state |= device->xkb->map->modmap[*k];
|
||||
|
||||
_clutter_event_push (event, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -54,7 +54,6 @@ struct _ClutterStageWin32
|
||||
wchar_t *wtitle;
|
||||
|
||||
ClutterBackendWin32 *backend;
|
||||
ClutterStageState state;
|
||||
|
||||
ClutterStage *wrapper;
|
||||
|
||||
|
@ -207,7 +207,7 @@ clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
|
||||
geometry->x = geometry->y = 0;
|
||||
|
||||
/* If we're fullscreen, return the size of the display. */
|
||||
if ((stage_x11->state & CLUTTER_STAGE_STATE_FULLSCREEN) &&
|
||||
if (_clutter_stage_is_fullscreen (stage_x11->wrapper) &&
|
||||
stage_x11->fullscreening)
|
||||
{
|
||||
geometry->width = DisplayWidth (backend_x11->xdpy, backend_x11->xscreen_num);
|
||||
@ -524,7 +524,7 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
|
||||
if (stage == NULL || CLUTTER_ACTOR_IN_DESTRUCTION (stage))
|
||||
return;
|
||||
|
||||
was_fullscreen = ((stage_x11->state & CLUTTER_STAGE_STATE_FULLSCREEN) != 0);
|
||||
was_fullscreen = _clutter_stage_is_fullscreen (stage);
|
||||
is_fullscreen = !!is_fullscreen;
|
||||
|
||||
if (was_fullscreen == is_fullscreen)
|
||||
@ -681,7 +681,7 @@ clutter_stage_x11_set_accept_focus (ClutterStageWindow *stage_window,
|
||||
}
|
||||
|
||||
static void
|
||||
set_stage_state (ClutterStageX11 *stage_x11,
|
||||
set_stage_x11_state (ClutterStageX11 *stage_x11,
|
||||
ClutterStageX11State unset_flags,
|
||||
ClutterStageX11State set_flags)
|
||||
{
|
||||
@ -721,7 +721,7 @@ clutter_stage_x11_show (ClutterStageWindow *stage_window,
|
||||
CLUTTER_NOTE (BACKEND, "Mapping stage[%lu]",
|
||||
(unsigned long) stage_x11->xwin);
|
||||
|
||||
set_stage_state (stage_x11, STAGE_X11_WITHDRAWN, 0);
|
||||
set_stage_x11_state (stage_x11, STAGE_X11_WITHDRAWN, 0);
|
||||
|
||||
update_wm_hints (stage_x11);
|
||||
|
||||
@ -750,7 +750,7 @@ clutter_stage_x11_hide (ClutterStageWindow *stage_window)
|
||||
if (stage_x11->xwin != None)
|
||||
{
|
||||
if (STAGE_X11_IS_MAPPED (stage_x11))
|
||||
set_stage_state (stage_x11, 0, STAGE_X11_WITHDRAWN);
|
||||
set_stage_x11_state (stage_x11, 0, STAGE_X11_WITHDRAWN);
|
||||
|
||||
g_assert (!STAGE_X11_IS_MAPPED (stage_x11));
|
||||
|
||||
@ -939,7 +939,7 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
|
||||
/* When fullscreen, we'll keep the xwin_width/height
|
||||
variables to track the old size of the window and we'll
|
||||
assume all ConfigureNotifies constitute a size change */
|
||||
if ((stage_x11->state & CLUTTER_STAGE_STATE_FULLSCREEN))
|
||||
if (_clutter_stage_is_fullscreen (stage))
|
||||
size_changed = TRUE;
|
||||
else if ((stage_x11->xwin_width != xevent->xconfigure.width) ||
|
||||
(stage_x11->xwin_height != xevent->xconfigure.height))
|
||||
@ -1040,9 +1040,9 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
|
||||
|
||||
if (type != None && data != NULL)
|
||||
{
|
||||
gboolean is_fullscreen = FALSE;
|
||||
Atom *atoms = (Atom *) data;
|
||||
gulong i;
|
||||
gboolean is_fullscreen = FALSE;
|
||||
|
||||
for (i = 0; i < n_items; i++)
|
||||
{
|
||||
@ -1050,26 +1050,20 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
|
||||
fullscreen_set = TRUE;
|
||||
}
|
||||
|
||||
is_fullscreen =
|
||||
(stage_x11->state & CLUTTER_STAGE_STATE_FULLSCREEN);
|
||||
is_fullscreen = _clutter_stage_is_fullscreen (stage_x11->wrapper);
|
||||
|
||||
if (fullscreen_set != is_fullscreen)
|
||||
{
|
||||
ClutterStageState new_state;
|
||||
|
||||
if (fullscreen_set)
|
||||
stage_x11->state |= CLUTTER_STAGE_STATE_FULLSCREEN;
|
||||
_clutter_stage_update_state (stage_x11->wrapper,
|
||||
0,
|
||||
CLUTTER_STAGE_STATE_FULLSCREEN);
|
||||
else
|
||||
stage_x11->state &= ~CLUTTER_STAGE_STATE_FULLSCREEN;
|
||||
|
||||
stage_x11->fullscreening = fullscreen_set;
|
||||
|
||||
event->any.type = CLUTTER_STAGE_STATE;
|
||||
event->any.source = CLUTTER_ACTOR (stage);
|
||||
event->any.stage = stage;
|
||||
event->stage_state.changed_mask =
|
||||
CLUTTER_STAGE_STATE_FULLSCREEN;
|
||||
event->stage_state.new_state = stage_x11->state;
|
||||
|
||||
res = CLUTTER_TRANSLATE_QUEUE;
|
||||
_clutter_stage_update_state (stage_x11->wrapper,
|
||||
CLUTTER_STAGE_STATE_FULLSCREEN,
|
||||
0);
|
||||
}
|
||||
|
||||
XFree (data);
|
||||
@ -1078,34 +1072,20 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
|
||||
break;
|
||||
|
||||
case FocusIn:
|
||||
if (!(stage_x11->state & CLUTTER_STAGE_STATE_ACTIVATED))
|
||||
if (!_clutter_stage_is_activated (stage_x11->wrapper))
|
||||
{
|
||||
/* TODO: check the detail? */
|
||||
stage_x11->state |= CLUTTER_STAGE_STATE_ACTIVATED;
|
||||
|
||||
event->type = CLUTTER_STAGE_STATE;
|
||||
event->any.source = CLUTTER_ACTOR (stage);
|
||||
event->any.stage = stage;
|
||||
event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED;
|
||||
event->stage_state.new_state = stage_x11->state;
|
||||
|
||||
res = CLUTTER_TRANSLATE_QUEUE;
|
||||
_clutter_stage_update_state (stage_x11->wrapper,
|
||||
0,
|
||||
CLUTTER_STAGE_STATE_ACTIVATED);
|
||||
}
|
||||
break;
|
||||
|
||||
case FocusOut:
|
||||
if (stage_x11->state & CLUTTER_STAGE_STATE_ACTIVATED)
|
||||
if (_clutter_stage_is_activated (stage_x11->wrapper))
|
||||
{
|
||||
/* TODO: check the detail? */
|
||||
stage_x11->state &= ~CLUTTER_STAGE_STATE_ACTIVATED;
|
||||
|
||||
event->any.type = CLUTTER_STAGE_STATE;
|
||||
event->any.source = CLUTTER_ACTOR (stage);
|
||||
event->any.stage = stage;
|
||||
event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED;
|
||||
event->stage_state.new_state = stage_x11->state;
|
||||
|
||||
res = CLUTTER_TRANSLATE_QUEUE;
|
||||
_clutter_stage_update_state (stage_x11->wrapper,
|
||||
CLUTTER_STAGE_STATE_ACTIVATED,
|
||||
0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -59,8 +59,6 @@ struct _ClutterStageX11
|
||||
|
||||
guint clipped_redraws_cool_off;
|
||||
|
||||
ClutterStageState state;
|
||||
|
||||
ClutterStageX11State wm_state;
|
||||
|
||||
guint is_foreign_xwin : 1;
|
||||
|
Loading…
Reference in New Issue
Block a user