Codebase list virt-viewer / db827de
Add a --shared / -s flag for shared session access By default when connecting with VNC, an existing viewer will be kicked off. This adds a --shared / -s flag which tells the server we are willing the share the session with other clients. This is wired up for VNC only. https://bugzilla.redhat.com/show_bug.cgi?id=1060425 Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Daniel P. Berrangé 3 years ago
7 changed file(s) with 40 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
5656 =item -t TITLE, --title TITLE
5757
5858 Set the window title to B<TITLE>
59
60 =item -s, --shared
61
62 Permitted a shared session with multiple clients
5963
6064 =item --debug
6165
7777 To specify which client monitors are used in fullscreen mode, see the
7878 CONFIGURATION section below.
7979
80 =item -s, --shared
81
82 Permitted a shared session with multiple clients
83
8084 =item --debug
8185
8286 Print debugging information
106106
107107 static gchar **opt_args = NULL;
108108 static char *opt_title = NULL;
109 static gboolean opt_shared = FALSE;
109110
110111 static void
111112 remote_viewer_add_option_entries(VirtViewerApp *self, GOptionContext *context, GOptionGroup *group)
113114 static const GOptionEntry options[] = {
114115 { "title", 't', 0, G_OPTION_ARG_STRING, &opt_title,
115116 N_("Set window title"), NULL },
117 { "shared", 's', 0, G_OPTION_ARG_NONE, &opt_shared,
118 N_("Share client session"), NULL },
116119 { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &opt_args,
117120 NULL, "URI|VV-FILE" },
118121 { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
156159 if (opt_title)
157160 g_object_set(app, "title", opt_title, NULL);
158161
159 end:
162 virt_viewer_app_set_shared(app, opt_shared);
163
164 end:
160165 if (ret && *status)
161166 g_printerr(_("Run '%s --help' to see a full list of available command line options\n"), g_get_prgname());
162167
132132 gboolean started;
133133 gboolean fullscreen;
134134 gboolean attach;
135 gboolean shared;
135136 gboolean quitting;
136137 gboolean kiosk;
137138 gboolean vm_ui;
24762477 return self->priv->attach;
24772478 }
24782479
2480 void
2481 virt_viewer_app_set_shared(VirtViewerApp *self, gboolean shared)
2482 {
2483 g_return_if_fail(VIRT_VIEWER_IS_APP(self));
2484
2485 self->priv->shared = shared;
2486 }
2487
2488 gboolean
2489 virt_viewer_app_get_shared(VirtViewerApp *self)
2490 {
2491 g_return_val_if_fail(VIRT_VIEWER_IS_APP(self), FALSE);
2492
2493 return self->priv->shared;
2494 }
2495
24792496 gboolean
24802497 virt_viewer_app_is_active(VirtViewerApp *self)
24812498 {
7979 void virt_viewer_app_set_hotkeys(VirtViewerApp *self, const gchar *hotkeys);
8080 void virt_viewer_app_set_attach(VirtViewerApp *self, gboolean attach);
8181 gboolean virt_viewer_app_get_attach(VirtViewerApp *self);
82 void virt_viewer_app_set_shared(VirtViewerApp *self, gboolean shared);
83 gboolean virt_viewer_app_get_shared(VirtViewerApp *self);
8284 gboolean virt_viewer_app_has_session(VirtViewerApp *self);
8385 void virt_viewer_app_set_connect_info(VirtViewerApp *self,
8486 const gchar *host,
422422 g_object_ref_sink(session->priv->vnc);
423423 session->priv->main_window = g_object_ref(main_window);
424424
425 vnc_display_set_shared_flag(session->priv->vnc,
426 virt_viewer_app_get_shared(app));
427
425428 g_signal_connect(session->priv->vnc, "vnc-connected",
426429 G_CALLBACK(virt_viewer_session_vnc_connected), session);
427430 g_signal_connect(session->priv->vnc, "vnc-initialized",
8282 static gboolean opt_attach = FALSE;
8383 static gboolean opt_waitvm = FALSE;
8484 static gboolean opt_reconnect = FALSE;
85 static gboolean opt_shared = FALSE;
8586
8687 typedef enum {
8788 DOMAIN_SELECTION_ID = (1 << 0),
142143 N_("Select the virtual machine only by its ID"), NULL },
143144 { "uuid", '\0', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, opt_domain_selection_cb,
144145 N_("Select the virtual machine only by its UUID"), NULL },
146 { "shared", 's', 0, G_OPTION_ARG_NONE, &opt_shared,
147 N_("Share client session"), NULL },
145148 { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &opt_args,
146149 NULL, "-- ID|UUID|DOMAIN-NAME" },
147150 { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
191194
192195 virt_viewer_app_set_direct(app, opt_direct);
193196 virt_viewer_app_set_attach(app, opt_attach);
197 virt_viewer_app_set_shared(app, opt_shared);
194198 self->priv->reconnect = opt_reconnect;
195199 self->priv->uri = g_strdup(opt_uri);
196200