base:navigation: Cleanup navigation key modifiers enum

We were exposing the 'ALT' modifier as if we were guaranteeing its
accuracy but truth is we were only exposing configuration dependent
values.

Make the API simpler for now, the same way as Gtk3 was exposing it, and
when we have time to guarantee more values by making them take backends
configuration into account, we will expose those values in a accurate
way.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1402

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3565>
This commit is contained in:
Thibault Saunier 2022-12-13 12:23:56 +01:00 committed by GStreamer Marge Bot
parent e59b3c93c7
commit f7b342f1dd
5 changed files with 24 additions and 7 deletions

View file

@ -3345,7 +3345,11 @@
"GST_NAVIGATION_MESSAGE_EVENT",
"GST_NAVIGATION_MESSAGE_INVALID",
"GST_NAVIGATION_MESSAGE_MOUSE_OVER",
"GST_NAVIGATION_MODIFIER_ALT_MASK",
"GST_NAVIGATION_MODIFIER_MOD1_MASK",
"GST_NAVIGATION_MODIFIER_MOD2_MASK",
"GST_NAVIGATION_MODIFIER_MOD3_MASK",
"GST_NAVIGATION_MODIFIER_MOD4_MASK",
"GST_NAVIGATION_MODIFIER_MOD5_MASK",
"GST_NAVIGATION_MODIFIER_BUTTON1_MASK",
"GST_NAVIGATION_MODIFIER_BUTTON2_MASK",
"GST_NAVIGATION_MODIFIER_BUTTON3_MASK",

View file

@ -578,7 +578,7 @@ _gst_modifiers_to_wpe (GstEvent * ev)
modifiers |= wpe_input_keyboard_modifier_control;
if (modifier_state & GST_NAVIGATION_MODIFIER_SHIFT_MASK)
modifiers |= wpe_input_keyboard_modifier_shift;
if (modifier_state & GST_NAVIGATION_MODIFIER_ALT_MASK)
if (modifier_state & GST_NAVIGATION_MODIFIER_MOD1_MASK)
modifiers |= wpe_input_keyboard_modifier_alt;
if (modifier_state & GST_NAVIGATION_MODIFIER_META_MASK)
modifiers |= wpe_input_keyboard_modifier_meta;

View file

@ -44,7 +44,11 @@ typedef struct _GstNavigationInterface GstNavigationInterface;
* GstNavigationModifierType:
* @GST_NAVIGATION_MODIFIER_SHIFT_MASK: the Shift key.
* @GST_NAVIGATION_MODIFIER_CONTROL_MASK: the Control key.
* @GST_NAVIGATION_MODIFIER_ALT_MASK: the fourth modifier key
* @GST_NAVIGATION_MODIFIER_MOD1_MASK: the third modifier key
* @GST_NAVIGATION_MODIFIER_MOD2_MASK: the fourth modifier key
* @GST_NAVIGATION_MODIFIER_MOD3_MASK: the fifth modifier key
* @GST_NAVIGATION_MODIFIER_MOD4_MASK: the sixth modifier key
* @GST_NAVIGATION_MODIFIER_MOD5_MASK: the seventh modifier key
* @GST_NAVIGATION_MODIFIER_BUTTON1_MASK: the first mouse button (usually the left button).
* @GST_NAVIGATION_MODIFIER_BUTTON2_MASK: the second mouse button (usually the right button).
* @GST_NAVIGATION_MODIFIER_BUTTON3_MASK: the third mouse button (usually the mouse wheel button or middle button).
@ -69,7 +73,12 @@ typedef enum
GST_NAVIGATION_MODIFIER_SHIFT_MASK = 1 << 0,
GST_NAVIGATION_MODIFIER_LOCK_MASK = 1 << 1,
GST_NAVIGATION_MODIFIER_CONTROL_MASK = 1 << 2,
GST_NAVIGATION_MODIFIER_ALT_MASK = 1 << 3,
GST_NAVIGATION_MODIFIER_MOD1_MASK = 1 << 3,
GST_NAVIGATION_MODIFIER_MOD2_MASK = 1 << 4,
GST_NAVIGATION_MODIFIER_MOD3_MASK = 1 << 5,
GST_NAVIGATION_MODIFIER_MOD4_MASK = 1 << 6,
GST_NAVIGATION_MODIFIER_MOD5_MASK = 1 << 7,
GST_NAVIGATION_MODIFIER_BUTTON1_MASK = 1 << 8,
GST_NAVIGATION_MODIFIER_BUTTON2_MASK = 1 << 9,
@ -86,7 +95,11 @@ typedef enum
GST_NAVIGATION_MODIFIER_SHIFT_MASK |
GST_NAVIGATION_MODIFIER_LOCK_MASK |
GST_NAVIGATION_MODIFIER_CONTROL_MASK |
GST_NAVIGATION_MODIFIER_ALT_MASK |
GST_NAVIGATION_MODIFIER_MOD1_MASK |
GST_NAVIGATION_MODIFIER_MOD2_MASK |
GST_NAVIGATION_MODIFIER_MOD3_MASK |
GST_NAVIGATION_MODIFIER_MOD4_MASK |
GST_NAVIGATION_MODIFIER_MOD5_MASK |
GST_NAVIGATION_MODIFIER_BUTTON1_MASK |
GST_NAVIGATION_MODIFIER_BUTTON2_MASK |
GST_NAVIGATION_MODIFIER_BUTTON3_MASK |

View file

@ -436,7 +436,7 @@ translateModifiers(Qt::KeyboardModifiers modifiers)
return (GstNavigationModifierType)(
((modifiers & Qt::KeyboardModifier::ShiftModifier) ? GST_NAVIGATION_MODIFIER_SHIFT_MASK : 0) |
((modifiers & Qt::KeyboardModifier::ControlModifier) ? GST_NAVIGATION_MODIFIER_CONTROL_MASK : 0) |
((modifiers & Qt::KeyboardModifier::AltModifier) ? GST_NAVIGATION_MODIFIER_ALT_MASK : 0) |
((modifiers & Qt::KeyboardModifier::AltModifier) ? GST_NAVIGATION_MODIFIER_MOD1_MASK : 0) |
((modifiers & Qt::KeyboardModifier::MetaModifier) ? GST_NAVIGATION_MODIFIER_META_MASK : 0));
}

View file

@ -419,7 +419,7 @@ translateModifiers(Qt::KeyboardModifiers modifiers)
return (GstNavigationModifierType)(
((modifiers & Qt::KeyboardModifier::ShiftModifier) ? GST_NAVIGATION_MODIFIER_SHIFT_MASK : 0) |
((modifiers & Qt::KeyboardModifier::ControlModifier) ? GST_NAVIGATION_MODIFIER_CONTROL_MASK : 0) |
((modifiers & Qt::KeyboardModifier::AltModifier) ? GST_NAVIGATION_MODIFIER_ALT_MASK : 0) |
((modifiers & Qt::KeyboardModifier::AltModifier) ? GST_NAVIGATION_MODIFIER_MOD1_MASK : 0) |
((modifiers & Qt::KeyboardModifier::MetaModifier) ? GST_NAVIGATION_MODIFIER_META_MASK : 0));
}