Pointer wrapping. Needs updated ecore.
authorsebastid <sebastid>
Fri, 22 Apr 2005 09:23:00 +0000 (09:23 +0000)
committersebastid <sebastid@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 22 Apr 2005 09:23:00 +0000 (09:23 +0000)
SVN revision: 14297

src/bin/e_zone.c
src/bin/e_zone.h

index 99d24d8..ddea192 100644 (file)
@@ -450,27 +450,31 @@ _e_zone_cb_mouse_in(void *data, int type, void *event)
 
    if (ev->win == zone->flip.top)
      {
-       zone->flip.timer = ecore_timer_add(1, _e_zone_cb_timer, zone);
+       zone->flip.timer = ecore_timer_add(0.5, _e_zone_cb_timer, zone);
        zone->flip.x = zone->desk_x_current;
        zone->flip.y = zone->desk_y_current - 1;
+       zone->flip.direction = E_DIRECTION_UP;
      }
    else if (ev->win == zone->flip.right)
      {
-       zone->flip.timer = ecore_timer_add(1, _e_zone_cb_timer, zone);
+       zone->flip.timer = ecore_timer_add(0.5, _e_zone_cb_timer, zone);
        zone->flip.x = zone->desk_x_current + 1;
        zone->flip.y = zone->desk_y_current;
+       zone->flip.direction = E_DIRECTION_RIGHT;
      }
    else if (ev->win == zone->flip.bottom)
      {
-       zone->flip.timer = ecore_timer_add(1, _e_zone_cb_timer, zone);
+       zone->flip.timer = ecore_timer_add(0.5, _e_zone_cb_timer, zone);
        zone->flip.x = zone->desk_x_current;
        zone->flip.y = zone->desk_y_current + 1;
+       zone->flip.direction = E_DIRECTION_DOWN;
      }
    else if (ev->win == zone->flip.left)
      {
-       zone->flip.timer = ecore_timer_add(1, _e_zone_cb_timer, zone);
+       zone->flip.timer = ecore_timer_add(0.5, _e_zone_cb_timer, zone);
        zone->flip.x = zone->desk_x_current - 1;
        zone->flip.y = zone->desk_y_current;
+       zone->flip.direction = E_DIRECTION_LEFT;
      }
    return 1;
 }
@@ -500,8 +504,30 @@ _e_zone_cb_timer(void *data)
    zone = data;
    desk = e_desk_at_xy_get(zone, zone->flip.x, zone->flip.y);
    if (desk)
-     e_desk_show(desk);
-   _e_zone_update_flip(zone);
+     {
+       int x, y;
+
+       e_desk_show(desk);
+       _e_zone_update_flip(zone);
+
+       ecore_x_pointer_last_xy_get(&x, &y);
+
+       switch (zone->flip.direction)
+         {
+          case E_DIRECTION_UP:
+             ecore_x_pointer_warp(zone->container->manager->win, x, zone->h - 2);
+             break;
+          case E_DIRECTION_RIGHT:
+             ecore_x_pointer_warp(zone->container->manager->win, 2, y);
+             break;
+          case E_DIRECTION_DOWN:
+             ecore_x_pointer_warp(zone->container->manager->win, x, 2);
+             break;
+          case E_DIRECTION_LEFT:
+             ecore_x_pointer_warp(zone->container->manager->win, zone->w - 2, y);
+             break;
+         }
+     }
 
    zone->flip.timer = NULL;
 
index 0b5d5b6..f43f937 100644 (file)
@@ -38,6 +38,7 @@ struct _E_Zone
        Ecore_X_Window top, right, bottom, left;
        Ecore_Timer *timer;
        int x, y;
+       E_Direction direction;
    } flip;
 };