]> Dogcows Code - chaz/tint2/commitdiff
cleanup
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Thu, 10 Sep 2009 21:00:50 +0000 (21:00 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Thu, 10 Sep 2009 21:00:50 +0000 (21:00 +0000)
src/panel.h
src/tint.c

index 698b7446ff5ed264e4c84aad3f3a57c79127a57e..b1ca46c33d1fcd22d47a2d22992e769873ad5fb7 100644 (file)
@@ -81,6 +81,8 @@ typedef struct {
    // --------------------------------------------------
    // taskbar point to the first taskbar in panel.area.list.
    // number of tasbar == nb_desktop
+       // taskbar[i] is used to loop over taskbar,
+       // while panel->area.list is used to loop over all panel's objects
    Taskbar *taskbar;
    int  nb_desktop;
 
index 70c6f5bd314dd83df088f987c39211695c4a73d1..33f5e67deba125d6568e4ff4d1a9f1b07d7487d5 100644 (file)
@@ -134,25 +134,26 @@ void cleanup()
 
 Taskbar *click_taskbar (Panel *panel, int x, int y)
 {
-       GSList *l0;
-       Taskbar *tskbar = NULL;
+       Taskbar *tskbar;
+       int i;
+
        if (panel_horizontal) {
-               for (l0 = panel->area.list; l0 ; l0 = l0->next) {
-                       tskbar = l0->data;
+               for (i=0; i < panel->nb_desktop ; i++) {
+                       tskbar = &panel->taskbar[i];
                        if (!tskbar->area.on_screen) continue;
                        if (x >= tskbar->area.posx && x <= (tskbar->area.posx + tskbar->area.width))
-                               break;
+                               return tskbar;
                }
        }
        else {
-               for (l0 = panel->area.list; l0 ; l0 = l0->next) {
-                       tskbar = l0->data;
+               for (i=0; i < panel->nb_desktop ; i++) {
+                       tskbar = &panel->taskbar[i];
                        if (!tskbar->area.on_screen) continue;
                        if (y >= tskbar->area.posy && y <= (tskbar->area.posy + tskbar->area.height))
-                               break;
+                               return tskbar;
                }
        }
-       return tskbar;
+       return NULL;
 }
 
 
This page took 0.024301 seconds and 4 git commands to generate.