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,17 +742,17 @@ typedef enum { /*< prefix=CLUTTER_SCROLL >*/
|
|||||||
/**
|
/**
|
||||||
* ClutterStageState:
|
* ClutterStageState:
|
||||||
* @CLUTTER_STAGE_STATE_FULLSCREEN: Fullscreen mask
|
* @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
|
* @CLUTTER_STAGE_STATE_ACTIVATED: Activated mask
|
||||||
*
|
*
|
||||||
* Stage state masks
|
* Stage state masks, used by the #ClutterEvent of type %CLUTTER_STAGE_STATE.
|
||||||
*
|
*
|
||||||
* Since: 0.4
|
* Since: 0.4
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CLUTTER_STAGE_STATE_FULLSCREEN = (1<<1),
|
CLUTTER_STAGE_STATE_FULLSCREEN = (1 << 1),
|
||||||
CLUTTER_STAGE_STATE_OFFSCREEN = (1<<2),
|
CLUTTER_STAGE_STATE_OFFSCREEN = (1 << 2),
|
||||||
CLUTTER_STAGE_STATE_ACTIVATED = (1<<3)
|
CLUTTER_STAGE_STATE_ACTIVATED = (1 << 3)
|
||||||
} ClutterStageState;
|
} ClutterStageState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,6 +109,13 @@ ClutterActor * _clutter_stage_get_drag_actor (ClutterStage *sta
|
|||||||
void _clutter_stage_remove_drag_actor (ClutterStage *stage,
|
void _clutter_stage_remove_drag_actor (ClutterStage *stage,
|
||||||
ClutterInputDevice *device);
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */
|
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */
|
||||||
|
@ -121,32 +121,33 @@ struct _ClutterStagePrivate
|
|||||||
/* the stage implementation */
|
/* the stage implementation */
|
||||||
ClutterStageWindow *impl;
|
ClutterStageWindow *impl;
|
||||||
|
|
||||||
ClutterColor color;
|
ClutterColor color;
|
||||||
ClutterPerspective perspective;
|
ClutterPerspective perspective;
|
||||||
CoglMatrix projection;
|
CoglMatrix projection;
|
||||||
CoglMatrix inverse_projection;
|
CoglMatrix inverse_projection;
|
||||||
CoglMatrix view;
|
CoglMatrix view;
|
||||||
float viewport[4];
|
float viewport[4];
|
||||||
ClutterFog fog;
|
|
||||||
|
|
||||||
gchar *title;
|
ClutterFog fog;
|
||||||
ClutterActor *key_focused_actor;
|
|
||||||
|
|
||||||
GQueue *event_queue;
|
gchar *title;
|
||||||
|
ClutterActor *key_focused_actor;
|
||||||
|
|
||||||
ClutterStageHint stage_hints;
|
GQueue *event_queue;
|
||||||
|
|
||||||
gint picks_per_frame;
|
ClutterStageHint stage_hints;
|
||||||
|
|
||||||
GArray *paint_volume_stack;
|
gint picks_per_frame;
|
||||||
|
|
||||||
ClutterPlane current_clip_planes[4];
|
GArray *paint_volume_stack;
|
||||||
|
|
||||||
GList *pending_queue_redraws;
|
ClutterPlane current_clip_planes[4];
|
||||||
|
|
||||||
ClutterPickMode pick_buffer_mode;
|
GList *pending_queue_redraws;
|
||||||
|
|
||||||
CoglFramebuffer *active_framebuffer;
|
ClutterPickMode pick_buffer_mode;
|
||||||
|
|
||||||
|
CoglFramebuffer *active_framebuffer;
|
||||||
|
|
||||||
GHashTable *devices;
|
GHashTable *devices;
|
||||||
|
|
||||||
@ -159,6 +160,8 @@ struct _ClutterStagePrivate
|
|||||||
gulong redraw_count;
|
gulong redraw_count;
|
||||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||||
|
|
||||||
|
ClutterStageState current_state;
|
||||||
|
|
||||||
guint relayout_pending : 1;
|
guint relayout_pending : 1;
|
||||||
guint redraw_pending : 1;
|
guint redraw_pending : 1;
|
||||||
guint is_fullscreen : 1;
|
guint is_fullscreen : 1;
|
||||||
@ -4397,3 +4400,87 @@ _clutter_stage_remove_drag_actor (ClutterStage *stage,
|
|||||||
if (g_hash_table_size (drag_actors) == 0)
|
if (g_hash_table_size (drag_actors) == 0)
|
||||||
g_object_set_data (G_OBJECT (stage), "__clutter_stage_drag_actors", NULL);
|
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;
|
break;
|
||||||
|
|
||||||
case GDK_FOCUS_CHANGE:
|
case GDK_FOCUS_CHANGE:
|
||||||
event = clutter_event_new (CLUTTER_STAGE_STATE);
|
if (gdk_event->focus_change.in)
|
||||||
event->stage_state.time = 0; /* XXX: there is no timestamp in this GdkEvent */
|
_clutter_stage_update_state (stage, 0, CLUTTER_STAGE_STATE_ACTIVATED);
|
||||||
event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED;
|
else
|
||||||
event->stage_state.new_state = gdk_event->focus_change.in
|
_clutter_stage_update_state (stage, CLUTTER_STAGE_STATE_ACTIVATED, 0);
|
||||||
? CLUTTER_STAGE_STATE_ACTIVATED
|
|
||||||
: 0;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GDK_CONFIGURE:
|
case GDK_CONFIGURE:
|
||||||
@ -263,23 +261,15 @@ clutter_gdk_handle_event (GdkEvent *gdk_event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GDK_WINDOW_STATE:
|
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)
|
if (gdk_event->window_state.changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
|
||||||
{
|
{
|
||||||
event->stage_state.changed_mask |= CLUTTER_STAGE_STATE_FULLSCREEN;
|
gboolean is_fullscreen;
|
||||||
event->stage_state.new_state |= (gdk_event->window_state.new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
|
|
||||||
? CLUTTER_STAGE_STATE_FULLSCREEN
|
is_fullscreen = (gdk_event->window_state.new_window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
|
||||||
: 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;
|
break;
|
||||||
|
|
||||||
|
@ -50,12 +50,6 @@ G_DEFINE_TYPE_WITH_CODE (ClutterStageOSX,
|
|||||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
|
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
|
||||||
clutter_stage_window_iface_init))
|
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 *
|
static ClutterActor *
|
||||||
clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
|
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);
|
CLUTTER_NOTE (BACKEND, "[%p] windowShouldClose", self->stage_osx);
|
||||||
|
|
||||||
event.type = CLUTTER_DELETE;
|
event.type = CLUTTER_DELETE;
|
||||||
event.any.stage = CLUTTER_STAGE (self->stage_osx->wrapper);
|
event.any.stage = self->stage_osx->wrapper;
|
||||||
clutter_event_put (&event);
|
clutter_event_put (&event);
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
@ -104,26 +98,34 @@ clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
|
|||||||
|
|
||||||
- (void) windowDidBecomeKey:(NSNotification*)aNotification
|
- (void) windowDidBecomeKey:(NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
|
ClutterStage *stage;
|
||||||
|
|
||||||
CLUTTER_NOTE (BACKEND, "[%p] windowDidBecomeKey", self->stage_osx);
|
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];
|
[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
|
- (void) windowDidResignKey:(NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
|
ClutterStage *stage;
|
||||||
|
|
||||||
CLUTTER_NOTE (BACKEND, "[%p] windowDidResignKey", self->stage_osx);
|
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];
|
[self setLevel: NSNormalWindowLevel];
|
||||||
if (!self->stage_osx->isHiding)
|
if (!self->stage_osx->isHiding)
|
||||||
[self orderBack: nil];
|
[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
|
- (NSSize) windowWillResize:(NSWindow *) sender toSize:(NSSize) frameSize
|
||||||
@ -143,7 +145,7 @@ clutter_stage_osx_get_wrapper (ClutterStageWindow *stage_window);
|
|||||||
|
|
||||||
- (void)windowDidChangeScreen:(NSNotification *)notification
|
- (void)windowDidChangeScreen:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
clutter_stage_ensure_redraw (CLUTTER_STAGE (self->stage_osx->wrapper));
|
clutter_stage_ensure_redraw (self->stage_osx->wrapper);
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -244,28 +246,6 @@ EVENT_HANDLER(tabletProximity)
|
|||||||
@end
|
@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
|
static void
|
||||||
clutter_stage_osx_save_frame (ClutterStageOSX *self)
|
clutter_stage_osx_save_frame (ClutterStageOSX *self)
|
||||||
@ -281,7 +261,7 @@ clutter_stage_osx_set_frame (ClutterStageOSX *self)
|
|||||||
{
|
{
|
||||||
g_assert (self->window != NULL);
|
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.
|
/* Raise above the menubar (and dock) covering the whole screen.
|
||||||
*
|
*
|
||||||
@ -528,11 +508,17 @@ clutter_stage_osx_set_fullscreen (ClutterStageWindow *stage_window,
|
|||||||
*/
|
*/
|
||||||
if (fullscreen)
|
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);
|
clutter_stage_osx_save_frame (self);
|
||||||
}
|
}
|
||||||
else
|
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);
|
clutter_stage_osx_set_frame (self);
|
||||||
|
|
||||||
|
@ -65,8 +65,6 @@ struct _ClutterStageOSX
|
|||||||
gint requisition_width;
|
gint requisition_width;
|
||||||
gint requisition_height;
|
gint requisition_height;
|
||||||
|
|
||||||
ClutterStageState stage_state;
|
|
||||||
|
|
||||||
gboolean acceptFocus;
|
gboolean acceptFocus;
|
||||||
gboolean isHiding;
|
gboolean isHiding;
|
||||||
gboolean haveRealized;
|
gboolean haveRealized;
|
||||||
|
@ -211,7 +211,6 @@ clutter_wayland_handle_keyboard_focus (void *data,
|
|||||||
{
|
{
|
||||||
ClutterInputDeviceWayland *device = data;
|
ClutterInputDeviceWayland *device = data;
|
||||||
ClutterStageCogl *stage_cogl;
|
ClutterStageCogl *stage_cogl;
|
||||||
ClutterEvent *event;
|
|
||||||
uint32_t *k, *end;
|
uint32_t *k, *end;
|
||||||
|
|
||||||
if (device->keyboard_focus)
|
if (device->keyboard_focus)
|
||||||
@ -219,14 +218,9 @@ clutter_wayland_handle_keyboard_focus (void *data,
|
|||||||
stage_cogl = device->keyboard_focus;
|
stage_cogl = device->keyboard_focus;
|
||||||
device->keyboard_focus = NULL;
|
device->keyboard_focus = NULL;
|
||||||
|
|
||||||
event = clutter_event_new (CLUTTER_STAGE_STATE);
|
_clutter_stage_update_state (stage_cogl->wrapper,
|
||||||
event->stage_state.time = _time;
|
CLUTTER_STAGE_STATE_ACTIVATED,
|
||||||
event->stage_state.stage = stage_cogl->wrapper;
|
0);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface)
|
if (surface)
|
||||||
@ -234,17 +228,14 @@ clutter_wayland_handle_keyboard_focus (void *data,
|
|||||||
stage_cogl = wl_surface_get_user_data (surface);
|
stage_cogl = wl_surface_get_user_data (surface);
|
||||||
device->keyboard_focus = stage_cogl;
|
device->keyboard_focus = stage_cogl;
|
||||||
|
|
||||||
event = clutter_event_new (CLUTTER_STAGE_STATE);
|
_clutter_stage_update_state (stage_cogl->wrapper,
|
||||||
event->stage_state.stage = stage_cogl->wrapper;
|
0,
|
||||||
event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED;
|
CLUTTER_STAGE_STATE_ACTIVATED);
|
||||||
event->stage_state.new_state = CLUTTER_STAGE_STATE_ACTIVATED;
|
|
||||||
|
|
||||||
end = (uint32_t *)((guint8 *)keys->data + keys->size);
|
end = (uint32_t *)((guint8 *)keys->data + keys->size);
|
||||||
device->modifier_state = 0;
|
device->modifier_state = 0;
|
||||||
for (k = keys->data; k < end; k++)
|
for (k = keys->data; k < end; k++)
|
||||||
device->modifier_state |= device->xkb->map->modmap[*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:
|
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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -54,7 +54,6 @@ struct _ClutterStageWin32
|
|||||||
wchar_t *wtitle;
|
wchar_t *wtitle;
|
||||||
|
|
||||||
ClutterBackendWin32 *backend;
|
ClutterBackendWin32 *backend;
|
||||||
ClutterStageState state;
|
|
||||||
|
|
||||||
ClutterStage *wrapper;
|
ClutterStage *wrapper;
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
|
|||||||
geometry->x = geometry->y = 0;
|
geometry->x = geometry->y = 0;
|
||||||
|
|
||||||
/* If we're fullscreen, return the size of the display. */
|
/* 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)
|
stage_x11->fullscreening)
|
||||||
{
|
{
|
||||||
geometry->width = DisplayWidth (backend_x11->xdpy, backend_x11->xscreen_num);
|
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))
|
if (stage == NULL || CLUTTER_ACTOR_IN_DESTRUCTION (stage))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
was_fullscreen = ((stage_x11->state & CLUTTER_STAGE_STATE_FULLSCREEN) != 0);
|
was_fullscreen = _clutter_stage_is_fullscreen (stage);
|
||||||
is_fullscreen = !!is_fullscreen;
|
is_fullscreen = !!is_fullscreen;
|
||||||
|
|
||||||
if (was_fullscreen == is_fullscreen)
|
if (was_fullscreen == is_fullscreen)
|
||||||
@ -681,9 +681,9 @@ clutter_stage_x11_set_accept_focus (ClutterStageWindow *stage_window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_stage_state (ClutterStageX11 *stage_x11,
|
set_stage_x11_state (ClutterStageX11 *stage_x11,
|
||||||
ClutterStageX11State unset_flags,
|
ClutterStageX11State unset_flags,
|
||||||
ClutterStageX11State set_flags)
|
ClutterStageX11State set_flags)
|
||||||
{
|
{
|
||||||
ClutterStageX11State new_stage_state, old_stage_state;
|
ClutterStageX11State new_stage_state, old_stage_state;
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ clutter_stage_x11_show (ClutterStageWindow *stage_window,
|
|||||||
CLUTTER_NOTE (BACKEND, "Mapping stage[%lu]",
|
CLUTTER_NOTE (BACKEND, "Mapping stage[%lu]",
|
||||||
(unsigned long) stage_x11->xwin);
|
(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);
|
update_wm_hints (stage_x11);
|
||||||
|
|
||||||
@ -750,7 +750,7 @@ clutter_stage_x11_hide (ClutterStageWindow *stage_window)
|
|||||||
if (stage_x11->xwin != None)
|
if (stage_x11->xwin != None)
|
||||||
{
|
{
|
||||||
if (STAGE_X11_IS_MAPPED (stage_x11))
|
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));
|
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
|
/* When fullscreen, we'll keep the xwin_width/height
|
||||||
variables to track the old size of the window and we'll
|
variables to track the old size of the window and we'll
|
||||||
assume all ConfigureNotifies constitute a size change */
|
assume all ConfigureNotifies constitute a size change */
|
||||||
if ((stage_x11->state & CLUTTER_STAGE_STATE_FULLSCREEN))
|
if (_clutter_stage_is_fullscreen (stage))
|
||||||
size_changed = TRUE;
|
size_changed = TRUE;
|
||||||
else if ((stage_x11->xwin_width != xevent->xconfigure.width) ||
|
else if ((stage_x11->xwin_width != xevent->xconfigure.width) ||
|
||||||
(stage_x11->xwin_height != xevent->xconfigure.height))
|
(stage_x11->xwin_height != xevent->xconfigure.height))
|
||||||
@ -1040,9 +1040,9 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
|
|||||||
|
|
||||||
if (type != None && data != NULL)
|
if (type != None && data != NULL)
|
||||||
{
|
{
|
||||||
|
gboolean is_fullscreen = FALSE;
|
||||||
Atom *atoms = (Atom *) data;
|
Atom *atoms = (Atom *) data;
|
||||||
gulong i;
|
gulong i;
|
||||||
gboolean is_fullscreen = FALSE;
|
|
||||||
|
|
||||||
for (i = 0; i < n_items; i++)
|
for (i = 0; i < n_items; i++)
|
||||||
{
|
{
|
||||||
@ -1050,26 +1050,20 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
|
|||||||
fullscreen_set = TRUE;
|
fullscreen_set = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_fullscreen =
|
is_fullscreen = _clutter_stage_is_fullscreen (stage_x11->wrapper);
|
||||||
(stage_x11->state & CLUTTER_STAGE_STATE_FULLSCREEN);
|
|
||||||
|
|
||||||
if (fullscreen_set != is_fullscreen)
|
if (fullscreen_set != is_fullscreen)
|
||||||
{
|
{
|
||||||
|
ClutterStageState new_state;
|
||||||
|
|
||||||
if (fullscreen_set)
|
if (fullscreen_set)
|
||||||
stage_x11->state |= CLUTTER_STAGE_STATE_FULLSCREEN;
|
_clutter_stage_update_state (stage_x11->wrapper,
|
||||||
|
0,
|
||||||
|
CLUTTER_STAGE_STATE_FULLSCREEN);
|
||||||
else
|
else
|
||||||
stage_x11->state &= ~CLUTTER_STAGE_STATE_FULLSCREEN;
|
_clutter_stage_update_state (stage_x11->wrapper,
|
||||||
|
CLUTTER_STAGE_STATE_FULLSCREEN,
|
||||||
stage_x11->fullscreening = fullscreen_set;
|
0);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XFree (data);
|
XFree (data);
|
||||||
@ -1078,34 +1072,20 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
if (!(stage_x11->state & CLUTTER_STAGE_STATE_ACTIVATED))
|
if (!_clutter_stage_is_activated (stage_x11->wrapper))
|
||||||
{
|
{
|
||||||
/* TODO: check the detail? */
|
_clutter_stage_update_state (stage_x11->wrapper,
|
||||||
stage_x11->state |= CLUTTER_STAGE_STATE_ACTIVATED;
|
0,
|
||||||
|
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;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FocusOut:
|
case FocusOut:
|
||||||
if (stage_x11->state & CLUTTER_STAGE_STATE_ACTIVATED)
|
if (_clutter_stage_is_activated (stage_x11->wrapper))
|
||||||
{
|
{
|
||||||
/* TODO: check the detail? */
|
_clutter_stage_update_state (stage_x11->wrapper,
|
||||||
stage_x11->state &= ~CLUTTER_STAGE_STATE_ACTIVATED;
|
CLUTTER_STAGE_STATE_ACTIVATED,
|
||||||
|
0);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -59,8 +59,6 @@ struct _ClutterStageX11
|
|||||||
|
|
||||||
guint clipped_redraws_cool_off;
|
guint clipped_redraws_cool_off;
|
||||||
|
|
||||||
ClutterStageState state;
|
|
||||||
|
|
||||||
ClutterStageX11State wm_state;
|
ClutterStageX11State wm_state;
|
||||||
|
|
||||||
guint is_foreign_xwin : 1;
|
guint is_foreign_xwin : 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user