[Spice-devel] [PATCH spice-gtk 19/25] spicy: disable display when deleting window
Marc-André Lureau
marcandre.lureau at gmail.com
Thu Jul 12 15:29:16 PDT 2012
---
gtk/spicy.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/gtk/spicy.c b/gtk/spicy.c
index ac2088e..44b5c2c 100644
--- a/gtk/spicy.c
+++ b/gtk/spicy.c
@@ -96,6 +96,7 @@ G_DEFINE_TYPE (SpiceWindow, spice_window, G_TYPE_OBJECT);
struct spice_connection {
SpiceSession *session;
SpiceGtkSession *gtk_session;
+ SpiceMainChannel *main;
SpiceWindow *wins[CHANNELID_MAX * MONITORID_MAX];
SpiceAudio *audio;
const char *mouse_state;
@@ -116,6 +117,7 @@ static void usb_connect_failed(GObject *object,
GError *error,
gpointer data);
static gboolean is_gtk_session_property(const gchar *property);
+static void del_window(spice_connection *conn, SpiceWindow *win);
/* options */
static gboolean fullscreen = false;
@@ -560,7 +562,11 @@ static gboolean delete_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
{
SpiceWindow *win = data;
- connection_disconnect(win->conn);
+ if (win->monitor_id == 0)
+ connection_disconnect(win->conn);
+ else
+ del_window(win->conn, win);
+
return true;
}
@@ -1529,6 +1535,12 @@ static void del_window(spice_connection *conn, SpiceWindow *win)
g_debug("del display monitor %d:%d", win->id, win->monitor_id);
conn->wins[win->id * CHANNELID_MAX + win->monitor_id] = NULL;
+ if (win->id > 0)
+ spice_main_set_display_enabled(conn->main, win->id, FALSE);
+ else
+ spice_main_set_display_enabled(conn->main, win->monitor_id, FALSE);
+ spice_main_send_monitor_config(conn->main);
+
destroy_spice_window(win);
}
@@ -1575,6 +1587,7 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data)
if (SPICE_IS_MAIN_CHANNEL(channel)) {
SPICE_DEBUG("new main channel");
+ conn->main = SPICE_MAIN_CHANNEL(channel);
g_signal_connect(channel, "channel-event",
G_CALLBACK(main_channel_event), conn);
g_signal_connect(channel, "main-mouse-update",
@@ -1620,6 +1633,7 @@ static void channel_destroy(SpiceSession *s, SpiceChannel *channel, gpointer dat
g_object_get(channel, "channel-id", &id, NULL);
if (SPICE_IS_MAIN_CHANNEL(channel)) {
SPICE_DEBUG("zap main channel");
+ conn->main = NULL;
}
if (SPICE_IS_DISPLAY_CHANNEL(channel)) {
--
1.7.10.4
More information about the Spice-devel
mailing list