summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2014-09-02 18:09:06 +0200
committerAlexander Preisinger <alexander.preisinger@gmail.com>2014-09-21 09:14:33 +0200
commit9f7e1cf70a18f3370b439486dabe3cf81c0296f6 (patch)
tree737ab8d7e8dc3352f403b0f118be60f6762b158b
parent710a8cab4a15d7a3d03c66c874c7b33697d2386c (diff)
downloadmpv-9f7e1cf70a18f3370b439486dabe3cf81c0296f6.tar.bz2
mpv-9f7e1cf70a18f3370b439486dabe3cf81c0296f6.tar.xz
wayland_common: rework state handling & fullscreen
Remove vo_wayland_{fullscreen,ontop,border} functions. Fullscreen handling is done in window_set_fullscreen and the other 2 are not implemented and used.
-rw-r--r--video/out/wayland_common.c88
-rw-r--r--video/out/wayland_common.h5
2 files changed, 35 insertions, 58 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index b32d42c7b0..d132601596 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -57,11 +57,11 @@ static void hide_cursor(struct vo_wayland_state * wl);
static void show_cursor(struct vo_wayland_state * wl);
static void window_move(struct vo_wayland_state * wl, uint32_t serial);
static void window_set_title(struct vo_wayland_state * wl, const char *title);
+static void window_set_fullscreen(struct vo_wayland_state * wl);
static void schedule_resize(struct vo_wayland_state *wl,
int32_t width,
int32_t height);
-static void vo_wayland_fullscreen (struct vo *vo);
static const struct mp_keymap keymap[] = {
// special keys
@@ -137,12 +137,16 @@ static void xdg_handle_configure(void *data,
schedule_resize(wl, width, height);
enum xdg_surface_state *state;
+
+ // reset states
+ wl->window.state.fullscreen = false;
+
wl_array_for_each(state, states) {
switch (*state) {
case XDG_SURFACE_STATE_MAXIMIZED:
break;
case XDG_SURFACE_STATE_FULLSCREEN:
- wl->window.is_fullscreen = true;
+ wl->window.state.fullscreen = true;
break;
case XDG_SURFACE_STATE_RESIZING:
case XDG_SURFACE_STATE_ACTIVATED:
@@ -723,16 +727,30 @@ static void window_move(struct vo_wayland_state *wl, uint32_t serial)
xdg_surface_move(wl->window.xdg_surface, wl->input.seat, serial);
}
-static void window_set_toplevel(struct vo_wayland_state *wl)
+static void window_set_title(struct vo_wayland_state *wl, const char *title)
{
if (wl->display.shell)
- xdg_surface_unset_fullscreen(wl->window.xdg_surface);
+ xdg_surface_set_title(wl->window.xdg_surface, title);
}
-static void window_set_title(struct vo_wayland_state *wl, const char *title)
+static void window_set_fullscreen(struct vo_wayland_state *wl)
{
- if (wl->display.shell)
- xdg_surface_set_title(wl->window.xdg_surface, title);
+ if (!wl->display.shell)
+ return;
+
+ if (!wl->window.state.fullscreen) {
+ MP_DBG(wl, "going fullscreen\n");
+ wl->window.p_width = wl->window.width;
+ wl->window.p_height = wl->window.height;
+ xdg_surface_set_fullscreen(wl->window.xdg_surface,
+ wl->display.fs_output);
+ }
+
+ else {
+ MP_DBG(wl, "leaving fullscreen\n");
+ xdg_surface_unset_fullscreen(wl->window.xdg_surface);
+ schedule_resize(wl, wl->window.p_width, wl->window.p_height);
+ }
}
static void schedule_resize(struct vo_wayland_state *wl,
@@ -963,50 +981,6 @@ void vo_wayland_uninit (struct vo *vo)
vo->wayland = NULL;
}
-static void vo_wayland_ontop (struct vo *vo)
-{
- /*
- * No ontop
- *
- *
- */
-}
-
-static void vo_wayland_border (struct vo *vo)
-{
- /* wayland clienst have to do the decorations themself
- * (client side decorations) but there is no such code implement nor
- * do I plan on implementing something like client side decorations
- *
- * The only exception would be resizing on when clicking and dragging
- * on the border region of the window but this should be discussed at first
- */
-}
-
-static void vo_wayland_fullscreen (struct vo *vo)
-{
- struct vo_wayland_state *wl = vo->wayland;
- if (!wl->display.shell)
- return;
-
-
- if (vo->opts->fullscreen) {
- MP_DBG(wl, "going fullscreen\n");
- wl->window.is_fullscreen = true;
- wl->window.p_width = wl->window.width;
- wl->window.p_height = wl->window.height;
- xdg_surface_set_fullscreen(wl->window.xdg_surface,
- wl->display.fs_output);
- }
-
- else {
- MP_DBG(wl, "leaving fullscreen\n");
- wl->window.is_fullscreen = false;
- xdg_surface_unset_fullscreen(wl->window.xdg_surface);
- schedule_resize(wl, wl->window.p_width, wl->window.p_height);
- }
-}
-
static int vo_wayland_check_events (struct vo *vo)
{
struct vo_wayland_state *wl = vo->wayland;
@@ -1153,10 +1127,7 @@ int vo_wayland_control (struct vo *vo, int *events, int request, void *arg)
*events |= vo_wayland_check_events(vo);
return VO_TRUE;
case VOCTRL_FULLSCREEN:
- vo_wayland_fullscreen(vo);
- return VO_TRUE;
- case VOCTRL_ONTOP:
- vo_wayland_ontop(vo);
+ window_set_fullscreen(wl);
return VO_TRUE;
case VOCTRL_GET_UNFS_WINDOW_SIZE: {
int *s = arg;
@@ -1166,7 +1137,7 @@ int vo_wayland_control (struct vo *vo, int *events, int request, void *arg)
}
case VOCTRL_SET_UNFS_WINDOW_SIZE: {
int *s = arg;
- if (!wl->window.is_fullscreen)
+ if (!wl->window.state.fullscreen)
schedule_resize(wl, s[0], s[1]);
return VO_TRUE;
}
@@ -1201,6 +1172,9 @@ bool vo_wayland_config (struct vo *vo, uint32_t flags)
{
struct vo_wayland_state *wl = vo->wayland;
+ // reset states
+ wl->window.state.fullscreen = false;
+
struct mp_rect screenrc;
vo_wayland_update_screeninfo(vo, &screenrc);
@@ -1215,7 +1189,7 @@ bool vo_wayland_config (struct vo *vo, uint32_t flags)
if (!(flags & VOFLAG_HIDDEN)) {
wl->window.width = vo->dwidth;
wl->window.height = vo->dheight;
- vo_wayland_fullscreen(vo);
+ window_set_fullscreen(wl);
}
return true;
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h
index 9924fab557..6b57988656 100644
--- a/video/out/wayland_common.h
+++ b/video/out/wayland_common.h
@@ -97,7 +97,10 @@ struct vo_wayland_state {
int32_t sh_height;
float aspect;
- bool is_fullscreen; // don't keep aspect ratio in fullscreen mode
+ struct {
+ bool fullscreen; // don't keep aspect ratio in fullscreen mode
+ } state;
+
int32_t fs_width; // fullscreen sizes
int32_t fs_height;