diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2026-01-05 01:11:45 -0700 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2026-01-05 01:11:45 -0700 |
| commit | 34e0354bb2d07ce0ad8a6e83e226370cfb9904da (patch) | |
| tree | a8b9638c6d74cc2454ca2d7354a8ecea7dbd4cba /rt/src | |
| parent | 9daffd37236469e8089e3c12207c449b4db09e92 (diff) | |
| download | montis-34e0354bb2d07ce0ad8a6e83e226370cfb9904da.tar.gz montis-34e0354bb2d07ce0ad8a6e83e226370cfb9904da.tar.bz2 montis-34e0354bb2d07ce0ad8a6e83e226370cfb9904da.zip | |
[feat] right-click drag to resize windows.
Diffstat (limited to 'rt/src')
| -rw-r--r-- | rt/src/util.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/rt/src/util.c b/rt/src/util.c index 66a2b20..e09cff9 100644 --- a/rt/src/util.c +++ b/rt/src/util.c @@ -63,6 +63,41 @@ void montis_plugin_set_toplevel_position(void *toplevel, double x, double y) 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) { |