wayland: Refine fullscreen/unfullscreen to emit the state change events

Also update the code to set the size of the stage to set it to the size of the
output. In future versions of the Wayland protocol we'll get a configure
message advising of us of the size we can be to achieve fullscreen.
This commit is contained in:
Rob Bradford 2012-01-23 13:07:13 +00:00
parent dd64ad1e42
commit 0094350467

View File

@ -31,9 +31,9 @@
#include <glib.h> #include <glib.h>
#include "clutter-stage-wayland.h" #include "clutter-stage-wayland.h"
#include "clutter-backend-wayland.h"
#include "clutter-stage-window.h" #include "clutter-stage-window.h"
#include "clutter-event-private.h"
#include <cogl/cogl.h> #include <cogl/cogl.h>
static ClutterStageWindowIface *clutter_stage_window_parent_iface = NULL; static ClutterStageWindowIface *clutter_stage_window_parent_iface = NULL;
@ -107,6 +107,10 @@ clutter_stage_wayland_set_fullscreen (ClutterStageWindow *stage_window,
gboolean fullscreen) gboolean fullscreen)
{ {
ClutterStageWayland *stage_wayland = CLUTTER_STAGE_WAYLAND (stage_window); ClutterStageWayland *stage_wayland = CLUTTER_STAGE_WAYLAND (stage_window);
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
ClutterBackend *backend = CLUTTER_BACKEND (stage_cogl->backend);
ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
ClutterActor *stage = _clutter_stage_window_get_wrapper (stage_window);
stage_wayland->fullscreen = fullscreen; stage_wayland->fullscreen = fullscreen;
@ -114,9 +118,32 @@ clutter_stage_wayland_set_fullscreen (ClutterStageWindow *stage_window,
return; return;
if (fullscreen) if (fullscreen)
wl_shell_surface_set_fullscreen (stage_wayland->wayland_shell_surface); {
ClutterEvent *event = clutter_event_new (CLUTTER_STAGE_STATE);
event->stage_state.changed_mask = CLUTTER_STAGE_STATE_FULLSCREEN;
event->stage_state.new_state = CLUTTER_STAGE_STATE_FULLSCREEN;
event->stage_state.stage = stage;
_clutter_event_push (event, FALSE);
clutter_actor_set_size (stage,
backend_wayland->output_width,
backend_wayland->output_height);
wl_shell_surface_set_fullscreen (stage_wayland->wayland_shell_surface);
}
else else
g_warning (G_STRLOC ": There is no Wayland API for un-fullscreening now"); {
ClutterEvent *event = clutter_event_new (CLUTTER_STAGE_STATE);
event->stage_state.changed_mask = CLUTTER_STAGE_STATE_FULLSCREEN;
event->stage_state.new_state = 0;
event->stage_state.stage = stage;
_clutter_event_push (event, FALSE);
wl_shell_surface_set_toplevel (stage_wayland->wayland_shell_surface);
}
} }
static void static void