From: Lyude Paul <thatsly...@gmail.com>

Co-authored-by: Peter Hutterer <peter.hutte...@who-t.net>
Signed-off-by: Lyude Paul <thatsly...@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
Signed-off-by: Bastian Farkas <bfar...@de.adit-jv.com>
---
 clients/desktop-shell.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index b133d86..686c929 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -350,6 +350,55 @@ panel_launcher_touch_up_handler(struct widget *widget, 
struct input *input,
 }
 
 static void
+panel_launcher_tablet_tool_proximity_in_handler(struct widget *widget,
+                                               struct tablet_tool *tool,
+                                               struct tablet *tablet, void 
*data)
+{
+       struct panel_launcher *launcher;
+
+       launcher = widget_get_user_data(widget);
+       launcher->focused = 1;
+       widget_schedule_redraw(widget);
+}
+
+static void
+panel_launcher_tablet_tool_proximity_out_handler(struct widget *widget,
+                                                struct tablet_tool *tool, void 
*data)
+{
+       struct panel_launcher *launcher;
+
+       launcher = widget_get_user_data(widget);
+       launcher->focused = 0;
+       widget_schedule_redraw(widget);
+}
+
+static void
+panel_launcher_tablet_tool_up_handler(struct widget *widget,
+                                     struct tablet_tool *tool,
+                                     void *data)
+{
+       struct panel_launcher *launcher;
+
+       launcher = widget_get_user_data(widget);
+       panel_launcher_activate(launcher);
+}
+
+static void
+panel_launcher_tablet_tool_button_handler(struct widget *widget,
+                                         struct tablet_tool *tool,
+                                         uint32_t button,
+                                         enum zwp_tablet_tool_v1_button_state 
state,
+                                         void *data)
+{
+       struct panel_launcher *launcher;
+
+       launcher = widget_get_user_data(widget);
+
+       if (state == ZWP_TABLET_TOOL_V1_BUTTON_STATE_RELEASED)
+               panel_launcher_activate(launcher);
+}
+
+static void
 clock_func(struct task *task, uint32_t events)
 {
        struct panel_clock *clock =
@@ -723,6 +772,13 @@ panel_add_launcher(struct panel *panel, const char *icon, 
const char *path)
                                      panel_launcher_touch_down_handler);
        widget_set_touch_up_handler(launcher->widget,
                                    panel_launcher_touch_up_handler);
+       widget_set_tablet_tool_up_handler(launcher->widget,
+                               panel_launcher_tablet_tool_up_handler);
+       widget_set_tablet_tool_proximity_handlers(launcher->widget,
+                               panel_launcher_tablet_tool_proximity_in_handler,
+                               
panel_launcher_tablet_tool_proximity_out_handler);
+       widget_set_tablet_tool_button_handler(launcher->widget,
+                               panel_launcher_tablet_tool_button_handler);
        widget_set_redraw_handler(launcher->widget,
                                  panel_launcher_redraw_handler);
        widget_set_motion_handler(launcher->widget,
-- 
2.7.4

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to