Skip to content

Commit

Permalink
media-keys: Add support for XF86TouchpadOn/Off
Browse files Browse the repository at this point in the history
Using hard-coded keys.

This requires new keycodes added to X.org in:
https://bugs.freedesktop.org/show_bug.cgi?id=31300

Signed-off-by: Zhang Xianwei <zhang.xianwei8@zte.com.cn>
  • Loading branch information
zhangxianwei8 authored and raveit65 committed Oct 1, 2018
1 parent b761b23 commit 193f3fb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/media-keys/acme.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

enum {
TOUCHPAD_KEY,
TOUCHPAD_ON_KEY,
TOUCHPAD_OFF_KEY,
MUTE_KEY,
VOLUME_DOWN_KEY,
VOLUME_UP_KEY,
Expand Down Expand Up @@ -63,6 +65,8 @@ static struct {
Key *key;
} keys[HANDLED_KEYS] = {
{ TOUCHPAD_KEY, "touchpad", NULL, NULL },
{ TOUCHPAD_ON_KEY, NULL, "XF86TouchpadOn", NULL },
{ TOUCHPAD_OFF_KEY, NULL, "XF86TouchpadOff", NULL },
{ MUTE_KEY, "volume-mute", NULL, NULL },
{ VOLUME_DOWN_KEY, "volume-down", NULL, NULL },
{ VOLUME_UP_KEY, "volume-up", NULL, NULL },
Expand Down
15 changes: 15 additions & 0 deletions plugins/media-keys/msd-media-keys-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,15 @@ do_eject_action (MsdMediaKeysManager *manager)
g_object_unref (fav_drive);
}

static void
do_touchpad_osd_action (MsdMediaKeysManager *manager, gboolean state)
{
dialog_init (manager);
msd_media_keys_window_set_action_custom (MSD_MEDIA_KEYS_WINDOW (manager->priv->dialog),
state ? "touchpad-enabled" : "touchpad-disabled",
FALSE);
dialog_show (manager);
}
static void
do_touchpad_action (MsdMediaKeysManager *manager)
{
Expand Down Expand Up @@ -930,6 +939,12 @@ do_action (MsdMediaKeysManager *manager,
case TOUCHPAD_KEY:
do_touchpad_action (manager);
break;
case TOUCHPAD_ON_KEY:
do_touchpad_osd_action(manager, TRUE);
break;
case TOUCHPAD_OFF_KEY:
do_touchpad_osd_action(manager, FALSE);
break;
case MUTE_KEY:
case VOLUME_DOWN_KEY:
case VOLUME_UP_KEY:
Expand Down

0 comments on commit 193f3fb

Please sign in to comment.