aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-10-27 12:06:39 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-10-27 12:06:39 +0000
commit0120c57ed5a8189508d315e4c650f54572a935a1 (patch)
tree7ec1e50ea6e0560ffc0ea7a61dbd158f41de77cb
parentterm: convert anonymous 'window' struct to named 'wl_window' struct (diff)
wayland: move wayland struct definitions to a separate file
-rw-r--r--meson.build1
-rw-r--r--terminal.h69
-rw-r--r--wayland.h74
3 files changed, 76 insertions, 68 deletions
diff --git a/meson.build b/meson.build
index 590f5f8f..62fceb6e 100644
--- a/meson.build
+++ b/meson.build
@@ -84,6 +84,7 @@ executable(
'tokenize.c', 'tokenize.h',
'tllist.h',
'vt.c', 'vt.h',
+ 'wayland.h',
wl_proto_src + wl_proto_headers, version,
dependencies: [threads, math, freetype, fontconfig, pixman, wayland_client, wayland_cursor, xkb],
install: true)
diff --git a/terminal.h b/terminal.h
index 71f190cc..e1756632 100644
--- a/terminal.h
+++ b/terminal.h
@@ -15,78 +15,11 @@
#include "font.h"
#include "tllist.h"
+#include "wayland.h"
#define likely(c) __builtin_expect(!!(c), 1)
#define unlikely(c) __builtin_expect(!!(c), 0)
-struct monitor {
- struct terminal *term;
- struct wl_output *output;
- struct zxdg_output_v1 *xdg;
- char *name;
-
- int x;
- int y;
-
- int width_mm;
- int height_mm;
-
- int width_px;
- int height_px;
-
- int scale;
- float refresh;
-};
-
-struct wl_window {
- struct wl_surface *surface;
- struct xdg_wm_base *shell;
- struct xdg_surface *xdg_surface;
- struct xdg_toplevel *xdg_toplevel;
-
- struct zxdg_decoration_manager_v1 *xdg_decoration_manager;
- struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;
-
- /* Scrollback search */
- struct wl_surface *search_surface;
- struct wl_subsurface *search_sub_surface;
-
- tll(const struct monitor *) on_outputs; /* Outputs we're mapped on */
-};
-
-struct wayland {
- struct wl_display *display;
- struct wl_registry *registry;
- struct wl_compositor *compositor;
- struct wl_subcompositor *sub_compositor;
- struct wl_shm *shm;
-
- struct wl_seat *seat;
- struct wl_keyboard *keyboard;
- struct zxdg_output_manager_v1 *xdg_output_manager;
-
- /* Clipboard */
- struct wl_data_device_manager *data_device_manager;
- struct wl_data_device *data_device;
- struct zwp_primary_selection_device_manager_v1 *primary_selection_device_manager;
- struct zwp_primary_selection_device_v1 *primary_selection_device;
-
- /* Cursor */
- struct {
- struct wl_pointer *pointer;
- uint32_t serial;
-
- struct wl_surface *surface;
- struct wl_cursor_theme *theme;
- struct wl_cursor *cursor;
- int size;
- char *theme_name;
- } pointer;
-
- bool have_argb8888;
- tll(struct monitor) monitors; /* All available outputs */
-};
-
struct rgb { float r, g, b; };
/*
diff --git a/wayland.h b/wayland.h
new file mode 100644
index 00000000..970cb8cf
--- /dev/null
+++ b/wayland.h
@@ -0,0 +1,74 @@
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "tllist.h"
+
+struct monitor {
+ struct terminal *term;
+ struct wl_output *output;
+ struct zxdg_output_v1 *xdg;
+ char *name;
+
+ int x;
+ int y;
+
+ int width_mm;
+ int height_mm;
+
+ int width_px;
+ int height_px;
+
+ int scale;
+ float refresh;
+};
+
+struct wl_window {
+ struct wl_surface *surface;
+ struct xdg_wm_base *shell;
+ struct xdg_surface *xdg_surface;
+ struct xdg_toplevel *xdg_toplevel;
+
+ struct zxdg_decoration_manager_v1 *xdg_decoration_manager;
+ struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;
+
+ /* Scrollback search */
+ struct wl_surface *search_surface;
+ struct wl_subsurface *search_sub_surface;
+
+ tll(const struct monitor *) on_outputs; /* Outputs we're mapped on */
+};
+
+struct wayland {
+ struct wl_display *display;
+ struct wl_registry *registry;
+ struct wl_compositor *compositor;
+ struct wl_subcompositor *sub_compositor;
+ struct wl_shm *shm;
+
+ struct wl_seat *seat;
+ struct wl_keyboard *keyboard;
+ struct zxdg_output_manager_v1 *xdg_output_manager;
+
+ /* Clipboard */
+ struct wl_data_device_manager *data_device_manager;
+ struct wl_data_device *data_device;
+ struct zwp_primary_selection_device_manager_v1 *primary_selection_device_manager;
+ struct zwp_primary_selection_device_v1 *primary_selection_device;
+
+ /* Cursor */
+ struct {
+ struct wl_pointer *pointer;
+ uint32_t serial;
+
+ struct wl_surface *surface;
+ struct wl_cursor_theme *theme;
+ struct wl_cursor *cursor;
+ int size;
+ char *theme_name;
+ } pointer;
+
+ bool have_argb8888;
+ tll(struct monitor) monitors; /* All available outputs */
+};