Skip to content

Commit

Permalink
Merge pull request Guake#146 from nevir/primary-as-control
Browse files Browse the repository at this point in the history
Properly handle ctrl (primary) on ubuntu 12+
  • Loading branch information
ulidtko committed Sep 21, 2013
2 parents c7a532c + 33a303b commit aa6f58e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/globalhotkeys/eggaccelerators.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,19 @@ is_hyper (const gchar *string)
(string[6] == '>'));
}

is_primary (const gchar *string)
{
return ((string[0] == '<') &&
(string[1] == 'p' || string[1] == 'P') &&
(string[2] == 'r' || string[2] == 'R') &&
(string[3] == 'i' || string[3] == 'I') &&
(string[4] == 'm' || string[4] == 'M') &&
(string[5] == 'a' || string[5] == 'A') &&
(string[6] == 'r' || string[6] == 'R') &&
(string[7] == 'y' || string[7] == 'Y') &&
(string[8] == '>'));
}

static inline gboolean
is_keycode (const gchar *string)
{
Expand Down Expand Up @@ -310,6 +323,12 @@ egg_accelerator_parse_virtual (const gchar *accelerator,
len -= 7;
mods |= EGG_VIRTUAL_SUPER_MASK;
}
else if (len >= 9 && is_primary (accelerator))
{
accelerator += 9;
len -= 9;
mods |= EGG_VIRTUAL_CONTROL_MASK;
}
else
{
gchar last_ch;
Expand Down

0 comments on commit aa6f58e

Please sign in to comment.