aboutsummaryrefslogtreecommitdiff
path: root/arken/src
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2026-01-06 15:45:03 -0700
committerJosh Rahm <joshuarahm@gmail.com>2026-01-06 15:45:03 -0700
commit09860c75bb129c70768692aaec3bd42d0b2735e3 (patch)
treeb0192d2779b26da22c169ac801b781362d10aacc /arken/src
parent68dd63f6b3de774863051b66e609a0ca4f4ac2a1 (diff)
downloadmontis-09860c75bb129c70768692aaec3bd42d0b2735e3.tar.gz
montis-09860c75bb129c70768692aaec3bd42d0b2735e3.tar.bz2
montis-09860c75bb129c70768692aaec3bd42d0b2735e3.zip
[reorg] add "middleware" library called "liberebor"
Diffstat (limited to 'arken/src')
-rw-r--r--arken/src/plugin.c61
-rw-r--r--arken/src/util.c133
2 files changed, 0 insertions, 194 deletions
diff --git a/arken/src/plugin.c b/arken/src/plugin.c
index 3edf486..ab02599 100644
--- a/arken/src/plugin.c
+++ b/arken/src/plugin.c
@@ -1,5 +1,4 @@
#include "plugin.h"
-#include "wl.h"
#include <ctype.h>
#include <dlfcn.h>
@@ -53,66 +52,6 @@ static void lock(plugin_t *plugin) { pthread_mutex_lock(&plugin->lock); };
static void unlock(plugin_t *plugin) { pthread_mutex_unlock(&plugin->lock); };
-static int plugin_hot_reload_same_state_action_(plugin_t *plugin, void *ignore)
-{
- return plugin_hot_reload_same_state(plugin);
-}
-
-void montis_do_request_hot_reload(void *plugv)
-{
- plugin_t *plugin = plugv;
-
- size_t n = plugin->n_requested_actions++;
- if (n < 8) {
- plugin->requested_actions[n].action = plugin_hot_reload_same_state_action_;
- plugin->requested_actions[n].arg_dtor = NULL;
- }
-}
-
-static int plugin_do_log(plugin_t *plugin, void *chrs)
-{
- char *str = chrs;
- puts(str);
- return 0;
-}
-
-void montis_do_request_log(void *plugv, const char *str)
-{
- plugin_t *plugin = plugv;
-
- size_t n = plugin->n_requested_actions++;
- if (n < 8) {
- plugin->requested_actions[n].action = plugin_do_log;
- plugin->requested_actions[n].str_arg = strdup(str);
- plugin->requested_actions[n].arg_dtor = free;
- }
-}
-
-static int montis_plugin_do_exit(void *plugv, int ec)
-{
- exit(ec);
- return 0;
-}
-
-void montis_do_request_exit(void *plugv, int ec)
-{
- plugin_t *plugin = plugv;
-
- size_t n = plugin->n_requested_actions++;
- if (n < 8) {
- plugin->requested_actions[n].action =
- (int (*)(plugin_t *, void *))montis_plugin_do_exit;
- plugin->requested_actions[n].int_arg = ec;
- plugin->requested_actions[n].arg_dtor = NULL;
- }
-}
-
-void *montis_plugin_get_seat(void *ctx)
-{
- struct montis_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)
{
diff --git a/arken/src/util.c b/arken/src/util.c
deleted file mode 100644
index e09cff9..0000000
--- a/arken/src/util.c
+++ /dev/null
@@ -1,133 +0,0 @@
-#include "util.h"
-#include "wl.h"
-
-#include <wlr/types/wlr_scene.h>
-#include <wlr/types/wlr_xdg_shell.h>
-
-static struct montis_server *server_from_ctx(void *ctx)
-{
- struct montis_server *server = wl_container_of(ctx, server, plugin);
- return server;
-}
-
-static struct montis_toplevel *toplevel_at(struct montis_server *server,
- double lx, double ly)
-{
- double sx = 0.0;
- double sy = 0.0;
-
- struct wlr_scene_node *node =
- wlr_scene_node_at(&server->scene->tree.node, lx, ly, &sx, &sy);
- if (node == NULL || node->type != WLR_SCENE_NODE_BUFFER) {
- return NULL;
- }
- struct wlr_scene_buffer *scene_buffer = wlr_scene_buffer_from_node(node);
- struct wlr_scene_surface *scene_surface =
- wlr_scene_surface_try_from_buffer(scene_buffer);
- if (!scene_surface) {
- return NULL;
- }
-
- struct wlr_scene_tree *tree = node->parent;
- while (tree != NULL && tree->node.data == NULL) {
- tree = tree->node.parent;
- }
- return tree ? tree->node.data : NULL;
-}
-
-void *montis_plugin_toplevel_at(void *ctx, double lx, double ly)
-{
- if (!ctx) {
- return NULL;
- }
- struct montis_server *server = server_from_ctx(ctx);
- return toplevel_at(server, lx, ly);
-}
-
-void montis_plugin_get_toplevel_position(void *toplevel, double *x, double *y)
-{
- if (!toplevel || !x || !y) {
- return;
- }
- struct montis_toplevel *tl = toplevel;
- *x = tl->scene_tree->node.x;
- *y = tl->scene_tree->node.y;
-}
-
-void montis_plugin_set_toplevel_position(void *toplevel, double x, double y)
-{
- if (!toplevel) {
- return;
- }
- struct montis_toplevel *tl = toplevel;
- wlr_scene_node_set_position(&tl->scene_tree->node, (int)x, (int)y);
-}
-
-void montis_plugin_get_toplevel_geometry(void *toplevel, double *x, double *y,
- double *w, double *h)
-{
- if (!toplevel || !x || !y || !w || !h) {
- return;
- }
- struct montis_toplevel *tl = toplevel;
- struct wlr_box geo_box;
- wlr_xdg_surface_get_geometry(tl->xdg_toplevel->base, &geo_box);
- *x = tl->scene_tree->node.x;
- *y = tl->scene_tree->node.y;
- *w = geo_box.width;
- *h = geo_box.height;
-}
-
-void montis_plugin_set_toplevel_geometry(void *toplevel, double x, double y,
- double w, double h)
-{
- if (!toplevel) {
- return;
- }
- struct montis_toplevel *tl = toplevel;
- wlr_scene_node_set_position(&tl->scene_tree->node, (int)x, (int)y);
- wlr_xdg_toplevel_set_size(tl->xdg_toplevel, (int)w, (int)h);
-}
-
-void montis_plugin_warp_cursor(void *ctx, double lx, double ly)
-{
- if (!ctx) {
- return;
- }
- struct montis_server *server = server_from_ctx(ctx);
- wlr_cursor_warp(server->cursor, NULL, lx, ly);
-}
-
-void montis_plugin_focus_toplevel(void *toplevel)
-{
- if (!toplevel) {
- return;
- }
- struct montis_toplevel *tl = toplevel;
- struct montis_server *server = tl->server;
- struct wlr_seat *seat = server->seat;
- struct wlr_surface *surface = tl->xdg_toplevel->base->surface;
- struct wlr_surface *prev_surface = seat->keyboard_state.focused_surface;
-
- if (prev_surface == surface) {
- return;
- }
- if (prev_surface) {
- struct wlr_xdg_toplevel *prev_toplevel =
- wlr_xdg_toplevel_try_from_wlr_surface(prev_surface);
- if (prev_toplevel != NULL) {
- wlr_xdg_toplevel_set_activated(prev_toplevel, false);
- }
- }
-
- struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
- wlr_scene_node_raise_to_top(&tl->scene_tree->node);
- wl_list_remove(&tl->link);
- wl_list_insert(&server->toplevels, &tl->link);
- wlr_xdg_toplevel_set_activated(tl->xdg_toplevel, true);
- if (keyboard != NULL) {
- wlr_seat_keyboard_notify_enter(seat, surface, keyboard->keycodes,
- keyboard->num_keycodes,
- &keyboard->modifiers);
- }
-}