mirror of
https://github.com/brl/mutter.git
synced 2024-12-11 22:10:16 +00:00
a02e20a14a
* clutter/clutter-actor.c: (clutter_actor_real_show), (clutter_actor_real_hide): Do not set the MAPPED flag on the actor if it is a top-level one (like ClutterStage); the backends are responsible for setting that flag, as it might be the result of an asynchronous operation (e.g. on X11). * clutter/eglnative/clutter-stage-egl.c: (clutter_stage_egl_show), (clutter_stage_egl_hide): Set/unset the CLUTTER_ACTOR_MAPPED flag on show and hide respectively. * clutter/osx/clutter-stage-osx.c: (clutter_stage_osx_show), (clutter_stage_osx_hide): Ditto as above. * clutter/sdl/clutter-stage-sdl.c: (clutter_stage_sdl_show), (clutter_stage_sdl_hide): Ditto as above, plus chain up to the parent class show/hide virtual functions. * clutter/x11/clutter-event-x11.c (event_translate): Use the MapNotify and UnmapNotify events to call the X11 stage map/unmap functions. * clutter/x11/clutter-stage-x11.[ch]: (clutter_stage_x11_set_fullscreen): Set the fullscreen_on_map flag with the fullscreen value. (clutter_stage_x11_map), (clutter_stage_x11_unmap): Set the MAPPED flag on the stage actor and redraw; also, if the fullscreen_on_map flag was set, call clutter_stage_fullscreen() as well. (#648) * tests/Makefile.am: * tests/test-fullscreen.c: Add a fullscreen test case for checking whether fullscreen works on every backend/platform.
93 lines
2.1 KiB
C
93 lines
2.1 KiB
C
#include <stdlib.h>
|
|
#include <clutter/clutter.h>
|
|
|
|
enum
|
|
{
|
|
START,
|
|
HIDE,
|
|
SHOW,
|
|
DONE
|
|
};
|
|
|
|
static int state = START;
|
|
|
|
static void
|
|
on_fullscreen (ClutterStage *stage)
|
|
{
|
|
g_debug ("fullscreen set, size: %dx%d, mapped: %s",
|
|
clutter_actor_get_width (CLUTTER_ACTOR (stage)),
|
|
clutter_actor_get_height (CLUTTER_ACTOR (stage)),
|
|
CLUTTER_ACTOR_IS_MAPPED (stage) ? "true" : "false");
|
|
}
|
|
|
|
static void
|
|
on_unfullscreen (ClutterStage *stage)
|
|
{
|
|
g_debug ("fullscreen unset, size: %dx%d, mapped: %s",
|
|
clutter_actor_get_width (CLUTTER_ACTOR (stage)),
|
|
clutter_actor_get_height (CLUTTER_ACTOR (stage)),
|
|
CLUTTER_ACTOR_IS_MAPPED (stage) ? "true" : "false");
|
|
}
|
|
|
|
static gboolean
|
|
toggle_fullscreen (gpointer dummy)
|
|
{
|
|
ClutterActor *stage = clutter_stage_get_default ();
|
|
gboolean is_fullscreen = FALSE;
|
|
|
|
g_object_get (G_OBJECT (stage), "fullscreen", &is_fullscreen, NULL);
|
|
|
|
switch (state)
|
|
{
|
|
case START:
|
|
g_debug ("start: is_fullscreen := %s", is_fullscreen ? "true" : "false");
|
|
clutter_actor_hide (stage);
|
|
state = HIDE;
|
|
return TRUE;
|
|
|
|
case HIDE:
|
|
g_debug ("hide: is_fullscreen := %s", is_fullscreen ? "true" : "false");
|
|
clutter_actor_show (stage);
|
|
state = SHOW;
|
|
return TRUE;
|
|
|
|
case SHOW:
|
|
g_debug ("show: is_fullscreen := %s", is_fullscreen ? "true" : "false");
|
|
clutter_stage_unfullscreen (CLUTTER_STAGE (stage));
|
|
state = DONE;
|
|
return TRUE;
|
|
|
|
case DONE:
|
|
g_debug ("done: is_fullscreen := %s", is_fullscreen ? "true" : "false");
|
|
clutter_main_quit ();
|
|
break;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
ClutterActor *stage;
|
|
|
|
clutter_init (&argc, &argv);
|
|
|
|
stage = clutter_stage_get_default ();
|
|
g_signal_connect (stage,
|
|
"fullscreen", G_CALLBACK (on_fullscreen),
|
|
NULL);
|
|
g_signal_connect (stage,
|
|
"unfullscreen", G_CALLBACK (on_unfullscreen),
|
|
NULL);
|
|
|
|
clutter_stage_fullscreen (CLUTTER_STAGE (stage));
|
|
clutter_actor_show (stage);
|
|
|
|
g_timeout_add (1000, toggle_fullscreen, NULL);
|
|
|
|
clutter_main ();
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|