clients/desktop-shell: Add tablet support to the top panel of the desktop shell

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Lyude Paul <thatslyude@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Bastian Farkas <bfarkas@de.adit-jv.com>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This commit is contained in:
Lyude Paul 2017-12-19 14:03:35 +05:30 committed by Daniel Stone
parent 6a06669b58
commit 017eac1a6b
2 changed files with 60 additions and 0 deletions

View file

@ -53,6 +53,7 @@
#include "window.h"
#include "tablet-unstable-v2-client-protocol.h"
#include "weston-desktop-shell-client-protocol.h"
#define DEFAULT_CLOCK_FORMAT CLOCK_FORMAT_MINUTES
@ -374,6 +375,56 @@ panel_launcher_touch_up_handler(struct widget *widget, struct input *input,
panel_launcher_activate(launcher);
}
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,
uint32_t state_w,
void *data)
{
struct panel_launcher *launcher;
enum zwp_tablet_tool_v2_button_state state = state_w;
launcher = widget_get_user_data(widget);
if (state == ZWP_TABLET_TOOL_V2_BUTTON_STATE_RELEASED)
panel_launcher_activate(launcher);
}
static void
clock_func(struct toytimer *tt)
{
@ -706,6 +757,13 @@ panel_add_launcher(struct panel *panel, const char *icon, const char *path, cons
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,

View file

@ -375,6 +375,8 @@ if get_option('shell-desktop')
'desktop-shell.c',
weston_desktop_shell_client_protocol_h,
weston_desktop_shell_protocol_c,
tablet_unstable_v2_client_protocol_h,
tablet_unstable_v2_protocol_c,
include_directories: common_inc,
dependencies: dep_toytoolkit,
install_dir: get_option('libexecdir'),