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