+void set_panel_properties(Panel *p)
+{
+ XStoreName (server.dsp, p->main_win, "tint2");
+
+ gsize len;
+ gchar *name = g_locale_to_utf8("tint2", -1, NULL, &len, NULL);
+ if (name != NULL) {
+ XChangeProperty(server.dsp, p->main_win, server.atom._NET_WM_NAME, server.atom.UTF8_STRING, 8, PropModeReplace, (unsigned char *) name, (int) len);
+ g_free(name);
+ }
+
+ // Dock
+ long val = server.atom._NET_WM_WINDOW_TYPE_DOCK;
+ XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_WINDOW_TYPE, XA_ATOM, 32, PropModeReplace, (unsigned char *) &val, 1);
+
+ // Reserved space
+ long struts [12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ if (panel_horizontal) {
+ if (panel_position & TOP) {
+ struts[2] = p->area.height + p->marginy;
+ struts[8] = p->posx;
+ // p->area.width - 1 allowed full screen on monitor 2
+ struts[9] = p->posx + p->area.width - 1;
+ }
+ else {
+ struts[3] = p->area.height + p->marginy;
+ struts[10] = p->posx;
+ // p->area.width - 1 allowed full screen on monitor 2
+ struts[11] = p->posx + p->area.width - 1;
+ }
+ }
+ else {
+ if (panel_position & LEFT) {
+ struts[0] = p->area.width + p->marginx;
+ struts[4] = p->posy;
+ // p->area.width - 1 allowed full screen on monitor 2
+ struts[5] = p->posy + p->area.height - 1;
+ }
+ else {
+ struts[1] = p->area.width + p->marginx;
+ struts[6] = p->posy;
+ // p->area.width - 1 allowed full screen on monitor 2
+ struts[7] = p->posy + p->area.height - 1;
+ }
+ }
+ // Old specification : fluxbox need _NET_WM_STRUT.
+ XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_STRUT, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &struts, 4);
+ XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_STRUT_PARTIAL, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &struts, 12);
+
+ // Sticky and below other window
+ val = 0xFFFFFFFF;
+ XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_DESKTOP, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &val, 1);
+ Atom state[4];
+ state[0] = server.atom._NET_WM_STATE_SKIP_PAGER;
+ state[1] = server.atom._NET_WM_STATE_SKIP_TASKBAR;
+ state[2] = server.atom._NET_WM_STATE_STICKY;
+ state[3] = server.atom._NET_WM_STATE_BELOW;
+ XChangeProperty (server.dsp, p->main_win, server.atom._NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char *) state, 4);
+
+ // Fixed position and non-resizable window
+ XSizeHints size_hints;
+ size_hints.flags = PPosition|PMinSize|PMaxSize;
+ size_hints.min_width = size_hints.max_width = p->area.width;
+ size_hints.min_height = size_hints.max_height = p->area.height;
+ XSetWMNormalHints(server.dsp, p->main_win, &size_hints);
+
+ // Unfocusable
+ XWMHints wmhints;
+ if (panel_dock) {
+ // TODO: Xdnd feature cannot be used in withdrawn state at the moment (at least GTK apps fail, qt seems to work)
+ wmhints.icon_window = wmhints.window_group = p->main_win;
+ wmhints.flags = StateHint | IconWindowHint;
+ wmhints.initial_state = WithdrawnState;
+ }
+ else {
+ wmhints.flags = InputHint;
+ wmhints.input = False;
+ }
+ XSetWMHints(server.dsp, p->main_win, &wmhints);
+
+ // Undecorated
+ long prop[5] = { 2, 0, 0, 0, 0 };
+ XChangeProperty(server.dsp, p->main_win, server.atom._MOTIF_WM_HINTS, server.atom._MOTIF_WM_HINTS, 32, PropModeReplace, (unsigned char *) prop, 5);
+
+ // XdndAware - Register for Xdnd events
+ int version=5;
+ XChangeProperty(server.dsp, p->main_win, server.atom.XdndAware, XA_ATOM, 32, PropModeReplace, (unsigned char*)&version, 1);
+}
+
+
+void set_panel_background(Panel *p)
+{
+ get_root_pixmap();
+
+ if (p->area.pix.pmap) XFreePixmap (server.dsp, p->area.pix.pmap);
+ p->area.pix.pmap = XCreatePixmap (server.dsp, server.root_win, p->area.width, p->area.height, server.depth);
+
+ // copy background (server.root_pmap) in panel.area.pix.pmap
+ Window dummy;
+ int x, y;
+ XTranslateCoordinates(server.dsp, p->main_win, server.root_win, 0, 0, &x, &y, &dummy);
+ XSetTSOrigin(server.dsp, server.gc, -x, -y) ;
+ XFillRectangle(server.dsp, p->area.pix.pmap, server.gc, 0, 0, p->area.width, p->area.height);
+
+ // draw background panel
+ cairo_surface_t *cs;
+ cairo_t *c;
+ cs = cairo_xlib_surface_create (server.dsp, p->area.pix.pmap, server.visual, p->area.width, p->area.height);
+ c = cairo_create (cs);
+
+ draw_background(&p->area, c, 0);
+
+ cairo_destroy (c);
+ cairo_surface_destroy (cs);
+
+ // redraw panel's object
+ GSList *l0;
+ Area *a;
+ for (l0 = p->area.list; l0 ; l0 = l0->next) {
+ a = l0->data;
+ set_redraw(a);
+ }
+}
+
+
+Panel *get_panel(Window win)
+{
+ int i;
+ for (i=0 ; i < nb_panel ; i++) {
+ if (panel1[i].main_win == win) {
+ return &panel1[i];
+ }
+ }
+ return 0;
+}
+