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:
|
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 | task-manager-api-wrapper.c \ |
6 | task-manager-api-wrapper.h \ |
7 | task-manager-api-wrapper-glue.h \ |
8 | + task-manager-panel-connector.c \ |
9 | + task-manager-panel-connector.h \ |
10 | task-settings.c \ |
11 | task-settings.h \ |
12 | task-window.c \ |
13 | |
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 | default = false |
19 | _description= Allow grouping of windows together that have different WM_CLIENT_NAME values. |
20 | |
21 | -[DEFAULT/intellihide] |
22 | -type = boolean |
23 | -default = true |
24 | -_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 | - |
26 | -[DEFAULT/intellihide_mode] |
27 | -type = integer |
28 | -default = 1 |
29 | -_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 | - |
31 | [DEFAULT/launcher_paths] |
32 | type = list-string |
33 | default = /usr/share/applications/firefox.desktop; |
34 | |
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 | +/* task-manager-panel-connector.c */ |
40 | + |
41 | +#include <dbus/dbus-glib.h> |
42 | +#include <dbus/dbus-glib-bindings.h> |
43 | +#include <unistd.h> |
44 | +#include <stdlib.h> |
45 | +#include <string.h> |
46 | +#include <glib/gstdio.h> |
47 | +#include <glib/gi18n.h> |
48 | +#include <X11/Xlib.h> |
49 | +#include <math.h> |
50 | + |
51 | +#include "libawn/awn-defines.h" |
52 | +#include "libawn/libawn-marshal.h" |
53 | + |
54 | +#include "task-manager-panel-connector.h" |
55 | + |
56 | +#ifdef HAVE_CONFIG_H |
57 | +#include <config.h> |
58 | +#endif |
59 | + |
60 | + |
61 | +G_DEFINE_TYPE (TaskManagerPanelConnector, task_manager_panel_connector, G_TYPE_OBJECT) |
62 | + |
63 | +#define GET_PRIVATE(o) \ |
64 | + (G_TYPE_INSTANCE_GET_PRIVATE ((o), TASK_MANAGER_TYPE_PANEL_CONNECTOR, TaskManagerPanelConnectorPrivate)) |
65 | + |
66 | +typedef struct _TaskManagerPanelConnectorPrivate TaskManagerPanelConnectorPrivate; |
67 | + |
68 | +struct _TaskManagerPanelConnectorPrivate |
69 | +{ |
70 | + gint panel_id; |
71 | + gint64 panel_xid; |
72 | + |
73 | + DBusGConnection *connection; |
74 | + DBusGProxy *proxy; |
75 | +}; |
76 | + |
77 | + |
78 | +enum |
79 | +{ |
80 | + PROP_0, |
81 | + PROP_PANEL_ID, |
82 | + PROP_PANEL_XID, |
83 | +}; |
84 | + |
85 | + |
86 | + |
87 | +static void |
88 | +on_prop_changed (DBusGProxy *proxy, const gchar *prop_name, |
89 | + GValue *value, TaskManagerPanelConnector * conn) |
90 | +{ |
91 | + TaskManagerPanelConnectorPrivate * priv; |
92 | + g_return_if_fail (TASK_MANAGER_IS_PANEL_CONNECTOR (conn)); |
93 | + priv = GET_PRIVATE(conn); |
94 | + |
95 | + g_object_set_property (G_OBJECT (conn), prop_name, value); |
96 | +} |
97 | + |
98 | + |
99 | +static void |
100 | +task_manager_panel_connector_get_property (GObject *object, guint property_id, |
101 | + GValue *value, GParamSpec *pspec) |
102 | +{ |
103 | + TaskManagerPanelConnectorPrivate * priv = GET_PRIVATE(object); |
104 | + switch (property_id) |
105 | + { |
106 | + case PROP_PANEL_ID: |
107 | + g_value_set_int (value, priv->panel_id); |
108 | + break; |
109 | + |
110 | + case PROP_PANEL_XID: |
111 | + g_value_set_int64 (value, priv->panel_xid); |
112 | + break; |
113 | + default: |
114 | + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); |
115 | + } |
116 | +} |
117 | + |
118 | +static void |
119 | +task_manager_panel_connector_set_property (GObject *object, guint property_id, |
120 | + const GValue *value, GParamSpec *pspec) |
121 | +{ |
122 | + TaskManagerPanelConnectorPrivate * priv = GET_PRIVATE(object); |
123 | + switch (property_id) |
124 | + { |
125 | + case PROP_PANEL_ID: |
126 | + priv->panel_id = g_value_get_int (value); |
127 | + break; |
128 | +#ifdef DEBUG |
129 | + /*Debug'd out. Remove this if TaskManagerPanelConnector ever becomes a generic object that |
130 | + supports all the props in panel*/ |
131 | + default: |
132 | + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); |
133 | +#endif |
134 | + } |
135 | +} |
136 | + |
137 | +static void |
138 | +task_manager_panel_connector_dispose (GObject *object) |
139 | +{ |
140 | + G_OBJECT_CLASS (task_manager_panel_connector_parent_class)->dispose (object); |
141 | +} |
142 | + |
143 | +static void |
144 | +task_manager_panel_connector_finalize (GObject *object) |
145 | +{ |
146 | + TaskManagerPanelConnectorPrivate * priv = GET_PRIVATE(object); |
147 | + if (priv->connection) |
148 | + { |
149 | + if (priv->proxy) |
150 | + { |
151 | + g_object_unref (priv->proxy); |
152 | + } |
153 | + dbus_g_connection_unref (priv->connection); |
154 | + priv->connection = NULL; |
155 | + priv->proxy = NULL; |
156 | + } |
157 | + |
158 | + G_OBJECT_CLASS (task_manager_panel_connector_parent_class)->finalize (object); |
159 | +} |
160 | + |
161 | +static void |
162 | +task_manager_panel_connector_init (TaskManagerPanelConnector *self) |
163 | +{ |
164 | + TaskManagerPanelConnectorPrivate * priv = GET_PRIVATE(self); |
165 | + GError *error = NULL; |
166 | + |
167 | + priv->connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); |
168 | + priv->proxy = NULL; |
169 | + priv->panel_xid = 0; |
170 | + |
171 | + if (error) |
172 | + { |
173 | + g_warning ("%s", error->message); |
174 | + g_error_free(error); |
175 | + } |
176 | +} |
177 | + |
178 | +static gboolean |
179 | +task_manager_panel_connector_do_connect_dbus (GObject * conn) |
180 | +{ |
181 | + TaskManagerPanelConnectorPrivate * priv = GET_PRIVATE(conn); |
182 | + |
183 | + gchar *object_path = g_strdup_printf ("/org/awnproject/Awn/Panel%d", |
184 | + priv->panel_id); |
185 | + if (!priv->proxy) |
186 | + { |
187 | + priv->proxy = dbus_g_proxy_new_for_name (priv->connection, |
188 | + "org.awnproject.Awn", |
189 | + object_path, |
190 | + "org.awnproject.Awn.Panel"); |
191 | + } |
192 | + if (!priv->proxy) |
193 | + { |
194 | + g_warning("Could not connect to mothership! Bailing\n"); |
195 | + return TRUE; |
196 | + } |
197 | + |
198 | + dbus_g_object_register_marshaller ( |
199 | + libawn_marshal_VOID__STRING_BOXED, |
200 | + G_TYPE_NONE, G_TYPE_STRING, G_TYPE_VALUE, |
201 | + G_TYPE_INVALID |
202 | + ); |
203 | + |
204 | + dbus_g_proxy_add_signal (priv->proxy, "PropertyChanged", |
205 | + G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); |
206 | + dbus_g_proxy_connect_signal (priv->proxy, "PropertyChanged", |
207 | + G_CALLBACK (on_prop_changed), conn, |
208 | + NULL); |
209 | + // get prop values from Panel |
210 | + DBusGProxy *prop_proxy = dbus_g_proxy_new_from_proxy ( |
211 | + priv->proxy, "org.freedesktop.DBus.Properties", NULL |
212 | + ); |
213 | + |
214 | + if (!prop_proxy) |
215 | + { |
216 | + g_warning("Could not get property values! Bailing\n"); |
217 | + } |
218 | + |
219 | + GError *error = NULL; |
220 | + |
221 | +#if HAVE_DBUS_GLIB_080 |
222 | + GHashTable *all_props = NULL; |
223 | + |
224 | + // doing GetAll reduces DBus lag significantly |
225 | + dbus_g_proxy_call (prop_proxy, "GetAll", &error, |
226 | + G_TYPE_STRING, "org.awnproject.Awn.Panel", |
227 | + G_TYPE_INVALID, |
228 | + dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, |
229 | + G_TYPE_VALUE), &all_props, |
230 | + G_TYPE_INVALID); |
231 | + |
232 | + if (error) goto crap_out; |
233 | + |
234 | + GHashTableIter iter; |
235 | + gpointer key, value; |
236 | + |
237 | + g_hash_table_iter_init (&iter, all_props); |
238 | + while (g_hash_table_iter_next (&iter, &key, &value)) |
239 | + { |
240 | + if (strcmp (key, "PanelXid") == 0) |
241 | + { |
242 | + priv->panel_xid = g_value_get_int64 (value); |
243 | + } |
244 | + } |
245 | + |
246 | +#else |
247 | + GValue panel_xid = {0,}; |
248 | + |
249 | + dbus_g_proxy_call (prop_proxy, "Get", &error, |
250 | + G_TYPE_STRING, "org.awnproject.Awn.Panel", |
251 | + G_TYPE_STRING, "PanelXid", |
252 | + G_TYPE_INVALID, |
253 | + G_TYPE_VALUE, &panel_xid, |
254 | + G_TYPE_INVALID); |
255 | + |
256 | + if (error) goto crap_out; |
257 | + |
258 | + if (G_VALUE_HOLDS_INT64 (&panel_xid)) |
259 | + { |
260 | + priv->panel_xid = g_value_get_int64 (&panel_xid); |
261 | + } |
262 | + |
263 | + g_value_unset (&panel_xid); |
264 | +#endif |
265 | + if (prop_proxy) g_object_unref (prop_proxy); |
266 | + |
267 | + g_free (object_path); |
268 | + return FALSE; |
269 | + |
270 | + crap_out: |
271 | + |
272 | + g_warning ("%s", error->message); |
273 | + g_error_free (error); |
274 | + g_free (object_path); |
275 | + if (prop_proxy) |
276 | + { |
277 | + g_object_unref (prop_proxy); |
278 | + } |
279 | + return TRUE; |
280 | +} |
281 | + |
282 | +static void |
283 | +task_manager_panel_connector_constructed (GObject *obj) |
284 | +{ |
285 | + TaskManagerPanelConnector *conn = TASK_MANAGER_PANEL_CONNECTOR(obj); |
286 | + TaskManagerPanelConnectorPrivate *priv = GET_PRIVATE(conn); |
287 | + |
288 | + if (priv->panel_id > 0) |
289 | + { |
290 | + task_manager_panel_connector_do_connect_dbus (obj); |
291 | + } |
292 | +} |
293 | + |
294 | +static void |
295 | +task_manager_panel_connector_class_init (TaskManagerPanelConnectorClass *klass) |
296 | +{ |
297 | + GObjectClass *object_class = G_OBJECT_CLASS (klass); |
298 | + |
299 | + object_class->get_property = task_manager_panel_connector_get_property; |
300 | + object_class->set_property = task_manager_panel_connector_set_property; |
301 | + object_class->dispose = task_manager_panel_connector_dispose; |
302 | + object_class->finalize = task_manager_panel_connector_finalize; |
303 | + object_class->constructed = task_manager_panel_connector_constructed; |
304 | + |
305 | + g_object_class_install_property (object_class, |
306 | + PROP_PANEL_ID, |
307 | + g_param_spec_int ("panel-id", |
308 | + "Panel ID", |
309 | + "The id of AwnPanel this connector connects to", |
310 | + 0, G_MAXINT, 0, |
311 | + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | |
312 | + G_PARAM_STATIC_STRINGS)); |
313 | + |
314 | + g_object_class_install_property ( object_class, |
315 | + PROP_PANEL_XID, |
316 | + g_param_spec_int64 ("panel-xid", |
317 | + "Panel XID", |
318 | + "The XID of AwnPanel this connector is connected to", |
319 | + G_MININT64, G_MAXINT64, 0, |
320 | + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); |
321 | + |
322 | + g_type_class_add_private (klass, sizeof (TaskManagerPanelConnectorPrivate)); |
323 | +} |
324 | + |
325 | +TaskManagerPanelConnector* |
326 | +task_manager_panel_connector_new (gint id) |
327 | +{ |
328 | + return g_object_new (TASK_MANAGER_TYPE_PANEL_CONNECTOR, |
329 | + "panel_id",id, |
330 | + NULL); |
331 | +} |
332 | + |
333 | +guint |
334 | +task_manager_panel_connector_inhibit_autohide (TaskManagerPanelConnector *conn, const gchar *reason) |
335 | +{ |
336 | + TaskManagerPanelConnectorPrivate *priv; |
337 | + GError *error = NULL; |
338 | + guint ret = 0; |
339 | + |
340 | + g_return_val_if_fail (TASK_MANAGER_IS_PANEL_CONNECTOR (conn), 0); |
341 | + priv = GET_PRIVATE(conn); |
342 | + |
343 | + if (!priv->proxy) |
344 | + { |
345 | + return 0; |
346 | + } |
347 | + |
348 | + gchar *app_name = g_strdup_printf ("%s:%d", g_get_prgname(), getpid()); |
349 | + |
350 | + dbus_g_proxy_call (priv->proxy, "InhibitAutohide", |
351 | + &error, |
352 | + G_TYPE_STRING, app_name, |
353 | + G_TYPE_STRING, reason, |
354 | + G_TYPE_INVALID, |
355 | + G_TYPE_UINT, &ret, |
356 | + G_TYPE_INVALID); |
357 | + |
358 | + if (app_name) g_free (app_name); |
359 | + |
360 | + if (error) |
361 | + { |
362 | + g_warning ("%s", error->message); |
363 | + g_error_free (error); |
364 | + } |
365 | + |
366 | + return ret; |
367 | +} |
368 | + |
369 | +void |
370 | +task_manager_panel_connector_uninhibit_autohide (TaskManagerPanelConnector *conn, guint cookie) |
371 | +{ |
372 | + TaskManagerPanelConnectorPrivate *priv; |
373 | + GError *error = NULL; |
374 | + |
375 | + g_return_if_fail (TASK_MANAGER_IS_PANEL_CONNECTOR (conn)); |
376 | + priv = GET_PRIVATE(conn); |
377 | + |
378 | + if (!priv->proxy) |
379 | + { |
380 | + return; |
381 | + } |
382 | + |
383 | + dbus_g_proxy_call (priv->proxy, "UninhibitAutohide", |
384 | + &error, |
385 | + G_TYPE_UINT, cookie, |
386 | + G_TYPE_INVALID, |
387 | + G_TYPE_INVALID); |
388 | + |
389 | + if (error) |
390 | + { |
391 | + g_warning ("%s", error->message); |
392 | + g_error_free (error); |
393 | + } |
394 | +} |
395 | + |
396 | + |
397 | |
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 | +/* task-manager-panel-connector.h */ |
403 | + |
404 | +#ifndef _TASK_MANAGER_PANEL_CONNECTOR |
405 | +#define _TASK_MANAGER_PANEL_CONNECTOR |
406 | + |
407 | +#include <glib-object.h> |
408 | + |
409 | +G_BEGIN_DECLS |
410 | + |
411 | +#define TASK_MANAGER_TYPE_PANEL_CONNECTOR task_manager_panel_connector_get_type() |
412 | + |
413 | +#define TASK_MANAGER_PANEL_CONNECTOR(obj) \ |
414 | + (G_TYPE_CHECK_INSTANCE_CAST ((obj), TASK_MANAGER_TYPE_PANEL_CONNECTOR, TaskManagerPanelConnector)) |
415 | + |
416 | +#define TASK_MANAGER_PANEL_CONNECTOR_CLASS(klass) \ |
417 | + (G_TYPE_CHECK_CLASS_CAST ((klass), TASK_MANAGER_TYPE_PANEL_CONNECTOR, TaskManagerPanelConnectorClass)) |
418 | + |
419 | +#define TASK_MANAGER_IS_PANEL_CONNECTOR(obj) \ |
420 | + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TASK_MANAGER_TYPE_PANEL_CONNECTOR)) |
421 | + |
422 | +#define TASK_MANAGER_IS_PANEL_CONNECTOR_CLASS(klass) \ |
423 | + (G_TYPE_CHECK_CLASS_TYPE ((klass), TASK_MANAGER_TYPE_PANEL_CONNECTOR)) |
424 | + |
425 | +#define TASK_MANAGER_PANEL_CONNECTOR_GET_CLASS(obj) \ |
426 | + (G_TYPE_INSTANCE_GET_CLASS ((obj), TASK_MANAGER_TYPE_PANEL_CONNECTOR, TaskManagerPanelConnectorClass)) |
427 | + |
428 | +typedef struct { |
429 | + GObject parent; |
430 | +} TaskManagerPanelConnector; |
431 | + |
432 | +typedef struct { |
433 | + GObjectClass parent_class; |
434 | +} TaskManagerPanelConnectorClass; |
435 | + |
436 | +GType task_manager_panel_connector_get_type (void); |
437 | + |
438 | +guint task_manager_panel_connector_inhibit_autohide (TaskManagerPanelConnector *conn, const gchar *reason); |
439 | +void task_manager_panel_connector_uninhibit_autohide (TaskManagerPanelConnector *conn, guint cookie); |
440 | + |
441 | +TaskManagerPanelConnector* task_manager_panel_connector_new (gint id); |
442 | + |
443 | +G_END_DECLS |
444 | + |
445 | +#endif /* _TASK_MANAGER_PANEL_CONNECTOR */ |
446 | |
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 | #include "libawn/awn-pixbuf-cache.h" |
452 | #include "awn-desktop-lookup-cached.h" |
453 | #include "task-manager.h" |
454 | +#include "task-manager-panel-connector.h" |
455 | + |
456 | #include "dock-manager-api.h" |
457 | |
458 | #include "task-drag-indicator.h" |
459 | @@ -69,20 +71,26 @@ |
460 | |
461 | static GQuark win_quark = 0; |
462 | |
463 | +typedef struct |
464 | +{ |
465 | + DesktopAgnosticConfigClient *panel_instance_client; |
466 | + GdkWindow * foreign_window; |
467 | + GdkRegion * foreign_region; |
468 | + TaskManagerPanelConnector * connector; |
469 | + gint intellihide_mode; |
470 | + guint autohide_cookie; |
471 | +} TaskManagerAwnPanelInfo; |
472 | + |
473 | struct _TaskManagerPrivate |
474 | { |
475 | DesktopAgnosticConfigClient *client; |
476 | + |
477 | + DBusGConnection *connection; |
478 | + DBusGProxy *proxy; |
479 | + |
480 | TaskSettings *settings; |
481 | WnckScreen *screen; |
482 | |
483 | - /*Used by Intellihide*/ |
484 | - guint autohide_cookie; |
485 | - GdkWindow *awn_gdk_window; |
486 | - GdkRegion * awn_gdk_region; |
487 | - |
488 | - guint attention_cookie; |
489 | - guint attention_source; |
490 | - |
491 | /* Dragging properties */ |
492 | TaskIcon *dragged_icon; |
493 | TaskDragIndicator *drag_indicator; |
494 | @@ -97,19 +105,23 @@ |
495 | |
496 | GHashTable *win_table; |
497 | GHashTable *desktops_table; |
498 | + GHashTable *intellihide_panel_instances; |
499 | + |
500 | /* |
501 | Used during grouping configuration changes for optimization purposes |
502 | */ |
503 | GList *grouping_list; |
504 | /* Properties */ |
505 | GValueArray *launcher_paths; |
506 | + |
507 | + guint attention_cookie; |
508 | + guint attention_source; |
509 | + |
510 | gboolean show_all_windows; |
511 | gboolean only_show_launchers; |
512 | gboolean drag_and_drop; |
513 | gboolean grouping; |
514 | - gboolean intellihide; |
515 | gboolean icon_grouping; |
516 | - gint intellihide_mode; |
517 | gint match_strength; |
518 | gint attention_autohide_timer; |
519 | |
520 | @@ -128,6 +140,7 @@ |
521 | |
522 | enum |
523 | { |
524 | + INTELLIHIDE_NONE, |
525 | INTELLIHIDE_WORKSPACE, |
526 | INTELLIHIDE_APP, |
527 | INTELLIHIDE_GROUP |
528 | @@ -144,11 +157,8 @@ |
529 | PROP_GROUPING, |
530 | PROP_ICON_GROUPING, |
531 | PROP_MATCH_STRENGTH, |
532 | - PROP_INTELLIHIDE, |
533 | - PROP_INTELLIHIDE_MODE, |
534 | PROP_ATTENTION_AUTOHIDE_TIMER, |
535 | - PROP_ATTENTION_REQUIRED_REMINDER, |
536 | - PROP_ATTENTION_REQUIED_REMINDER_ID |
537 | + PROP_ATTENTION_REQUIRED_REMINDER |
538 | }; |
539 | |
540 | |
541 | @@ -205,6 +215,10 @@ |
542 | static void task_manager_active_workspace_changed_cb (WnckScreen *screen, |
543 | WnckWorkspace *previous_space, |
544 | TaskManager * manager); |
545 | +static void task_manager_check_for_intersection (TaskManager * manager, |
546 | + WnckWorkspace * space, |
547 | + WnckApplication * app); |
548 | + |
549 | static void task_manager_win_geom_changed_cb (WnckWindow *window, |
550 | TaskManager * manager); |
551 | static void task_manager_win_closed_cb (WnckScreen *screen, |
552 | @@ -219,6 +233,11 @@ |
553 | |
554 | static gboolean _attention_required_reminder_cb (TaskManager * manager); |
555 | |
556 | +static void task_manager_intellihide_change_cb (const char* group, |
557 | + const char* key, |
558 | + GValue* value, |
559 | + int * user_data); |
560 | + |
561 | typedef enum |
562 | { |
563 | TASK_MANAGER_ERROR_UNSUPPORTED_WINDOW_TYPE, |
564 | @@ -282,14 +301,6 @@ |
565 | g_value_set_boolean (value, manager->priv->icon_grouping); |
566 | break; |
567 | |
568 | - case PROP_INTELLIHIDE: |
569 | - g_value_set_boolean (value, manager->priv->intellihide); |
570 | - break; |
571 | - |
572 | - case PROP_INTELLIHIDE_MODE: |
573 | - g_value_set_int (value, manager->priv->intellihide_mode); |
574 | - break; |
575 | - |
576 | case PROP_MATCH_STRENGTH: |
577 | g_value_set_int (value, manager->priv->match_strength); |
578 | break; |
579 | @@ -315,6 +326,8 @@ |
580 | { |
581 | TaskManager *manager = TASK_MANAGER (object); |
582 | |
583 | + g_return_if_fail (TASK_IS_MANAGER (object)); |
584 | + |
585 | switch (prop_id) |
586 | { |
587 | case PROP_SHOW_ALL_WORKSPACES: |
588 | @@ -351,25 +364,7 @@ |
589 | case PROP_ICON_GROUPING: |
590 | manager->priv->icon_grouping = g_value_get_boolean (value); |
591 | break; |
592 | - |
593 | - case PROP_INTELLIHIDE: |
594 | - /* TODO move into a function */ |
595 | - manager->priv->intellihide = g_value_get_boolean (value); |
596 | - if (!manager->priv->intellihide && manager->priv->autohide_cookie) |
597 | - { |
598 | - awn_applet_uninhibit_autohide (AWN_APPLET(manager), manager->priv->autohide_cookie); |
599 | - manager->priv->autohide_cookie = 0; |
600 | - } |
601 | - if (manager->priv->intellihide && !manager->priv->autohide_cookie) |
602 | - { |
603 | - manager->priv->autohide_cookie = awn_applet_inhibit_autohide (AWN_APPLET(manager),"Intellihide" ); |
604 | - } |
605 | - break; |
606 | - |
607 | - case PROP_INTELLIHIDE_MODE: |
608 | - manager->priv->intellihide_mode = g_value_get_int (value); |
609 | - break; |
610 | - |
611 | + |
612 | case PROP_ATTENTION_AUTOHIDE_TIMER: |
613 | manager->priv->attention_autohide_timer = g_value_get_int (value); |
614 | break; |
615 | @@ -395,16 +390,108 @@ |
616 | } |
617 | |
618 | static void |
619 | +_delete_panel_info_cb (TaskManagerAwnPanelInfo * panel_info) |
620 | +{ |
621 | + g_object_unref (panel_info->connector); |
622 | + g_free (panel_info); |
623 | +} |
624 | + |
625 | +static void |
626 | +_on_panel_added (DBusGProxy *proxy,guint panel_id,TaskManager *applet) |
627 | +{ |
628 | + TaskManagerPrivate *priv = TASK_MANAGER_GET_PRIVATE (applet); |
629 | + GError * error = NULL; |
630 | + TaskManagerAwnPanelInfo * panel_info = NULL; |
631 | + gchar * uid = g_strdup_printf("-999%d",panel_id); |
632 | + |
633 | + g_assert (!g_hash_table_lookup (priv->intellihide_panel_instances,GINT_TO_POINTER (panel_id))); |
634 | + panel_info = g_malloc0 (sizeof (TaskManagerAwnPanelInfo) ); |
635 | + panel_info->connector = task_manager_panel_connector_new (panel_id); |
636 | + g_free (uid); |
637 | + panel_info->panel_instance_client = awn_config_get_default (panel_id, NULL); |
638 | + panel_info->intellihide_mode = desktop_agnostic_config_client_get_int ( |
639 | + panel_info->panel_instance_client, |
640 | + "panel", |
641 | + "intellihide_mode", |
642 | + &error); |
643 | + if (error) |
644 | + { |
645 | + g_debug ("%s: error accessing intellihide_mode. \"%s\"",__func__,error->message); |
646 | + g_error_free (error); |
647 | + error = NULL; |
648 | + } |
649 | + desktop_agnostic_config_client_notify_add (panel_info->panel_instance_client, |
650 | + "panel", |
651 | + "intellihide_mode", |
652 | + (DesktopAgnosticConfigNotifyFunc)task_manager_intellihide_change_cb, |
653 | + &panel_info->intellihide_mode, |
654 | + &error); |
655 | + if (error) |
656 | + { |
657 | + g_debug ("%s: error binding intellihide_mode. \"%s\"",__func__,error->message); |
658 | + g_error_free (error); |
659 | + error = NULL; |
660 | + } |
661 | + |
662 | + if (!panel_info->intellihide_mode && panel_info->autohide_cookie) |
663 | + { |
664 | + task_manager_panel_connector_uninhibit_autohide (panel_info->connector, panel_info->autohide_cookie); |
665 | + panel_info->autohide_cookie = 0; |
666 | + } |
667 | + if (panel_info->intellihide_mode && !panel_info->autohide_cookie) |
668 | + { |
669 | + panel_info->autohide_cookie = task_manager_panel_connector_inhibit_autohide (panel_info->connector,"Intellihide" ); |
670 | + } |
671 | + |
672 | + g_hash_table_insert (priv->intellihide_panel_instances,GINT_TO_POINTER(panel_id),panel_info); |
673 | +} |
674 | + |
675 | +static void |
676 | +_on_panel_removed (DBusGProxy *proxy,guint panel_id,TaskManager * applet) |
677 | +{ |
678 | + TaskManagerPrivate *priv = TASK_MANAGER_GET_PRIVATE (applet); |
679 | + TaskManagerAwnPanelInfo * panel_info = g_hash_table_lookup (priv->intellihide_panel_instances,GINT_TO_POINTER (panel_id)); |
680 | + |
681 | + desktop_agnostic_config_client_remove_instance (panel_info->panel_instance_client); |
682 | + g_assert (g_hash_table_remove (priv->intellihide_panel_instances,GINT_TO_POINTER (panel_id))); |
683 | +} |
684 | + |
685 | +static void |
686 | task_manager_constructed (GObject *object) |
687 | { |
688 | TaskManagerPrivate *priv; |
689 | GtkWidget *widget; |
690 | + GError *error=NULL; |
691 | + GStrv panel_paths; |
692 | |
693 | G_OBJECT_CLASS (task_manager_parent_class)->constructed (object); |
694 | |
695 | priv = TASK_MANAGER_GET_PRIVATE (object); |
696 | widget = GTK_WIDGET (object); |
697 | |
698 | + priv->proxy = dbus_g_proxy_new_for_name (priv->connection, |
699 | + "org.awnproject.Awn", |
700 | + "/org/awnproject/Awn", |
701 | + "org.awnproject.Awn.App"); |
702 | + if (!priv->proxy) |
703 | + { |
704 | + g_warning("%s: Could not connect to mothership!\n",__func__); |
705 | + } |
706 | + else |
707 | + { |
708 | + dbus_g_proxy_add_signal (priv->proxy, "PanelAdded", |
709 | + G_TYPE_INT, G_TYPE_INVALID); |
710 | + dbus_g_proxy_add_signal (priv->proxy, "PanelRemoved", |
711 | + G_TYPE_INT, G_TYPE_INVALID); |
712 | + dbus_g_proxy_connect_signal (priv->proxy, "PanelAdded", |
713 | + G_CALLBACK (_on_panel_added), object, |
714 | + NULL); |
715 | + dbus_g_proxy_connect_signal (priv->proxy, "PanelRemoved", |
716 | + G_CALLBACK (_on_panel_removed), object, |
717 | + NULL); |
718 | + |
719 | + } |
720 | + |
721 | /* |
722 | Set the cache size of our AwnPixbufCache to something a bit bigger. |
723 | |
724 | @@ -415,9 +502,12 @@ |
725 | NULL); |
726 | |
727 | priv->desktops_table = g_hash_table_new_full (g_str_hash,g_str_equal,g_free,g_free); |
728 | + priv->intellihide_panel_instances = g_hash_table_new_full (g_direct_hash,g_direct_equal, |
729 | + NULL, |
730 | + (GDestroyNotify)_delete_panel_info_cb); |
731 | |
732 | priv->client = awn_config_get_default_for_applet (AWN_APPLET (object), NULL); |
733 | - |
734 | + |
735 | /* Connect up the important bits */ |
736 | desktop_agnostic_config_client_bind (priv->client, |
737 | DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT, |
738 | @@ -454,21 +544,9 @@ |
739 | "icon_grouping", |
740 | object, "icon_grouping", TRUE, |
741 | DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, |
742 | - NULL); |
743 | - desktop_agnostic_config_client_bind (priv->client, |
744 | - DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT, |
745 | - "intellihide", |
746 | - object, "intellihide", TRUE, |
747 | - DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, |
748 | NULL); |
749 | desktop_agnostic_config_client_bind (priv->client, |
750 | DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT, |
751 | - "intellihide_mode", |
752 | - object, "intellihide_mode", TRUE, |
753 | - DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, |
754 | - NULL); |
755 | - desktop_agnostic_config_client_bind (priv->client, |
756 | - DESKTOP_AGNOSTIC_CONFIG_GROUP_DEFAULT, |
757 | "match_strength", |
758 | object, "match_strength", TRUE, |
759 | DESKTOP_AGNOSTIC_CONFIG_BIND_METHOD_FALLBACK, |
760 | @@ -495,6 +573,32 @@ |
761 | |
762 | /* DBus interface */ |
763 | priv->dbus_proxy = task_manager_dispatcher_new (TASK_MANAGER (object)); |
764 | + |
765 | + if (priv->proxy) |
766 | + { |
767 | + dbus_g_proxy_call (priv->proxy, "GetPanels", |
768 | + &error, |
769 | + G_TYPE_INVALID, |
770 | + G_TYPE_STRV, &panel_paths, |
771 | + G_TYPE_INVALID); |
772 | + if (error) |
773 | + { |
774 | + g_debug ("%s: %s",__func__,error->message); |
775 | + g_error_free (error); |
776 | + error = NULL; |
777 | + } |
778 | + else |
779 | + { |
780 | + for (gint i=0; panel_paths[i];i++) |
781 | + { |
782 | + //strlen is like this as a reminder. |
783 | + _on_panel_added (priv->proxy, |
784 | + atoi(panel_paths[i] + strlen("/org/awnproject/Awn/Panel")), |
785 | + TASK_MANAGER(object)); |
786 | + |
787 | + } |
788 | + } |
789 | + } |
790 | } |
791 | |
792 | static void |
793 | @@ -555,22 +659,6 @@ |
794 | G_PARAM_CONSTRUCT | G_PARAM_READWRITE); |
795 | g_object_class_install_property (obj_class, PROP_ICON_GROUPING, pspec); |
796 | |
797 | - pspec = g_param_spec_boolean ("intellihide", |
798 | - "intellihide", |
799 | - "Intellihide", |
800 | - TRUE, |
801 | - G_PARAM_READWRITE); |
802 | - g_object_class_install_property (obj_class, PROP_INTELLIHIDE, pspec); |
803 | - |
804 | - pspec = g_param_spec_int ("intellihide_mode", |
805 | - "intellihide mode", |
806 | - "Intellihide mode", |
807 | - 0, |
808 | - 2, |
809 | - 1, |
810 | - G_PARAM_CONSTRUCT | G_PARAM_READWRITE); |
811 | - g_object_class_install_property (obj_class, PROP_INTELLIHIDE_MODE, pspec); |
812 | - |
813 | pspec = g_param_spec_int ("match_strength", |
814 | "match_strength", |
815 | "How radical matching is applied for grouping items", |
816 | @@ -619,9 +707,10 @@ |
817 | task_manager_init (TaskManager *manager) |
818 | { |
819 | TaskManagerPrivate *priv; |
820 | - |
821 | + GError *error = NULL; |
822 | + |
823 | priv = manager->priv = TASK_MANAGER_GET_PRIVATE (manager); |
824 | - |
825 | + |
826 | priv->screen = wnck_screen_get_default (); |
827 | priv->launcher_paths = NULL; |
828 | priv->hidden_list = NULL; |
829 | @@ -647,6 +736,14 @@ |
830 | priv->dragged_icon = NULL; |
831 | priv->drag_timeout = 0; |
832 | |
833 | + priv->connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); |
834 | + priv->proxy = NULL; |
835 | + if (error) |
836 | + { |
837 | + g_warning ("%s", error->message); |
838 | + g_error_free(error); |
839 | + } |
840 | + |
841 | /* connect to the relevent WnckScreen signals */ |
842 | g_signal_connect (priv->screen, "window-opened", |
843 | G_CALLBACK (on_window_opened), manager); |
844 | @@ -755,16 +852,25 @@ |
845 | desktop_agnostic_config_client_unbind_all_for_object (priv->client, |
846 | object, |
847 | NULL); |
848 | + if (priv->connection) |
849 | + { |
850 | + if (priv->proxy) g_object_unref (priv->proxy); |
851 | + dbus_g_connection_unref (priv->connection); |
852 | + priv->connection = NULL; |
853 | + priv->proxy = NULL; |
854 | + } |
855 | + |
856 | + /* |
857 | if (priv->autohide_cookie) |
858 | { |
859 | awn_applet_uninhibit_autohide (AWN_APPLET(object), priv->autohide_cookie); |
860 | priv->autohide_cookie = 0; |
861 | - } |
862 | - if (priv->awn_gdk_window) |
863 | + }*/ |
864 | +/* if (priv->awn_gdk_window) |
865 | { |
866 | g_object_unref (priv->awn_gdk_window); |
867 | priv->awn_gdk_window = NULL; |
868 | - } |
869 | + }*/ |
870 | |
871 | G_OBJECT_CLASS (task_manager_parent_class)->dispose (object); |
872 | } |
873 | @@ -1734,14 +1840,22 @@ |
874 | g_value_array_free (launcher_paths); |
875 | } |
876 | |
877 | +static void |
878 | +task_manager_intellihide_change_cb (const char* group, |
879 | + const char* key, |
880 | + GValue* value, |
881 | + int * user_data) |
882 | +{ |
883 | + *user_data = g_value_get_int (value); |
884 | +} |
885 | + |
886 | /* |
887 | * Checks when launchers got added/removed in the list in gconf/file. |
888 | * It removes the launchers from the task-icons and add those |
889 | * that aren't already on the bar. |
890 | */ |
891 | static void |
892 | -task_manager_refresh_launcher_paths (TaskManager *manager, |
893 | - GValueArray *list) |
894 | +task_manager_refresh_launcher_paths (TaskManager *manager, GValueArray *list) |
895 | { |
896 | TaskManagerPrivate *priv; |
897 | |
898 | @@ -2434,14 +2548,9 @@ |
899 | return region; |
900 | } |
901 | |
902 | -/* |
903 | - Governs the panel autohide when Intellihide is enabled. |
904 | - If a window in the relevant window list intersects with the awn panel then |
905 | - autohide will be uninhibited otherwise it will be inhibited. |
906 | - */ |
907 | - |
908 | static void |
909 | -task_manager_check_for_intersection (TaskManager * manager, |
910 | +task_manager_check_for_panel_instance_intersection (TaskManager * manager, |
911 | + TaskManagerAwnPanelInfo * panel_info, |
912 | WnckWorkspace * space, |
913 | WnckApplication * app) |
914 | { |
915 | @@ -2451,35 +2560,24 @@ |
916 | gboolean intersect = FALSE; |
917 | GdkRectangle awn_rect; |
918 | gint depth; |
919 | - gint64 xid; |
920 | GdkRegion * updated_region; |
921 | - |
922 | g_return_if_fail (TASK_IS_MANAGER (manager)); |
923 | priv = manager->priv; |
924 | |
925 | - /* |
926 | - Generate a GdkRegion for the awn panel_size |
927 | - */ |
928 | - if (!priv->awn_gdk_window) |
929 | - { |
930 | - g_object_get (manager, "panel-xid", &xid, NULL); |
931 | - priv->awn_gdk_window = gdk_window_foreign_new ( xid); |
932 | - } |
933 | - g_return_if_fail (priv->awn_gdk_window); |
934 | - gdk_window_get_geometry (priv->awn_gdk_window,&awn_rect.x, |
935 | + gdk_window_get_geometry (panel_info->foreign_window,&awn_rect.x, |
936 | &awn_rect.y,&awn_rect.width, |
937 | &awn_rect.height,&depth); |
938 | /* |
939 | gdk_window_get_geometry gives us an x,y or 0,0 |
940 | Fix that using get root origin. |
941 | */ |
942 | - gdk_window_get_root_origin (priv->awn_gdk_window,&awn_rect.x,&awn_rect.y); |
943 | + gdk_window_get_root_origin (panel_info->foreign_window,&awn_rect.x,&awn_rect.y); |
944 | /* |
945 | We cache the region for reuse for situations where the input mask is an empty |
946 | region when the panel is hidden. In that case we reuse the last good |
947 | region. |
948 | */ |
949 | - updated_region = xutils_get_input_shape (priv->awn_gdk_window); |
950 | + updated_region = xutils_get_input_shape (panel_info->foreign_window); |
951 | g_return_if_fail (updated_region); |
952 | if (gdk_region_empty(updated_region)) |
953 | { |
954 | @@ -2487,18 +2585,18 @@ |
955 | } |
956 | else |
957 | { |
958 | - if (priv->awn_gdk_region) |
959 | + if (panel_info->foreign_region) |
960 | { |
961 | - gdk_region_destroy (priv->awn_gdk_region); |
962 | + gdk_region_destroy (panel_info->foreign_region); |
963 | } |
964 | - priv->awn_gdk_region = updated_region; |
965 | - gdk_region_offset (priv->awn_gdk_region,awn_rect.x,awn_rect.y); |
966 | + panel_info->foreign_region = updated_region; |
967 | + gdk_region_offset (panel_info->foreign_region,awn_rect.x,awn_rect.y); |
968 | } |
969 | |
970 | /* |
971 | Get the list of windows to check for intersection |
972 | */ |
973 | - switch (priv->intellihide_mode) |
974 | + switch (panel_info->intellihide_mode) |
975 | { |
976 | case INTELLIHIDE_WORKSPACE: |
977 | windows = wnck_screen_get_windows (priv->screen); |
978 | @@ -2506,7 +2604,14 @@ |
979 | case INTELLIHIDE_GROUP: /*TODO... Implement this for now same as app*/ |
980 | case INTELLIHIDE_APP: |
981 | default: |
982 | - windows = wnck_application_get_windows (app); |
983 | + if (app) |
984 | + { |
985 | + windows = wnck_application_get_windows (app); |
986 | + } |
987 | + else |
988 | + { |
989 | + windows = wnck_screen_get_windows (priv->screen); |
990 | + } |
991 | break; |
992 | } |
993 | |
994 | @@ -2543,7 +2648,7 @@ |
995 | &win_rect.y,&win_rect.width, |
996 | &win_rect.height); |
997 | |
998 | - if (gdk_region_rect_in (priv->awn_gdk_region, &win_rect) != |
999 | + if (gdk_region_rect_in (panel_info->foreign_region, &win_rect) != |
1000 | GDK_OVERLAP_RECTANGLE_OUT) |
1001 | { |
1002 | #ifdef DEBUG |
1003 | @@ -2558,28 +2663,94 @@ |
1004 | /* |
1005 | Allow panel to hide (if necessary) |
1006 | */ |
1007 | - if (intersect && priv->autohide_cookie) |
1008 | + if (intersect && panel_info->autohide_cookie) |
1009 | { |
1010 | - awn_applet_uninhibit_autohide (AWN_APPLET(manager), priv->autohide_cookie); |
1011 | + task_manager_panel_connector_uninhibit_autohide (panel_info->connector, panel_info->autohide_cookie); |
1012 | #ifdef DEBUG |
1013 | - g_debug ("me eat cookie: %u",priv->autohide_cookie); |
1014 | + g_debug ("me eat cookie: %u",panel_info->autohide_cookie); |
1015 | #endif |
1016 | - priv->autohide_cookie = 0; |
1017 | + panel_info->autohide_cookie = 0; |
1018 | } |
1019 | |
1020 | /* |
1021 | Inhibit Hide if not already doing so |
1022 | */ |
1023 | - if (!intersect && !priv->autohide_cookie) |
1024 | + if (!intersect && !panel_info->autohide_cookie) |
1025 | { |
1026 | - priv->autohide_cookie = awn_applet_inhibit_autohide (AWN_APPLET(manager), "Intellihide"); |
1027 | + gchar * identifier = g_strdup_printf ("Intellihide:applet_conector=%p",panel_info->connector); |
1028 | + panel_info->autohide_cookie = task_manager_panel_connector_inhibit_autohide (panel_info->connector, identifier); |
1029 | + g_free (identifier); |
1030 | #ifdef DEBUG |
1031 | - g_debug ("cookie is %u",priv->autohide_cookie); |
1032 | + g_debug ("cookie is %u",panel_info->autohide_cookie); |
1033 | #endif |
1034 | } |
1035 | |
1036 | } |
1037 | |
1038 | +static gboolean |
1039 | +_waiting_for_panel_dbus (TaskManager * manager) |
1040 | +{ |
1041 | + TaskManagerPrivate *priv; |
1042 | + |
1043 | + g_return_val_if_fail (TASK_IS_MANAGER (manager),FALSE); |
1044 | + priv = manager->priv; |
1045 | + |
1046 | + task_manager_check_for_intersection (manager, |
1047 | + wnck_screen_get_active_workspace (priv->screen), |
1048 | + wnck_application_get (wnck_window_get_xid(wnck_screen_get_active_window (priv->screen)))); |
1049 | + return FALSE; |
1050 | +} |
1051 | +/* |
1052 | + Governs the panel autohide when Intellihide is enabled. |
1053 | + If a window in the relevant window list intersects with the awn panel then |
1054 | + autohide will be uninhibited otherwise it will be inhibited. |
1055 | + */ |
1056 | + |
1057 | +static void |
1058 | +task_manager_check_for_intersection (TaskManager * manager, |
1059 | + WnckWorkspace * space, |
1060 | + WnckApplication * app) |
1061 | +{ |
1062 | + TaskManagerPrivate *priv; |
1063 | + gint64 xid; |
1064 | + GHashTableIter iter; |
1065 | + gpointer key,value; |
1066 | + |
1067 | + g_return_if_fail (TASK_IS_MANAGER (manager)); |
1068 | + priv = manager->priv; |
1069 | + |
1070 | + g_hash_table_iter_init (&iter, priv->intellihide_panel_instances); |
1071 | + while (g_hash_table_iter_next (&iter, &key, &value) ) |
1072 | + { |
1073 | + TaskManagerAwnPanelInfo * panel_info = value; |
1074 | + g_object_get (panel_info->connector, "panel-xid", &xid, NULL); |
1075 | + if (!xid) |
1076 | + { |
1077 | + g_timeout_add (1000,(GSourceFunc)_waiting_for_panel_dbus,manager); |
1078 | + } |
1079 | + else |
1080 | + { |
1081 | + if (!panel_info->foreign_window) |
1082 | + { |
1083 | + panel_info->foreign_window = gdk_window_foreign_new ( xid); |
1084 | + } |
1085 | + if (panel_info->intellihide_mode) |
1086 | + { |
1087 | + task_manager_check_for_panel_instance_intersection(manager, |
1088 | + panel_info, |
1089 | + space, |
1090 | + app); |
1091 | + } |
1092 | + else if ( !panel_info->intellihide_mode && panel_info->autohide_cookie) |
1093 | + { |
1094 | + task_manager_panel_connector_uninhibit_autohide (panel_info->connector, panel_info->autohide_cookie); |
1095 | + panel_info->autohide_cookie = 0; |
1096 | + } |
1097 | + } |
1098 | + } |
1099 | + return; |
1100 | +} |
1101 | + |
1102 | /* |
1103 | Active window has changed. If intellhide is active we need to check for |
1104 | window instersections |
1105 | @@ -2596,12 +2767,6 @@ |
1106 | |
1107 | g_return_if_fail (TASK_IS_MANAGER (manager)); |
1108 | priv = manager->priv; |
1109 | - |
1110 | - if (!priv->intellihide) |
1111 | - { |
1112 | -/* g_warning ("%s: Intellihide callback invoked with Intellihide off",__func__);*/ |
1113 | - return; |
1114 | - } |
1115 | |
1116 | win = wnck_screen_get_active_window (screen); |
1117 | if (!win) |
1118 | @@ -2612,13 +2777,17 @@ |
1119 | we had intersection and the panel was hidden, it will continue hide. |
1120 | So inhibit the autohide if there is no active window. |
1121 | */ |
1122 | + task_manager_check_for_intersection (manager, |
1123 | + wnck_screen_get_active_workspace(screen), |
1124 | + NULL); |
1125 | +/* |
1126 | if (!priv->autohide_cookie) |
1127 | { |
1128 | priv->autohide_cookie = awn_applet_inhibit_autohide (AWN_APPLET(manager), "Intellihide"); |
1129 | #ifdef DEBUG |
1130 | g_debug ("%s: cookie is %u",__func__,priv->autohide_cookie); |
1131 | #endif |
1132 | - } |
1133 | + }*/ |
1134 | return; |
1135 | } |
1136 | app = wnck_window_get_application (win); |
1137 | @@ -2641,21 +2810,13 @@ |
1138 | |
1139 | g_return_if_fail (TASK_IS_MANAGER (manager)); |
1140 | priv = manager->priv; |
1141 | - if (!priv->intellihide) |
1142 | - { |
1143 | -/* g_warning ("%s: Intellihide callback invoked with Intellihide off",__func__); */ |
1144 | - return; |
1145 | - } |
1146 | + |
1147 | win = wnck_screen_get_active_window (screen); |
1148 | if (!win) |
1149 | { |
1150 | - if (!priv->autohide_cookie) |
1151 | - { |
1152 | - priv->autohide_cookie = awn_applet_inhibit_autohide (AWN_APPLET(manager), "Intellihide"); |
1153 | -#ifdef DEBUG |
1154 | - g_debug ("%s: cookie is %u",__func__,priv->autohide_cookie); |
1155 | -#endif |
1156 | - } |
1157 | + task_manager_check_for_intersection (manager, |
1158 | + wnck_screen_get_active_workspace(screen), |
1159 | + NULL); |
1160 | return; |
1161 | } |
1162 | |
1163 | @@ -2671,13 +2832,9 @@ |
1164 | WnckWindow *win; |
1165 | WnckApplication *app; |
1166 | WnckWorkspace *space; |
1167 | + |
1168 | g_return_if_fail (TASK_IS_MANAGER (manager)); |
1169 | priv = manager->priv; |
1170 | - if (!priv->intellihide) |
1171 | - { |
1172 | -/* g_warning ("%s: Intellihide callback invoked with Intellihide off",__func__);*/ |
1173 | - return; |
1174 | - } |
1175 | win = wnck_screen_get_active_window (priv->screen); |
1176 | if (!win) |
1177 | { |
1178 | @@ -2703,11 +2860,6 @@ |
1179 | WnckWorkspace *space; |
1180 | g_return_if_fail (TASK_IS_MANAGER (manager)); |
1181 | priv = manager->priv; |
1182 | - if (!priv->intellihide) |
1183 | - { |
1184 | -/* g_warning ("%s: Intellihide callback invoked with Intellihide off",__func__);*/ |
1185 | - return; |
1186 | - } |
1187 | win = wnck_screen_get_active_window (priv->screen); |
1188 | if (!win) |
1189 | { |
1190 | @@ -2730,10 +2882,6 @@ |
1191 | g_return_if_fail (TASK_IS_MANAGER (manager)); |
1192 | priv = manager->priv; |
1193 | |
1194 | - if (!priv->intellihide) |
1195 | - { |
1196 | - return; |
1197 | - } |
1198 | win = wnck_screen_get_active_window (priv->screen); |
1199 | if (!win) |
1200 | { |
1201 | |
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 | default = false |
1207 | _description=If true, the panel will expand to full monitor width/height. |
1208 | |
1209 | +[panel/intellihide_mode] |
1210 | +type = integer |
1211 | +default = 2 |
1212 | +_description= Intellihide mode. 0.. Disabled, 1.. use windows on active workspace, 2.. use windows of currently focused app. |
1213 | + |
1214 | [panel/monitor_align] |
1215 | type = float |
1216 | default = 0.5 |
1217 | |
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 | [DBus (name="org.awnproject.Awn.App")] |
1223 | public interface AppDBusInterface: GLib.Object |
1224 | { |
1225 | - public abstract ObjectPath[] get_panels () throws DBus.Error; |
1226 | + public abstract string[] get_panels () throws DBus.Error; |
1227 | public abstract void remove_panel (int panel_id) throws DBus.Error; |
1228 | + public signal void panel_added (int panel_id); |
1229 | + public signal void panel_removed (int panel_id); |
1230 | } |
1231 | |
1232 | public class Application: GLib.Object, AppDBusInterface |
1233 | @@ -107,6 +109,7 @@ |
1234 | this.panels.insert ((owned)path, panel); |
1235 | |
1236 | panel.show (); |
1237 | + this.panel_added (panel_id); |
1238 | } |
1239 | else |
1240 | { |
1241 | @@ -116,24 +119,25 @@ |
1242 | |
1243 | foreach (unowned Panel p in untouched_panels) |
1244 | { |
1245 | + int panel_id = p.panel_id; |
1246 | string path = "/org/awnproject/Awn/Panel%d".printf (p.panel_id); |
1247 | this.panels.remove (path); |
1248 | + this.panel_removed (panel_id); |
1249 | p.destroy (); |
1250 | } |
1251 | } |
1252 | |
1253 | - public ObjectPath[] get_panels () throws DBus.Error |
1254 | + public string[] get_panels () throws DBus.Error |
1255 | { |
1256 | var keys = this.panels.get_keys (); |
1257 | keys.sort (strcmp); |
1258 | |
1259 | - ObjectPath[] paths = new ObjectPath[keys.length ()]; |
1260 | + string[] paths = new string[keys.length ()]; |
1261 | int i = 0; |
1262 | foreach (unowned string path in keys) |
1263 | { |
1264 | - paths[i++] = new ObjectPath (path); |
1265 | + paths[i++] = path; |
1266 | } |
1267 | - |
1268 | return paths; |
1269 | } |
1270 |
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.