mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-07 22:16:00 +01:00
rootston: seat resize and rotate
This commit is contained in:
parent
fc09f90462
commit
eb3c367c63
2 changed files with 37 additions and 4 deletions
|
@ -480,6 +480,12 @@ void roots_seat_focus_view(struct roots_seat *seat, struct roots_view *view) {
|
||||||
wlr_seat_keyboard_notify_enter(seat->seat, view->wlr_surface);
|
wlr_seat_keyboard_notify_enter(seat->seat, view->wlr_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void seat_set_xcursor_image(struct roots_seat *seat, struct
|
||||||
|
wlr_xcursor_image *image) {
|
||||||
|
wlr_cursor_set_image(seat->cursor->cursor, image->buffer, image->width,
|
||||||
|
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
||||||
|
}
|
||||||
|
|
||||||
void roots_seat_begin_move(struct roots_seat *seat, struct roots_view *view) {
|
void roots_seat_begin_move(struct roots_seat *seat, struct roots_view *view) {
|
||||||
struct roots_cursor *cursor = seat->cursor;
|
struct roots_cursor *cursor = seat->cursor;
|
||||||
cursor->mode = ROOTS_CURSOR_MOVE;
|
cursor->mode = ROOTS_CURSOR_MOVE;
|
||||||
|
@ -492,16 +498,42 @@ void roots_seat_begin_move(struct roots_seat *seat, struct roots_view *view) {
|
||||||
struct wlr_xcursor *xcursor = get_move_xcursor(seat->cursor->xcursor_theme);
|
struct wlr_xcursor *xcursor = get_move_xcursor(seat->cursor->xcursor_theme);
|
||||||
if (xcursor != NULL) {
|
if (xcursor != NULL) {
|
||||||
struct wlr_xcursor_image *image = xcursor->images[0];
|
struct wlr_xcursor_image *image = xcursor->images[0];
|
||||||
wlr_cursor_set_image(cursor->cursor, image->buffer, image->width,
|
seat_set_xcursor_image(seat, image);
|
||||||
image->width, image->height, image->hotspot_x, image->hotspot_y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void roots_seat_begin_resize(struct roots_seat *seat, struct roots_view *view,
|
void roots_seat_begin_resize(struct roots_seat *seat, struct roots_view *view,
|
||||||
uint32_t edges) {
|
uint32_t edges) {
|
||||||
// TODO
|
struct roots_cursor *cursor = seat->cursor;
|
||||||
|
cursor->mode = ROOTS_CURSOR_RESIZE;
|
||||||
|
cursor->offs_x = cursor->cursor->x;
|
||||||
|
cursor->offs_y = cursor->cursor->y;
|
||||||
|
cursor->view_x = view->x;
|
||||||
|
cursor->view_y = view->y;
|
||||||
|
struct wlr_box size;
|
||||||
|
view_get_size(view, &size);
|
||||||
|
cursor->view_width = size.width;
|
||||||
|
cursor->view_height = size.height;
|
||||||
|
cursor->resize_edges = edges;
|
||||||
|
wlr_seat_pointer_clear_focus(seat->seat);
|
||||||
|
|
||||||
|
struct wlr_xcursor *xcursor = get_resize_xcursor(cursor->xcursor_theme, edges);
|
||||||
|
if (xcursor != NULL) {
|
||||||
|
seat_set_xcursor_image(seat, xcursor->images[0]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void roots_seat_begin_rotate(struct roots_seat *seat, struct roots_view *view) {
|
void roots_seat_begin_rotate(struct roots_seat *seat, struct roots_view *view) {
|
||||||
// TODO
|
struct roots_cursor *cursor = seat->cursor;
|
||||||
|
cursor->mode = ROOTS_CURSOR_ROTATE;
|
||||||
|
cursor->offs_x = cursor->cursor->x;
|
||||||
|
cursor->offs_y = cursor->cursor->y;
|
||||||
|
cursor->view_rotation = view->rotation;
|
||||||
|
wlr_seat_pointer_clear_focus(seat->seat);
|
||||||
|
|
||||||
|
struct wlr_xcursor *xcursor = get_rotate_xcursor(cursor->xcursor_theme);
|
||||||
|
if (xcursor != NULL) {
|
||||||
|
seat_set_xcursor_image(seat, xcursor->images[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,7 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_xdg_toplevel_v6_resize_event *e = data;
|
struct wlr_xdg_toplevel_v6_resize_event *e = data;
|
||||||
// TODO verify event serial
|
// TODO verify event serial
|
||||||
struct roots_seat *seat = input_seat_from_wlr_seat(input, e->seat->seat);
|
struct roots_seat *seat = input_seat_from_wlr_seat(input, e->seat->seat);
|
||||||
|
assert(seat);
|
||||||
if (!seat || seat->cursor->mode != ROOTS_CURSOR_PASSTHROUGH) {
|
if (!seat || seat->cursor->mode != ROOTS_CURSOR_PASSTHROUGH) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue