]> Dogcows Code - chaz/tint2/commitdiff
*fix* calculate right struts for multiple monitors. fixes issue 148 and issue 178
authorAndreas Fink <andreas.fink85@googlemail.com>
Tue, 22 Dec 2009 13:37:13 +0000 (13:37 +0000)
committerAndreas Fink <andreas.fink85@googlemail.com>
Tue, 22 Dec 2009 13:37:13 +0000 (13:37 +0000)
*fix* uninstall all timers on reconfiguring

src/config.c
src/panel.c
src/tooltip/tooltip.c
src/util/timer.c
src/util/timer.h

index d93d2c3d4166115c237fe9fadb8ec2d0bf5771f2..bc54938eda8d6ee71f0abab6e19b3957898e2a38 100644 (file)
@@ -45,6 +45,7 @@
 #include "config.h"
 #include "window.h"
 #include "tooltip.h"
+#include "timer.h"
 
 #ifdef ENABLE_BATTERY
 #include "battery.h"
@@ -74,6 +75,7 @@ void init_config()
        list_back = g_slist_append(0, calloc(1, sizeof(Area)));
 
        // tint2 could reload config, so we cleanup objects
+       uninstall_all_timer();
        cleanup_systray();
 #ifdef ENABLE_BATTERY
        cleanup_battery();
index 50aa5c38bf175e0779afff8e9fca4d844572d54a..a5a62dd987aaea8a6129901d456938d1a2b868b5 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;
index ba1acfe9a127336236df7b947dd24196972c3f15..8e74972ab783026220f87a4532b4506b158339af 100644 (file)
@@ -60,10 +60,8 @@ void init_tooltip()
        if (!g_tooltip.font_desc)
                g_tooltip.font_desc = pango_font_description_from_string("sans 10");
 
-       if (g_tooltip.show_timer_id == 0)
-               g_tooltip.show_timer_id = install_timer(0, 0, 0, 0, tooltip_show);
-       if (g_tooltip.hide_timer_id == 0)
-               g_tooltip.hide_timer_id = install_timer(0, 0, 0, 0, tooltip_hide);
+       g_tooltip.show_timer_id = install_timer(0, 0, 0, 0, tooltip_show);
+       g_tooltip.hide_timer_id = install_timer(0, 0, 0, 0, tooltip_hide);
 
        XSetWindowAttributes attr;
        attr.override_redirect = True;
index 48529dc3f22b8731aadfb70b86c9efe8311930c6..d66fa9927cad203a0464e4f8f56f82bc074cb15b 100644 (file)
@@ -71,3 +71,12 @@ void uninstall_timer(int id)
                timer_iter = timer_iter->next;
        }
 }
+
+
+void uninstall_all_timer()
+{
+       while (timer_list) {
+               struct timer* t = timer_list->data;
+               uninstall_timer(t->id);
+       }
+}
index fae0203546c39dd40e6847f8285d4c6435622b03..e938b2f2a89b196a156ed34596e75b96c9d0e103 100644 (file)
@@ -45,4 +45,7 @@ void reset_timer(int id, int value_sec, int value_nsec, int interval_sec, int in
 /** uninstalls a timer with the given 'id'. If no timer is installed with this id nothing happens **/
 void uninstall_timer(int id);
 
+/** uninstalls all timer. Calls uninstall_timer for all available id's **/
+void uninstall_all_timer();
+
 #endif // TIMER_H
This page took 0.028897 seconds and 4 git commands to generate.