Skip to content

Commit e338a28

Browse files
committed
Implement built-in menu button click handling
Add function to handle built-in menu clicks. Trigger action invocation on menu button click. Signed-off-by: LI Qingwu <[email protected]>
1 parent 0d58450 commit e338a28

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/input.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,24 @@ struct notification *get_notification_at(const int y) {
5555
return NULL;
5656
}
5757

58+
bool handle_builtin_menu_click(int x, int y) {
59+
if (!settings.built_in_menu) {
60+
return false;
61+
}
62+
63+
struct notification *n = get_notification_at(y);
64+
if (n) {
65+
if (menu_get_count(n) > 0) {
66+
struct menu *m = menu_get_at(n, x, y);
67+
if (m) {
68+
signal_action_invoked(n, m->key);
69+
return true;
70+
}
71+
}
72+
}
73+
return false;
74+
}
75+
5876
void input_handle_click(unsigned int button, bool button_down, int mouse_x, int mouse_y){
5977
LOG_I("Pointer handle button %i: %i", button, button_down);
6078

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

84+
if (settings.built_in_menu){
85+
if (handle_builtin_menu_click( mouse_x, mouse_y))
86+
return;
87+
}
88+
6689
enum mouse_action *acts;
6790

6891
switch (button) {

0 commit comments

Comments
 (0)