~ubuntu-branches/ubuntu/feisty/vino/feisty-proposed

« back to all changes in this revision

Viewing changes to debian/patches/01_no_client_on_hold_loop.patch

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2006-05-04 22:46:26 UTC
  • Revision ID: james.westby@ubuntu.com-20060504224626-2pvxi3cx33xktm5b
Tags: 2.13.5-0ubuntu6
* debian/patches/01_no_client_on_hold_loop.patch:
  - patch by Gary Coady <gary@lyranthe.org>
  - The IO socket for clients on hold should not be included in the
    GTK main loop. Ubuntu: #31037

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--- vino-2.13.5.orig/server/vino-server.c
 
2
+++ vino-2.13.5/server/vino-server.c
 
3
@@ -201,39 +201,6 @@
 
4
   return TRUE;
 
5
 }
 
6
 
 
7
-static void
 
8
-vino_server_set_client_on_hold (VinoServer            *server,
 
9
-                               VinoServerClientInfo  *client,
 
10
-                               gboolean               on_hold)
 
11
-{
 
12
-  rfbClientPtr rfb_client = client->rfb_client;
 
13
-
 
14
-  dprintf (RFB, "Setting client '%s' on hold: %s\n",
 
15
-          rfb_client->host, on_hold ? "(true)" : "(false)");
 
16
-
 
17
-  rfb_client->onHold = on_hold;
 
18
-
 
19
-  /* We don't process any pending data from an client which is
 
20
-   * on hold, so don't let it starve the rest of the mainloop.
 
21
-   */
 
22
-  g_source_set_priority (g_main_context_find_source_by_id (NULL, client->io_watch),
 
23
-                        on_hold ? G_PRIORITY_LOW : G_PRIORITY_DEFAULT);
 
24
-
 
25
-  if (!on_hold)
 
26
-    {
 
27
-      if (!client->update_timeout)
 
28
-       client->update_timeout = g_timeout_add (50,
 
29
-                                               (GSourceFunc) vino_server_update_client_timeout,
 
30
-                                               rfb_client);
 
31
-    }
 
32
-  else
 
33
-    {
 
34
-      if (client->update_timeout)
 
35
-       g_source_remove (client->update_timeout);
 
36
-      client->update_timeout = 0;
 
37
-    }
 
38
-}
 
39
-
 
40
 static inline gboolean
 
41
 more_data_pending (int fd)
 
42
 {
 
43
@@ -257,6 +224,51 @@
 
44
   return vino_server_update_client (rfb_client);
 
45
 }
 
46
 
 
47
+static void
 
48
+vino_server_set_client_on_hold (VinoServer            *server,
 
49
+                               VinoServerClientInfo  *client,
 
50
+                               gboolean               on_hold)
 
51
+{
 
52
+  rfbClientPtr rfb_client = client->rfb_client;
 
53
+
 
54
+  dprintf (RFB, "Setting client '%s' on hold: %s\n",
 
55
+          rfb_client->host, on_hold ? "(true)" : "(false)");
 
56
+
 
57
+  rfb_client->onHold = on_hold;
 
58
+
 
59
+  if (on_hold)
 
60
+  {
 
61
+    if (client->io_watch)
 
62
+    {
 
63
+      g_source_remove(client->io_watch);
 
64
+      client->io_watch = 0;
 
65
+    }
 
66
+
 
67
+    if (client->update_timeout)
 
68
+    {
 
69
+      g_source_remove (client->update_timeout);
 
70
+      client->update_timeout = 0;
 
71
+    }
 
72
+  }
 
73
+  else
 
74
+  {
 
75
+    if (!client->io_watch)
 
76
+    {
 
77
+      client->io_watch = g_io_add_watch (client->io_channel,
 
78
+                                       G_IO_IN|G_IO_PRI,
 
79
+                                       (GIOFunc) vino_server_client_data_pending,
 
80
+                                       rfb_client);
 
81
+    }
 
82
+
 
83
+    if (!client->update_timeout)
 
84
+    {
 
85
+      client->update_timeout = g_timeout_add (50,
 
86
+                                       (GSourceFunc) vino_server_update_client_timeout,
 
87
+                                       rfb_client);
 
88
+    }
 
89
+  }
 
90
+}
 
91
+
 
92
 static enum rfbNewClientAction
 
93
 vino_server_handle_new_client (rfbClientPtr rfb_client)
 
94
 {
 
95
@@ -280,11 +292,6 @@
 
96
 
 
97
   client->io_channel = g_io_channel_unix_new (rfb_client->sock);
 
98
 
 
99
-  client->io_watch = g_io_add_watch (client->io_channel,
 
100
-                                    G_IO_IN|G_IO_PRI,
 
101
-                                    (GIOFunc) vino_server_client_data_pending,
 
102
-                                    rfb_client);
 
103
-
 
104
   server->priv->clients = g_slist_prepend (server->priv->clients, client);
 
105
 
 
106
   vino_server_set_client_on_hold (server, client, server->priv->on_hold);