- XStoreName (server.dsp, p->main_win, "tint2");
-
- // TODO: check if the name is really needed for a panel/taskbar ?
- 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_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;
- }
- // 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
- long 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
- XSizeHints size_hints;
- size_hints.flags = PPosition;
- XChangeProperty (server.dsp, p->main_win, XA_WM_NORMAL_HINTS, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *) &size_hints, sizeof (XSizeHints) / 4);
-
- // Unfocusable
- XWMHints wmhints;
- wmhints.flags = InputHint;
- wmhints.input = False;
- XChangeProperty (server.dsp, p->main_win, XA_WM_HINTS, XA_WM_HINTS, 32, PropModeReplace, (unsigned char *) &wmhints, sizeof (XWMHints) / 4);
-
- // 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);
+ 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);
+
+ // 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);
+
+ // 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);
+
+ // Reserved space
+ unsigned int d1, screen_width, screen_height;
+ Window d2;
+ int d3;
+ XGetGeometry(server.dsp, server.root_win, &d2, &d3, &d3, &screen_width, &screen_height, &d1, &d1);
+ Monitor monitor = server.monitor[p->monitor];
+ 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 + monitor.y;
+ 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 + screen_height - monitor.y - monitor.height;
+ 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 + monitor.x;
+ 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 + screen_width - monitor.x - monitor.width;
+ 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);
+
+ // Fixed position and non-resizable window
+ // Allow panel move and resize when tint2 reload config file
+ 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);