Skip to content

Commit

Permalink
Implement built-in menu button click handling
Browse files Browse the repository at this point in the history
Add function to handle built-in menu clicks.
Trigger action invocation on menu button click.

Signed-off-by: LI Qingwu <[email protected]>
  • Loading branch information
Qingwu-Li committed Feb 8, 2025
1 parent 1c3052b commit 318dfe1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ struct notification *get_notification_at(const int y) {
return NULL;
}

bool handle_builtin_menu_click(int x, int y) {
if (!settings.built_in_menu) {
return false;
}

struct notification *n = get_notification_at(y);
if (n) {
if (menu_get_count(n) > 0) {
struct menu *m = menu_get_at(n, x, y);
if (m) {
signal_action_invoked(n, m->key);
return true;
}
}
}
return false;
}

void input_handle_click(unsigned int button, bool button_down, int mouse_x, int mouse_y){
LOG_I("Pointer handle button %i: %i", button, button_down);

Expand All @@ -63,6 +81,11 @@ void input_handle_click(unsigned int button, bool button_down, int mouse_x, int
return;
}

if (settings.built_in_menu){
if (handle_builtin_menu_click( mouse_x, mouse_y))
return;
}

enum mouse_action *acts;

switch (button) {
Expand Down

0 comments on commit 318dfe1

Please sign in to comment.