diff options
author | Paul Donohue <git@PaulSD.com> | 2021-04-04 10:24:15 -0400 |
---|---|---|
committer | Paul Donohue <git@PaulSD.com> | 2021-04-10 08:53:34 -0400 |
commit | ea81b97f742f1a899222ae3ed92e5b433253542e (patch) | |
tree | b1f85aedc568b42f3222d714e505d22ad8d4ed05 | |
parent | c83d09ba103c88f0690ad514c7786072fa0c3ca5 (diff) |
spice-widget: add spice_display_keyboard_ungrab()
Internally, spice-widget has separate try_keyboard_ungrab() and
try_mouse_ungrab() functions to ungrab the keyboard and mouse
respectively. Both of these functions are called when the grab
sequence is pressed.
spice-widget exposes try_mouse_ungrab() as spice_display_mouse_ungrab()
to allow callers to explicitly ungrab. However, it does not currently
expose try_keyboard_ungrab(), so callers can only ungrab the mouse and
cannot ungrab the keyboard.
Correct this by exposing try_keyboard_ungrab() as
spice_display_keyboard_ungrab().
Fixes #73
-rw-r--r-- | doc/reference/spice-gtk-sections.txt | 1 | ||||
-rw-r--r-- | src/map-file | 1 | ||||
-rw-r--r-- | src/spice-gtk-sym-file | 1 | ||||
-rw-r--r-- | src/spice-widget.c | 18 | ||||
-rw-r--r-- | src/spice-widget.h | 1 |
5 files changed, 21 insertions, 1 deletions
diff --git a/doc/reference/spice-gtk-sections.txt b/doc/reference/spice-gtk-sections.txt index 33f4038..d5a7d58 100644 --- a/doc/reference/spice-gtk-sections.txt +++ b/doc/reference/spice-gtk-sections.txt @@ -404,6 +404,7 @@ SpiceDisplayClass SpiceDisplayKeyEvent spice_display_new spice_display_new_with_monitor +spice_display_keyboard_ungrab spice_display_mouse_ungrab spice_display_set_grab_keys spice_display_get_grab_keys diff --git a/src/map-file b/src/map-file index bb85702..2dbb0d0 100644 --- a/src/map-file +++ b/src/map-file @@ -37,6 +37,7 @@ spice_display_get_primary; spice_display_get_type; spice_display_gl_draw_done; spice_display_key_event_get_type; +spice_display_keyboard_ungrab; spice_display_mouse_ungrab; spice_display_new; spice_display_new_with_monitor; diff --git a/src/spice-gtk-sym-file b/src/spice-gtk-sym-file index e52334b..5ba57cb 100644 --- a/src/spice-gtk-sym-file +++ b/src/spice-gtk-sym-file @@ -2,6 +2,7 @@ spice_display_get_grab_keys spice_display_get_pixbuf spice_display_get_type spice_display_key_event_get_type +spice_display_keyboard_ungrab spice_display_mouse_ungrab spice_display_new spice_display_new_with_monitor diff --git a/src/spice-widget.c b/src/spice-widget.c index 50824bf..7ee02a8 100644 --- a/src/spice-widget.c +++ b/src/spice-widget.c @@ -73,7 +73,8 @@ * The widget will optionally grab the keyboard and the mouse when * focused if the properties #SpiceDisplay:grab-keyboard and * #SpiceDisplay:grab-mouse are #TRUE respectively. It can be - * ungrabbed with spice_display_mouse_ungrab(), and by setting a key + * ungrabbed with spice_display_keyboard_ungrab() and + * spice_display_mouse_ungrab(), and by setting a key * combination with spice_display_set_grab_keys(). * * Finally, spice_display_get_pixbuf() will take a screenshot of the @@ -3517,6 +3518,21 @@ SpiceDisplay* spice_display_new_with_monitor(SpiceSession *session, gint channel } /** + * spice_display_keyboard_ungrab: + * @display: a #SpiceDisplay + * + * Ungrab the keyboard. + * + * Since: 0.40 + **/ +void spice_display_keyboard_ungrab(SpiceDisplay *display) +{ + g_return_if_fail(SPICE_IS_DISPLAY(display)); + + try_keyboard_ungrab(display); +} + +/** * spice_display_mouse_ungrab: * @display: a #SpiceDisplay * diff --git a/src/spice-widget.h b/src/spice-widget.h index e0b1fb3..60a7514 100644 --- a/src/spice-widget.h +++ b/src/spice-widget.h @@ -73,6 +73,7 @@ GType spice_display_get_type(void); SpiceDisplay* spice_display_new(SpiceSession *session, int channel_id); SpiceDisplay* spice_display_new_with_monitor(SpiceSession *session, gint channel_id, gint monitor_id); +void spice_display_keyboard_ungrab(SpiceDisplay *display); void spice_display_mouse_ungrab(SpiceDisplay *display); void spice_display_set_grab_keys(SpiceDisplay *display, SpiceGrabSequence *seq); SpiceGrabSequence *spice_display_get_grab_keys(SpiceDisplay *display); |