inline moveresize

There were only two lines left in common
This commit is contained in:
Devin J. Pohly 2020-04-22 22:32:53 -05:00
parent 0a43197203
commit 1595256341

19
dwl.c
View File

@ -135,7 +135,6 @@ static void motionabsolute(struct wl_listener *listener, void *data);
static void motionnotify(uint32_t time); static void motionnotify(uint32_t time);
static void motionrelative(struct wl_listener *listener, void *data); static void motionrelative(struct wl_listener *listener, void *data);
static void movemouse(const Arg *arg); static void movemouse(const Arg *arg);
static void moveresize(Client *c, unsigned int mode);
static void quit(const Arg *arg); static void quit(const Arg *arg);
static void render(struct wlr_surface *surface, int sx, int sy, void *data); static void render(struct wlr_surface *surface, int sx, int sy, void *data);
static void rendermon(struct wl_listener *listener, void *data); static void rendermon(struct wl_listener *listener, void *data);
@ -632,22 +631,13 @@ movemouse(const Arg *arg)
if (!c) { if (!c) {
return; return;
} }
moveresize(c, CurMove);
}
void /* Prepare for moving client in motionnotify */
moveresize(Client *c, unsigned int mode)
{
/* This function sets up an interactive move or resize operation, where the
* compositor stops propagating pointer events to clients and instead
* consumes them itself, to move or resize windows. */
grabbed_client = c; grabbed_client = c;
cursor_mode = mode; cursor_mode = CurMove;
if (mode == CurMove) {
grabsx = cursor->x - c->x; grabsx = cursor->x - c->x;
grabsy = cursor->y - c->y; grabsy = cursor->y - c->y;
} }
}
void void
quit(const Arg *arg) quit(const Arg *arg)
@ -798,7 +788,10 @@ resizemouse(const Arg *arg)
wlr_cursor_warp_closest(cursor, NULL, wlr_cursor_warp_closest(cursor, NULL,
c->x + sbox.x + sbox.width, c->x + sbox.x + sbox.width,
c->y + sbox.y + sbox.height); c->y + sbox.y + sbox.height);
moveresize(c, CurResize);
/* Prepare for resizing client in motionnotify */
grabbed_client = c;
cursor_mode = CurResize;
} }
void void