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