aleksej patch for segv on moving window to a new desk if its negative desk
authorCarsten Haitzler <raster@rasterman.com>
Sun, 4 Dec 2005 03:25:34 +0000 (03:25 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Sun, 4 Dec 2005 03:25:34 +0000 (03:25 +0000)
count :)

SVN revision: 18817

src/bin/e_actions.c
src/bin/e_desk.c

index 9765988..43ec503 100644 (file)
@@ -700,11 +700,43 @@ ACT_FN_GO(window_desk_move_by)
      {
        E_Desk *desk;
        int dx, dy;
+       int to_x = 0, to_y = 0;
 
        e_desk_xy_get(bd->desk, &dx, &dy);
-       desk = e_desk_at_xy_get(bd->zone, dx + x, dy + y);
+       
+       to_x = dx + x; to_y = dy + y;
+       while( ( desk = e_desk_at_xy_get(bd->zone, to_x , to_y ) ) == NULL )
+         {
+            // here we are out of our desktop range
+            while( to_x >= bd->zone->desk_x_count )
+              {
+                 to_x -= bd->zone->desk_x_count;
+                 to_y ++;
+              }
+            while( to_x < 0 )
+              {
+                 to_x += bd->zone->desk_x_count;
+                 to_y --;
+              }
+            
+            while( to_y >= bd->zone->desk_y_count )
+              {
+                 to_y -= bd->zone->desk_y_count;
+              }
+            while( to_y < 0 )
+              {
+                 to_y += bd->zone->desk_y_count;
+              }
+         }
+       
        if (desk)
-         e_border_desk_set(bd, desk);
+         {
+            // switch desktop. Quite usefull from the interface point of view.
+            e_zone_desk_flip_by( bd->zone, to_x - dx , to_y - dy );
+            // send the border to the required desktop.
+            e_border_desk_set(bd, desk);
+            e_border_focus_set( bd, 1, 1);
+         }
      }
 }
 
index 1bc8aac..7664552 100644 (file)
@@ -313,7 +313,9 @@ e_desk_at_xy_get(E_Zone *zone, int x, int y)
 
    if ((x >= zone->desk_x_count) || (y >= zone->desk_y_count))
      return NULL;
-
+   else if ((x < 0) || (y < 0))
+     return NULL;
+   
    return zone->desks[x + (y * zone->desk_x_count)];
 }