[Spice-devel] [PATCH spice-gtk] spicy: show the correct ungrab key combination
Christophe Fergeau
cfergeau at redhat.com
Wed Oct 17 02:33:51 PDT 2012
On Tue, Oct 16, 2012 at 06:19:41PM +0200, Marc-André Lureau wrote:
> 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.
"Also" hints that this should be split in 2 separate commits.
>
> 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);
I'd change that to g_strdup_printf as the message can be translated, the
grabbing sequence can be configured, ... so we don't have much control over
the status string length
> } 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",
> - },{
I was wondering why you were removing the menu entry, but when the mouse in
grabbed, the user can't get to the menu, so it's indeed not very useful.
ACK.
Christophe
> #ifdef USE_SMARTCARD
> .name = "InsertSmartcard",
> .label = N_("_Insert Smartcard"),
> --
> 1.7.11.7
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20121017/56a8b063/attachment.pgp>
More information about the Spice-devel
mailing list