Merge lp:~rcryderman/awn/multi-panel-intellihide into lp:awn/0.4
- multi-panel-intellihide
- Merge into trunk
Proposed by
moonbeam
Status: | Superseded |
---|---|
Proposed branch: | lp:~rcryderman/awn/multi-panel-intellihide |
Merge into: | lp:awn/0.4 |
Diff against target: |
1269 lines (+711/-160) 7 files modified
applets/taskmanager/Makefile.am (+2/-0) applets/taskmanager/awn-applet-taskmanager.schema-ini.in (+0/-10) applets/taskmanager/task-manager-panel-connector.c (+358/-0) applets/taskmanager/task-manager-panel-connector.h (+44/-0) applets/taskmanager/task-manager.c (+293/-145) data/avant-window-navigator.schema-ini.in.in (+5/-0) src/awn-app.vala (+9/-5) |
To merge this branch: | bzr merge lp:~rcryderman/awn/multi-panel-intellihide |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michal Hruby (community) | Approve | ||
Review via email: mp+39189@code.launchpad.net |
This proposal has been superseded by a proposal from 2010-10-25.
Commit message
Description of the change
Not perfect but I'd like to get this into trunk so it gets some testing.
To post a comment you must log in.
- 769. By moonbeam
-
* applets/
taskmanager/ task-manager- panel-connector .c:
* applets/taskmanager/ task-manager. c:
Fixes. removed source, removed a notify - 770. By moonbeam
-
* applets/
taskmanager/ task-manager- panel-connector .c:
Suppress debug's due to panel connector not recognizing all the
exported properties of panel.
Revision history for this message
moonbeam (rcryderman) wrote : | # |
> Few comments:
> Please get rid of 304, and also the other occurrences of priv->source.
> 96: Will cause lots of criticals because panel has properties which
> PanelConnector doesn't.
> 664: Make sure you remove the notification on panel removed signal.
Done.
Revision history for this message
Michal Hruby (mhr3) : | # |
review:
Approve
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'applets/taskmanager/Makefile.am' | |||
2 | --- applets/taskmanager/Makefile.am 2010-09-09 23:55:56 +0000 | |||
3 | +++ applets/taskmanager/Makefile.am 2010-10-25 13:06:06 +0000 | |||
4 | @@ -67,6 +67,8 @@ | |||
5 | 67 | task-manager-api-wrapper.c \ | 67 | task-manager-api-wrapper.c \ |
6 | 68 | task-manager-api-wrapper.h \ | 68 | task-manager-api-wrapper.h \ |
7 | 69 | task-manager-api-wrapper-glue.h \ | 69 | task-manager-api-wrapper-glue.h \ |
8 | 70 | task-manager-panel-connector.c \ | ||
9 | 71 | task-manager-panel-connector.h \ | ||
10 | 70 | task-settings.c \ | 72 | task-settings.c \ |
11 | 71 | task-settings.h \ | 73 | task-settings.h \ |
12 | 72 | task-window.c \ | 74 | task-window.c \ |
13 | 73 | 75 | ||
14 | === modified file 'applets/taskmanager/awn-applet-taskmanager.schema-ini.in' | |||
15 | --- applets/taskmanager/awn-applet-taskmanager.schema-ini.in 2010-10-22 18:33:54 +0000 | |||
16 | +++ applets/taskmanager/awn-applet-taskmanager.schema-ini.in 2010-10-25 13:06:06 +0000 | |||
17 | @@ -63,16 +63,6 @@ | |||
18 | 63 | default = false | 63 | default = false |
19 | 64 | _description= Allow grouping of windows together that have different WM_CLIENT_NAME values. | 64 | _description= Allow grouping of windows together that have different WM_CLIENT_NAME values. |
20 | 65 | 65 | ||
21 | 66 | [DEFAULT/intellihide] | ||
22 | 67 | type = boolean | ||
23 | 68 | default = true | ||
24 | 69 | _description=Intellihide if hide is enabled for the panel. This will inhibit autohide of the panel if there are no intersecting windows in the relevant window list (see intellihide_mode). | ||
25 | 70 | |||
26 | 71 | [DEFAULT/intellihide_mode] | ||
27 | 72 | type = integer | ||
28 | 73 | default = 1 | ||
29 | 74 | _description=How to generate the list of windows tested for intersection when Intellihide is active. 0.. use windows on active workspace, 1.. use windows of currently focused app. | ||
30 | 75 | |||
31 | 76 | [DEFAULT/launcher_paths] | 66 | [DEFAULT/launcher_paths] |
32 | 77 | type = list-string | 67 | type = list-string |
33 | 78 | default = /usr/share/applications/firefox.desktop; | 68 | default = /usr/share/applications/firefox.desktop; |
34 | 79 | 69 | ||
35 | === added file 'applets/taskmanager/task-manager-panel-connector.c' | |||
36 | --- applets/taskmanager/task-manager-panel-connector.c 1970-01-01 00:00:00 +0000 | |||
37 | +++ applets/taskmanager/task-manager-panel-connector.c 2010-10-25 13:06:06 +0000 | |||
38 | @@ -0,0 +1,358 @@ | |||
39 | 1 | /* task-manager-panel-connector.c */ | ||
40 | 2 | |||
41 | 3 | #include <dbus/dbus-glib.h> | ||
42 | 4 | #include <dbus/dbus-glib-bindings.h> | ||
43 | 5 | #include <unistd.h> | ||
44 | 6 | #include <stdlib.h> | ||
45 | 7 | #include <string.h> | ||
46 | 8 | #include <glib/gstdio.h> | ||
47 | 9 | #include <glib/gi18n.h> | ||
48 | 10 | #include <X11/Xlib.h> | ||
49 | 11 | #include <math.h> | ||
50 | 12 | |||
51 | 13 | #include "libawn/awn-defines.h" | ||
52 | 14 | #include "libawn/libawn-marshal.h" | ||
53 | 15 | |||
54 | 16 | #include "task-manager-panel-connector.h" | ||
55 | 17 | |||
56 | 18 | #ifdef HAVE_CONFIG_H | ||
57 | 19 | #include <config.h> | ||
58 | 20 | #endif | ||
59 | 21 | |||
60 | 22 | |||
61 | 23 | G_DEFINE_TYPE (TaskManagerPanelConnector, task_manager_panel_connector, G_TYPE_OBJECT) | ||
62 | 24 | |||
63 | 25 | #define GET_PRIVATE(o) \ | ||
64 | 26 | (G_TYPE_INSTANCE_GET_PRIVATE ((o), TASK_MANAGER_TYPE_PANEL_CONNECTOR, TaskManagerPanelConnectorPrivate)) | ||
65 | 27 | |||
66 | 28 | typedef struct _TaskManagerPanelConnectorPrivate TaskManagerPanelConnectorPrivate; | ||
67 | 29 | |||
68 | 30 | struct _TaskManagerPanelConnectorPrivate | ||
69 | 31 | { | ||
70 | 32 | gint panel_id; | ||
71 | 33 | gint64 panel_xid; | ||
72 | 34 | |||
73 | 35 | DBusGConnection *connection; | ||
74 | 36 | DBusGProxy *proxy; | ||
75 | 37 | }; | ||
76 | 38 | |||
77 | 39 | |||
78 | 40 | enum | ||
79 | 41 | { | ||
80 | 42 | PROP_0, | ||
81 | 43 | PROP_PANEL_ID, | ||
82 | 44 | PROP_PANEL_XID, | ||
83 | 45 | }; | ||
84 | 46 | |||
85 | 47 | |||
86 | 48 | |||
87 | 49 | static void | ||
88 | 50 | on_prop_changed (DBusGProxy *proxy, const gchar *prop_name, | ||
89 | 51 | GValue *value, TaskManagerPanelConnector * conn) | ||
90 | 52 | { | ||
91 | 53 | TaskManagerPanelConnectorPrivate * priv; | ||
92 | 54 | g_return_if_fail (TASK_MANAGER_IS_PANEL_CONNECTOR (conn)); | ||
93 | 55 | priv = GET_PRIVATE(conn); | ||
94 | 56 | |||
95 | 57 | g_object_set_property (G_OBJECT (conn), prop_name, value); | ||
96 | 58 | } | ||
97 | 59 | |||
98 | 60 | |||
99 | 61 | static void | ||
100 | 62 | task_manager_panel_connector_get_property (GObject *object, guint property_id, | ||
101 | 63 | GValue *value, GParamSpec *pspec) | ||
102 | 64 | { | ||
103 | 65 | TaskManagerPanelConnectorPrivate * priv = GET_PRIVATE(object); | ||
104 | 66 | switch (property_id) | ||
105 | 67 | { | ||
106 | 68 | case PROP_PANEL_ID: | ||
107 | 69 | g_value_set_int (value, priv->panel_id); | ||
108 | 70 | break; | ||
109 | 71 | |||
110 | 72 | case PROP_PANEL_XID: | ||
111 | 73 | g_value_set_int64 (value, priv->panel_xid); | ||
112 | 74 | break; | ||
113 | 75 | default: | ||
114 | 76 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
115 | 77 | } | ||
116 | 78 | } | ||
117 | 79 | |||
118 | 80 | static void | ||
119 | 81 | task_manager_panel_connector_set_property (GObject *object, guint property_id, | ||
120 | 82 | const GValue *value, GParamSpec *pspec) | ||
121 | 83 | { | ||
122 | 84 | TaskManagerPanelConnectorPrivate * priv = GET_PRIVATE(object); | ||
123 | 85 | switch (property_id) | ||
124 | 86 | { | ||
125 | 87 | case PROP_PANEL_ID: | ||
126 | 88 | priv->panel_id = g_value_get_int (value); | ||
127 | 89 | break; | ||
128 | 90 | #ifdef DEBUG | ||
129 | 91 | /*Debug'd out. Remove this if TaskManagerPanelConnector ever becomes a generic object that | ||
130 | 92 | supports all the props in panel*/ | ||
131 | 93 | default: | ||
132 | 94 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | ||
133 | 95 | #endif | ||
134 | 96 | } | ||
135 | 97 | } | ||
136 | 98 | |||
137 | 99 | static void | ||
138 | 100 | task_manager_panel_connector_dispose (GObject *object) | ||
139 | 101 | { | ||
140 | 102 | G_OBJECT_CLASS (task_manager_panel_connector_parent_class)->dispose (object); | ||
141 | 103 | } | ||
142 | 104 | |||
143 | 105 | static void | ||
144 | 106 | task_manager_panel_connector_finalize (GObject *object) | ||
145 | 107 | { | ||
146 | 108 | TaskManagerPanelConnectorPrivate * priv = GET_PRIVATE(object); | ||
147 | 109 | if (priv->connection) | ||
148 | 110 | { | ||
149 | 111 | if (priv->proxy) | ||
150 | 112 | { | ||
151 | 113 | g_object_unref (priv->proxy); | ||
152 | 114 | } | ||
153 | 115 | dbus_g_connection_unref (priv->connection); | ||
154 | 116 | priv->connection = NULL; | ||
155 | 117 | priv->proxy = NULL; | ||
156 | 118 | } | ||
157 | 119 | |||
158 | 120 | G_OBJECT_CLASS (task_manager_panel_connector_parent_class)->finalize (object); | ||
159 | 121 | } | ||
160 | 122 | |||
161 | 123 | static void | ||
162 | 124 | task_manager_panel_connector_init (TaskManagerPanelConnector *self) | ||
163 | 125 | { | ||
164 | 126 | TaskManagerPanelConnectorPrivate * priv = GET_PRIVATE(self); | ||
165 | 127 | GError *error = NULL; | ||
166 | 128 | |||
167 | 129 | priv->connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); | ||
168 | 130 | priv->proxy = NULL; | ||
169 | 131 | priv->panel_xid = 0; | ||
170 | 132 | |||
171 | 133 | if (error) | ||
172 | 134 | { | ||
173 | 135 | g_warning ("%s", error->message); | ||
174 | 136 | g_error_free(error); | ||
175 | 137 | } | ||
176 | 138 | } | ||
177 | 139 | |||
178 | 140 | static gboolean | ||
179 | 141 | task_manager_panel_connector_do_connect_dbus (GObject * conn) | ||
180 | 142 | { | ||
181 | 143 | TaskManagerPanelConnectorPrivate * priv = GET_PRIVATE(conn); | ||
182 | 144 | |||
183 | 145 | gchar *object_path = g_strdup_printf ("/org/awnproject/Awn/Panel%d", | ||
184 | 146 | priv->panel_id); | ||
185 | 147 | if (!priv->proxy) | ||
186 | 148 | { | ||
187 | 149 | priv->proxy = dbus_g_proxy_new_for_name (priv->connection, | ||
188 | 150 | "org.awnproject.Awn", | ||
189 | 151 | object_path, | ||
190 | 152 | "org.awnproject.Awn.Panel"); | ||
191 | 153 | } | ||
192 | 154 | if (!priv->proxy) | ||
193 | 155 | { | ||
194 | 156 | g_warning("Could not connect to mothership! Bailing\n"); | ||
195 | 157 | return TRUE; | ||
196 | 158 | } | ||
197 | 159 | |||
198 | 160 | dbus_g_object_register_marshaller ( | ||
199 | 161 | libawn_marshal_VOID__STRING_BOXED, | ||
200 | 162 | G_TYPE_NONE, G_TYPE_STRING, G_TYPE_VALUE, | ||
201 | 163 | G_TYPE_INVALID | ||
202 | 164 | ); | ||
203 | 165 | |||
204 | 166 | dbus_g_proxy_add_signal (priv->proxy, "PropertyChanged", | ||
205 | 167 | G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); | ||
206 | 168 | dbus_g_proxy_connect_signal (priv->proxy, "PropertyChanged", | ||
207 | 169 | G_CALLBACK (on_prop_changed), conn, | ||
208 | 170 | NULL); | ||
209 | 171 | // get prop values from Panel | ||
210 | 172 | DBusGProxy *prop_proxy = dbus_g_proxy_new_from_proxy ( | ||
211 | 173 | priv->proxy, "org.freedesktop.DBus.Properties", NULL | ||
212 | 174 | ); | ||
213 | 175 | |||
214 | 176 | if (!prop_proxy) | ||
215 | 177 | { | ||
216 | 178 | g_warning("Could not get property values! Bailing\n"); | ||
217 | 179 | } | ||
218 | 180 | |||
219 | 181 | GError *error = NULL; | ||
220 | 182 | |||
221 | 183 | #if HAVE_DBUS_GLIB_080 | ||
222 | 184 | GHashTable *all_props = NULL; | ||
223 | 185 | |||
224 | 186 | // doing GetAll reduces DBus lag significantly | ||
225 | 187 | dbus_g_proxy_call (prop_proxy, "GetAll", &error, | ||
226 | 188 | G_TYPE_STRING, "org.awnproject.Awn.Panel", | ||
227 | 189 | G_TYPE_INVALID, | ||
228 | 190 | dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, | ||
229 | 191 | G_TYPE_VALUE), &all_props, | ||
230 | 192 | G_TYPE_INVALID); | ||
231 | 193 | |||
232 | 194 | if (error) goto crap_out; | ||
233 | 195 | |||
234 | 196 | GHashTableIter iter; | ||
235 | 197 | gpointer key, value; | ||
236 | 198 | |||
237 | 199 | g_hash_table_iter_init (&iter, all_props); | ||
238 | 200 | while (g_hash_table_iter_next (&iter, &key, &value)) | ||
239 | 201 | { | ||
240 | 202 | if (strcmp (key, "PanelXid") == 0) | ||
241 | 203 | { | ||
242 | 204 | priv->panel_xid = g_value_get_int64 (value); | ||
243 | 205 | } | ||
244 | 206 | } | ||
245 | 207 | |||
246 | 208 | #else | ||
247 | 209 | GValue panel_xid = {0,}; | ||
248 | 210 | |||
249 | 211 | dbus_g_proxy_call (prop_proxy, "Get", &error, | ||
250 | 212 | G_TYPE_STRING, "org.awnproject.Awn.Panel", | ||
251 | 213 | G_TYPE_STRING, "PanelXid", | ||
252 | 214 | G_TYPE_INVALID, | ||
253 | 215 | G_TYPE_VALUE, &panel_xid, | ||
254 | 216 | G_TYPE_INVALID); | ||
255 | 217 | |||
256 | 218 | if (error) goto crap_out; | ||
257 | 219 | |||
258 | 220 | if (G_VALUE_HOLDS_INT64 (&panel_xid)) | ||
259 | 221 | { | ||
260 | 222 | priv->panel_xid = g_value_get_int64 (&panel_xid); | ||
261 | 223 | } | ||
262 | 224 | |||
263 | 225 | g_value_unset (&panel_xid); | ||
264 | 226 | #endif | ||
265 | 227 | if (prop_proxy) g_object_unref (prop_proxy); | ||
266 | 228 | |||
267 | 229 | g_free (object_path); | ||
268 | 230 | return FALSE; | ||
269 | 231 | |||
270 | 232 | crap_out: | ||
271 | 233 | |||
272 | 234 | g_warning ("%s", error->message); | ||
273 | 235 | g_error_free (error); | ||
274 | 236 | g_free (object_path); | ||
275 | 237 | if (prop_proxy) | ||
276 | 238 | { | ||
277 | 239 | g_object_unref (prop_proxy); | ||
278 | 240 | } | ||
279 | 241 | return TRUE; | ||
280 | 242 | } | ||
281 | 243 | |||
282 | 244 | static void | ||
283 | 245 | task_manager_panel_connector_constructed (GObject *obj) | ||
284 | 246 | { | ||
285 | 247 | TaskManagerPanelConnector *conn = TASK_MANAGER_PANEL_CONNECTOR(obj); | ||
286 | 248 | TaskManagerPanelConnectorPrivate *priv = GET_PRIVATE(conn); | ||
287 | 249 | |||
288 | 250 | if (priv->panel_id > 0) | ||
289 | 251 | { | ||
290 | 252 | task_manager_panel_connector_do_connect_dbus (obj); | ||
291 | 253 | } | ||
292 | 254 | } | ||
293 | 255 | |||
294 | 256 | static void | ||
295 | 257 | task_manager_panel_connector_class_init (TaskManagerPanelConnectorClass *klass) | ||
296 | 258 | { | ||
297 | 259 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
298 | 260 | |||
299 | 261 | object_class->get_property = task_manager_panel_connector_get_property; | ||
300 | 262 | object_class->set_property = task_manager_panel_connector_set_property; | ||
301 | 263 | object_class->dispose = task_manager_panel_connector_dispose; | ||
302 | 264 | object_class->finalize = task_manager_panel_connector_finalize; | ||
303 | 265 | object_class->constructed = task_manager_panel_connector_constructed; | ||
304 | 266 | |||
305 | 267 | g_object_class_install_property (object_class, | ||
306 | 268 | PROP_PANEL_ID, | ||
307 | 269 | g_param_spec_int ("panel-id", | ||
308 | 270 | "Panel ID", | ||
309 | 271 | "The id of AwnPanel this connector connects to", | ||
310 | 272 | 0, G_MAXINT, 0, | ||
311 | 273 | G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | | ||
312 | 274 | G_PARAM_STATIC_STRINGS)); | ||
313 | 275 | |||
314 | 276 | g_object_class_install_property ( object_class, | ||
315 | 277 | PROP_PANEL_XID, | ||
316 | 278 | g_param_spec_int64 ("panel-xid", | ||
317 | 279 | "Panel XID", | ||
318 | 280 | "The XID of AwnPanel this connector is connected to", | ||
319 | 281 | G_MININT64, G_MAXINT64, 0, | ||
320 | 282 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); | ||
321 | 283 | |||
322 | 284 | g_type_class_add_private (klass, sizeof (TaskManagerPanelConnectorPrivate)); | ||
323 | 285 | } | ||
324 | 286 | |||
325 | 287 | TaskManagerPanelConnector* | ||
326 | 288 | task_manager_panel_connector_new (gint id) | ||
327 | 289 | { | ||
328 | 290 | return g_object_new (TASK_MANAGER_TYPE_PANEL_CONNECTOR, | ||
329 | 291 | "panel_id",id, | ||
330 | 292 | NULL); | ||
331 | 293 | } | ||
332 | 294 | |||
333 | 295 | guint | ||
334 | 296 | task_manager_panel_connector_inhibit_autohide (TaskManagerPanelConnector *conn, const gchar *reason) | ||
335 | 297 | { | ||
336 | 298 | TaskManagerPanelConnectorPrivate *priv; | ||
337 | 299 | GError *error = NULL; | ||
338 | 300 | guint ret = 0; | ||
339 | 301 | |||
340 | 302 | g_return_val_if_fail (TASK_MANAGER_IS_PANEL_CONNECTOR (conn), 0); | ||
341 | 303 | priv = GET_PRIVATE(conn); | ||
342 | 304 | |||
343 | 305 | if (!priv->proxy) | ||
344 | 306 | { | ||
345 | 307 | return 0; | ||
346 | 308 | } | ||
347 | 309 | |||
348 | 310 | gchar *app_name = g_strdup_printf ("%s:%d", g_get_prgname(), getpid()); | ||
349 | 311 | |||
350 | 312 | dbus_g_proxy_call (priv->proxy, "InhibitAutohide", | ||
351 | 313 | &error, | ||
352 | 314 | G_TYPE_STRING, app_name, | ||
353 | 315 | G_TYPE_STRING, reason, | ||
354 | 316 | G_TYPE_INVALID, | ||
355 | 317 | G_TYPE_UINT, &ret, | ||
356 | 318 | G_TYPE_INVALID); | ||
357 | 319 | |||
358 | 320 | if (app_name) g_free (app_name); | ||
359 | 321 | |||
360 | 322 | if (error) | ||
361 | 323 | { | ||
362 | 324 | g_warning ("%s", error->message); | ||
363 | 325 | g_error_free (error); | ||
364 | 326 | } | ||
365 | 327 | |||
366 | 328 | return ret; | ||
367 | 329 | } | ||
368 | 330 | |||
369 | 331 | void | ||
370 | 332 | task_manager_panel_connector_uninhibit_autohide (TaskManagerPanelConnector *conn, guint cookie) | ||
371 | 333 | { | ||
372 | 334 | TaskManagerPanelConnectorPrivate *priv; | ||
373 | 335 | GError *error = NULL; | ||
374 | 336 | |||
375 | 337 | g_return_if_fail (TASK_MANAGER_IS_PANEL_CONNECTOR (conn)); | ||
376 | 338 | priv = GET_PRIVATE(conn); | ||
377 | 339 | |||
378 | 340 | if (!priv->proxy) | ||
379 | 341 | { | ||
380 | 342 | return; | ||
381 | 343 | } | ||
382 | 344 | |||
383 | 345 | dbus_g_proxy_call (priv->proxy, "UninhibitAutohide", | ||
384 | 346 | &error, | ||
385 | 347 | G_TYPE_UINT, cookie, | ||
386 | 348 | G_TYPE_INVALID, | ||
387 | 349 | G_TYPE_INVALID); | ||
388 | 350 | |||
389 | 351 | if (error) | ||
390 | 352 | { | ||
391 | 353 | g_warning ("%s", error->message); | ||
392 | 354 | g_error_free (error); | ||
393 | 355 | } | ||
394 | 356 | } | ||
395 | 357 | |||
396 | 358 | |||
397 | 0 | 359 | ||
398 | === added file 'applets/taskmanager/task-manager-panel-connector.h' | |||
399 | --- applets/taskmanager/task-manager-panel-connector.h 1970-01-01 00:00:00 +0000 | |||
400 | +++ applets/taskmanager/task-manager-panel-connector.h 2010-10-25 13:06:06 +0000 | |||
401 | @@ -0,0 +1,44 @@ | |||
402 | 1 | /* task-manager-panel-connector.h */ | ||
403 | 2 | |||
404 | 3 | #ifndef _TASK_MANAGER_PANEL_CONNECTOR | ||
405 | 4 | #define _TASK_MANAGER_PANEL_CONNECTOR | ||
406 | 5 | |||
407 | 6 | #include <glib-object.h> | ||
408 | 7 | |||
409 | 8 | G_BEGIN_DECLS | ||
410 | 9 | |||
411 | 10 | #define TASK_MANAGER_TYPE_PANEL_CONNECTOR task_manager_panel_connector_get_type() | ||
412 | 11 | |||
413 | 12 | #define TASK_MANAGER_PANEL_CONNECTOR(obj) \ | ||
414 | 13 | (G_TYPE_CHECK_INSTANCE_CAST ((obj), TASK_MANAGER_TYPE_PANEL_CONNECTOR, TaskManagerPanelConnector)) | ||
415 | 14 | |||
416 | 15 | #define TASK_MANAGER_PANEL_CONNECTOR_CLASS(klass) \ | ||
417 | 16 | (G_TYPE_CHECK_CLASS_CAST ((klass), TASK_MANAGER_TYPE_PANEL_CONNECTOR, TaskManagerPanelConnectorClass)) | ||
418 | 17 | |||
419 | 18 | #define TASK_MANAGER_IS_PANEL_CONNECTOR(obj) \ | ||
420 | 19 | (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TASK_MANAGER_TYPE_PANEL_CONNECTOR)) | ||
421 | 20 | |||
422 | 21 | #define TASK_MANAGER_IS_PANEL_CONNECTOR_CLASS(klass) \ | ||
423 | 22 | (G_TYPE_CHECK_CLASS_TYPE ((klass), TASK_MANAGER_TYPE_PANEL_CONNECTOR)) | ||
424 | 23 | |||
425 | 24 | #define TASK_MANAGER_PANEL_CONNECTOR_GET_CLASS(obj) \ | ||
426 | 25 | (G_TYPE_INSTANCE_GET_CLASS ((obj), TASK_MANAGER_TYPE_PANEL_CONNECTOR, TaskManagerPanelConnectorClass)) | ||
427 | 26 | |||
428 | 27 | typedef struct { | ||
429 | 28 | GObject parent; | ||
430 | 29 | } TaskManagerPanelConnector; | ||
431 | 30 | |||
432 | 31 | typedef struct { | ||
433 | 32 | GObjectClass parent_class; | ||
434 | 33 | } TaskManagerPanelConnectorClass; | ||
435 | 34 | |||
436 | 35 | GType task_manager_panel_connector_get_type (void); | ||
437 | 36 | |||
438 | 37 | guint task_manager_panel_connector_inhibit_autohide (TaskManagerPanelConnector *conn, const gchar *reason); | ||
439 | 38 | void task_manager_panel_connector_uninhibit_autohide (TaskManagerPanelConnector *conn, guint cookie); | ||
440 | 39 | |||
441 | 40 | TaskManagerPanelConnector* task_manager_panel_connector_new (gint id); | ||
442 | 41 | |||
443 | 42 | G_END_DECLS | ||
444 | 43 | |||
445 | 44 | #endif /* _TASK_MANAGER_PANEL_CONNECTOR */ | ||
446 | 0 | 45 | ||
447 | === modified file 'applets/taskmanager/task-manager.c' | |||
448 | --- applets/taskmanager/task-manager.c 2010-07-19 22:28:12 +0000 | |||
449 | +++ applets/taskmanager/task-manager.c 2010-10-25 13:06:06 +0000 | |||
450 | @@ -47,6 +47,8 @@ | |||
451 | 47 | #include "libawn/awn-pixbuf-cache.h" | 47 | #include "libawn/awn-pixbuf-cache.h" |
452 | 48 | #include "awn-desktop-lookup-cached.h" | 48 | #include "awn-desktop-lookup-cached.h" |
453 | 49 | #include "task-manager.h" | 49 | #include "task-manager.h" |
454 | 50 | #include "task-manager-panel-connector.h" | ||
455 | 51 | |||
456 | 50 | #include "dock-manager-api.h" | 52 | #include "dock-manager-api.h" |
457 | 51 | 53 | ||
458 | 52 | #include "task-drag-indicator.h" | 54 | #include "task-drag-indicator.h" |
459 | @@ -69,20 +71,26 @@ | |||
460 | 69 | 71 | ||
461 | 70 | static GQuark win_quark = 0; | 72 | static GQuark win_quark = 0; |
462 | 71 | 73 | ||
463 | 74 | typedef struct | ||
464 | 75 | { | ||
465 | 76 | DesktopAgnosticConfigClient *panel_instance_client; | ||
466 | 77 | GdkWindow * foreign_window; | ||
467 | 78 | GdkRegion * foreign_region; | ||
468 | 79 | TaskManagerPanelConnector * connector; | ||
469 | 80 | gint intellihide_mode; | ||
470 | 81 | guint autohide_cookie; | ||
471 | 82 | } TaskManagerAwnPanelInfo; | ||
472 | 83 | |||
473 | 72 | struct _TaskManagerPrivate | 84 | struct _TaskManagerPrivate |
474 | 73 | { | 85 | { |
475 | 74 | DesktopAgnosticConfigClient *client; | 86 | DesktopAgnosticConfigClient *client; |
476 | 87 | |||
477 | 88 | DBusGConnection *connection; | ||
478 | 89 | DBusGProxy *proxy; | ||
479 | 90 | |||
480 | 75 | TaskSettings *settings; | 91 | TaskSettings *settings; |
481 | 76 | WnckScreen *screen; | 92 | WnckScreen *screen; |
482 | 77 | 93 | ||
483 | 78 | /*Used by Intellihide*/ | ||
484 | 79 | guint autohide_cookie; | ||
485 | 80 | GdkWindow *awn_gdk_window; | ||
486 | 81 | GdkRegion * awn_gdk_region; | ||
487 | 82 | |||
488 | 83 | guint attention_cookie; | ||
489 | 84 | guint attention_source; | ||
490 | 85 | |||
491 | 86 | /* Dragging properties */ | 94 | /* Dragging properties */ |
492 | 87 | TaskIcon *dragged_icon; | 95 | TaskIcon *dragged_icon; |
493 | 88 | TaskDragIndicator *drag_indicator; | 96 | TaskDragIndicator *drag_indicator; |
494 | @@ -97,19 +105,23 @@ | |||
495 | 97 | 105 | ||
496 | 98 | GHashTable *win_table; | 106 | GHashTable *win_table; |
497 | 99 | GHashTable *desktops_table; | 107 | GHashTable *desktops_table; |
498 | 108 | GHashTable *intellihide_panel_instances; | ||
499 | 109 | |||
500 | 100 | /* | 110 | /* |
501 | 101 | Used during grouping configuration changes for optimization purposes | 111 | Used during grouping configuration changes for optimization purposes |
502 | 102 | */ | 112 | */ |
503 | 103 | GList *grouping_list; | 113 | GList *grouping_list; |
504 | 104 | /* Properties */ | 114 | /* Properties */ |
505 | 105 | GValueArray *launcher_paths; | 115 | GValueArray *launcher_paths; |
506 | 116 | |||
507 | 117 | guint attention_cookie; | ||
508 | 118 | guint attention_source; | ||
509 | 119 | |||
510 | 106 | gboolean show_all_windows; | 120 | gboolean show_all_windows; |
511 | 107 | gboolean only_show_launchers; | 121 | gboolean only_show_launchers; |
512 | 108 | gboolean drag_and_drop; | 122 | gboolean drag_and_drop; |
513 | 109 | gboolean grouping; | 123 | gboolean grouping; |
514 | 110 | gboolean intellihide; | ||
515 | 111 | gboolean icon_grouping; | 124 | gboolean icon_grouping; |
516 | 112 | gint intellihide_mode; | ||
517 | 113 | gint match_strength; | 125 | gint match_strength; |
518 | 114 | gint attention_autohide_timer; | 126 | gint attention_autohide_timer; |
519 | 115 | 127 | ||
520 | @@ -128,6 +140,7 @@ | |||
521 | 128 | 140 | ||
522 | 129 | enum | 141 | enum |
523 | 130 | { | 142 | { |
524 | 143 | INTELLIHIDE_NONE, | ||
525 | 131 | INTELLIHIDE_WORKSPACE, | 144 | INTELLIHIDE_WORKSPACE, |
526 | 132 | INTELLIHIDE_APP, | 145 | INTELLIHIDE_APP, |
527 | 133 | INTELLIHIDE_GROUP | 146 | INTELLIHIDE_GROUP |
528 | @@ -144,11 +157,8 @@ | |||
529 | 144 | PROP_GROUPING, | 157 | PROP_GROUPING, |
530 | 145 | PROP_ICON_GROUPING, | 158 | PROP_ICON_GROUPING, |
531 | 146 | PROP_MATCH_STRENGTH, | 159 | PROP_MATCH_STRENGTH, |
532 | 147 | PROP_INTELLIHIDE, | ||
533 | 148 | PROP_INTELLIHIDE_MODE, | ||
534 | 149 | PROP_ATTENTION_AUTOHIDE_TIMER, | 160 | PROP_ATTENTION_AUTOHIDE_TIMER, |
537 | 150 | PROP_ATTENTION_REQUIRED_REMINDER, | 161 | PROP_ATTENTION_REQUIRED_REMINDER |
536 | 151 | PROP_ATTENTION_REQUIED_REMINDER_ID | ||
538 | 152 | }; | 162 | }; |
539 | 153 | 163 | ||
540 | 154 | 164 | ||
541 | @@ -205,6 +215,10 @@ | |||
542 | 205 | static void task_manager_active_workspace_changed_cb (WnckScreen *screen, | 215 | static void task_manager_active_workspace_changed_cb (WnckScreen *screen, |
543 | 206 | WnckWorkspace *previous_space, | 216 | WnckWorkspace *previous_space, |
544 | 207 | TaskManager * manager); | 217 | TaskManager * manager); |
545 | 218 | static void task_manager_check_for_intersection (TaskManager * manager, | ||
546 | 219 | WnckWorkspace * space, | ||
547 | 220 | WnckApplication * app); | ||
548 | 221 | |||
549 | 208 | static void task_manager_win_geom_changed_cb (WnckWindow *window, | 222 | static void task_manager_win_geom_changed_cb (WnckWindow *window, |
550 | 209 | TaskManager * manager); | 223 | TaskManager * manager); |
551 | 210 | static void task_manager_win_closed_cb (WnckScreen *screen, | 224 | static void task_manager_win_closed_cb (WnckScreen *screen, |
552 | @@ -219,6 +233,11 @@ | |||
553 | 219 | 233 | ||
554 | 220 | static gboolean _attention_required_reminder_cb (TaskManager * manager); | 234 | static gboolean _attention_required_reminder_cb (TaskManager * manager); |
555 | 221 | 235 | ||
556 | 236 | static void task_manager_intellihide_change_cb (const char* group, | ||
557 | 237 | const char* key, | ||
558 | 238 | GValue* value, | ||
559 | 239 | int * user_data); | ||
560 | 240 | |||
561 | 222 | typedef enum | 241 | typedef enum |
562 | 223 | { | 242 | { |
563 | 224 | TASK_MANAGER_ERROR_UNSUPPORTED_WINDOW_TYPE, | 243 | TASK_MANAGER_ERROR_UNSUPPORTED_WINDOW_TYPE, |
564 | @@ -282,14 +301,6 @@ | |||
565 | 282 | g_value_set_boolean (value, manager->priv->icon_grouping); | 301 | g_value_set_boolean (value, manager->priv->icon_grouping); |
566 | 283 | break; | 302 | break; |
567 | 284 | 303 | ||
568 | 285 | case PROP_INTELLIHIDE: | ||
569 | 286 | g_value_set_boolean (value, manager->priv->intellihide); | ||
570 | 287 | break; | ||
571 | 288 | |||
572 | 289 | case PROP_INTELLIHIDE_MODE: | ||
573 | 290 | g_value_set_int (value, manager->priv->intellihide_mode); | ||
574 | 291 | break; | ||
575 | 292 | |||
576 | 293 | case PROP_MATCH_STRENGTH: | 304 | case PROP_MATCH_STRENGTH: |
577 | 294 | g_value_set_int (value, manager->priv->match_strength); | 305 | g_value_set_int (value, manager->priv->match_strength); |
578 | 295 | break; | 306 | break; |
579 | @@ -315,6 +326,8 @@ | |||
580 | 315 | { | 326 | { |
581 | 316 | TaskManager *manager = TASK_MANAGER (object); | 327 | TaskManager *manager = TASK_MANAGER (object); |
582 | 317 | 328 | ||
583 | 329 | g_return_if_fail (TASK_IS_MANAGER (object)); | ||
584 | 330 | |||
585 | 318 | switch (prop_id) | 331 | switch (prop_id) |
586 | 319 | { | 332 | { |
587 | 320 | case PROP_SHOW_ALL_WORKSPACES: | 333 | case PROP_SHOW_ALL_WORKSPACES: |
588 | @@ -351,25 +364,7 @@ | |||
589 | 351 | case PROP_ICON_GROUPING: | 364 | case PROP_ICON_GROUPING: |
590 | 352 | manager->priv->icon_grouping = g_value_get_boolean (value); | 365 | manager->priv->icon_grouping = g_value_get_boolean (value); |
591 | 353 | break; | 366 | break; |
611 | 354 | 367 | ||
593 | 355 | case PROP_INTELLIHIDE: | ||
594 | 356 | /* TODO move into a function */ | ||
595 | 357 | manager->priv->intellihide = g_value_get_boolean (value); | ||
596 | 358 | if (!manager->priv->intellihide && manager->priv->autohide_cookie) | ||
597 | 359 | { | ||
598 | 360 | awn_applet_uninhibit_autohide (AWN_APPLET(manager), manager->priv->autohide_cookie); | ||
599 | 361 | manager->priv->autohide_cookie = 0; | ||
600 | 362 | } | ||
601 | 363 | if (manager->priv->intellihide && !manager->priv->autohide_cookie) | ||
602 | 364 | { | ||
603 | 365 | manager->priv->autohide_cookie = awn_applet_inhibit_autohide (AWN_APPLET(manager),"Intellihide" ); | ||
604 | 366 | } | ||
605 | 367 | break; | ||
606 | 368 | |||
607 | 369 | case PROP_INTELLIHIDE_MODE: | ||
608 | 370 | manager->priv->intellihide_mode = g_value_get_int (value); | ||
609 | 371 | break; | ||
610 | 372 | |||
612 | 373 | case PROP_ATTENTION_AUTOHIDE_TIMER: | 368 | case PROP_ATTENTION_AUTOHIDE_TIMER: |
613 | 374 | manager->priv->attention_autohide_timer = g_value_get_int (value); | 369 | manager->priv->attention_autohide_timer = g_value_get_int (value); |
614 | 375 | break; | 370 | break; |
615 | @@ -395,16 +390,108 @@ | |||
616 | 395 | } | 390 | } |
617 | 396 | 391 | ||
618 | 397 | static void | 392 | static void |
619 | 393 | _delete_panel_info_cb (TaskManagerAwnPanelInfo * panel_info) | ||
620 | 394 | { | ||
621 | 395 | g_object_unref (panel_info->connector); | ||
622 | 396 | g_free (panel_info); | ||
623 | 397 | } | ||
624 | 398 | |||
625 | 399 | static void | ||
626 | 400 | _on_panel_added (DBusGProxy *proxy,guint panel_id,TaskManager *applet) | ||
627 | 401 | { | ||
628 | 402 | TaskManagerPrivate *priv = TASK_MANAGER_GET_PRIVATE (applet); | ||
629 | 403 | GError * error = NULL; | ||
630 | 404 | TaskManagerAwnPanelInfo * panel_info = NULL; | ||
631 | 405 | gchar * uid = g_strdup_printf("-999%d",panel_id); | ||
632 | 406 | |||
633 | 407 | g_assert (!g_hash_table_lookup (priv->intellihide_panel_instances,GINT_TO_POINTER (panel_id))); | ||
634 | 408 | panel_info = g_malloc0 (sizeof (TaskManagerAwnPanelInfo) ); | ||
635 | 409 | panel_info->connector = task_manager_panel_connector_new (panel_id); | ||
636 | 410 | g_free (uid); | ||
637 | 411 | panel_info->panel_instance_client = awn_config_get_default (panel_id, NULL); | ||
638 | 412 | panel_info->intellihide_mode = desktop_agnostic_config_client_get_int ( | ||
639 | 413 | panel_info->panel_instance_client, | ||
640 | 414 | "panel", | ||
641 | 415 | "intellihide_mode", | ||
642 | 416 | &error); | ||
643 | 417 | if (error) | ||
644 | 418 | { | ||
645 | 419 | g_debug ("%s: error accessing intellihide_mode. \"%s\"",__func__,error->message); | ||
646 | 420 | g_error_free (error); | ||
647 | 421 | error = NULL; | ||
648 | 422 | } | ||
649 | 423 | desktop_agnostic_config_client_notify_add (panel_info->panel_instance_client, | ||
650 | 424 | "panel", | ||
651 | 425 | "intellihide_mode", | ||
652 | 426 | (DesktopAgnosticConfigNotifyFunc)task_manager_intellihide_change_cb, | ||
653 | 427 | &panel_info->intellihide_mode, | ||
654 | 428 | &error); | ||
655 | 429 | if (error) | ||
656 | 430 | { | ||
657 | 431 | g_debug ("%s: error binding intellihide_mode. \"%s\"",__func__,error->message); | ||
658 | 432 | g_error_free (error); | ||
659 | 433 | error = NULL; | ||
660 | 434 | } | ||
661 | 435 | |||
662 | 436 | if (!panel_info->intellihide_mode && panel_info->autohide_cookie) | ||
663 | 437 | { | ||
664 | 438 | task_manager_panel_connector_uninhibit_autohide (panel_info->connector, panel_info->autohide_cookie); | ||
665 | 439 | panel_info->autohide_cookie = 0; | ||
666 | 440 | } | ||
667 | 441 | if (panel_info->intellihide_mode && !panel_info->autohide_cookie) | ||
668 | 442 | { | ||
669 | 443 | panel_info->autohide_cookie = task_manager_panel_connector_inhibit_autohide (panel_info->connector,"Intellihide" ); | ||
670 | 444 | } | ||
671 | 445 | |||
672 | 446 | g_hash_table_insert (priv->intellihide_panel_instances,GINT_TO_POINTER(panel_id),panel_info); | ||
673 | 447 | } | ||
674 | 448 | |||
675 | 449 | static void | ||
676 | 450 | _on_panel_removed (DBusGProxy *proxy,guint panel_id,TaskManager * applet) | ||
677 | 451 | { | ||
678 | 452 | TaskManagerPrivate *priv = TASK_MANAGER_GET_PRIVATE (applet); | ||
679 | 453 | TaskManagerAwnPanelInfo * panel_info = g_hash_table_lookup (priv->intellihide_panel_instances,GINT_TO_POINTER (panel_id)); | ||
680 | 454 | |||
681 | 455 | desktop_agnostic_config_client_remove_instance (panel_info->panel_instance_client); | ||
682 | 456 | g_assert (g_hash_table_remove (priv->intellihide_panel_instances,GINT_TO_POINTER (panel_id))); | ||
683 | 457 | } | ||
684 | 458 | |||
685 | 459 | static void | ||
686 | 398 | task_manager_constructed (GObject *object) | 460 | task_manager_constructed (GObject *object) |
687 | 399 | { | 461 | { |
688 | 400 | TaskManagerPrivate *priv; | 462 | TaskManagerPrivate *priv; |
689 | 401 | GtkWidget *widget; | 463 | GtkWidget *widget; |
690 | 464 | GError *error=NULL; | ||
691 | 465 | GStrv panel_paths; | ||
692 | 402 | 466 | ||
693 | 403 | G_OBJECT_CLASS (task_manager_parent_class)->constructed (object); | 467 | G_OBJECT_CLASS (task_manager_parent_class)->constructed (object); |
694 | 404 | 468 | ||
695 | 405 | priv = TASK_MANAGER_GET_PRIVATE (object); | 469 | priv = TASK_MANAGER_GET_PRIVATE (object); |
696 | 406 | widget = GTK_WIDGET (object); | 470 | widget = GTK_WIDGET (object); |
697 | 407 | 471 | ||
698 | 472 | priv->proxy = dbus_g_proxy_new_for_name (priv->connection, | ||
699 | 473 | "org.awnproject.Awn", | ||
700 | 474 | "/org/awnproject/Awn", | ||
701 | 475 | "org.awnproject.Awn.App"); | ||
702 | 476 | if (!priv->proxy) | ||
703 | 477 | { | ||
704 | 478 | g_warning("%s: Could not connect to mothership!\n",__func__); | ||
705 | 479 | } | ||
706 | 480 | else | ||
707 | 481 | { | ||
708 | 482 | dbus_g_proxy_add_signal (priv->proxy, "PanelAdded", | ||
709 | 483 | G_TYPE_INT, G_TYPE_INVALID); | ||
710 | 484 | dbus_g_proxy_add_signal (priv->proxy, "PanelRemoved", | ||
711 | 485 | G_TYPE_INT, G_TYPE_INVALID); | ||
712 | 486 | dbus_g_proxy_connect_signal (priv->proxy, "PanelAdded", | ||
713 | 487 | G_CALLBACK (_on_panel_added), object, | ||
714 | 488 | NULL); | ||
715 | 489 | dbus_g_proxy_connect_signal (priv->proxy, "PanelRemoved", | ||
716 | 490 | G_CALLBACK (_on_panel_removed), object, | ||
717 | 491 | NULL); | ||
718 | 492 | |||
719 | 493 | } | ||
720 | 494 | |||
721 | 408 | /* | 495 | /* |
722 | 409 | Set the cache size of our AwnPixbufCache to something a bit bigger. | 496 | Set the cache size of our AwnPixbufCache to something a bit bigger. |
723 | 410 | 497 | ||
724 | @@ -415,9 +502,12 @@ | |||
725 | 415 | NULL); | 502 | NULL); |
726 | 416 | 503 | ||
727 | 417 | priv->desktops_table = g_hash_table_new_full (g_str_hash,g_str_equal,g_free,g_free); | 504 | priv->desktops_table = g_hash_table_new_full (g_str_hash,g_str_equal,g_free,g_free); |
728 | 505 | priv->intellihide_panel_instances = g_hash_table_new_full (g_direct_hash,g_direct_equal, | ||
729 | 506 | NULL, | ||
730 | 507 | (GDestroyNotify)_delete_panel_info_cb); | ||
731 | 418 | 508 | ||
732 | 419 | priv->client = awn_config_get_default_for_applet (AWN_APPLET (object), NULL); | 509 | priv->client = awn_config_get_default_for_applet (AWN_APPLET (object), NULL); |
734 | 420 | 510 | ||
735 | 421 | /* Connect up the important bits */ | 511 | /* Connect up the important bits */ |
736 | 422 | desktop_agnostic_config_client_bind (priv->client, | 512 | desktop_agnostic_config_client_bind (priv->client, |
737 | 423 | DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT, | 513 | DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT, |
738 | @@ -454,21 +544,9 @@ | |||
739 | 454 | "icon_grouping", | 544 | "icon_grouping", |
740 | 455 | object, "icon_grouping", TRUE, | 545 | object, "icon_grouping", TRUE, |
741 | 456 | DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, | 546 | DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, |
742 | 457 | NULL); | ||
743 | 458 | desktop_agnostic_config_client_bind (priv->client, | ||
744 | 459 | DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT, | ||
745 | 460 | "intellihide", | ||
746 | 461 | object, "intellihide", TRUE, | ||
747 | 462 | DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, | ||
748 | 463 | NULL); | 547 | NULL); |
749 | 464 | desktop_agnostic_config_client_bind (priv->client, | 548 | desktop_agnostic_config_client_bind (priv->client, |
750 | 465 | DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT, | 549 | DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT, |
751 | 466 | "intellihide_mode", | ||
752 | 467 | object, "intellihide_mode", TRUE, | ||
753 | 468 | DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, | ||
754 | 469 | NULL); | ||
755 | 470 | desktop_agnostic_config_client_bind (priv->client, | ||
756 | 471 | DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT, | ||
757 | 472 | "match_strength", | 550 | "match_strength", |
758 | 473 | object, "match_strength", TRUE, | 551 | object, "match_strength", TRUE, |
759 | 474 | DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, | 552 | DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, |
760 | @@ -495,6 +573,32 @@ | |||
761 | 495 | 573 | ||
762 | 496 | /* DBus interface */ | 574 | /* DBus interface */ |
763 | 497 | priv->dbus_proxy = task_manager_dispatcher_new (TASK_MANAGER (object)); | 575 | priv->dbus_proxy = task_manager_dispatcher_new (TASK_MANAGER (object)); |
764 | 576 | |||
765 | 577 | if (priv->proxy) | ||
766 | 578 | { | ||
767 | 579 | dbus_g_proxy_call (priv->proxy, "GetPanels", | ||
768 | 580 | &error, | ||
769 | 581 | G_TYPE_INVALID, | ||
770 | 582 | G_TYPE_STRV, &panel_paths, | ||
771 | 583 | G_TYPE_INVALID); | ||
772 | 584 | if (error) | ||
773 | 585 | { | ||
774 | 586 | g_debug ("%s: %s",__func__,error->message); | ||
775 | 587 | g_error_free (error); | ||
776 | 588 | error = NULL; | ||
777 | 589 | } | ||
778 | 590 | else | ||
779 | 591 | { | ||
780 | 592 | for (gint i=0; panel_paths[i];i++) | ||
781 | 593 | { | ||
782 | 594 | //strlen is like this as a reminder. | ||
783 | 595 | _on_panel_added (priv->proxy, | ||
784 | 596 | atoi(panel_paths[i] + strlen("/org/awnproject/Awn/Panel")), | ||
785 | 597 | TASK_MANAGER(object)); | ||
786 | 598 | |||
787 | 599 | } | ||
788 | 600 | } | ||
789 | 601 | } | ||
790 | 498 | } | 602 | } |
791 | 499 | 603 | ||
792 | 500 | static void | 604 | static void |
793 | @@ -555,22 +659,6 @@ | |||
794 | 555 | G_PARAM_CONSTRUCT | G_PARAM_READWRITE); | 659 | G_PARAM_CONSTRUCT | G_PARAM_READWRITE); |
795 | 556 | g_object_class_install_property (obj_class, PROP_ICON_GROUPING, pspec); | 660 | g_object_class_install_property (obj_class, PROP_ICON_GROUPING, pspec); |
796 | 557 | 661 | ||
797 | 558 | pspec = g_param_spec_boolean ("intellihide", | ||
798 | 559 | "intellihide", | ||
799 | 560 | "Intellihide", | ||
800 | 561 | TRUE, | ||
801 | 562 | G_PARAM_READWRITE); | ||
802 | 563 | g_object_class_install_property (obj_class, PROP_INTELLIHIDE, pspec); | ||
803 | 564 | |||
804 | 565 | pspec = g_param_spec_int ("intellihide_mode", | ||
805 | 566 | "intellihide mode", | ||
806 | 567 | "Intellihide mode", | ||
807 | 568 | 0, | ||
808 | 569 | 2, | ||
809 | 570 | 1, | ||
810 | 571 | G_PARAM_CONSTRUCT | G_PARAM_READWRITE); | ||
811 | 572 | g_object_class_install_property (obj_class, PROP_INTELLIHIDE_MODE, pspec); | ||
812 | 573 | |||
813 | 574 | pspec = g_param_spec_int ("match_strength", | 662 | pspec = g_param_spec_int ("match_strength", |
814 | 575 | "match_strength", | 663 | "match_strength", |
815 | 576 | "How radical matching is applied for grouping items", | 664 | "How radical matching is applied for grouping items", |
816 | @@ -619,9 +707,10 @@ | |||
817 | 619 | task_manager_init (TaskManager *manager) | 707 | task_manager_init (TaskManager *manager) |
818 | 620 | { | 708 | { |
819 | 621 | TaskManagerPrivate *priv; | 709 | TaskManagerPrivate *priv; |
821 | 622 | 710 | GError *error = NULL; | |
822 | 711 | |||
823 | 623 | priv = manager->priv = TASK_MANAGER_GET_PRIVATE (manager); | 712 | priv = manager->priv = TASK_MANAGER_GET_PRIVATE (manager); |
825 | 624 | 713 | ||
826 | 625 | priv->screen = wnck_screen_get_default (); | 714 | priv->screen = wnck_screen_get_default (); |
827 | 626 | priv->launcher_paths = NULL; | 715 | priv->launcher_paths = NULL; |
828 | 627 | priv->hidden_list = NULL; | 716 | priv->hidden_list = NULL; |
829 | @@ -647,6 +736,14 @@ | |||
830 | 647 | priv->dragged_icon = NULL; | 736 | priv->dragged_icon = NULL; |
831 | 648 | priv->drag_timeout = 0; | 737 | priv->drag_timeout = 0; |
832 | 649 | 738 | ||
833 | 739 | priv->connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); | ||
834 | 740 | priv->proxy = NULL; | ||
835 | 741 | if (error) | ||
836 | 742 | { | ||
837 | 743 | g_warning ("%s", error->message); | ||
838 | 744 | g_error_free(error); | ||
839 | 745 | } | ||
840 | 746 | |||
841 | 650 | /* connect to the relevent WnckScreen signals */ | 747 | /* connect to the relevent WnckScreen signals */ |
842 | 651 | g_signal_connect (priv->screen, "window-opened", | 748 | g_signal_connect (priv->screen, "window-opened", |
843 | 652 | G_CALLBACK (on_window_opened), manager); | 749 | G_CALLBACK (on_window_opened), manager); |
844 | @@ -755,16 +852,25 @@ | |||
845 | 755 | desktop_agnostic_config_client_unbind_all_for_object (priv->client, | 852 | desktop_agnostic_config_client_unbind_all_for_object (priv->client, |
846 | 756 | object, | 853 | object, |
847 | 757 | NULL); | 854 | NULL); |
848 | 855 | if (priv->connection) | ||
849 | 856 | { | ||
850 | 857 | if (priv->proxy) g_object_unref (priv->proxy); | ||
851 | 858 | dbus_g_connection_unref (priv->connection); | ||
852 | 859 | priv->connection = NULL; | ||
853 | 860 | priv->proxy = NULL; | ||
854 | 861 | } | ||
855 | 862 | |||
856 | 863 | /* | ||
857 | 758 | if (priv->autohide_cookie) | 864 | if (priv->autohide_cookie) |
858 | 759 | { | 865 | { |
859 | 760 | awn_applet_uninhibit_autohide (AWN_APPLET(object), priv->autohide_cookie); | 866 | awn_applet_uninhibit_autohide (AWN_APPLET(object), priv->autohide_cookie); |
860 | 761 | priv->autohide_cookie = 0; | 867 | priv->autohide_cookie = 0; |
863 | 762 | } | 868 | }*/ |
864 | 763 | if (priv->awn_gdk_window) | 869 | /* if (priv->awn_gdk_window) |
865 | 764 | { | 870 | { |
866 | 765 | g_object_unref (priv->awn_gdk_window); | 871 | g_object_unref (priv->awn_gdk_window); |
867 | 766 | priv->awn_gdk_window = NULL; | 872 | priv->awn_gdk_window = NULL; |
869 | 767 | } | 873 | }*/ |
870 | 768 | 874 | ||
871 | 769 | G_OBJECT_CLASS (task_manager_parent_class)->dispose (object); | 875 | G_OBJECT_CLASS (task_manager_parent_class)->dispose (object); |
872 | 770 | } | 876 | } |
873 | @@ -1734,14 +1840,22 @@ | |||
874 | 1734 | g_value_array_free (launcher_paths); | 1840 | g_value_array_free (launcher_paths); |
875 | 1735 | } | 1841 | } |
876 | 1736 | 1842 | ||
877 | 1843 | static void | ||
878 | 1844 | task_manager_intellihide_change_cb (const char* group, | ||
879 | 1845 | const char* key, | ||
880 | 1846 | GValue* value, | ||
881 | 1847 | int * user_data) | ||
882 | 1848 | { | ||
883 | 1849 | *user_data = g_value_get_int (value); | ||
884 | 1850 | } | ||
885 | 1851 | |||
886 | 1737 | /* | 1852 | /* |
887 | 1738 | * Checks when launchers got added/removed in the list in gconf/file. | 1853 | * Checks when launchers got added/removed in the list in gconf/file. |
888 | 1739 | * It removes the launchers from the task-icons and add those | 1854 | * It removes the launchers from the task-icons and add those |
889 | 1740 | * that aren't already on the bar. | 1855 | * that aren't already on the bar. |
890 | 1741 | */ | 1856 | */ |
891 | 1742 | static void | 1857 | static void |
894 | 1743 | task_manager_refresh_launcher_paths (TaskManager *manager, | 1858 | task_manager_refresh_launcher_paths (TaskManager *manager, GValueArray *list) |
893 | 1744 | GValueArray *list) | ||
895 | 1745 | { | 1859 | { |
896 | 1746 | TaskManagerPrivate *priv; | 1860 | TaskManagerPrivate *priv; |
897 | 1747 | 1861 | ||
898 | @@ -2434,14 +2548,9 @@ | |||
899 | 2434 | return region; | 2548 | return region; |
900 | 2435 | } | 2549 | } |
901 | 2436 | 2550 | ||
902 | 2437 | /* | ||
903 | 2438 | Governs the panel autohide when Intellihide is enabled. | ||
904 | 2439 | If a window in the relevant window list intersects with the awn panel then | ||
905 | 2440 | autohide will be uninhibited otherwise it will be inhibited. | ||
906 | 2441 | */ | ||
907 | 2442 | |||
908 | 2443 | static void | 2551 | static void |
910 | 2444 | task_manager_check_for_intersection (TaskManager * manager, | 2552 | task_manager_check_for_panel_instance_intersection (TaskManager * manager, |
911 | 2553 | TaskManagerAwnPanelInfo * panel_info, | ||
912 | 2445 | WnckWorkspace * space, | 2554 | WnckWorkspace * space, |
913 | 2446 | WnckApplication * app) | 2555 | WnckApplication * app) |
914 | 2447 | { | 2556 | { |
915 | @@ -2451,35 +2560,24 @@ | |||
916 | 2451 | gboolean intersect = FALSE; | 2560 | gboolean intersect = FALSE; |
917 | 2452 | GdkRectangle awn_rect; | 2561 | GdkRectangle awn_rect; |
918 | 2453 | gint depth; | 2562 | gint depth; |
919 | 2454 | gint64 xid; | ||
920 | 2455 | GdkRegion * updated_region; | 2563 | GdkRegion * updated_region; |
921 | 2456 | |||
922 | 2457 | g_return_if_fail (TASK_IS_MANAGER (manager)); | 2564 | g_return_if_fail (TASK_IS_MANAGER (manager)); |
923 | 2458 | priv = manager->priv; | 2565 | priv = manager->priv; |
924 | 2459 | 2566 | ||
935 | 2460 | /* | 2567 | gdk_window_get_geometry (panel_info->foreign_window,&awn_rect.x, |
926 | 2461 | Generate a GdkRegion for the awn panel_size | ||
927 | 2462 | */ | ||
928 | 2463 | if (!priv->awn_gdk_window) | ||
929 | 2464 | { | ||
930 | 2465 | g_object_get (manager, "panel-xid", &xid, NULL); | ||
931 | 2466 | priv->awn_gdk_window = gdk_window_foreign_new ( xid); | ||
932 | 2467 | } | ||
933 | 2468 | g_return_if_fail (priv->awn_gdk_window); | ||
934 | 2469 | gdk_window_get_geometry (priv->awn_gdk_window,&awn_rect.x, | ||
936 | 2470 | &awn_rect.y,&awn_rect.width, | 2568 | &awn_rect.y,&awn_rect.width, |
937 | 2471 | &awn_rect.height,&depth); | 2569 | &awn_rect.height,&depth); |
938 | 2472 | /* | 2570 | /* |
939 | 2473 | gdk_window_get_geometry gives us an x,y or 0,0 | 2571 | gdk_window_get_geometry gives us an x,y or 0,0 |
940 | 2474 | Fix that using get root origin. | 2572 | Fix that using get root origin. |
941 | 2475 | */ | 2573 | */ |
943 | 2476 | gdk_window_get_root_origin (priv->awn_gdk_window,&awn_rect.x,&awn_rect.y); | 2574 | gdk_window_get_root_origin (panel_info->foreign_window,&awn_rect.x,&awn_rect.y); |
944 | 2477 | /* | 2575 | /* |
945 | 2478 | We cache the region for reuse for situations where the input mask is an empty | 2576 | We cache the region for reuse for situations where the input mask is an empty |
946 | 2479 | region when the panel is hidden. In that case we reuse the last good | 2577 | region when the panel is hidden. In that case we reuse the last good |
947 | 2480 | region. | 2578 | region. |
948 | 2481 | */ | 2579 | */ |
950 | 2482 | updated_region = xutils_get_input_shape (priv->awn_gdk_window); | 2580 | updated_region = xutils_get_input_shape (panel_info->foreign_window); |
951 | 2483 | g_return_if_fail (updated_region); | 2581 | g_return_if_fail (updated_region); |
952 | 2484 | if (gdk_region_empty(updated_region)) | 2582 | if (gdk_region_empty(updated_region)) |
953 | 2485 | { | 2583 | { |
954 | @@ -2487,18 +2585,18 @@ | |||
955 | 2487 | } | 2585 | } |
956 | 2488 | else | 2586 | else |
957 | 2489 | { | 2587 | { |
959 | 2490 | if (priv->awn_gdk_region) | 2588 | if (panel_info->foreign_region) |
960 | 2491 | { | 2589 | { |
962 | 2492 | gdk_region_destroy (priv->awn_gdk_region); | 2590 | gdk_region_destroy (panel_info->foreign_region); |
963 | 2493 | } | 2591 | } |
966 | 2494 | priv->awn_gdk_region = updated_region; | 2592 | panel_info->foreign_region = updated_region; |
967 | 2495 | gdk_region_offset (priv->awn_gdk_region,awn_rect.x,awn_rect.y); | 2593 | gdk_region_offset (panel_info->foreign_region,awn_rect.x,awn_rect.y); |
968 | 2496 | } | 2594 | } |
969 | 2497 | 2595 | ||
970 | 2498 | /* | 2596 | /* |
971 | 2499 | Get the list of windows to check for intersection | 2597 | Get the list of windows to check for intersection |
972 | 2500 | */ | 2598 | */ |
974 | 2501 | switch (priv->intellihide_mode) | 2599 | switch (panel_info->intellihide_mode) |
975 | 2502 | { | 2600 | { |
976 | 2503 | case INTELLIHIDE_WORKSPACE: | 2601 | case INTELLIHIDE_WORKSPACE: |
977 | 2504 | windows = wnck_screen_get_windows (priv->screen); | 2602 | windows = wnck_screen_get_windows (priv->screen); |
978 | @@ -2506,7 +2604,14 @@ | |||
979 | 2506 | case INTELLIHIDE_GROUP: /*TODO... Implement this for now same as app*/ | 2604 | case INTELLIHIDE_GROUP: /*TODO... Implement this for now same as app*/ |
980 | 2507 | case INTELLIHIDE_APP: | 2605 | case INTELLIHIDE_APP: |
981 | 2508 | default: | 2606 | default: |
983 | 2509 | windows = wnck_application_get_windows (app); | 2607 | if (app) |
984 | 2608 | { | ||
985 | 2609 | windows = wnck_application_get_windows (app); | ||
986 | 2610 | } | ||
987 | 2611 | else | ||
988 | 2612 | { | ||
989 | 2613 | windows = wnck_screen_get_windows (priv->screen); | ||
990 | 2614 | } | ||
991 | 2510 | break; | 2615 | break; |
992 | 2511 | } | 2616 | } |
993 | 2512 | 2617 | ||
994 | @@ -2543,7 +2648,7 @@ | |||
995 | 2543 | &win_rect.y,&win_rect.width, | 2648 | &win_rect.y,&win_rect.width, |
996 | 2544 | &win_rect.height); | 2649 | &win_rect.height); |
997 | 2545 | 2650 | ||
999 | 2546 | if (gdk_region_rect_in (priv->awn_gdk_region, &win_rect) != | 2651 | if (gdk_region_rect_in (panel_info->foreign_region, &win_rect) != |
1000 | 2547 | GDK_OVERLAP_RECTANGLE_OUT) | 2652 | GDK_OVERLAP_RECTANGLE_OUT) |
1001 | 2548 | { | 2653 | { |
1002 | 2549 | #ifdef DEBUG | 2654 | #ifdef DEBUG |
1003 | @@ -2558,28 +2663,94 @@ | |||
1004 | 2558 | /* | 2663 | /* |
1005 | 2559 | Allow panel to hide (if necessary) | 2664 | Allow panel to hide (if necessary) |
1006 | 2560 | */ | 2665 | */ |
1008 | 2561 | if (intersect && priv->autohide_cookie) | 2666 | if (intersect && panel_info->autohide_cookie) |
1009 | 2562 | { | 2667 | { |
1011 | 2563 | awn_applet_uninhibit_autohide (AWN_APPLET(manager), priv->autohide_cookie); | 2668 | task_manager_panel_connector_uninhibit_autohide (panel_info->connector, panel_info->autohide_cookie); |
1012 | 2564 | #ifdef DEBUG | 2669 | #ifdef DEBUG |
1014 | 2565 | g_debug ("me eat cookie: %u",priv->autohide_cookie); | 2670 | g_debug ("me eat cookie: %u",panel_info->autohide_cookie); |
1015 | 2566 | #endif | 2671 | #endif |
1017 | 2567 | priv->autohide_cookie = 0; | 2672 | panel_info->autohide_cookie = 0; |
1018 | 2568 | } | 2673 | } |
1019 | 2569 | 2674 | ||
1020 | 2570 | /* | 2675 | /* |
1021 | 2571 | Inhibit Hide if not already doing so | 2676 | Inhibit Hide if not already doing so |
1022 | 2572 | */ | 2677 | */ |
1024 | 2573 | if (!intersect && !priv->autohide_cookie) | 2678 | if (!intersect && !panel_info->autohide_cookie) |
1025 | 2574 | { | 2679 | { |
1027 | 2575 | priv->autohide_cookie = awn_applet_inhibit_autohide (AWN_APPLET(manager), "Intellihide"); | 2680 | gchar * identifier = g_strdup_printf ("Intellihide:applet_conector=%p",panel_info->connector); |
1028 | 2681 | panel_info->autohide_cookie = task_manager_panel_connector_inhibit_autohide (panel_info->connector, identifier); | ||
1029 | 2682 | g_free (identifier); | ||
1030 | 2576 | #ifdef DEBUG | 2683 | #ifdef DEBUG |
1032 | 2577 | g_debug ("cookie is %u",priv->autohide_cookie); | 2684 | g_debug ("cookie is %u",panel_info->autohide_cookie); |
1033 | 2578 | #endif | 2685 | #endif |
1034 | 2579 | } | 2686 | } |
1035 | 2580 | 2687 | ||
1036 | 2581 | } | 2688 | } |
1037 | 2582 | 2689 | ||
1038 | 2690 | static gboolean | ||
1039 | 2691 | _waiting_for_panel_dbus (TaskManager * manager) | ||
1040 | 2692 | { | ||
1041 | 2693 | TaskManagerPrivate *priv; | ||
1042 | 2694 | |||
1043 | 2695 | g_return_val_if_fail (TASK_IS_MANAGER (manager),FALSE); | ||
1044 | 2696 | priv = manager->priv; | ||
1045 | 2697 | |||
1046 | 2698 | task_manager_check_for_intersection (manager, | ||
1047 | 2699 | wnck_screen_get_active_workspace (priv->screen), | ||
1048 | 2700 | wnck_application_get (wnck_window_get_xid(wnck_screen_get_active_window (priv->screen)))); | ||
1049 | 2701 | return FALSE; | ||
1050 | 2702 | } | ||
1051 | 2703 | /* | ||
1052 | 2704 | Governs the panel autohide when Intellihide is enabled. | ||
1053 | 2705 | If a window in the relevant window list intersects with the awn panel then | ||
1054 | 2706 | autohide will be uninhibited otherwise it will be inhibited. | ||
1055 | 2707 | */ | ||
1056 | 2708 | |||
1057 | 2709 | static void | ||
1058 | 2710 | task_manager_check_for_intersection (TaskManager * manager, | ||
1059 | 2711 | WnckWorkspace * space, | ||
1060 | 2712 | WnckApplication * app) | ||
1061 | 2713 | { | ||
1062 | 2714 | TaskManagerPrivate *priv; | ||
1063 | 2715 | gint64 xid; | ||
1064 | 2716 | GHashTableIter iter; | ||
1065 | 2717 | gpointer key,value; | ||
1066 | 2718 | |||
1067 | 2719 | g_return_if_fail (TASK_IS_MANAGER (manager)); | ||
1068 | 2720 | priv = manager->priv; | ||
1069 | 2721 | |||
1070 | 2722 | g_hash_table_iter_init (&iter, priv->intellihide_panel_instances); | ||
1071 | 2723 | while (g_hash_table_iter_next (&iter, &key, &value) ) | ||
1072 | 2724 | { | ||
1073 | 2725 | TaskManagerAwnPanelInfo * panel_info = value; | ||
1074 | 2726 | g_object_get (panel_info->connector, "panel-xid", &xid, NULL); | ||
1075 | 2727 | if (!xid) | ||
1076 | 2728 | { | ||
1077 | 2729 | g_timeout_add (1000,(GSourceFunc)_waiting_for_panel_dbus,manager); | ||
1078 | 2730 | } | ||
1079 | 2731 | else | ||
1080 | 2732 | { | ||
1081 | 2733 | if (!panel_info->foreign_window) | ||
1082 | 2734 | { | ||
1083 | 2735 | panel_info->foreign_window = gdk_window_foreign_new ( xid); | ||
1084 | 2736 | } | ||
1085 | 2737 | if (panel_info->intellihide_mode) | ||
1086 | 2738 | { | ||
1087 | 2739 | task_manager_check_for_panel_instance_intersection(manager, | ||
1088 | 2740 | panel_info, | ||
1089 | 2741 | space, | ||
1090 | 2742 | app); | ||
1091 | 2743 | } | ||
1092 | 2744 | else if ( !panel_info->intellihide_mode && panel_info->autohide_cookie) | ||
1093 | 2745 | { | ||
1094 | 2746 | task_manager_panel_connector_uninhibit_autohide (panel_info->connector, panel_info->autohide_cookie); | ||
1095 | 2747 | panel_info->autohide_cookie = 0; | ||
1096 | 2748 | } | ||
1097 | 2749 | } | ||
1098 | 2750 | } | ||
1099 | 2751 | return; | ||
1100 | 2752 | } | ||
1101 | 2753 | |||
1102 | 2583 | /* | 2754 | /* |
1103 | 2584 | Active window has changed. If intellhide is active we need to check for | 2755 | Active window has changed. If intellhide is active we need to check for |
1104 | 2585 | window instersections | 2756 | window instersections |
1105 | @@ -2596,12 +2767,6 @@ | |||
1106 | 2596 | 2767 | ||
1107 | 2597 | g_return_if_fail (TASK_IS_MANAGER (manager)); | 2768 | g_return_if_fail (TASK_IS_MANAGER (manager)); |
1108 | 2598 | priv = manager->priv; | 2769 | priv = manager->priv; |
1109 | 2599 | |||
1110 | 2600 | if (!priv->intellihide) | ||
1111 | 2601 | { | ||
1112 | 2602 | /* g_warning ("%s: Intellihide callback invoked with Intellihide off",__func__);*/ | ||
1113 | 2603 | return; | ||
1114 | 2604 | } | ||
1115 | 2605 | 2770 | ||
1116 | 2606 | win = wnck_screen_get_active_window (screen); | 2771 | win = wnck_screen_get_active_window (screen); |
1117 | 2607 | if (!win) | 2772 | if (!win) |
1118 | @@ -2612,13 +2777,17 @@ | |||
1119 | 2612 | we had intersection and the panel was hidden, it will continue hide. | 2777 | we had intersection and the panel was hidden, it will continue hide. |
1120 | 2613 | So inhibit the autohide if there is no active window. | 2778 | So inhibit the autohide if there is no active window. |
1121 | 2614 | */ | 2779 | */ |
1122 | 2780 | task_manager_check_for_intersection (manager, | ||
1123 | 2781 | wnck_screen_get_active_workspace(screen), | ||
1124 | 2782 | NULL); | ||
1125 | 2783 | /* | ||
1126 | 2615 | if (!priv->autohide_cookie) | 2784 | if (!priv->autohide_cookie) |
1127 | 2616 | { | 2785 | { |
1128 | 2617 | priv->autohide_cookie = awn_applet_inhibit_autohide (AWN_APPLET(manager), "Intellihide"); | 2786 | priv->autohide_cookie = awn_applet_inhibit_autohide (AWN_APPLET(manager), "Intellihide"); |
1129 | 2618 | #ifdef DEBUG | 2787 | #ifdef DEBUG |
1130 | 2619 | g_debug ("%s: cookie is %u",__func__,priv->autohide_cookie); | 2788 | g_debug ("%s: cookie is %u",__func__,priv->autohide_cookie); |
1131 | 2620 | #endif | 2789 | #endif |
1133 | 2621 | } | 2790 | }*/ |
1134 | 2622 | return; | 2791 | return; |
1135 | 2623 | } | 2792 | } |
1136 | 2624 | app = wnck_window_get_application (win); | 2793 | app = wnck_window_get_application (win); |
1137 | @@ -2641,21 +2810,13 @@ | |||
1138 | 2641 | 2810 | ||
1139 | 2642 | g_return_if_fail (TASK_IS_MANAGER (manager)); | 2811 | g_return_if_fail (TASK_IS_MANAGER (manager)); |
1140 | 2643 | priv = manager->priv; | 2812 | priv = manager->priv; |
1146 | 2644 | if (!priv->intellihide) | 2813 | |
1142 | 2645 | { | ||
1143 | 2646 | /* g_warning ("%s: Intellihide callback invoked with Intellihide off",__func__); */ | ||
1144 | 2647 | return; | ||
1145 | 2648 | } | ||
1147 | 2649 | win = wnck_screen_get_active_window (screen); | 2814 | win = wnck_screen_get_active_window (screen); |
1148 | 2650 | if (!win) | 2815 | if (!win) |
1149 | 2651 | { | 2816 | { |
1157 | 2652 | if (!priv->autohide_cookie) | 2817 | task_manager_check_for_intersection (manager, |
1158 | 2653 | { | 2818 | wnck_screen_get_active_workspace(screen), |
1159 | 2654 | priv->autohide_cookie = awn_applet_inhibit_autohide (AWN_APPLET(manager), "Intellihide"); | 2819 | NULL); |
1153 | 2655 | #ifdef DEBUG | ||
1154 | 2656 | g_debug ("%s: cookie is %u",__func__,priv->autohide_cookie); | ||
1155 | 2657 | #endif | ||
1156 | 2658 | } | ||
1160 | 2659 | return; | 2820 | return; |
1161 | 2660 | } | 2821 | } |
1162 | 2661 | 2822 | ||
1163 | @@ -2671,13 +2832,9 @@ | |||
1164 | 2671 | WnckWindow *win; | 2832 | WnckWindow *win; |
1165 | 2672 | WnckApplication *app; | 2833 | WnckApplication *app; |
1166 | 2673 | WnckWorkspace *space; | 2834 | WnckWorkspace *space; |
1167 | 2835 | |||
1168 | 2674 | g_return_if_fail (TASK_IS_MANAGER (manager)); | 2836 | g_return_if_fail (TASK_IS_MANAGER (manager)); |
1169 | 2675 | priv = manager->priv; | 2837 | priv = manager->priv; |
1170 | 2676 | if (!priv->intellihide) | ||
1171 | 2677 | { | ||
1172 | 2678 | /* g_warning ("%s: Intellihide callback invoked with Intellihide off",__func__);*/ | ||
1173 | 2679 | return; | ||
1174 | 2680 | } | ||
1175 | 2681 | win = wnck_screen_get_active_window (priv->screen); | 2838 | win = wnck_screen_get_active_window (priv->screen); |
1176 | 2682 | if (!win) | 2839 | if (!win) |
1177 | 2683 | { | 2840 | { |
1178 | @@ -2703,11 +2860,6 @@ | |||
1179 | 2703 | WnckWorkspace *space; | 2860 | WnckWorkspace *space; |
1180 | 2704 | g_return_if_fail (TASK_IS_MANAGER (manager)); | 2861 | g_return_if_fail (TASK_IS_MANAGER (manager)); |
1181 | 2705 | priv = manager->priv; | 2862 | priv = manager->priv; |
1182 | 2706 | if (!priv->intellihide) | ||
1183 | 2707 | { | ||
1184 | 2708 | /* g_warning ("%s: Intellihide callback invoked with Intellihide off",__func__);*/ | ||
1185 | 2709 | return; | ||
1186 | 2710 | } | ||
1187 | 2711 | win = wnck_screen_get_active_window (priv->screen); | 2863 | win = wnck_screen_get_active_window (priv->screen); |
1188 | 2712 | if (!win) | 2864 | if (!win) |
1189 | 2713 | { | 2865 | { |
1190 | @@ -2730,10 +2882,6 @@ | |||
1191 | 2730 | g_return_if_fail (TASK_IS_MANAGER (manager)); | 2882 | g_return_if_fail (TASK_IS_MANAGER (manager)); |
1192 | 2731 | priv = manager->priv; | 2883 | priv = manager->priv; |
1193 | 2732 | 2884 | ||
1194 | 2733 | if (!priv->intellihide) | ||
1195 | 2734 | { | ||
1196 | 2735 | return; | ||
1197 | 2736 | } | ||
1198 | 2737 | win = wnck_screen_get_active_window (priv->screen); | 2885 | win = wnck_screen_get_active_window (priv->screen); |
1199 | 2738 | if (!win) | 2886 | if (!win) |
1200 | 2739 | { | 2887 | { |
1201 | 2740 | 2888 | ||
1202 | === modified file 'data/avant-window-navigator.schema-ini.in.in' | |||
1203 | --- data/avant-window-navigator.schema-ini.in.in 2010-07-19 22:28:12 +0000 | |||
1204 | +++ data/avant-window-navigator.schema-ini.in.in 2010-10-25 13:06:06 +0000 | |||
1205 | @@ -86,6 +86,11 @@ | |||
1206 | 86 | default = false | 86 | default = false |
1207 | 87 | _description=If true, the panel will expand to full monitor width/height. | 87 | _description=If true, the panel will expand to full monitor width/height. |
1208 | 88 | 88 | ||
1209 | 89 | [panel/intellihide_mode] | ||
1210 | 90 | type = integer | ||
1211 | 91 | default = 2 | ||
1212 | 92 | _description= Intellihide mode. 0.. Disabled, 1.. use windows on active workspace, 2.. use windows of currently focused app. | ||
1213 | 93 | |||
1214 | 89 | [panel/monitor_align] | 94 | [panel/monitor_align] |
1215 | 90 | type = float | 95 | type = float |
1216 | 91 | default = 0.5 | 96 | default = 0.5 |
1217 | 92 | 97 | ||
1218 | === modified file 'src/awn-app.vala' | |||
1219 | --- src/awn-app.vala 2010-07-24 12:58:39 +0000 | |||
1220 | +++ src/awn-app.vala 2010-10-25 13:06:06 +0000 | |||
1221 | @@ -26,8 +26,10 @@ | |||
1222 | 26 | [DBus (name="org.awnproject.Awn.App")] | 26 | [DBus (name="org.awnproject.Awn.App")] |
1223 | 27 | public interface AppDBusInterface: GLib.Object | 27 | public interface AppDBusInterface: GLib.Object |
1224 | 28 | { | 28 | { |
1226 | 29 | public abstract ObjectPath[] get_panels () throws DBus.Error; | 29 | public abstract string[] get_panels () throws DBus.Error; |
1227 | 30 | public abstract void remove_panel (int panel_id) throws DBus.Error; | 30 | public abstract void remove_panel (int panel_id) throws DBus.Error; |
1228 | 31 | public signal void panel_added (int panel_id); | ||
1229 | 32 | public signal void panel_removed (int panel_id); | ||
1230 | 31 | } | 33 | } |
1231 | 32 | 34 | ||
1232 | 33 | public class Application: GLib.Object, AppDBusInterface | 35 | public class Application: GLib.Object, AppDBusInterface |
1233 | @@ -107,6 +109,7 @@ | |||
1234 | 107 | this.panels.insert ((owned)path, panel); | 109 | this.panels.insert ((owned)path, panel); |
1235 | 108 | 110 | ||
1236 | 109 | panel.show (); | 111 | panel.show (); |
1237 | 112 | this.panel_added (panel_id); | ||
1238 | 110 | } | 113 | } |
1239 | 111 | else | 114 | else |
1240 | 112 | { | 115 | { |
1241 | @@ -116,24 +119,25 @@ | |||
1242 | 116 | 119 | ||
1243 | 117 | foreach (unowned Panel p in untouched_panels) | 120 | foreach (unowned Panel p in untouched_panels) |
1244 | 118 | { | 121 | { |
1245 | 122 | int panel_id = p.panel_id; | ||
1246 | 119 | string path = "/org/awnproject/Awn/Panel%d".printf (p.panel_id); | 123 | string path = "/org/awnproject/Awn/Panel%d".printf (p.panel_id); |
1247 | 120 | this.panels.remove (path); | 124 | this.panels.remove (path); |
1248 | 125 | this.panel_removed (panel_id); | ||
1249 | 121 | p.destroy (); | 126 | p.destroy (); |
1250 | 122 | } | 127 | } |
1251 | 123 | } | 128 | } |
1252 | 124 | 129 | ||
1254 | 125 | public ObjectPath[] get_panels () throws DBus.Error | 130 | public string[] get_panels () throws DBus.Error |
1255 | 126 | { | 131 | { |
1256 | 127 | var keys = this.panels.get_keys (); | 132 | var keys = this.panels.get_keys (); |
1257 | 128 | keys.sort (strcmp); | 133 | keys.sort (strcmp); |
1258 | 129 | 134 | ||
1260 | 130 | ObjectPath[] paths = new ObjectPath[keys.length ()]; | 135 | string[] paths = new string[keys.length ()]; |
1261 | 131 | int i = 0; | 136 | int i = 0; |
1262 | 132 | foreach (unowned string path in keys) | 137 | foreach (unowned string path in keys) |
1263 | 133 | { | 138 | { |
1265 | 134 | paths[i++] = new ObjectPath (path); | 139 | paths[i++] = path; |
1266 | 135 | } | 140 | } |
1267 | 136 | |||
1268 | 137 | return paths; | 141 | return paths; |
1269 | 138 | } | 142 | } |
1270 | 139 | 143 |
Few comments:
Please get rid of 304, and also the other occurrences of priv->source.
96: Will cause lots of criticals because panel has properties which PanelConnector doesn't.
664: Make sure you remove the notification on panel removed signal.