display: Expose window_grab_modifiers
Since commit c255031b6d6 we pass scroll-events through to the compositor if the window_grab_modifiers are pressed; in order to allow gnome-shell to check for those events, expose the struct member as a MetaDisplay property. Also take the opportunity to pick a more generic name, now that the modifier is no longer used exclusively for mouse clicks (unless we maintain the notion of scroll events as button 4 and 5 "clicks"). Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1695>
This commit is contained in:
parent
30e1c51b33
commit
7901b98808
@ -167,6 +167,7 @@ enum
|
|||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
|
PROP_COMPOSITOR_MODIFIERS,
|
||||||
PROP_FOCUS_WINDOW
|
PROP_FOCUS_WINDOW
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -199,6 +200,9 @@ meta_display_get_property(GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
|
case PROP_COMPOSITOR_MODIFIERS:
|
||||||
|
g_value_set_flags (value, meta_display_get_compositor_modifiers (display));
|
||||||
|
break;
|
||||||
case PROP_FOCUS_WINDOW:
|
case PROP_FOCUS_WINDOW:
|
||||||
g_value_set_object (value, display->focus_window);
|
g_value_set_object (value, display->focus_window);
|
||||||
break;
|
break;
|
||||||
@ -512,6 +516,15 @@ meta_display_class_init (MetaDisplayClass *klass)
|
|||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
G_TYPE_BOOLEAN, 1, G_TYPE_TASK);
|
G_TYPE_BOOLEAN, 1, G_TYPE_TASK);
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_COMPOSITOR_MODIFIERS,
|
||||||
|
g_param_spec_flags ("compositor-modifiers",
|
||||||
|
"Compositor modifiers",
|
||||||
|
"Modifiers reserved for compositor actions",
|
||||||
|
CLUTTER_TYPE_MODIFIER_TYPE,
|
||||||
|
0,
|
||||||
|
G_PARAM_READABLE));
|
||||||
|
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_FOCUS_WINDOW,
|
PROP_FOCUS_WINDOW,
|
||||||
g_param_spec_object ("focus-window",
|
g_param_spec_object ("focus-window",
|
||||||
|
@ -273,7 +273,7 @@ meta_display_handle_event (MetaDisplay *display,
|
|||||||
{
|
{
|
||||||
ClutterModifierType grab_mods;
|
ClutterModifierType grab_mods;
|
||||||
|
|
||||||
grab_mods = meta_display_get_window_grab_modifiers (display);
|
grab_mods = meta_display_get_compositor_modifiers (display);
|
||||||
if ((clutter_event_get_state (event) & grab_mods) != 0)
|
if ((clutter_event_get_state (event) & grab_mods) != 0)
|
||||||
{
|
{
|
||||||
bypass_wayland = TRUE;
|
bypass_wayland = TRUE;
|
||||||
|
@ -141,8 +141,6 @@ gboolean meta_keybindings_process_event (MetaDisplay *display,
|
|||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
const ClutterEvent *event);
|
const ClutterEvent *event);
|
||||||
|
|
||||||
ClutterModifierType meta_display_get_window_grab_modifiers (MetaDisplay *display);
|
|
||||||
|
|
||||||
gboolean meta_prefs_add_keybinding (const char *name,
|
gboolean meta_prefs_add_keybinding (const char *name,
|
||||||
GSettings *settings,
|
GSettings *settings,
|
||||||
MetaKeyBindingAction action,
|
MetaKeyBindingAction action,
|
||||||
|
@ -1227,7 +1227,7 @@ meta_change_button_grab (MetaKeyBindingManager *keys,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ClutterModifierType
|
ClutterModifierType
|
||||||
meta_display_get_window_grab_modifiers (MetaDisplay *display)
|
meta_display_get_compositor_modifiers (MetaDisplay *display)
|
||||||
{
|
{
|
||||||
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
||||||
return keys->window_grab_modifiers;
|
return keys->window_grab_modifiers;
|
||||||
@ -1297,15 +1297,20 @@ meta_display_ungrab_window_buttons (MetaDisplay *display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_window_grab_modifiers (MetaKeyBindingManager *keys)
|
update_window_grab_modifiers (MetaDisplay *display)
|
||||||
{
|
{
|
||||||
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
||||||
MetaVirtualModifier virtual_mods;
|
MetaVirtualModifier virtual_mods;
|
||||||
unsigned int mods;
|
unsigned int mods;
|
||||||
|
|
||||||
virtual_mods = meta_prefs_get_mouse_button_mods ();
|
virtual_mods = meta_prefs_get_mouse_button_mods ();
|
||||||
devirtualize_modifiers (keys, virtual_mods, &mods);
|
devirtualize_modifiers (keys, virtual_mods, &mods);
|
||||||
|
|
||||||
keys->window_grab_modifiers = mods;
|
if (keys->window_grab_modifiers != mods)
|
||||||
|
{
|
||||||
|
keys->window_grab_modifiers = mods;
|
||||||
|
g_object_notify (G_OBJECT (display), "compositor-modifiers");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1378,7 +1383,7 @@ prefs_changed_callback (MetaPreference pref,
|
|||||||
meta_display_ungrab_window_buttons (display, w->xwindow);
|
meta_display_ungrab_window_buttons (display, w->xwindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_window_grab_modifiers (keys);
|
update_window_grab_modifiers (display);
|
||||||
|
|
||||||
for (l = windows; l; l = l->next)
|
for (l = windows; l; l = l->next)
|
||||||
{
|
{
|
||||||
@ -4559,7 +4564,7 @@ meta_display_init_keys (MetaDisplay *display)
|
|||||||
|
|
||||||
reload_combos (keys);
|
reload_combos (keys);
|
||||||
|
|
||||||
update_window_grab_modifiers (keys);
|
update_window_grab_modifiers (display);
|
||||||
|
|
||||||
/* Keys are actually grabbed in meta_screen_grab_keys() */
|
/* Keys are actually grabbed in meta_screen_grab_keys() */
|
||||||
|
|
||||||
|
@ -6499,7 +6499,7 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
case CLUTTER_BUTTON_PRESS:
|
case CLUTTER_BUTTON_PRESS:
|
||||||
{
|
{
|
||||||
ClutterModifierType grab_mods = meta_display_get_window_grab_modifiers (window->display);
|
ClutterModifierType grab_mods = meta_display_get_compositor_modifiers (window->display);
|
||||||
|
|
||||||
/* This is the keybinding or menu case where we've
|
/* This is the keybinding or menu case where we've
|
||||||
* been dragging around the window without the button
|
* been dragging around the window without the button
|
||||||
@ -8426,7 +8426,7 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
|
|||||||
* care about. Just let the event through.
|
* care about. Just let the event through.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
grab_mods = meta_display_get_window_grab_modifiers (display);
|
grab_mods = meta_display_get_compositor_modifiers (display);
|
||||||
event_mods = clutter_event_get_state (event);
|
event_mods = clutter_event_get_state (event);
|
||||||
unmodified = (event_mods & grab_mods) == 0;
|
unmodified = (event_mods & grab_mods) == 0;
|
||||||
source = clutter_event_get_source_device (event);
|
source = clutter_event_get_source_device (event);
|
||||||
|
@ -170,6 +170,9 @@ guint meta_display_get_keybinding_action (MetaDisplay *display,
|
|||||||
unsigned int keycode,
|
unsigned int keycode,
|
||||||
unsigned long mask);
|
unsigned long mask);
|
||||||
|
|
||||||
|
META_EXPORT
|
||||||
|
ClutterModifierType meta_display_get_compositor_modifiers (MetaDisplay *display);
|
||||||
|
|
||||||
META_EXPORT
|
META_EXPORT
|
||||||
GSList *meta_display_sort_windows_by_stacking (MetaDisplay *display,
|
GSList *meta_display_sort_windows_by_stacking (MetaDisplay *display,
|
||||||
GSList *windows);
|
GSList *windows);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user