aboutsummaryrefslogtreecommitdiff
path: root/harness/src
diff options
context:
space:
mode:
Diffstat (limited to 'harness/src')
-rw-r--r--harness/src/wl.c12
-rw-r--r--harness/src/wl.h95
2 files changed, 101 insertions, 6 deletions
diff --git a/harness/src/wl.c b/harness/src/wl.c
index bed98b4..2bbef59 100644
--- a/harness/src/wl.c
+++ b/harness/src/wl.c
@@ -627,8 +627,8 @@ static void xdg_surface_map(struct wl_listener *listener, void *data)
{
/* Called when the surface is mapped, or ready to display on-screen. */
struct tinywl_view *view = wl_container_of(listener, view, map);
- plugin_call_update_state(view->server->plugin, plugin_handle_surface_map,
- data);
+ plugin_call_update_state(view->server->plugin, plugin_handle_surface, data,
+ SURFACE_MAP);
view->mapped = true;
focus_view(view, view->xdg_surface->surface);
}
@@ -637,8 +637,8 @@ static void xdg_surface_unmap(struct wl_listener *listener, void *data)
{
/* Called when the surface is unmapped, and should no longer be shown. */
struct tinywl_view *view = wl_container_of(listener, view, unmap);
- plugin_call_update_state(view->server->plugin, plugin_handle_surface_unmap,
- data);
+ plugin_call_update_state(view->server->plugin, plugin_handle_surface, data,
+ SURFACE_UNMAP);
view->mapped = false;
}
@@ -646,8 +646,8 @@ static void xdg_surface_destroy(struct wl_listener *listener, void *data)
{
/* Called when the surface is destroyed and should never be shown again. */
struct tinywl_view *view = wl_container_of(listener, view, destroy);
- plugin_call_update_state(view->server->plugin, plugin_handle_surface_destroy,
- data);
+ plugin_call_update_state(view->server->plugin, plugin_handle_surface, data,
+ SURFACE_DELETE);
wl_list_remove(&view->link);
free(view);
}
diff --git a/harness/src/wl.h b/harness/src/wl.h
new file mode 100644
index 0000000..f24dc1b
--- /dev/null
+++ b/harness/src/wl.h
@@ -0,0 +1,95 @@
+#pragma once
+
+#include "plugin.h"
+#include <getopt.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <wayland-server-core.h>
+#include <wlr/backend.h>
+#include <wlr/render/wlr_renderer.h>
+#include <wlr/types/wlr_compositor.h>
+#include <wlr/types/wlr_cursor.h>
+#include <wlr/types/wlr_data_device.h>
+#include <wlr/types/wlr_input_device.h>
+#include <wlr/types/wlr_keyboard.h>
+#include <wlr/types/wlr_matrix.h>
+#include <wlr/types/wlr_output.h>
+#include <wlr/types/wlr_output_layout.h>
+#include <wlr/types/wlr_pointer.h>
+#include <wlr/types/wlr_seat.h>
+#include <wlr/types/wlr_xcursor_manager.h>
+#include <wlr/types/wlr_xdg_shell.h>
+#include <wlr/util/log.h>
+#include <wlr/xwayland.h>
+#include <xkbcommon/xkbcommon.h>
+
+/* For brevity's sake, struct members are annotated where they are used. */
+enum tinywl_cursor_mode {
+ TINYWL_CURSOR_PASSTHROUGH,
+ TINYWL_CURSOR_MOVE,
+ TINYWL_CURSOR_RESIZE,
+};
+
+struct tinywl_server {
+ struct wl_display *wl_display;
+ struct wlr_backend *backend;
+ struct wlr_renderer *renderer;
+
+ struct wlr_xdg_shell *xdg_shell;
+ struct wl_listener new_xdg_surface;
+ struct wl_list views;
+
+ struct wlr_cursor *cursor;
+ struct wlr_xcursor_manager *cursor_mgr;
+ struct wl_listener cursor_motion;
+ struct wl_listener cursor_motion_absolute;
+ struct wl_listener cursor_button;
+ struct wl_listener cursor_axis;
+ struct wl_listener cursor_frame;
+
+ struct wlr_seat *seat;
+ struct wl_listener new_input;
+ struct wl_listener request_cursor;
+ struct wl_listener request_set_selection;
+ struct wl_list keyboards;
+ enum tinywl_cursor_mode cursor_mode;
+ struct tinywl_view *grabbed_view;
+ double grab_x, grab_y;
+ struct wlr_box grab_geobox;
+ uint32_t resize_edges;
+
+ struct wlr_output_layout *output_layout;
+ struct wl_list outputs;
+ struct wl_listener new_output;
+
+ plugin_t plugin;
+};
+
+struct tinywl_output {
+ struct wl_list link;
+ struct tinywl_server *server;
+ struct wlr_output *wlr_output;
+ struct wl_listener frame;
+};
+
+struct tinywl_view {
+ struct wl_list link;
+ struct tinywl_server *server;
+ struct wlr_xdg_surface *xdg_surface;
+ struct wl_listener map;
+ struct wl_listener unmap;
+ struct wl_listener destroy;
+ struct wl_listener request_move;
+ struct wl_listener request_resize;
+ bool mapped;
+ int x, y;
+};
+
+struct tinywl_keyboard {
+ struct wl_list link;
+ struct tinywl_server *server;
+ struct wlr_input_device *device;
+
+ struct wl_listener modifiers;
+ struct wl_listener key;
+};