aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-04-30 11:33:32 -0500
committerDevin J. Pohly <djpohly@gmail.com>2020-04-30 11:33:32 -0500
commit33b0236858f5c885d47501c19948299a4a1d83a2 (patch)
tree670bc09001c496b8556d8c4a3c7bad552326f996
parent3973ea5bfe9676bf8673781a966c933b0af0a232 (diff)
make move-grab coords client-relative
-rw-r--r--dwl.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/dwl.c b/dwl.c
index 1060d10..2dcf03d 100644
--- a/dwl.c
+++ b/dwl.c
@@ -204,7 +204,7 @@ static struct wl_listener request_cursor;
static struct wl_list keyboards;
static unsigned int cursor_mode;
static Client *grabc;
-static double grabsx, grabsy; /* surface-relative */
+static int grabcx, grabcy; /* client-relative */
static struct wlr_output_layout *output_layout;
static struct wlr_box sgeom;
@@ -690,8 +690,7 @@ motionnotify(uint32_t time)
if (cursor_mode == CurMove) {
/* Move the grabbed client to the new position. */
/* XXX assumes the surface is at (0,0) within grabc */
- resize(grabc, cursor->x - grabsx - grabc->bw,
- cursor->y - grabsy - grabc->bw,
+ resize(grabc, cursor->x - grabcx, cursor->y - grabcy,
grabc->geom.width, grabc->geom.height, 1);
return;
} else if (cursor_mode == CurResize) {
@@ -735,7 +734,8 @@ void
moveresize(const Arg *arg)
{
struct wlr_surface *surface;
- grabc = xytoclient(cursor->x, cursor->y, &surface, &grabsx, &grabsy);
+ double sx, sy;
+ grabc = xytoclient(cursor->x, cursor->y, &surface, &sx, &sy);
if (!grabc)
return;
@@ -743,6 +743,8 @@ moveresize(const Arg *arg)
setfloating(grabc, 1);
switch (cursor_mode = arg->ui) {
case CurMove:
+ grabcx = cursor->x - grabc->geom.x;
+ grabcy = cursor->y - grabc->geom.y;
wlr_xcursor_manager_set_cursor_image(cursor_mgr, "fleur", cursor);
break;
case CurResize: