[Spice-devel] [PATCH spice-gtk 3/4] spicy: add toggle mouse mode menu
Marc-André Lureau
marcandre.lureau at redhat.com
Mon Nov 9 06:02:09 PST 2015
This is just for testing, the UI could be different in better clients.
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
src/spicy.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/spicy.c b/src/spicy.c
index 4de56d9..a5e974b 100644
--- a/src/spicy.c
+++ b/src/spicy.c
@@ -356,6 +356,21 @@ static void menu_cb_remove_smartcard(GtkAction *action, void *data)
}
#endif
+static void menu_cb_mouse_mode(GtkAction *action, void *data)
+{
+ SpiceWindow *win = data;
+ SpiceMainChannel *cmain = win->conn->main;
+ int mode;
+
+ g_object_get(cmain, "mouse-mode", &mode, NULL);
+ if (mode == SPICE_MOUSE_MODE_CLIENT)
+ mode = SPICE_MOUSE_MODE_SERVER;
+ else
+ mode = SPICE_MOUSE_MODE_CLIENT;
+
+ spice_main_request_mouse_mode(cmain, mode);
+}
+
#ifdef USE_USBREDIR
static void remove_cb(GtkContainer *container, GtkWidget *widget, void *data)
{
@@ -692,6 +707,12 @@ static const GtkActionEntry entries[] = {
},{
#endif
+ .name = "MouseMode",
+ .label = "Toggle _mouse mode",
+ .callback = G_CALLBACK(menu_cb_mouse_mode),
+ .accelerator = "<shift>F7",
+
+ },{
/* Help menu */
.name = "About",
.stock_id = GTK_STOCK_ABOUT,
@@ -783,6 +804,7 @@ static char ui_xml[] =
" <menu action='OptionMenu'>\n"
" <menuitem action='grab-keyboard'/>\n"
" <menuitem action='grab-mouse'/>\n"
+" <menuitem action='MouseMode'/>\n"
" <menuitem action='resize-guest'/>\n"
" <menuitem action='scaling'/>\n"
" <menuitem action='disable-inputs'/>\n"
--
2.5.0
More information about the Spice-devel
mailing list