Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Positions the window menu relative to the pointer. #187

Merged
merged 2 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,13 @@ Support for visual effects to improve usability, but not for pure show.
* Exploratory ideas
* Stretch: Consider supporting XScreenSaver (or visualization modules).

* Toolkit improvements
* Menu
* Permit navigation by keys
* Position all menus to remain within output.
* Re-position to remain within output when submenu opens.
* Handle case of too manu menu items that exceed output space.

## Visualization and effects

* Animations
Expand Down
8 changes: 8 additions & 0 deletions src/toolkit/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,14 @@ void wlmtk_window_menu_set_enabled(
wlmtk_container_pointer_grab(
menu_element_ptr->parent_container_ptr,
menu_element_ptr);

if (wlmtk_window_element(window_ptr)->pointer_inside) {
wlmtk_element_set_position(
menu_element_ptr,
wlmtk_window_element(window_ptr)->last_pointer_x, 0);
} else {
wlmtk_element_set_position(menu_element_ptr, 0, 0);
}
} else {
wlmtk_container_pointer_grab_release(
menu_element_ptr->parent_container_ptr,
Expand Down