[Spice-commits] doc/reference src/map-file src/spice-gtk-sym-file src/spice-widget.c src/spice-widget.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 12 13:13:40 UTC 2021


 doc/reference/spice-gtk-sections.txt |    1 +
 src/map-file                         |    1 +
 src/spice-gtk-sym-file               |    1 +
 src/spice-widget.c                   |   18 +++++++++++++++++-
 src/spice-widget.h                   |    1 +
 5 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit ea81b97f742f1a899222ae3ed92e5b433253542e
Author: Paul Donohue <git at PaulSD.com>
Date:   Sun Apr 4 10:24:15 2021 -0400

    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

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
@@ -3516,6 +3517,21 @@ SpiceDisplay* spice_display_new_with_monitor(SpiceSession *session, gint channel
                         NULL);
 }
 
+/**
+ * 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);


More information about the Spice-commits mailing list