]> git.mdlowis.com Git - proto/labwc.git/commit
Refactor the logic of placing client-menu with ShowMenu action
authortokyo4j <hrak1529@gmail.com>
Fri, 20 Sep 2024 16:11:27 +0000 (01:11 +0900)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sat, 21 Sep 2024 17:07:34 +0000 (18:07 +0100)
commit25f5cdd3a6e05f0e82d9e03ffd0889056d4ca8e1
tree468fd53b64bc65b6ac7188bbcf98b4251b2de532
parentd29464bac79c6969feac0af2d5364717f36dfc74
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.
12 files changed:
include/action.h
include/labwc.h
include/ssd.h
src/action.c
src/input/cursor.c
src/input/keyboard.c
src/input/tablet.c
src/input/touch.c
src/menu/menu.c
src/seat.c
src/ssd/ssd.c
src/window-rules.c