]> Dogcows Code - chaz/tint2/blob - src/systray/systraybar.c
2d13af46b457eb0c908cb7b01f8464530f1e1079
[chaz/tint2] / src / systray / systraybar.c
1 /**************************************************************************
2 * Tint2 : systraybar
3 *
4 * Copyright (C) 2009 thierry lorthiois (lorthiois@bbsoft.fr)
5 * based on 'docker-1.5' from Ben Jansens.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version 2
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 **************************************************************************/
19
20 #include <X11/Xlib.h>
21 #include <X11/Xutil.h>
22 #include <X11/Xatom.h>
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 #include <glib.h>
27 #include <Imlib2.h>
28 #include <X11/extensions/Xdamage.h>
29 #include <X11/extensions/Xcomposite.h>
30 #include <X11/extensions/Xrender.h>
31
32
33 #include "systraybar.h"
34 #include "server.h"
35 #include "panel.h"
36
37 GSList *icons;
38
39 /* defined in the systray spec */
40 #define SYSTEM_TRAY_REQUEST_DOCK 0
41 #define SYSTEM_TRAY_BEGIN_MESSAGE 1
42 #define SYSTEM_TRAY_CANCEL_MESSAGE 2
43
44 // selection window
45 Window net_sel_win = None;
46
47 // freedesktop specification doesn't allow multi systray
48 Systraybar systray;
49 int refresh_systray;
50 int systray_enabled;
51 int systray_max_icon_size;
52
53 // background pixmap if we render ourselves the icons
54 static Pixmap render_background;
55
56
57 void default_systray()
58 {
59 memset(&systray, 0, sizeof(Systraybar));
60 render_background = 0;
61 systray.alpha = 100;
62 systray.sort = 3;
63 systray.area._draw_foreground = draw_systray;
64 systray.area.size_mode = SIZE_BY_CONTENT;
65 systray.area._resize = resize_systray;
66 }
67
68 void cleanup_systray()
69 {
70 stop_net();
71 systray_enabled = 0;
72 systray_max_icon_size = 0;
73 systray.area.on_screen = 0;
74 free_area(&systray.area);
75 if (render_background) {
76 XFreePixmap(server.dsp, render_background);
77 render_background = 0;
78 }
79 }
80
81 void init_systray()
82 {
83 start_net();
84
85 if (!systray_enabled)
86 return;
87
88 if (!server.visual32 && (systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0)) {
89 printf("No 32 bit visual for your X implementation. 'systray_asb = 100 0 0' will be forced\n");
90 systray.alpha = 100;
91 systray.brightness = systray.saturation = 0;
92 }
93 }
94
95
96 void init_systray_panel(void *p)
97 {
98 Panel *panel =(Panel*)p;
99
100 systray.area.parent = p;
101 systray.area.panel = p;
102
103 GSList *l;
104 int count = 0;
105 for (l = systray.list_icons; l ; l = l->next) {
106 if (!((TrayWindow*)l->data)->hide)
107 count++;
108 }
109 if (count == 0)
110 systray.area.on_screen = 0;
111 else
112 systray.area.on_screen = 1;
113 refresh_systray = 0;
114 }
115
116
117 void draw_systray(void *obj, cairo_t *c)
118 {
119 // here, sysbar's position is defined. so we can calculate position of tray icon.
120 Systraybar *sysbar = obj;
121 Panel *panel = sysbar->area.panel;
122 int i, posx, posy;
123 int start = panel->area.bg->border.width + panel->area.paddingy + systray.area.bg->border.width + systray.area.paddingy +sysbar->marging/2;
124 if (panel_horizontal) {
125 posy = start;
126 posx = systray.area.posx + systray.area.bg->border.width + systray.area.paddingxlr;
127 }
128 else {
129 posx = start;
130 posy = systray.area.posy + systray.area.bg->border.width + systray.area.paddingxlr;
131 }
132
133 TrayWindow *traywin;
134 GSList *l;
135 for (i=1, l = systray.list_icons; l ; i++, l = l->next) {
136 traywin = (TrayWindow*)l->data;
137 if (traywin->hide) continue;
138
139 traywin->y = posy;
140 traywin->x = posx;
141 traywin->width = sysbar->icon_size;
142 traywin->height = sysbar->icon_size;
143 if (panel_horizontal) {
144 if (i % sysbar->icons_per_column)
145 posy += sysbar->icon_size + sysbar->area.paddingx;
146 else {
147 posy = start;
148 posx += (sysbar->icon_size + systray.area.paddingx);
149 }
150 }
151 else {
152 if (i % sysbar->icons_per_row)
153 posx += sysbar->icon_size + systray.area.paddingx;
154 else {
155 posx = start;
156 posy += (sysbar->icon_size + systray.area.paddingx);
157 }
158 }
159
160 // position and size the icon window
161 XMoveResizeWindow(server.dsp, traywin->id, traywin->x, traywin->y, sysbar->icon_size, sysbar->icon_size);
162 XResizeWindow(server.dsp, traywin->tray_id, sysbar->icon_size, sysbar->icon_size);
163 }
164
165 if (server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
166 if (render_background) XFreePixmap(server.dsp, render_background);
167 render_background = XCreatePixmap(server.dsp, server.root_win, systray.area.width, systray.area.height, server.depth);
168 XCopyArea(server.dsp, systray.area.pix, render_background, server.gc, 0, 0, systray.area.width, systray.area.height, 0, 0);
169 }
170
171 refresh_systray = 1;
172 }
173
174
175 int resize_systray(void *obj)
176 {
177 Systraybar *sysbar = obj;
178 GSList *l;
179 int count;
180
181 if (panel_horizontal)
182 sysbar->icon_size = sysbar->area.height;
183 else
184 sysbar->icon_size = sysbar->area.width;
185 sysbar->icon_size = sysbar->icon_size - (2 * sysbar->area.bg->border.width) - (2 * sysbar->area.paddingy);
186 if (systray_max_icon_size > 0 && sysbar->icon_size > systray_max_icon_size)
187 sysbar->icon_size = systray_max_icon_size;
188 count = 0;
189 for (l = systray.list_icons; l ; l = l->next) {
190 if (!((TrayWindow*)l->data)->hide)
191 count++;
192 }
193 //printf("count %d\n", count);
194
195 if (panel_horizontal) {
196 int height = sysbar->area.height - 2*sysbar->area.bg->border.width - 2*sysbar->area.paddingy;
197 // here icons_per_column always higher than 0
198 sysbar->icons_per_column = (height+sysbar->area.paddingx) / (sysbar->icon_size+sysbar->area.paddingx);
199 sysbar->marging = height - (sysbar->icons_per_column-1)*(sysbar->icon_size+sysbar->area.paddingx) - sysbar->icon_size;
200 sysbar->icons_per_row = count / sysbar->icons_per_column + (count%sysbar->icons_per_column != 0);
201 systray.area.width = (2 * systray.area.bg->border.width) + (2 * systray.area.paddingxlr) + (sysbar->icon_size * sysbar->icons_per_row) + ((sysbar->icons_per_row-1) * systray.area.paddingx);
202 }
203 else {
204 int width = sysbar->area.width - 2*sysbar->area.bg->border.width - 2*sysbar->area.paddingy;
205 // here icons_per_row always higher than 0
206 sysbar->icons_per_row = (width+sysbar->area.paddingx) / (sysbar->icon_size+sysbar->area.paddingx);
207 sysbar->marging = width - (sysbar->icons_per_row-1)*(sysbar->icon_size+sysbar->area.paddingx) - sysbar->icon_size;
208 sysbar->icons_per_column = count / sysbar->icons_per_row+ (count%sysbar->icons_per_row != 0);
209 systray.area.height = (2 * systray.area.bg->border.width) + (2 * systray.area.paddingxlr) + (sysbar->icon_size * sysbar->icons_per_column) + ((sysbar->icons_per_column-1) * systray.area.paddingx);
210 }
211 return 1;
212 }
213
214
215 // ***********************************************
216 // systray protocol
217
218 void start_net()
219 {
220 if (net_sel_win) {
221 // protocol already started
222 if (!systray_enabled)
223 stop_net();
224 return;
225 }
226 else
227 if (!systray_enabled)
228 return;
229
230 Window win = XGetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN);
231
232 // freedesktop systray specification
233 if (win != None) {
234 // search pid
235 Atom _NET_WM_PID, actual_type;
236 int actual_format;
237 unsigned long nitems;
238 unsigned long bytes_after;
239 unsigned char *prop = 0;
240 int pid;
241
242 _NET_WM_PID = XInternAtom(server.dsp, "_NET_WM_PID", True);
243 int ret = XGetWindowProperty(server.dsp, win, _NET_WM_PID, 0, 1024, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &bytes_after, &prop);
244
245 fprintf(stderr, "tint2 : another systray is running");
246 if (ret == Success && prop) {
247 pid = prop[1] * 256;
248 pid += prop[0];
249 fprintf(stderr, " pid=%d", pid);
250 }
251 fprintf(stderr, "\n");
252 return;
253 }
254
255 // init systray protocol
256 net_sel_win = XCreateSimpleWindow(server.dsp, server.root_win, -1, -1, 1, 1, 0, 0, 0);
257
258 // v0.3 trayer specification. tint2 always horizontal.
259 // Vertical panel will draw the systray horizontal.
260 long orient = 0;
261 XChangeProperty(server.dsp, net_sel_win, server.atom._NET_SYSTEM_TRAY_ORIENTATION, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &orient, 1);
262 VisualID vid;
263 if (server.visual32 && (systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0))
264 vid = XVisualIDFromVisual(server.visual32);
265 else
266 vid = XVisualIDFromVisual(server.visual);
267 XChangeProperty(server.dsp, net_sel_win, XInternAtom(server.dsp, "_NET_SYSTEM_TRAY_VISUAL", False), XA_VISUALID, 32, PropModeReplace, (unsigned char*)&vid, 1);
268
269 XSetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN, net_sel_win, CurrentTime);
270 if (XGetSelectionOwner(server.dsp, server.atom._NET_SYSTEM_TRAY_SCREEN) != net_sel_win) {
271 stop_net();
272 fprintf(stderr, "tint2 : can't get systray manager\n");
273 return;
274 }
275
276 //fprintf(stderr, "tint2 : systray started\n");
277 XClientMessageEvent ev;
278 ev.type = ClientMessage;
279 ev.window = server.root_win;
280 ev.message_type = server.atom.MANAGER;
281 ev.format = 32;
282 ev.data.l[0] = CurrentTime;
283 ev.data.l[1] = server.atom._NET_SYSTEM_TRAY_SCREEN;
284 ev.data.l[2] = net_sel_win;
285 ev.data.l[3] = 0;
286 ev.data.l[4] = 0;
287 XSendEvent(server.dsp, server.root_win, False, StructureNotifyMask, (XEvent*)&ev);
288 }
289
290
291 void stop_net()
292 {
293 //fprintf(stderr, "tint2 : systray stopped\n");
294 if (systray.list_icons) {
295 // remove_icon change systray.list_icons
296 while(systray.list_icons)
297 remove_icon((TrayWindow*)systray.list_icons->data);
298
299 g_slist_free(systray.list_icons);
300 systray.list_icons = 0;
301 }
302
303 if (net_sel_win != None) {
304 XDestroyWindow(server.dsp, net_sel_win);
305 net_sel_win = None;
306 }
307 }
308
309
310 gboolean error;
311 int window_error_handler(Display *d, XErrorEvent *e)
312 {
313 d=d;e=e;
314 error = TRUE;
315 if (e->error_code != BadWindow) {
316 printf("error_handler %d\n", e->error_code);
317 }
318 return 0;
319 }
320
321
322 static gint compare_traywindows(gconstpointer a, gconstpointer b)
323 {
324 const TrayWindow * traywin_a = (TrayWindow*)a;
325 const TrayWindow * traywin_b = (TrayWindow*)b;
326 XTextProperty name_a, name_b;
327
328 if(XGetWMName(server.dsp, traywin_a->tray_id, &name_a) == 0) {
329 return -1;
330 }
331 else if(XGetWMName(server.dsp, traywin_b->tray_id, &name_b) == 0) {
332 XFree(name_a.value);
333 return 1;
334 }
335 else {
336 gint retval = g_ascii_strncasecmp((char*)name_a.value, (char*)name_b.value, -1) * systray.sort;
337 XFree(name_a.value);
338 XFree(name_b.value);
339 return retval;
340 }
341 }
342
343
344 gboolean add_icon(Window id)
345 {
346 TrayWindow *traywin;
347 XErrorHandler old;
348 Panel *panel = systray.area.panel;
349 int hide = 0;
350
351 error = FALSE;
352 XWindowAttributes attr;
353 if ( XGetWindowAttributes(server.dsp, id, &attr) == False ) return FALSE;
354 unsigned long mask = 0;
355 XSetWindowAttributes set_attr;
356 Visual* visual = server.visual;
357 //printf("icon with depth: %d, width %d, height %d\n", attr.depth, attr.width, attr.height);
358 //printf("icon with depth: %d\n", attr.depth);
359 if (attr.depth != server.depth || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
360 visual = attr.visual;
361 set_attr.colormap = attr.colormap;
362 set_attr.background_pixel = 0;
363 set_attr.border_pixel = 0;
364 mask = CWColormap|CWBackPixel|CWBorderPixel;
365 }
366 else {
367 set_attr.background_pixmap = ParentRelative;
368 mask = CWBackPixmap;
369 }
370 Window parent_window;
371 parent_window = XCreateWindow(server.dsp, panel->main_win, 0, 0, 30, 30, 0, attr.depth, InputOutput, visual, mask, &set_attr);
372 old = XSetErrorHandler(window_error_handler);
373 XReparentWindow(server.dsp, id, parent_window, 0, 0);
374 XSync(server.dsp, False);
375 XSetErrorHandler(old);
376 if (error != FALSE) {
377 fprintf(stderr, "tint2 : not icon_swallow\n");
378 XDestroyWindow(server.dsp, parent_window);
379 return FALSE;
380 }
381
382 {
383 Atom acttype;
384 int actfmt;
385 unsigned long nbitem, bytes;
386 unsigned char *data = 0;
387 int ret;
388
389 ret = XGetWindowProperty(server.dsp, id, server.atom._XEMBED_INFO, 0, 2, False, server.atom._XEMBED_INFO, &acttype, &actfmt, &nbitem, &bytes, &data);
390 if (ret == Success) {
391 if (data) {
392 if (nbitem == 2) {
393 //hide = ((data[1] & XEMBED_MAPPED) == 0);
394 //printf("hide %d\n", hide);
395 }
396 XFree(data);
397 }
398 }
399 else {
400 fprintf(stderr, "tint2 : xembed error\n");
401 XDestroyWindow(server.dsp, parent_window);
402 return FALSE;
403 }
404 }
405 {
406 XEvent e;
407 e.xclient.type = ClientMessage;
408 e.xclient.serial = 0;
409 e.xclient.send_event = True;
410 e.xclient.message_type = server.atom._XEMBED;
411 e.xclient.window = id;
412 e.xclient.format = 32;
413 e.xclient.data.l[0] = CurrentTime;
414 e.xclient.data.l[1] = XEMBED_EMBEDDED_NOTIFY;
415 e.xclient.data.l[2] = 0;
416 e.xclient.data.l[3] = parent_window;
417 e.xclient.data.l[4] = 0;
418 XSendEvent(server.dsp, id, False, 0xFFFFFF, &e);
419 }
420
421 traywin = g_new0(TrayWindow, 1);
422 traywin->id = parent_window;
423 traywin->tray_id = id;
424 traywin->hide = hide;
425 traywin->depth = attr.depth;
426 traywin->damage = 0;
427
428 if (systray.area.on_screen == 0)
429 systray.area.on_screen = 1;
430
431 if (systray.sort == 3)
432 systray.list_icons = g_slist_prepend(systray.list_icons, traywin);
433 else if (systray.sort == 2)
434 systray.list_icons = g_slist_append(systray.list_icons, traywin);
435 else
436 systray.list_icons = g_slist_insert_sorted(systray.list_icons, traywin, compare_traywindows);
437 //printf("add_icon id %lx, %d\n", id, g_slist_length(systray.list_icons));
438
439 // watch for the icon trying to resize itself!
440 XSelectInput(server.dsp, traywin->tray_id, StructureNotifyMask);
441 if (server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
442 traywin->damage = XDamageCreate(server.dsp, traywin->id, XDamageReportRawRectangles);
443 XCompositeRedirectWindow(server.dsp, traywin->id, CompositeRedirectManual);
444 }
445
446 // show the window
447 if (!traywin->hide)
448 XMapWindow(server.dsp, traywin->tray_id);
449 if (!traywin->hide && !panel->is_hidden)
450 XMapRaised(server.dsp, traywin->id);
451
452 // changed in systray
453 systray.area.resize = 1;
454 panel_refresh = 1;
455 return TRUE;
456 }
457
458
459 void remove_icon(TrayWindow *traywin)
460 {
461 XErrorHandler old;
462
463 // remove from our list
464 systray.list_icons = g_slist_remove(systray.list_icons, traywin);
465 //printf("remove_icon id %lx, %d\n", traywin->id);
466
467 XSelectInput(server.dsp, traywin->tray_id, NoEventMask);
468 if (traywin->damage)
469 XDamageDestroy(server.dsp, traywin->damage);
470
471 // reparent to root
472 error = FALSE;
473 old = XSetErrorHandler(window_error_handler);
474 if (!traywin->hide)
475 XUnmapWindow(server.dsp, traywin->tray_id);
476 XReparentWindow(server.dsp, traywin->tray_id, server.root_win, 0, 0);
477 XDestroyWindow(server.dsp, traywin->id);
478 XSync(server.dsp, False);
479 XSetErrorHandler(old);
480 if (traywin->render_timeout)
481 stop_timeout(traywin->render_timeout);
482 g_free(traywin);
483
484 // check empty systray
485 int count = 0;
486 GSList *l;
487 for (l = systray.list_icons; l ; l = l->next) {
488 if (!((TrayWindow*)l->data)->hide)
489 count++;
490 }
491 if (count == 0) {
492 systray.area.on_screen = 0;
493 systray.area.width = 0;
494 }
495 // changed in systray
496 systray.area.resize = 1;
497 panel_refresh = 1;
498 }
499
500
501 void net_message(XClientMessageEvent *e)
502 {
503 unsigned long opcode;
504 Window id;
505
506 opcode = e->data.l[1];
507 switch (opcode) {
508 case SYSTEM_TRAY_REQUEST_DOCK:
509 id = e->data.l[2];
510 if (id) add_icon(id);
511 break;
512
513 case SYSTEM_TRAY_BEGIN_MESSAGE:
514 case SYSTEM_TRAY_CANCEL_MESSAGE:
515 // we don't show baloons messages.
516 break;
517
518 default:
519 if (opcode == server.atom._NET_SYSTEM_TRAY_MESSAGE_DATA)
520 printf("message from dockapp: %s\n", e->data.b);
521 else
522 fprintf(stderr, "SYSTEM_TRAY : unknown message type\n");
523 break;
524 }
525 }
526
527 void systray_render_icon_now(void* t)
528 {
529 // we end up in this function only in real transparency mode or if systray_task_asb != 100 0 0
530 // we made also sure, that we always have a 32 bit visual, i.e. we can safely create 32 bit pixmaps here
531 TrayWindow* traywin = t;
532 traywin->render_timeout = 0;
533
534 // good systray icons support 32 bit depth, but some icons are still 24 bit.
535 // We create a heuristic mask for these icons, i.e. we get the rgb value in the top left corner, and
536 // mask out all pixel with the same rgb value
537 Panel* panel = systray.area.panel;
538
539 // Very ugly hack, but somehow imlib2 is not able to get the image from the traywindow itself,
540 // so we first render the tray window onto a pixmap, and then we tell imlib2 to use this pixmap as
541 // drawable. If someone knows why it does not work with the traywindow itself, please tell me ;)
542 Pixmap tmp_pmap = XCreatePixmap(server.dsp, server.root_win, traywin->width, traywin->height, 32);
543 XRenderPictFormat* f;
544 if (traywin->depth == 24)
545 f = XRenderFindStandardFormat(server.dsp, PictStandardRGB24);
546 else if (traywin->depth == 32)
547 f = XRenderFindStandardFormat(server.dsp, PictStandardARGB32);
548 else {
549 printf("Strange tray icon found with depth: %d\n", traywin->depth);
550 return;
551 }
552 Picture pict_image;
553 //if (server.real_transparency)
554 //pict_image = XRenderCreatePicture(server.dsp, traywin->id, f, 0, 0);
555 // reverted Rev 407 because here it's breaking alls icon with systray + xcompmgr
556 pict_image = XRenderCreatePicture(server.dsp, traywin->tray_id, f, 0, 0);
557 Picture pict_drawable = XRenderCreatePicture(server.dsp, tmp_pmap, XRenderFindVisualFormat(server.dsp, server.visual32), 0, 0);
558 XRenderComposite(server.dsp, PictOpSrc, pict_image, None, pict_drawable, 0, 0, 0, 0, 0, 0, traywin->width, traywin->height);
559 XRenderFreePicture(server.dsp, pict_image);
560 XRenderFreePicture(server.dsp, pict_drawable);
561 // end of the ugly hack and we can continue as before
562
563 imlib_context_set_visual(server.visual32);
564 imlib_context_set_colormap(server.colormap32);
565 imlib_context_set_drawable(tmp_pmap);
566 Imlib_Image image = imlib_create_image_from_drawable(0, 0, 0, traywin->width, traywin->height, 1);
567 if (image == 0)
568 return;
569
570 imlib_context_set_image(image);
571 //if (traywin->depth == 24)
572 //imlib_save_image("/home/thil77/test.jpg");
573 imlib_image_set_has_alpha(1);
574 DATA32* data = imlib_image_get_data();
575 if (traywin->depth == 24) {
576 createHeuristicMask(data, traywin->width, traywin->height);
577 }
578 if (systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0)
579 adjust_asb(data, traywin->width, traywin->height, systray.alpha, (float)systray.saturation/100, (float)systray.brightness/100);
580 imlib_image_put_back_data(data);
581 XCopyArea(server.dsp, render_background, systray.area.pix, server.gc, traywin->x-systray.area.posx, traywin->y-systray.area.posy, traywin->width, traywin->height, traywin->x-systray.area.posx, traywin->y-systray.area.posy);
582 render_image(systray.area.pix, traywin->x-systray.area.posx, traywin->y-systray.area.posy, traywin->width, traywin->height);
583 XCopyArea(server.dsp, systray.area.pix, panel->main_win, server.gc, traywin->x-systray.area.posx, traywin->y-systray.area.posy, traywin->width, traywin->height, traywin->x, traywin->y);
584 imlib_free_image_and_decache();
585 XFreePixmap(server.dsp, tmp_pmap);
586 imlib_context_set_visual(server.visual);
587 imlib_context_set_colormap(server.colormap);
588
589 if (traywin->damage)
590 XDamageSubtract(server.dsp, traywin->damage, None, None);
591 XFlush(server.dsp);
592 }
593
594
595 void systray_render_icon(TrayWindow* traywin)
596 {
597 if (server.real_transparency || systray.alpha != 100 || systray.brightness != 0 || systray.saturation != 0) {
598 // wine tray icons update whenever mouse is over them, so we limit the updates to 50 ms
599 if (traywin->render_timeout == 0)
600 traywin->render_timeout = add_timeout(50, 0, systray_render_icon_now, traywin);
601 }
602 else {
603 // comment by andreas: I'm still not sure, what exactly we need to do here... Somehow trayicons which do not
604 // offer the same depth as tint2 does, need to draw a background pixmap, but this cannot be done with
605 // XCopyArea... So we actually need XRenderComposite???
606 // Pixmap pix = XCreatePixmap(server.dsp, server.root_win, traywin->width, traywin->height, server.depth);
607 // XCopyArea(server.dsp, panel->temp_pmap, pix, server.gc, traywin->x, traywin->y, traywin->width, traywin->height, 0, 0);
608 // XSetWindowBackgroundPixmap(server.dsp, traywin->id, pix);
609 XClearArea(server.dsp, traywin->tray_id, 0, 0, traywin->width, traywin->height, True);
610 }
611 }
612
613
614 void refresh_systray_icon()
615 {
616 TrayWindow *traywin;
617 GSList *l;
618 for (l = systray.list_icons; l ; l = l->next) {
619 traywin = (TrayWindow*)l->data;
620 if (traywin->hide) continue;
621 systray_render_icon(traywin);
622 }
623 }
This page took 0.069761 seconds and 4 git commands to generate.