Support xwayland window title bar dragging

This commit is contained in:
Johan Malm 2020-05-04 22:21:30 +01:00
parent 4c53bd8bf9
commit 83c3492c87
7 changed files with 109 additions and 42 deletions

View file

@ -252,9 +252,10 @@ static void process_cursor_motion(struct server *server, uint32_t time)
double sx, sy;
struct wlr_seat *seat = server->seat;
struct wlr_surface *surface = NULL;
int view_area;
struct view *view = desktop_view_at(server, server->cursor->x,
server->cursor->y, &surface, &sx,
&sy);
&sy, &view_area);
if (!view) {
/* If there's no view under the cursor, set the cursor image to
* a default. This is what makes the cursor image appear when
@ -262,6 +263,12 @@ static void process_cursor_motion(struct server *server, uint32_t time)
wlr_xcursor_manager_set_cursor_image(
server->cursor_mgr, "left_ptr", server->cursor);
}
switch (view_area) {
case LAB_DECO_PART_TOP:
wlr_xcursor_manager_set_cursor_image(
server->cursor_mgr, "left_ptr", server->cursor);
break;
}
if (surface) {
bool focus_changed = seat->pointer_state.focused_surface !=
surface;
@ -332,9 +339,10 @@ void server_cursor_button(struct wl_listener *listener, void *data)
event->button, event->state);
double sx, sy;
struct wlr_surface *surface;
int view_area;
struct view *view = desktop_view_at(server, server->cursor->x,
server->cursor->y, &surface, &sx,
&sy);
&sy, &view_area);
if (event->state == WLR_BUTTON_RELEASED) {
/* If you released any buttons, we exit interactive move/resize
* mode. */
@ -342,6 +350,11 @@ void server_cursor_button(struct wl_listener *listener, void *data)
} else {
/* Focus that client if the button was _pressed_ */
focus_view(view, surface);
switch (view_area) {
case LAB_DECO_PART_TOP:
begin_interactive(view, TINYWL_CURSOR_MOVE, 0);
break;
}
}
}