summaryrefslogtreecommitdiffstats
path: root/video/out/wayland_common.h
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2013-07-18 17:35:28 +0200
committerAlexander Preisinger <alexander.preisinger@gmail.com>2013-07-18 17:52:56 +0200
commit3dc063a3308e2f3e2a1a94f2a6b1c58e64a757bb (patch)
tree9a3fdfb642e6df9128a8a041def4991861321b68 /video/out/wayland_common.h
parentc5b76714a0c9d57521b08e135f4f3c4e35c8b245 (diff)
downloadmpv-3dc063a3308e2f3e2a1a94f2a6b1c58e64a757bb.tar.bz2
mpv-3dc063a3308e2f3e2a1a94f2a6b1c58e64a757bb.tar.xz
wayland: use a unified struct for the state
This commit removes the pointer to the single different structures for input and window and puts them as anonymous structures inside the wayland_state structure. This has the disadvantage of passing the substructure to the listeners, but the advantage is that we don't have to allocate them and check for NULL pointers. This makes it more reliable and easier to follow.
Diffstat (limited to 'video/out/wayland_common.h')
-rw-r--r--video/out/wayland_common.h107
1 files changed, 51 insertions, 56 deletions
diff --git a/video/out/wayland_common.h b/video/out/wayland_common.h
index 955a67b20e..6b39e982aa 100644
--- a/video/out/wayland_common.h
+++ b/video/out/wayland_common.h
@@ -30,8 +30,6 @@
#include "config.h"
struct vo;
-struct vo_wayland_state;
-
struct vo_wayland_output {
uint32_t id; /* unique name */
@@ -42,11 +40,48 @@ struct vo_wayland_output {
struct wl_list link;
};
-struct vo_wayland_display {
- struct wl_display *display;
- struct wl_registry *registry;
- struct wl_compositor *compositor;
- struct wl_shell *shell;
+
+struct vo_wayland_state {
+ struct vo *vo;
+
+ struct {
+ int fd;
+ struct wl_display *display;
+ struct wl_registry *registry;
+ struct wl_compositor *compositor;
+ struct wl_shell *shell;
+
+ struct wl_list output_list;
+ struct wl_output *fs_output; /* fullscreen output */
+ int output_mode_received;
+
+ int display_fd;
+
+ uint32_t formats;
+ } display;
+
+ struct {
+ int32_t width;
+ int32_t height;
+ int32_t p_width; // previous sizes for leaving fullscreen
+ int32_t p_height;
+ float aspect;
+
+ struct wl_surface *surface;
+ struct wl_shell_surface *shell_surface;
+ int events; /* mplayer events (VO_EVENT_RESIZE) */
+
+ /* Because the egl windows have a special resize windw function we have to
+ * register it first before doing any resizing.
+ * This makes us independet from the output driver */
+ void (*resize_func) (struct vo_wayland_state *wl,
+ uint32_t edges,
+ int32_t width,
+ int32_t height,
+ void *user_data);
+
+ void *resize_func_data;
+ } window;
struct {
struct wl_shm *shm;
@@ -60,57 +95,17 @@ struct vo_wayland_display {
uint32_t serial;
} cursor;
- int display_fd;
-
- struct wl_list output_list;
- struct wl_output *fs_output; /* fullscreen output */
- int output_mode_received;
-
- uint32_t formats;
-};
-
-struct vo_wayland_window {
- int32_t width;
- int32_t height;
- int32_t p_width;
- int32_t p_height;
- float aspect;
-
- struct wl_surface *surface;
- struct wl_shell_surface *shell_surface;
-
- int events; /* mplayer events (VO_EVENT_RESIZE) */
-
- /* Because the egl windows have a special resize windw function we have to
- * register it first before doing any resizing.
- * This makes us independet from the output driver */
- void (*resize_func) (struct vo_wayland_state *wl,
- uint32_t edges,
- int32_t width,
- int32_t height,
- void *user_data);
-
- void *resize_func_data;
-};
-
-struct vo_wayland_input {
- struct wl_seat *seat;
- struct wl_keyboard *keyboard;
- struct wl_pointer *pointer;
-
struct {
- struct xkb_context *context;
- struct xkb_keymap *keymap;
- struct xkb_state *state;
- } xkb;
-};
-
-struct vo_wayland_state {
- struct vo *vo;
+ struct wl_seat *seat;
+ struct wl_keyboard *keyboard;
+ struct wl_pointer *pointer;
- struct vo_wayland_display *display;
- struct vo_wayland_window *window;
- struct vo_wayland_input *input;
+ struct {
+ struct xkb_context *context;
+ struct xkb_keymap *keymap;
+ struct xkb_state *state;
+ } xkb;
+ } input;
};
int vo_wayland_init(struct vo *vo);