[PATCH spice-gtk] spicy: show the correct ungrab key combination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The gtk accelerator for ungrab is useless, since it has to be handled
by the spice widget only. It could be useful to still show the ungrab
key sequence in the menu (for help), but unfortunately, spice-gtk grab
sequence syntax is not the same as gtk accelerator syntax, and that
would be needlessly complicated to handle.

Also correctly show the configured sequence in the status bar when the
widget has the grab.

https://bugzilla.redhat.com/show_bug.cgi?id=851090
---
 gtk/spicy.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/gtk/spicy.c b/gtk/spicy.c
index 6390b79..7064736 100644
--- a/gtk/spicy.c
+++ b/gtk/spicy.c
@@ -310,7 +310,10 @@ static void update_status_window(SpiceWindow *win)
     if (win == NULL)
         return;
     if (win->mouse_grabbed) {
-        snprintf(status, sizeof(status), _("Use Shift+F12 to ungrab mouse."));
+        SpiceGrabSequence *sequence = spice_display_get_grab_keys(SPICE_DISPLAY(win->spice));
+        gchar *seq = spice_grab_sequence_as_string(sequence);
+        snprintf(status, sizeof(status), _("Use %s to ungrab mouse."), seq);
+        g_free(seq);
     } else {
         snprintf(status, sizeof(status), _("mouse: %s, agent: %s"),
                  win->conn->mouse_state, win->conn->agent_state);
@@ -415,13 +418,6 @@ static void menu_cb_fullscreen(GtkAction *action, void *data)
     window_set_fullscreen(win, !win->fullscreen);
 }
 
-static void menu_cb_ungrab(GtkAction *action, void *data)
-{
-    SpiceWindow *win = data;
-
-    spice_display_mouse_ungrab(SPICE_DISPLAY(win->spice));
-}
-
 #ifdef USE_SMARTCARD
 static void enable_smartcard_actions(SpiceWindow *win, VReader *reader,
                                      gboolean can_insert, gboolean can_remove)
@@ -795,13 +791,6 @@ static const GtkActionEntry entries[] = {
         .callback    = G_CALLBACK(menu_cb_fullscreen),
         .accelerator = "<shift>F11",
     },{
-
-        /* Input menu */
-        .name        = "UngrabMouse",
-        .label       = N_("_Ungrab mouse"),
-        .callback    = G_CALLBACK(menu_cb_ungrab),
-        .accelerator = "<shift>F12",
-    },{
 #ifdef USE_SMARTCARD
 	.name        = "InsertSmartcard",
 	.label       = N_("_Insert Smartcard"),
-- 
1.7.11.7

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]