logo

inaban

Unnamed repository; edit this file 'description' to name the repository.
commit: 524f64c0cebb07ac47c56c4af29f1d68ebc0c6f7
parent: e5a058a00a17537474bf7e9f1335cd19aa07e33c
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon,  1 Jul 2019 12:22:46 +0200

Remove remnants of CSD resize/move

Diffstat:

Minaban.c69+--------------------------------------------------------------------
Minaban.h13-------------
2 files changed, 1 insertion(+), 81 deletions(-)

diff --git a/inaban.c b/inaban.c @@ -271,70 +271,8 @@ desktop_view_at(struct inaban_server *server, } static void -process_cursor_move(struct inaban_server *server, uint32_t time) -{ - /* Move the grabbed view to the new position. */ - server->grabbed_view->x = server->cursor->x - server->grab_x; - server->grabbed_view->y = server->cursor->y - server->grab_y; -} - -static void -process_cursor_resize(struct inaban_server *server, uint32_t time) -{ - /* - * Resizing the grabbed view can be a little bit complicated, because we - * could be resizing from any corner or edge. This not only resizes the view - * on one or two axes, but can also move the view if you resize from the top - * or left edges (or top-left corner). - * - * Note that I took some shortcuts here. In a more fleshed-out compositor, - * you'd wait for the client to prepare a buffer at the new size, then - * commit any movement that was prepared. - */ - struct inaban_view *view = server->grabbed_view; - double dx = server->cursor->x - server->grab_x; - double dy = server->cursor->y - server->grab_y; - double x = view->x; - double y = view->y; - int width = server->grab_width; - int height = server->grab_height; - if(server->resize_edges & WLR_EDGE_TOP) - { - y = server->grab_y + dy; - height -= dy; - if(height < 1) y += height; - } - else if(server->resize_edges & WLR_EDGE_BOTTOM) - height += dy; - if(server->resize_edges & WLR_EDGE_LEFT) - { - x = server->grab_x + dx; - width -= dx; - if(width < 1) x += width; - } - else if(server->resize_edges & WLR_EDGE_RIGHT) - width += dx; - - view->x = x; - view->y = y; - wlr_xdg_toplevel_set_size(view->xdg_surface, width, height); -} - -static void process_cursor_motion(struct inaban_server *server, uint32_t time) { - /* If the mode is non-passthrough, delegate to those functions. */ - if(server->cursor_mode == INABAN_CURSOR_MOVE) - { - process_cursor_move(server, time); - return; - } - else if(server->cursor_mode == INABAN_CURSOR_RESIZE) - { - process_cursor_resize(server, time); - return; - } - /* Otherwise, find the view under the pointer and send the event along. */ double sx, sy; struct wlr_seat *seat = server->seat; @@ -410,15 +348,10 @@ server_cursor_button(struct wl_listener *listener, void *data) /* Notify the client with pointer focus that a button press has occurred */ wlr_seat_pointer_notify_button(server->seat, event->time_msec, event->button, event->state); double sx, sy; - struct wlr_seat *seat = server->seat; struct wlr_surface *surface; struct inaban_view *view = desktop_view_at(server, server->cursor->x, server->cursor->y, &surface, &sx, &sy); - if(event->state == WLR_BUTTON_RELEASED) - server->cursor_mode = - INABAN_CURSOR_PASSTHROUGH; /* If you released any buttons, we exit interactive move/resize mode. */ - else - focus_view(view, surface); /* Focus that client if the button was _pressed_ */ + focus_view(view, surface); /* Focus that client if the button was _pressed_ */ } static void diff --git a/inaban.h b/inaban.h @@ -20,14 +20,6 @@ #include <wlr/util/log.h> #include <xkbcommon/xkbcommon.h> -/* For brevity's sake, struct members are annotated where they are used. */ -enum inaban_cursor_mode -{ - INABAN_CURSOR_PASSTHROUGH, - INABAN_CURSOR_MOVE, - INABAN_CURSOR_RESIZE, -}; - struct inaban_server { struct wl_display *wl_display; @@ -50,11 +42,6 @@ struct inaban_server struct wl_listener new_input; struct wl_listener request_cursor; struct wl_list keyboards; - enum inaban_cursor_mode cursor_mode; - struct inaban_view *grabbed_view; - double grab_x, grab_y; - int grab_width, grab_height; - uint32_t resize_edges; struct wlr_output_layout *output_layout; struct wl_list outputs;