~ruther/dwl

749880cedd052ed1b8c0e6b979778077084d6d45 — Devin J. Pohly 5 years ago 996738a
calculate resize based just on cursor/window

This eliminates the need for grab_height and grab_width.
1 files changed, 2 insertions(+), 12 deletions(-)

M dwl.c
M dwl.c => dwl.c +2 -12
@@ 176,7 176,6 @@ static struct wl_list keyboards;
static unsigned int cursor_mode;
static Client *grabbed_client;
static double grabsx, grabsy;
static int grab_width, grab_height;

static struct wlr_output_layout *output_layout;
static struct wl_list mons;


@@ 566,10 565,9 @@ motionnotify(uint32_t time)
		 * compositor, you'd wait for the client to prepare a buffer at
		 * the new size, then commit any movement that was prepared.
		 */
		double dx = cursor->x - grabsx;
		double dy = cursor->y - grabsy;
		wlr_xdg_toplevel_set_size(grabbed_client->xdg_surface,
				grab_width + dx, grab_height + dy);
				cursor->x - grabbed_client->x,
				cursor->y - grabbed_client->y);
		return;
	}



@@ 643,12 641,6 @@ 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. */
	struct wlr_surface *focused_surface =
		seat->pointer_state.focused_surface;
	if (c->xdg_surface->surface != focused_surface) {
		/* Deny move/resize requests from unfocused clients. */
		return;
	}
	grabbed_client = c;
	cursor_mode = mode;
	struct wlr_box sbox;


@@ 660,8 652,6 @@ moveresize(Client *c, unsigned int mode)
		grabsx = cursor->x + sbox.x;
		grabsy = cursor->y + sbox.y;
	}
	grab_width = sbox.width;
	grab_height = sbox.height;
}

void

Do not follow this link