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