]> Dogcows Code - chaz/tint2/blobdiff - src/panel.c
*fix* issue 185
[chaz/tint2] / src / panel.c
index 50aa5c38bf175e0779afff8e9fca4d844572d54a..3064a201f0057024e4b5839511def7dc3b6e8a40 100644 (file)
@@ -427,16 +427,21 @@ void set_panel_properties(Panel *p)
        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;
+                       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;
+                       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;
@@ -444,13 +449,13 @@ void set_panel_properties(Panel *p)
        }
        else {
                if (panel_position & LEFT) {
-                       struts[0] = p->area.width + p->marginx;
+                       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;
+                       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;
@@ -467,6 +472,13 @@ void set_panel_properties(Panel *p)
        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);
+
+       // Set WM_CLASS
+       XClassHint* classhint = XAllocClassHint();
+       classhint->res_name = "tint2";
+       classhint->res_class = "Tint2";
+       XSetClassHint(server.dsp, p->main_win, classhint);
+       XFree(classhint);
 }
 
 
This page took 0.022943 seconds and 4 git commands to generate.