void visual_refresh ()
{
- if (!server.root_pmap) {
- Pixmap wall = get_root_pixmap();
-
- server.root_pmap = server_create_pixmap (panel.area.width, panel.area.height);
-
- XCopyArea (server.dsp, wall, server.root_pmap, server.gc, server.posx, server.posy, panel.area.width, panel.area.height, 0, 0);
-
- redraw (&panel.area);
- }
+ if (!panel.area.pmap)
+ set_panel_background();
if (server.pmap) XFreePixmap (server.dsp, server.pmap);
server.pmap = server_create_pixmap (panel.area.width, panel.area.height);
+ XCopyArea (server.dsp, panel.area.pmap, server.pmap, server.gc, 0, 0, panel.area.width, panel.area.height, 0, 0);
- XCopyArea (server.dsp, server.root_pmap, server.pmap, server.gc, 0, 0, panel.area.width, panel.area.height, 0, 0);
-
- draw (&panel.area);
+ // draw child object
+ GSList *l = panel.area.list;
+ for (; l ; l = l->next)
+ draw (l->data);
- XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, 0, 0, panel.area.width, panel.area.height, 0, 0);
- XFlush(server.dsp);
+ // main_win doesn't include panel.area.paddingx, so we have WM capabilities on left and right.
+ XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, panel.area.paddingx, 0, panel.area.width-(2*panel.area.paddingx), panel.area.height, 0, 0);
+ XFlush (server.dsp);
panel.refresh = 0;
}
/* Catch some events */
XSetWindowAttributes att = { ParentRelative, 0L, 0, 0L, 0, 0, Always, 0L, 0L, False, ExposureMask|ButtonPressMask|ButtonReleaseMask, NoEventMask, False, 0, 0 };
- /* XCreateWindow(display, parent, x, y, w, h, border, depth, class, visual, mask, attrib) */
+ // XCreateWindow(display, parent, x, y, w, h, border, depth, class, visual, mask, attrib)
+ // main_win doesn't include panel.area.paddingx, so we have WM capabilities on left and right.
if (window.main_win) XDestroyWindow(server.dsp, window.main_win);
- win = XCreateWindow (server.dsp, server.root_win, server.posx, server.posy, panel.area.width, panel.area.height, 0, server.depth, InputOutput, CopyFromParent, CWEventMask, &att);
+ win = XCreateWindow (server.dsp, server.root_win, server.posx+panel.area.paddingx, server.posy, panel.area.width-(2*panel.area.paddingx), panel.area.height, 0, server.depth, InputOutput, CopyFromParent, CWEventMask, &att);
set_panel_properties (win);
window.main_win = win;
if (server.gc) XFree(server.gc);
XGCValues gcValues;
server.gc = XCreateGC(server.dsp, win, (unsigned long) 0, &gcValues);
-
+ if (server.gc_root) XFree(server.gc_root);
+ server.gc_root = XCreateGC(server.dsp, server.root_win, (unsigned long) 0, &gcValues);
+
XMapWindow (server.dsp, win);
XFlush (server.dsp);
}
panel.area.list = g_slist_append(panel.area.list, taskbar);
}
}
+ redraw(&panel.area);
panel.refresh = 1;
}
+void set_panel_background()
+{
+ Pixmap wall = get_root_pixmap();
+
+ panel.area.pmap = server_create_pixmap (panel.area.width, panel.area.height);
+
+ // add layer of root pixmap
+ XCopyArea (server.dsp, wall, panel.area.pmap, server.gc, server.posx, server.posy, panel.area.width, panel.area.height, 0, 0);
+
+ // draw background panel
+ cairo_surface_t *cs;
+ cairo_t *c;
+ cs = cairo_xlib_surface_create (server.dsp, panel.area.pmap, server.visual, panel.area.width, panel.area.height);
+ c = cairo_create (cs);
+
+ draw_background (&panel.area, c);
+
+ cairo_destroy (c);
+ cairo_surface_destroy (cs);
+
+ // copy background panel on desktop window
+ XCopyArea (server.dsp, panel.area.pmap, server.root_win, server.gc_root, 0, 0, panel.area.width, panel.area.height, server.posx, server.posy);
+
+ redraw (&panel.area);
+}
+
+
/* Catch events */
XSelectInput (server.dsp, server.root_win, PropertyChangeMask|StructureNotifyMask);
- setlocale(LC_ALL, "");
+ setlocale (LC_ALL, "");
}
else if (at == server.atom._NET_NUMBER_OF_DESKTOPS) {
config_taskbar();
visible_object();
- redraw(&panel.area);
}
/* Change desktop */
else if (at == server.atom._NET_CURRENT_DESKTOP) {
}
/* Wallpaper changed */
else if (at == server.atom._XROOTPMAP_ID) {
- XFreePixmap (server.dsp, server.root_pmap);
- server.root_pmap = 0;
- redraw(&panel.area);
- panel.clock.area.redraw = 1;
+ XFreePixmap (server.dsp, panel.area.pmap);
+ panel.area.pmap = 0;
panel.refresh = 1;
}
}
init ();
load_config:
- if (server.root_pmap) XFreePixmap (server.dsp, server.root_pmap);
- server.root_pmap = 0;
+ if (panel.area.pmap) XFreePixmap (server.dsp, panel.area.pmap);
+ panel.area.pmap = 0;
// read tint2rc config
i = 0;
if (c != -1)
break;
case Expose:
- XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, 0, 0, panel.area.width, panel.area.height, 0, 0);
+ XCopyArea (server.dsp, panel.area.pmap, server.root_win, server.gc_root, 0, 0, panel.area.width, panel.area.height, server.posx, server.posy);
+ XCopyArea (server.dsp, server.pmap, window.main_win, server.gc, panel.area.paddingx, 0, panel.area.width-(2*panel.area.paddingx), panel.area.height, 0, 0);
break;
case PropertyNotify: