aboutsummaryrefslogtreecommitdiff
path: root/harness/src
diff options
context:
space:
mode:
Diffstat (limited to 'harness/src')
-rw-r--r--harness/src/plugin.c7
-rw-r--r--harness/src/wl.c113
2 files changed, 19 insertions, 101 deletions
diff --git a/harness/src/plugin.c b/harness/src/plugin.c
index 8226db7..38dd0bf 100644
--- a/harness/src/plugin.c
+++ b/harness/src/plugin.c
@@ -1,5 +1,6 @@
#include "plugin.h"
#include "foreign_intf.h"
+#include "wl.h"
#include <sys/stat.h>
#include <unistd.h>
@@ -106,6 +107,11 @@ void do_request_exit(void *plugv, int ec)
}
}
+static void* plugin_get_seat(void* ctx) {
+ struct tinywl_server* server = wl_container_of(ctx, server, plugin);
+ return server->seat;
+}
+
static int load_plugin_from_file_(int argc, char **argv, const char *filename,
plugin_t *plugin)
{
@@ -133,6 +139,7 @@ static int load_plugin_from_file_(int argc, char **argv, const char *filename,
plugin->foreign_intf.request_hot_reload = do_request_hot_reload;
plugin->foreign_intf.do_log = do_request_log;
plugin->foreign_intf.request_exit = do_request_exit;
+ plugin->foreign_intf.get_seat = plugin_get_seat;
plugin->plugin_load(plugin->argc, plugin->argv, &plugin->foreign_intf);
end:
diff --git a/harness/src/wl.c b/harness/src/wl.c
index cdc3447..bed98b4 100644
--- a/harness/src/wl.c
+++ b/harness/src/wl.c
@@ -1,29 +1,10 @@
#define _POSIX_C_SOURCE 200112L
-#include "plugin.h"
-#include <getopt.h>
-#include <stdbool.h>
+
+#include "wl.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <time.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>
// This macro is responsible for calling a handler on a plugin. This macro will
// acquire the plugin's lock, call the member with the arguments and update the
@@ -43,77 +24,6 @@
plugin_run_requested_actions(pl__); \
} while (0)
-/* 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;
-};
-
static void focus_view(struct tinywl_view *view, struct wlr_surface *surface)
{
/* Note: this function only deals with keyboard focus. */
@@ -194,16 +104,17 @@ static void keyboard_handle_key(struct wl_listener *listener, void *data)
if (nsyms > 0) {
codepoint =
xkb_state_key_get_utf32(keyboard->device->keyboard->xkb_state, keycode);
- plugin_call_update_state(server->plugin, plugin_handle_keybinding, event,
- modifiers, syms[0], codepoint, &handled);
+ plugin_call_update_state(server->plugin, plugin_handle_keybinding,
+ keyboard->device, event, modifiers, syms[0],
+ codepoint, &handled);
}
- if (!handled) {
- /* Otherwise, we pass it along to the client. */
- wlr_seat_set_keyboard(seat, keyboard->device);
- wlr_seat_keyboard_notify_key(seat, event->time_msec, event->keycode,
- event->state);
- }
+ // if (!handled) {
+ // /* Otherwise, we pass it along to the client. */
+ // wlr_seat_set_keyboard(seat, keyboard->device);
+ // wlr_seat_keyboard_notify_key(seat, event->time_msec, event->keycode,
+ // event->state);
+ // }
}
static void server_new_keyboard(struct tinywl_server *server,