mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-30 00:15:58 +01:00
Fixed a bug with move-resize, removed xdg-shell ack_configure event
Fixed move-resizing a view when only one coordinate changes.
This commit is contained in:
parent
e2843d87c8
commit
a3a8b7bfd8
6 changed files with 31 additions and 18 deletions
|
@ -32,6 +32,7 @@ struct roots_xdg_surface_v6 {
|
||||||
struct {
|
struct {
|
||||||
uint32_t configure_serial;
|
uint32_t configure_serial;
|
||||||
double x, y;
|
double x, y;
|
||||||
|
bool update_x, update_y;
|
||||||
uint32_t width, height;
|
uint32_t width, height;
|
||||||
} move_resize;
|
} move_resize;
|
||||||
};
|
};
|
||||||
|
|
|
@ -125,7 +125,6 @@ struct wlr_xdg_surface_v6 {
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal commit;
|
struct wl_signal commit;
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
struct wl_signal ack_configure;
|
|
||||||
struct wl_signal ping_timeout;
|
struct wl_signal ping_timeout;
|
||||||
|
|
||||||
struct wl_signal request_maximize;
|
struct wl_signal request_maximize;
|
||||||
|
|
|
@ -98,13 +98,7 @@ static void roots_cursor_update_position(struct roots_cursor *cursor, uint32_t t
|
||||||
height = 0;
|
height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active_x != seat->focus->x ||
|
view_move_resize(seat->focus, active_x, active_y, width, height);
|
||||||
active_y != seat->focus->y) {
|
|
||||||
view_move_resize(seat->focus, active_x, active_y,
|
|
||||||
width, height);
|
|
||||||
} else {
|
|
||||||
view_resize(seat->focus, width, height);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ROOTS_CURSOR_ROTATE:
|
case ROOTS_CURSOR_ROTATE:
|
||||||
|
|
|
@ -103,6 +103,11 @@ void view_resize(struct roots_view *view, uint32_t width, uint32_t height) {
|
||||||
|
|
||||||
void view_move_resize(struct roots_view *view, double x, double y,
|
void view_move_resize(struct roots_view *view, double x, double y,
|
||||||
uint32_t width, uint32_t height) {
|
uint32_t width, uint32_t height) {
|
||||||
|
if (x == view->x == x && y == view->y) {
|
||||||
|
view_resize(view, width, height);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (view->move_resize) {
|
if (view->move_resize) {
|
||||||
view->move_resize(view, x, y, width, height);
|
view->move_resize(view, x, y, width, height);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -76,15 +76,24 @@ static void move_resize(struct roots_view *view, double x, double y,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool update_x = x != view->x;
|
||||||
|
bool update_y = y != view->y;
|
||||||
|
|
||||||
uint32_t constrained_width, constrained_height;
|
uint32_t constrained_width, constrained_height;
|
||||||
apply_size_constraints(surface, width, height, &constrained_width,
|
apply_size_constraints(surface, width, height, &constrained_width,
|
||||||
&constrained_height);
|
&constrained_height);
|
||||||
|
|
||||||
|
if (update_x) {
|
||||||
x = x + width - constrained_width;
|
x = x + width - constrained_width;
|
||||||
|
}
|
||||||
|
if (update_y) {
|
||||||
y = y + height - constrained_height;
|
y = y + height - constrained_height;
|
||||||
|
}
|
||||||
|
|
||||||
roots_surface->move_resize.x = x;
|
roots_surface->move_resize.x = x;
|
||||||
roots_surface->move_resize.y = y;
|
roots_surface->move_resize.y = y;
|
||||||
|
roots_surface->move_resize.update_x = update_x;
|
||||||
|
roots_surface->move_resize.update_y = update_y;
|
||||||
roots_surface->move_resize.width = constrained_width;
|
roots_surface->move_resize.width = constrained_width;
|
||||||
roots_surface->move_resize.height = constrained_height;
|
roots_surface->move_resize.height = constrained_height;
|
||||||
|
|
||||||
|
@ -158,12 +167,20 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
||||||
struct roots_view *view = roots_surface->view;
|
struct roots_view *view = roots_surface->view;
|
||||||
struct wlr_xdg_surface_v6 *surface = view->xdg_surface_v6;
|
struct wlr_xdg_surface_v6 *surface = view->xdg_surface_v6;
|
||||||
|
|
||||||
if (roots_surface->move_resize.configure_serial ==
|
if (roots_surface->move_resize.configure_serial > 0 &&
|
||||||
|
roots_surface->move_resize.configure_serial ==
|
||||||
surface->configure_serial) {
|
surface->configure_serial) {
|
||||||
|
struct wlr_box size;
|
||||||
|
get_size(view, &size);
|
||||||
|
|
||||||
|
if (roots_surface->move_resize.update_x) {
|
||||||
view->x = roots_surface->move_resize.x +
|
view->x = roots_surface->move_resize.x +
|
||||||
roots_surface->move_resize.width - surface->geometry->width;
|
roots_surface->move_resize.width - size.width;
|
||||||
|
}
|
||||||
|
if (roots_surface->move_resize.update_y) {
|
||||||
view->y = roots_surface->move_resize.y +
|
view->y = roots_surface->move_resize.y +
|
||||||
roots_surface->move_resize.height - surface->geometry->height;
|
roots_surface->move_resize.height - size.height;
|
||||||
|
}
|
||||||
roots_surface->move_resize.configure_serial = 0;
|
roots_surface->move_resize.configure_serial = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -814,8 +814,6 @@ static void xdg_surface_ack_configure(struct wl_client *client,
|
||||||
surface->configured = true;
|
surface->configured = true;
|
||||||
surface->configure_serial = serial;
|
surface->configure_serial = serial;
|
||||||
|
|
||||||
wl_signal_emit(&surface->events.ack_configure, surface);
|
|
||||||
|
|
||||||
free(configure);
|
free(configure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1155,7 +1153,6 @@ static void xdg_shell_get_xdg_surface(struct wl_client *wl_client,
|
||||||
wl_signal_init(&surface->events.request_show_window_menu);
|
wl_signal_init(&surface->events.request_show_window_menu);
|
||||||
wl_signal_init(&surface->events.commit);
|
wl_signal_init(&surface->events.commit);
|
||||||
wl_signal_init(&surface->events.destroy);
|
wl_signal_init(&surface->events.destroy);
|
||||||
wl_signal_init(&surface->events.ack_configure);
|
|
||||||
wl_signal_init(&surface->events.ping_timeout);
|
wl_signal_init(&surface->events.ping_timeout);
|
||||||
|
|
||||||
wl_signal_add(&surface->surface->events.destroy,
|
wl_signal_add(&surface->surface->events.destroy,
|
||||||
|
|
Loading…
Reference in a new issue