mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-29 05:40:20 -04:00
Backported handling view unmap while grabbed from tinywl
This commit is contained in:
parent
18950eb844
commit
4f0f564e27
3 changed files with 9 additions and 1 deletions
|
|
@ -30,5 +30,6 @@ struct wb_cursor {
|
|||
|
||||
struct wb_cursor *wb_cursor_create(struct wb_server *server);
|
||||
void wb_cursor_destroy(struct wb_cursor *cursor);
|
||||
void reset_cursor_mode(struct wb_server *server);
|
||||
|
||||
#endif /* cursor.h */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
#include "waybox/cursor.h"
|
||||
#include "waybox/xdg_shell.h"
|
||||
|
||||
void reset_cursor_mode(struct wb_server *server) {
|
||||
/* Reset the cursor mode to passthrough */
|
||||
server->cursor->cursor_mode = WB_CURSOR_PASSTHROUGH;
|
||||
server->grabbed_view = NULL;
|
||||
}
|
||||
|
||||
static void process_cursor_move(struct wb_server *server) {
|
||||
/* Move the grabbed view to the new position. */
|
||||
struct wb_view *view = server->grabbed_view;
|
||||
|
|
@ -161,7 +167,7 @@ static void handle_cursor_button(struct wl_listener *listener, void *data) {
|
|||
cursor->server->cursor->cursor->x, cursor->server->cursor->cursor->y, &surface, &sx, &sy);
|
||||
if (event->state == WLR_BUTTON_RELEASED) {
|
||||
/* If you released any buttons, we exit interactive move/resize mode. */
|
||||
cursor->cursor_mode = WB_CURSOR_PASSTHROUGH;
|
||||
reset_cursor_mode(cursor->server);
|
||||
} else {
|
||||
/* Focus that client if the button was _pressed_ */
|
||||
focus_view(view, surface);
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ static void xdg_toplevel_unmap(struct wl_listener *listener, void *data) {
|
|||
struct wb_view *view = wl_container_of(listener, view, unmap);
|
||||
if (view->xdg_toplevel->base->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL)
|
||||
return;
|
||||
reset_cursor_mode(view->server);
|
||||
|
||||
/* Focus the next view, if any. */
|
||||
struct wb_view *next_view = wl_container_of(view->link.next, next_view, link);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue