Change the event on flip to a pointer warp event.

SVN revision: 15602
This commit is contained in:
sebastid 2005-07-01 08:20:05 +00:00 committed by sebastid
parent 38f024978a
commit b49dde8e5d
5 changed files with 39 additions and 60 deletions

View File

@ -45,7 +45,7 @@ static int _e_border_cb_window_move_resize_request(void *data, int ev_type, void
static int _e_border_cb_desktop_change(void *data, int ev_type, void *ev);
static int _e_border_cb_sync_alarm(void *data, int ev_type, void *ev);
static int _e_border_cb_zone_desk_flip(void *data, int ev_type, void *ev);
static int _e_border_cb_pointer_warp(void *data, int ev_type, void *ev);
static void _e_border_cb_signal_move_start(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_border_cb_signal_move_stop(void *data, Evas_Object *obj, const char *emission, const char *source);
@ -184,7 +184,7 @@ e_border_init(void)
handlers = evas_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_SYNC_ALARM, _e_border_cb_sync_alarm, NULL));
ecore_x_passive_grab_replay_func_set(_e_border_cb_grab_replay, NULL);
handlers = evas_list_append(handlers, ecore_event_handler_add(E_EVENT_ZONE_DESK_FLIP, _e_border_cb_zone_desk_flip, NULL));
handlers = evas_list_append(handlers, ecore_event_handler_add(E_EVENT_POINTER_WARP, _e_border_cb_pointer_warp, NULL));
E_EVENT_BORDER_ADD = ecore_event_type_new();
E_EVENT_BORDER_REMOVE = ecore_event_type_new();
@ -2791,28 +2791,15 @@ _e_border_cb_sync_alarm(void *data, int ev_type, void *ev)
* Calculate pos from e->x and e->y
*/
static int
_e_border_cb_zone_desk_flip(void *data, int ev_type, void *ev)
_e_border_cb_pointer_warp(void *data, int ev_type, void *ev)
{
E_Event_Zone_Desk_Flip *e;
E_Event_Pointer_Warp *e;
e = ev;
if (!move) return 1;
switch (e->direction)
{
case E_DIRECTION_UP:
e_border_move(move, move->x, move->y + (move->zone->h - 2));
break;
case E_DIRECTION_RIGHT:
e_border_move(move, move->x - (move->zone->w - 2), move->y);
break;
case E_DIRECTION_DOWN:
e_border_move(move, move->x, move->y - (move->zone->h - 2));
break;
case E_DIRECTION_LEFT:
e_border_move(move, move->x + (move->zone->w - 2), move->y);
break;
}
printf("warp: %d %d %d %d\n", e->curr.x, e->prev.x, e->curr.y, e->prev.y);
e_border_move(move, move->x + (e->curr.x - e->prev.x), move->y + (e->curr.y - e->prev.y));
return 1;
}

View File

@ -291,11 +291,11 @@ _e_int_menus_main_del_hook(void *obj)
}
else
{
printf("%%$%%@%#^#^#$^#$\n"
"%%$%%@%#^#^#$^#$\n"
printf("%%$%%@%%#^#^#$^#$\n"
"%%$%%@%%#^#^#$^#$\n"
" main menu object data is NULL!\n"
"%%$%%@%#^#^#$^#$\n"
"%%$%%@%#^#^#$^#$\n");
"%%$%%@%%#^#^#$^#$\n"
"%%$%%@%%#^#^#$^#$\n");
}
}

View File

@ -24,7 +24,6 @@ static int _e_main_cb_x_flusher(void *data);
static int _e_main_cb_idler_before(void *data);
static int _e_main_cb_idler_after(void *data);
static int _e_main_cb_startup_fake_status(void *data);
static int _e_main_cb_startup_fake_end(void *data);
static void _e_main_desk_save(void);

View File

@ -17,10 +17,9 @@ static int _e_zone_cb_mouse_out(void *data, int type, void *event);
static int _e_zone_cb_timer(void *data);
static int _e_zone_cb_desk_show(void *data, int type, void *event);
static void _e_zone_update_flip(E_Zone *zone);
static void _e_zone_event_zone_desk_flip_free(void *data, void *ev);
int E_EVENT_ZONE_DESK_COUNT_SET = 0;
int E_EVENT_ZONE_DESK_FLIP = 0;
int E_EVENT_POINTER_WARP = 0;
#define E_ZONE_FLIP_UP(zone) ((zone)->desk_y_current > 0)
#define E_ZONE_FLIP_RIGHT(zone) (((zone)->desk_x_current + 1) < (zone)->desk_x_count)
@ -31,7 +30,7 @@ int
e_zone_init(void)
{
E_EVENT_ZONE_DESK_COUNT_SET = ecore_event_type_new();
E_EVENT_ZONE_DESK_FLIP = ecore_event_type_new();
E_EVENT_POINTER_WARP = ecore_event_type_new();
return 1;
}
@ -698,11 +697,17 @@ _e_zone_cb_timer(void *data)
{
E_Zone *zone;
E_Desk *prev = NULL, *current = NULL;
E_Event_Pointer_Warp *ev;
int x, y;
ev = E_NEW(E_Event_Pointer_Warp, 1);
if (!ev) return 0;
zone = data;
ecore_x_pointer_xy_get(zone->container->win, &x, &y);
ev->prev.x = x;
ev->prev.y = y;
prev = e_desk_at_xy_get(zone, zone->desk_x_current, zone->desk_y_current);
switch (zone->flip.direction)
@ -715,6 +720,8 @@ _e_zone_cb_timer(void *data)
{
e_desk_show(current);
ecore_x_pointer_warp(zone->container->win, x, zone->h - 2);
ev->curr.x = x;
ev->curr.y = zone->h - 2;
}
}
break;
@ -726,6 +733,8 @@ _e_zone_cb_timer(void *data)
{
e_desk_show(current);
ecore_x_pointer_warp(zone->container->win, 2, y);
ev->curr.y = y;
ev->curr.x = 2;
}
}
break;
@ -737,6 +746,8 @@ _e_zone_cb_timer(void *data)
{
e_desk_show(current);
ecore_x_pointer_warp(zone->container->win, x, 2);
ev->curr.x = x;
ev->curr.y = 2;
}
}
break;
@ -748,6 +759,8 @@ _e_zone_cb_timer(void *data)
{
e_desk_show(current);
ecore_x_pointer_warp(zone->container->win, zone->w - 2, y);
ev->curr.y = y;
ev->curr.x = zone->w - 2;
}
}
break;
@ -756,22 +769,9 @@ _e_zone_cb_timer(void *data)
zone->flip.timer = NULL;
if (current)
{
E_Event_Zone_Desk_Flip *ev;
ev = E_NEW(E_Event_Zone_Desk_Flip, 1);
if (!ev) return 0;
ev->x = x;
ev->y = y;
ev->direction = zone->flip.direction;
ev->prev = prev;
if (ev->prev) e_object_ref(E_OBJECT(ev->prev));
ev->current = current;
e_object_ref(E_OBJECT(ev->current));
ecore_event_add(E_EVENT_ZONE_DESK_FLIP, ev, _e_zone_event_zone_desk_flip_free, NULL);
}
ecore_event_add(E_EVENT_POINTER_WARP, ev, NULL, NULL);
else
free(ev);
return 0;
}
@ -839,14 +839,3 @@ _e_zone_update_flip(E_Zone *zone)
ecore_x_window_hide(zone->flip.bottom);
}
}
static void
_e_zone_event_zone_desk_flip_free(void *data, void *ev)
{
E_Event_Zone_Desk_Flip *e;
e = ev;
if (e->prev) e_object_unref(E_OBJECT(e->prev));
e_object_unref(E_OBJECT(e->current));
free(e);
}

View File

@ -6,7 +6,8 @@
typedef struct _E_Zone E_Zone;
typedef struct _E_Event_Zone_Desk_Count_Set E_Event_Zone_Desk_Count_Set;
typedef struct _E_Event_Zone_Desk_Flip E_Event_Zone_Desk_Flip;
/* TODO: Move this to a general place? */
typedef struct _E_Event_Pointer_Warp E_Event_Pointer_Warp;
#else
#ifndef E_ZONE_H
@ -52,11 +53,14 @@ struct _E_Event_Zone_Desk_Count_Set
E_Zone *zone;
};
struct _E_Event_Zone_Desk_Flip
struct _E_Event_Pointer_Warp
{
int x, y;
E_Direction direction;
E_Desk *prev, *current;
struct {
int x, y;
} prev;
struct {
int x, y;
} curr;
};
EAPI int e_zone_init(void);
@ -79,7 +83,7 @@ EAPI void e_zone_desk_linear_flip_to(E_Zone *zone, int x);
EAPI int e_zone_app_exec(E_Zone *zone, E_App *a);
extern EAPI int E_EVENT_ZONE_DESK_COUNT_SET;
extern EAPI int E_EVENT_ZONE_DESK_FLIP;
extern EAPI int E_EVENT_POINTER_WARP;
#endif
#endif