mirror of
https://github.com/labwc/labwc.git
synced 2026-02-25 01:40:28 -05:00
Refactor the logic of placing client-menu with ShowMenu action
Before this commit, we assumed `ShowMenu` action is not bound to any buttons other than window menu button and always place the client-menu under the window-menu button when atCursor="no". Also, it was going to be difficult to distinguish whether the action is executed from the window menu button or the window icon, which will be added soon. This commit fixes it to open the menu under the actually-clicked button by passing `cursor_context` to `actions_run()`, with some refactoring: - `seat->pressed.resize_edges` is removed and it's calculated from the cursor position and `seat->pressed.type` just before running Resize action. This slightly changes the existing logic to determine the resizing edges with Alt-Right + Drag mousebinding, but `seat->pressed.type` is still stored on button press so it doesn't bring back the issue #543. - `seat->pressed.toplevel` is removed and `get_toplevel()` in `update_pressed_surface()` may be called more often, but its overhead will be negligible.
This commit is contained in:
parent
d29464bac7
commit
25f5cdd3a6
12 changed files with 67 additions and 109 deletions
|
|
@ -129,9 +129,8 @@ struct seat {
|
|||
struct input_method_relay *input_method_relay;
|
||||
|
||||
/**
|
||||
* pressed view/surface/node will usually be NULL and is only set on
|
||||
* button press while the mouse is over a view or surface, and reset
|
||||
* to NULL on button release.
|
||||
* This is usually zeroed and is only set on button press while the
|
||||
* mouse is over a view or surface, and zeroed on button release.
|
||||
* It is used to send cursor motion events to a surface even though
|
||||
* the cursor has left the surface in the meantime.
|
||||
*
|
||||
|
|
@ -144,13 +143,7 @@ struct seat {
|
|||
*
|
||||
* Both (view && !surface) and (surface && !view) are possible.
|
||||
*/
|
||||
struct {
|
||||
struct view *view;
|
||||
struct wlr_scene_node *node;
|
||||
struct wlr_surface *surface;
|
||||
struct wlr_surface *toplevel;
|
||||
uint32_t resize_edges;
|
||||
} pressed;
|
||||
struct cursor_context pressed;
|
||||
|
||||
struct {
|
||||
bool active;
|
||||
|
|
@ -492,9 +485,7 @@ void seat_focus_surface(struct seat *seat, struct wlr_surface *surface);
|
|||
void seat_focus_lock_surface(struct seat *seat, struct wlr_surface *surface);
|
||||
|
||||
void seat_set_focus_layer(struct seat *seat, struct wlr_layer_surface_v1 *layer);
|
||||
void seat_set_pressed(struct seat *seat, struct view *view,
|
||||
struct wlr_scene_node *node, struct wlr_surface *surface,
|
||||
struct wlr_surface *toplevel, uint32_t resize_edges);
|
||||
void seat_set_pressed(struct seat *seat, struct cursor_context *ctx);
|
||||
void seat_reset_pressed(struct seat *seat);
|
||||
void seat_output_layout_changed(struct seat *seat);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue