aboutsummaryrefslogtreecommitdiff
path: root/rt
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2026-01-04 21:41:39 -0700
committerJosh Rahm <joshuarahm@gmail.com>2026-01-04 21:41:39 -0700
commit9637f06dd40418bd01cde0fe9f33d4fe979555ab (patch)
treec41c136ed52aee4a4b74818531b05c55b938deb8 /rt
parent5e86dbfa1bb30c8b1f36582e1a5229a208c5bff4 (diff)
downloadmontis-9637f06dd40418bd01cde0fe9f33d4fe979555ab.tar.gz
montis-9637f06dd40418bd01cde0fe9f33d4fe979555ab.tar.bz2
montis-9637f06dd40418bd01cde0fe9f33d4fe979555ab.zip
[refactor] Change dragging behavior to use the motion event.
Diffstat (limited to 'rt')
-rw-r--r--rt/include/plugin.h2
-rw-r--r--rt/include/util.h1
-rw-r--r--rt/src/util.c14
-rw-r--r--rt/src/wl.c5
4 files changed, 3 insertions, 19 deletions
diff --git a/rt/include/plugin.h b/rt/include/plugin.h
index 4146b37..d7ae18b 100644
--- a/rt/include/plugin.h
+++ b/rt/include/plugin.h
@@ -146,7 +146,7 @@ typedef struct PLUGIN {
/* Absolute motion only for now; relative motion stays in the runtime. */
EXPORT(opqst_t (*plugin_handle_motion)(
struct wlr_pointer_motion_absolute_event *event, uint32_t modifiers,
- opqst_t state));
+ double lx, double ly, opqst_t state));
/*
* Handles a surface being mapped, unmapped or destroyed.
diff --git a/rt/include/util.h b/rt/include/util.h
index f7de541..b477113 100644
--- a/rt/include/util.h
+++ b/rt/include/util.h
@@ -6,7 +6,6 @@
* are intended for direct FFI use from the Haskell plugin.
*/
-void montis_plugin_get_cursor_position(void *ctx, double *x, double *y);
void *montis_plugin_toplevel_at(void *ctx, double lx, double ly);
void montis_plugin_get_toplevel_position(void *toplevel, double *x, double *y);
void montis_plugin_set_toplevel_position(void *toplevel, double x, double y);
diff --git a/rt/src/util.c b/rt/src/util.c
index d02c07c..6576770 100644
--- a/rt/src/util.c
+++ b/rt/src/util.c
@@ -12,7 +12,6 @@ static struct montis_server *server_from_ctx(void *ctx)
static struct montis_toplevel *toplevel_at(struct montis_server *server,
double lx, double ly)
{
- struct wlr_surface *surface = NULL;
double sx = 0.0;
double sy = 0.0;
@@ -28,9 +27,6 @@ static struct montis_toplevel *toplevel_at(struct montis_server *server,
return NULL;
}
- surface = scene_surface->surface;
- (void)surface;
-
struct wlr_scene_tree *tree = node->parent;
while (tree != NULL && tree->node.data == NULL) {
tree = tree->node.parent;
@@ -38,16 +34,6 @@ static struct montis_toplevel *toplevel_at(struct montis_server *server,
return tree ? tree->node.data : NULL;
}
-void montis_plugin_get_cursor_position(void *ctx, double *x, double *y)
-{
- if (!ctx || !x || !y) {
- return;
- }
- struct montis_server *server = server_from_ctx(ctx);
- *x = server->cursor->x;
- *y = server->cursor->y;
-}
-
void *montis_plugin_toplevel_at(void *ctx, double lx, double ly)
{
if (!ctx) {
diff --git a/rt/src/wl.c b/rt/src/wl.c
index af348f3..f528c22 100644
--- a/rt/src/wl.c
+++ b/rt/src/wl.c
@@ -452,16 +452,15 @@ static void server_cursor_motion_absolute(struct wl_listener *listener,
wl_container_of(listener, server, cursor_motion_absolute);
struct wlr_pointer_motion_absolute_event *event = data;
- printf("[CQD] - %lf %lf\n", event->x, event->y);
struct wlr_seat *seat = server->seat;
struct wlr_keyboard *keyboard = wlr_seat_get_keyboard(seat);
uint32_t modifiers = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0;
- plugin_call_update_state(server->plugin, plugin_handle_motion, event,
- modifiers);
wlr_cursor_warp_absolute(server->cursor, &event->pointer->base, event->x,
event->y);
process_cursor_motion(server, event->time_msec);
+ plugin_call_update_state(server->plugin, plugin_handle_motion, event,
+ modifiers, server->cursor->x, server->cursor->y);
}
static void server_cursor_button(struct wl_listener *listener, void *data)