keybindings: Clean up code a tiny bit
This commit is contained in:
parent
8e5cfccf49
commit
80266d3071
@ -1081,7 +1081,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
Window xwindow;
|
Window xwindow;
|
||||||
gboolean binding_per_window;
|
gboolean only_per_window;
|
||||||
gboolean grab;
|
gboolean grab;
|
||||||
} ChangeKeygrabData;
|
} ChangeKeygrabData;
|
||||||
|
|
||||||
@ -1092,29 +1092,31 @@ change_keygrab_foreach (gpointer key,
|
|||||||
{
|
{
|
||||||
ChangeKeygrabData *data = user_data;
|
ChangeKeygrabData *data = user_data;
|
||||||
MetaKeyBinding *binding = value;
|
MetaKeyBinding *binding = value;
|
||||||
|
gboolean binding_is_per_window = (binding->flags & META_KEY_BINDING_PER_WINDOW) != 0;
|
||||||
|
|
||||||
if (!!data->binding_per_window ==
|
if (data->only_per_window != binding_is_per_window)
|
||||||
!!(binding->flags & META_KEY_BINDING_PER_WINDOW) &&
|
return;
|
||||||
binding->keycode != 0)
|
|
||||||
{
|
if (binding->keycode == 0)
|
||||||
meta_change_keygrab (data->display, data->xwindow, data->grab,
|
return;
|
||||||
binding->keysym,
|
|
||||||
binding->keycode,
|
meta_change_keygrab (data->display, data->xwindow, data->grab,
|
||||||
binding->mask);
|
binding->keysym,
|
||||||
}
|
binding->keycode,
|
||||||
|
binding->mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
change_binding_keygrabs (MetaDisplay *display,
|
change_binding_keygrabs (MetaDisplay *display,
|
||||||
Window xwindow,
|
Window xwindow,
|
||||||
gboolean binding_per_window,
|
gboolean only_per_window,
|
||||||
gboolean grab)
|
gboolean grab)
|
||||||
{
|
{
|
||||||
ChangeKeygrabData data;
|
ChangeKeygrabData data;
|
||||||
|
|
||||||
data.display = display;
|
data.display = display;
|
||||||
data.xwindow = xwindow;
|
data.xwindow = xwindow;
|
||||||
data.binding_per_window = binding_per_window;
|
data.only_per_window = only_per_window;
|
||||||
data.grab = grab;
|
data.grab = grab;
|
||||||
|
|
||||||
g_hash_table_foreach (display->key_bindings, change_keygrab_foreach, &data);
|
g_hash_table_foreach (display->key_bindings, change_keygrab_foreach, &data);
|
||||||
|
Loading…
Reference in New Issue
Block a user