[Spice-devel] [PATCH spice-gtk] spicy: show the correct ungrab key combination
Marc-André Lureau
marcandre.lureau at gmail.com
Tue Oct 16 09:19:41 PDT 2012
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
More information about the Spice-devel
mailing list