unify winlist action code and set activation type
SVN revision: 81442
This commit is contained in:
parent
5a90bb9d81
commit
cb34a3e7f5
|
@ -103,9 +103,13 @@ e_modapi_save(E_Module *m __UNUSED__)
|
||||||
|
|
||||||
/* action callback */
|
/* action callback */
|
||||||
static void
|
static void
|
||||||
_e_mod_action_winlist_cb(E_Object *obj, const char *params)
|
_e_mod_action_winlist_cb_helper(E_Object *obj, const char *params, int modifiers, E_Winlist_Activate_Type type)
|
||||||
{
|
{
|
||||||
E_Zone *zone = NULL;
|
E_Zone *zone = NULL;
|
||||||
|
E_Winlist_Filter filter = E_WINLIST_FILTER_NONE;
|
||||||
|
int direction = 0; // -1 for prev, 1 for next;
|
||||||
|
int udlr = -1; // 0 for up, 1 for down, 2 for left, 3 for right
|
||||||
|
Eina_Bool ok = EINA_TRUE;
|
||||||
|
|
||||||
if (obj)
|
if (obj)
|
||||||
{
|
{
|
||||||
|
@ -119,243 +123,79 @@ _e_mod_action_winlist_cb(E_Object *obj, const char *params)
|
||||||
zone = e_util_zone_current_get(e_manager_current_get());
|
zone = e_util_zone_current_get(e_manager_current_get());
|
||||||
}
|
}
|
||||||
if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
|
if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
|
||||||
if (zone)
|
if (!zone) return;
|
||||||
|
if (params)
|
||||||
{
|
{
|
||||||
if (params)
|
if (!strcmp(params, "next"))
|
||||||
{
|
direction = 1;
|
||||||
if (!strcmp(params, "next"))
|
else if (!strcmp(params, "prev"))
|
||||||
{
|
direction = -1;
|
||||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
else if (!strcmp(params, "class-next"))
|
||||||
e_winlist_next();
|
direction = 1, filter = E_WINLIST_FILTER_CLASS_WINDOWS;
|
||||||
}
|
else if (!strcmp(params, "class-prev"))
|
||||||
else if (!strcmp(params, "prev"))
|
direction = -1, filter = E_WINLIST_FILTER_CLASS_WINDOWS;
|
||||||
{
|
else if (!strcmp(params, "classes-next"))
|
||||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
direction = 1, filter = E_WINLIST_FILTER_CLASSES;
|
||||||
e_winlist_prev();
|
else if (!strcmp(params, "classes-prev"))
|
||||||
}
|
direction = -1, filter = E_WINLIST_FILTER_CLASSES;
|
||||||
else if (!strcmp(params, "class-next"))
|
else if (!strcmp(params, "up"))
|
||||||
{
|
udlr = 0;
|
||||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_CLASS_WINDOWS))
|
else if (!strcmp(params, "down"))
|
||||||
e_winlist_next();
|
udlr = 1;
|
||||||
}
|
else if (!strcmp(params, "left"))
|
||||||
else if (!strcmp(params, "class-prev"))
|
udlr = 2;
|
||||||
{
|
else if (!strcmp(params, "right"))
|
||||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_CLASS_WINDOWS))
|
udlr = 3;
|
||||||
e_winlist_prev();
|
else return;
|
||||||
}
|
}
|
||||||
else if (!strcmp(params, "classes-next"))
|
else
|
||||||
{
|
direction = 1;
|
||||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_CLASSES))
|
if (direction)
|
||||||
e_winlist_next();
|
ok = !e_winlist_show(zone, filter);
|
||||||
}
|
if (!ok)
|
||||||
else if (!strcmp(params, "classes-prev"))
|
{
|
||||||
{
|
if (!type) return;
|
||||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_CLASSES))
|
if (!direction) return;
|
||||||
e_winlist_prev();
|
e_winlist_modifiers_set(modifiers, type);
|
||||||
}
|
return;
|
||||||
else if (!strcmp(params, "left"))
|
}
|
||||||
{
|
if (direction == 1)
|
||||||
e_winlist_left(zone);
|
e_winlist_next();
|
||||||
}
|
else if (direction == -1)
|
||||||
else if (!strcmp(params, "down"))
|
e_winlist_prev();
|
||||||
{
|
if (direction) return;
|
||||||
e_winlist_down(zone);
|
switch (udlr)
|
||||||
}
|
{
|
||||||
else if (!strcmp(params, "up"))
|
case 0:
|
||||||
{
|
e_winlist_up(zone);
|
||||||
e_winlist_up(zone);
|
break;
|
||||||
}
|
case 1:
|
||||||
else if (!strcmp(params, "right"))
|
e_winlist_down(zone);
|
||||||
{
|
break;
|
||||||
e_winlist_right(zone);
|
case 2:
|
||||||
}
|
e_winlist_left(zone);
|
||||||
}
|
break;
|
||||||
else
|
case 3:
|
||||||
{
|
e_winlist_right(zone);
|
||||||
if (!e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
break;
|
||||||
e_winlist_next();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_e_mod_action_winlist_mouse_cb(E_Object *obj, const char *params,
|
_e_mod_action_winlist_cb(E_Object *obj, const char *params)
|
||||||
Ecore_Event_Mouse_Button *ev)
|
|
||||||
{
|
{
|
||||||
E_Zone *zone = NULL;
|
_e_mod_action_winlist_cb_helper(obj, params, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (obj)
|
static void
|
||||||
{
|
_e_mod_action_winlist_mouse_cb(E_Object *obj, const char *params, Ecore_Event_Mouse_Button *ev)
|
||||||
if (obj->type == E_MANAGER_TYPE)
|
{
|
||||||
zone = e_util_zone_current_get((E_Manager *)obj);
|
_e_mod_action_winlist_cb_helper(obj, params, ev->modifiers, E_WINLIST_ACTIVATE_TYPE_MOUSE);
|
||||||
else if (obj->type == E_CONTAINER_TYPE)
|
|
||||||
zone = e_util_zone_current_get(((E_Container *)obj)->manager);
|
|
||||||
else if (obj->type == E_ZONE_TYPE)
|
|
||||||
zone = e_util_zone_current_get(((E_Zone *)obj)->container->manager);
|
|
||||||
else
|
|
||||||
zone = e_util_zone_current_get(e_manager_current_get());
|
|
||||||
}
|
|
||||||
if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
|
|
||||||
if (zone)
|
|
||||||
{
|
|
||||||
if (params)
|
|
||||||
{
|
|
||||||
if (!strcmp(params, "next"))
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_next();
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "prev"))
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_prev();
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "class-next"))
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASS_WINDOWS))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_next();
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "class-prev"))
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASS_WINDOWS))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_prev();
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "classes-next"))
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASSES))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_next();
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "classes-prev"))
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASSES))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_prev();
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "left"))
|
|
||||||
{
|
|
||||||
e_winlist_left(zone);
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "down"))
|
|
||||||
{
|
|
||||||
e_winlist_down(zone);
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "up"))
|
|
||||||
{
|
|
||||||
e_winlist_up(zone);
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "right"))
|
|
||||||
{
|
|
||||||
e_winlist_right(zone);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_e_mod_action_winlist_key_cb(E_Object *obj, const char *params, Ecore_Event_Key *ev)
|
_e_mod_action_winlist_key_cb(E_Object *obj, const char *params, Ecore_Event_Key *ev)
|
||||||
{
|
{
|
||||||
E_Zone *zone = NULL;
|
_e_mod_action_winlist_cb_helper(obj, params, ev->modifiers, E_WINLIST_ACTIVATE_TYPE_KEY);
|
||||||
|
|
||||||
if (obj)
|
|
||||||
{
|
|
||||||
if (obj->type == E_MANAGER_TYPE)
|
|
||||||
zone = e_util_zone_current_get((E_Manager *)obj);
|
|
||||||
else if (obj->type == E_CONTAINER_TYPE)
|
|
||||||
zone = e_util_zone_current_get(((E_Container *)obj)->manager);
|
|
||||||
else if (obj->type == E_ZONE_TYPE)
|
|
||||||
zone = e_util_zone_current_get(((E_Zone *)obj)->container->manager);
|
|
||||||
else
|
|
||||||
zone = e_util_zone_current_get(e_manager_current_get());
|
|
||||||
}
|
|
||||||
if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
|
|
||||||
if (zone)
|
|
||||||
{
|
|
||||||
if (params)
|
|
||||||
{
|
|
||||||
if (!strcmp(params, "next"))
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_next();
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "prev"))
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_prev();
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "class-next"))
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASS_WINDOWS))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_next();
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "class-prev"))
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASS_WINDOWS))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_prev();
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "classes-next"))
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASSES))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_next();
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "classes-prev"))
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_CLASSES))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_prev();
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "left"))
|
|
||||||
{
|
|
||||||
e_winlist_left(zone);
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "down"))
|
|
||||||
{
|
|
||||||
e_winlist_down(zone);
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "up"))
|
|
||||||
{
|
|
||||||
e_winlist_up(zone);
|
|
||||||
}
|
|
||||||
else if (!strcmp(params, "right"))
|
|
||||||
{
|
|
||||||
e_winlist_right(zone);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (e_winlist_show(zone, E_WINLIST_FILTER_NONE))
|
|
||||||
e_winlist_modifiers_set(ev->modifiers);
|
|
||||||
else
|
|
||||||
e_winlist_next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ static int _last_pointer_y = 0;
|
||||||
static E_Border *_last_border = NULL;
|
static E_Border *_last_border = NULL;
|
||||||
static int _hold_count = 0;
|
static int _hold_count = 0;
|
||||||
static int _hold_mod = 0;
|
static int _hold_mod = 0;
|
||||||
|
static E_Winlist_Activate_Type _activate_type = 0;
|
||||||
static Eina_List *_handlers = NULL;
|
static Eina_List *_handlers = NULL;
|
||||||
static Ecore_X_Window _input_window = 0;
|
static Ecore_X_Window _input_window = 0;
|
||||||
static int _warp_to = 0;
|
static int _warp_to = 0;
|
||||||
|
@ -278,6 +279,7 @@ e_winlist_hide(void)
|
||||||
_winlist = NULL;
|
_winlist = NULL;
|
||||||
_hold_count = 0;
|
_hold_count = 0;
|
||||||
_hold_mod = 0;
|
_hold_mod = 0;
|
||||||
|
_activate_type = 0;
|
||||||
|
|
||||||
EINA_LIST_FREE(_handlers, handler)
|
EINA_LIST_FREE(_handlers, handler)
|
||||||
ecore_event_handler_del(handler);
|
ecore_event_handler_del(handler);
|
||||||
|
@ -884,11 +886,12 @@ e_winlist_right(E_Zone *zone)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
e_winlist_modifiers_set(int mod)
|
e_winlist_modifiers_set(int mod, E_Winlist_Activate_Type type)
|
||||||
{
|
{
|
||||||
if (!_winlist) return;
|
if (!_winlist) return;
|
||||||
_hold_mod = mod;
|
_hold_mod = mod;
|
||||||
_hold_count = 0;
|
_hold_count = 0;
|
||||||
|
_activate_type = type;
|
||||||
if (_hold_mod & ECORE_EVENT_MODIFIER_SHIFT) _hold_count++;
|
if (_hold_mod & ECORE_EVENT_MODIFIER_SHIFT) _hold_count++;
|
||||||
if (_hold_mod & ECORE_EVENT_MODIFIER_CTRL) _hold_count++;
|
if (_hold_mod & ECORE_EVENT_MODIFIER_CTRL) _hold_count++;
|
||||||
if (_hold_mod & ECORE_EVENT_MODIFIER_ALT) _hold_count++;
|
if (_hold_mod & ECORE_EVENT_MODIFIER_ALT) _hold_count++;
|
||||||
|
|
|
@ -10,6 +10,14 @@ typedef enum _E_Winlist_Filter {
|
||||||
E_WINLIST_FILTER_CLASSES = 2 /* loop through classes (last selected win) */
|
E_WINLIST_FILTER_CLASSES = 2 /* loop through classes (last selected win) */
|
||||||
} E_Winlist_Filter;
|
} E_Winlist_Filter;
|
||||||
|
|
||||||
|
typedef enum E_Winlist_Activate_Type
|
||||||
|
{
|
||||||
|
E_WINLIST_ACTIVATE_TYPE_NONE,
|
||||||
|
E_WINLIST_ACTIVATE_TYPE_KEY,
|
||||||
|
E_WINLIST_ACTIVATE_TYPE_MOUSE,
|
||||||
|
E_WINLIST_ACTIVATE_TYPE_EDGE,
|
||||||
|
} E_Winlist_Activate_Type;
|
||||||
|
|
||||||
int e_winlist_show(E_Zone *zone, E_Winlist_Filter filter);
|
int e_winlist_show(E_Zone *zone, E_Winlist_Filter filter);
|
||||||
void e_winlist_hide(void);
|
void e_winlist_hide(void);
|
||||||
void e_winlist_next(void);
|
void e_winlist_next(void);
|
||||||
|
@ -18,6 +26,6 @@ void e_winlist_left(E_Zone *zone);
|
||||||
void e_winlist_right(E_Zone *zone);
|
void e_winlist_right(E_Zone *zone);
|
||||||
void e_winlist_down(E_Zone *zone);
|
void e_winlist_down(E_Zone *zone);
|
||||||
void e_winlist_up(E_Zone *zone);
|
void e_winlist_up(E_Zone *zone);
|
||||||
void e_winlist_modifiers_set(int mod);
|
void e_winlist_modifiers_set(int mod, E_Winlist_Activate_Type type);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue