[x11] Do not forcibly set the stage size on fullscreen

Setting the stage size using clutter_actor_set_size() is almost always
wrong: the X11 stage implementation should save the size and queue a
relayout -- like it does when receiving a ConfigureNotify. The same
should happen when setting it to be full screen.
This commit is contained in:
Emmanuele Bassi 2009-06-08 02:04:27 +01:00
parent ca305d2a40
commit 12b4e0400c

View File

@ -44,6 +44,8 @@
#include <X11/extensions/Xfixes.h> #include <X11/extensions/Xfixes.h>
#endif #endif
#define STAGE_X11_IS_MAPPED(s) ((((ClutterStageX11 *) (s))->wm_state & STAGE_X11_WITHDRAWN) == 0)
static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface); static void clutter_stage_window_iface_init (ClutterStageWindowIface *iface);
G_DEFINE_TYPE_WITH_CODE (ClutterStageX11, G_DEFINE_TYPE_WITH_CODE (ClutterStageX11,
@ -158,9 +160,14 @@ clutter_stage_x11_get_preferred_width (ClutterActor *self,
gfloat *natural_width_p) gfloat *natural_width_p)
{ {
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self); ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self);
gboolean resize; gboolean is_fullscreen, resize;
if (stage_x11->fullscreen_on_map) is_fullscreen = FALSE;
g_object_get (G_OBJECT (stage_x11->wrapper),
"fullscreen", &is_fullscreen,
NULL);
if (is_fullscreen || stage_x11->fullscreen_on_map)
{ {
int width; int width;
@ -196,9 +203,14 @@ clutter_stage_x11_get_preferred_height (ClutterActor *self,
gfloat *natural_height_p) gfloat *natural_height_p)
{ {
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self); ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self);
gboolean resize; gboolean is_fullscreen, resize;
if (stage_x11->fullscreen_on_map) is_fullscreen = FALSE;
g_object_get (G_OBJECT (stage_x11->wrapper),
"fullscreen", &is_fullscreen,
NULL);
if (is_fullscreen || stage_x11->fullscreen_on_map)
{ {
int height; int height;
@ -373,7 +385,7 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
ClutterBackendX11 *backend_x11 = stage_x11->backend; ClutterBackendX11 *backend_x11 = stage_x11->backend;
ClutterStage *stage = stage_x11->wrapper; ClutterStage *stage = stage_x11->wrapper;
if (!stage) if (stage == NULL)
return; return;
CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES); CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES);
@ -399,8 +411,7 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
stage_x11->xwin_width = width; stage_x11->xwin_width = width;
stage_x11->xwin_height = height; stage_x11->xwin_height = height;
clutter_actor_set_size (CLUTTER_ACTOR (stage), width, height); if (!STAGE_X11_IS_MAPPED (stage_x11))
stage_x11->fullscreen_on_map = TRUE; stage_x11->fullscreen_on_map = TRUE;
if (stage_x11->xwin != None) if (stage_x11->xwin != None)
@ -435,6 +446,7 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
} }
else else
{ {
if (!STAGE_X11_IS_MAPPED (stage_x11))
stage_x11->fullscreen_on_map = FALSE; stage_x11->fullscreen_on_map = FALSE;
if (stage_x11->xwin != None) if (stage_x11->xwin != None)
@ -459,6 +471,8 @@ clutter_stage_x11_set_fullscreen (ClutterStageWindow *stage_window,
} }
} }
} }
clutter_actor_queue_relayout (CLUTTER_ACTOR (stage));
} }
static void static void
@ -491,8 +505,6 @@ clutter_stage_x11_set_user_resizable (ClutterStageWindow *stage_window,
clutter_stage_x11_fix_window_size (stage_x11, -1, -1); clutter_stage_x11_fix_window_size (stage_x11, -1, -1);
} }
#define STAGE_X11_IS_MAPPED(s) ((((ClutterStageX11 *) (s))->wm_state & STAGE_X11_WITHDRAWN) == 0)
static void static void
update_wm_hints (ClutterStageX11 *stage_x11) update_wm_hints (ClutterStageX11 *stage_x11)
{ {