summaryrefslogtreecommitdiffstats
path: root/include/wayland.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/wayland.h')
-rw-r--r--include/wayland.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/include/wayland.h b/include/wayland.h
new file mode 100644
index 00000000..d7c7397d
--- /dev/null
+++ b/include/wayland.h
@@ -0,0 +1,80 @@
+#ifndef ROFI_XCB_H
+#define ROFI_XCB_H
+
+#include <glib.h>
+#include <cairo.h>
+#include <xkbcommon/xkbcommon.h>
+#include <wayland-client.h>
+#include <libgwater-wayland.h>
+
+#include "unstable/window-switcher/window-switcher-unstable-v1-client-protocol.h"
+#include "xkb.h"
+
+typedef enum {
+ WAYLAND_GLOBAL_COMPOSITOR,
+ WAYLAND_GLOBAL_LAUNCHER_MENU,
+ WAYLAND_GLOBAL_WINDOW_SWITCHER,
+ WAYLAND_GLOBAL_SHM,
+ _WAYLAND_GLOBAL_SIZE,
+} wayland_global_name;
+
+typedef struct _wayland_seat wayland_seat;
+
+typedef struct {
+ GMainLoop *main_loop;
+ GWaterWaylandSource *main_loop_source;
+ struct wl_display *display;
+ struct wl_registry *registry;
+ uint32_t global_names[_WAYLAND_GLOBAL_SIZE];
+ struct wl_compositor *compositor;
+ struct zww_launcher_menu_v1 *launcher_menu;
+ struct zww_window_switcher_v1 *window_switcher;
+ struct wl_shm *shm;
+ size_t buffer_count;
+ struct {
+ char *theme_name;
+ char **name;
+ struct wl_cursor_theme *theme;
+ struct wl_cursor *cursor;
+ struct wl_cursor_image *image;
+ struct wl_surface *surface;
+ struct wl_callback *frame_cb;
+ } cursor;
+ GHashTable *seats;
+ GHashTable *seats_by_name;
+ wayland_seat *last_seat;
+ GHashTable *outputs;
+ struct wl_surface *surface;
+ struct wl_callback *frame_cb;
+ size_t scales[3];
+ int32_t scale;
+} wayland_stuff;
+
+struct _wayland_seat {
+ wayland_stuff *context;
+ uint32_t global_name;
+ struct wl_seat *seat;
+ gchar *name;
+ uint32_t serial;
+ struct wl_keyboard *keyboard;
+ xkb_stuff xkb;
+ struct wl_pointer *pointer;
+ widget_button_event button;
+ widget_motion_event motion;
+ struct {
+ gint vertical;
+ gint horizontal;
+ } wheel;
+};
+
+/* Supported interface versions */
+#define WL_COMPOSITOR_INTERFACE_VERSION 3
+#define WW_LAUNCHER_MENU_INTERFACE_VERSION 1
+#define WW_WINDOW_SWITCHER_INTERFACE_VERSION 1
+#define WL_SHM_INTERFACE_VERSION 1
+#define WL_SEAT_INTERFACE_VERSION 5
+#define WL_OUTPUT_INTERFACE_VERSION 2
+
+extern wayland_stuff *wayland;
+
+#endif