2005-06-07 06:05:18 -07:00
|
|
|
#include "e.h"
|
2012-11-30 06:38:34 -08:00
|
|
|
#include "e_mod_main.h"
|
2005-06-07 06:05:18 -07:00
|
|
|
|
|
|
|
/* local subsystem functions */
|
2005-06-11 23:50:34 -07:00
|
|
|
typedef struct _E_Winlist_Win E_Winlist_Win;
|
|
|
|
|
|
|
|
struct _E_Winlist_Win
|
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
Evas_Object *bg_object;
|
|
|
|
Evas_Object *icon_object;
|
|
|
|
E_Border *border;
|
2005-06-14 03:19:25 -07:00
|
|
|
unsigned char was_iconified : 1;
|
|
|
|
unsigned char was_shaded : 1;
|
2005-06-11 23:50:34 -07:00
|
|
|
};
|
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
static void _e_winlist_size_adjust(void);
|
|
|
|
static void _e_winlist_border_add(E_Border *bd, E_Zone *zone, E_Desk *desk);
|
|
|
|
static void _e_winlist_border_del(E_Border *bd);
|
|
|
|
static void _e_winlist_activate_nth(int n);
|
|
|
|
static void _e_winlist_activate(void);
|
|
|
|
static void _e_winlist_deactivate(void);
|
|
|
|
static void _e_winlist_show_active(void);
|
|
|
|
static Eina_Bool _e_winlist_cb_event_border_add(void *data, int type, void *event);
|
|
|
|
static Eina_Bool _e_winlist_cb_event_border_remove(void *data, int type, void *event);
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool _e_winlist_cb_key_down(void *data, int type, void *event);
|
|
|
|
static Eina_Bool _e_winlist_cb_key_up(void *data, int type, void *event);
|
|
|
|
static Eina_Bool _e_winlist_cb_mouse_down(void *data, int type, void *event);
|
|
|
|
static Eina_Bool _e_winlist_cb_mouse_up(void *data, int type, void *event);
|
|
|
|
static Eina_Bool _e_winlist_cb_mouse_wheel(void *data, int type, void *event);
|
|
|
|
static Eina_Bool _e_winlist_cb_mouse_move(void *data, int type, void *event);
|
|
|
|
static Eina_Bool _e_winlist_scroll_timer(void *data);
|
|
|
|
static Eina_Bool _e_winlist_warp_timer(void *data);
|
|
|
|
static Eina_Bool _e_winlist_animator(void *data);
|
2006-12-28 06:15:10 -08:00
|
|
|
#if 0
|
2012-06-20 00:01:53 -07:00
|
|
|
static void _e_winlist_cb_item_mouse_in(void *data, Evas *evas,
|
|
|
|
Evas_Object *obj, void *event_info);
|
2006-12-28 06:15:10 -08:00
|
|
|
#endif
|
2005-06-07 06:05:18 -07:00
|
|
|
|
|
|
|
/* local subsystem globals */
|
2010-08-18 14:04:39 -07:00
|
|
|
static E_Popup *_winlist = NULL;
|
|
|
|
static Evas_Object *_bg_object = NULL;
|
|
|
|
static Evas_Object *_list_object = NULL;
|
|
|
|
static Evas_Object *_icon_object = NULL;
|
|
|
|
static Eina_List *_wins = NULL;
|
|
|
|
static Eina_List *_win_selected = NULL;
|
|
|
|
static E_Desk *_last_desk = NULL;
|
|
|
|
static int _last_pointer_x = 0;
|
|
|
|
static int _last_pointer_y = 0;
|
|
|
|
static E_Border *_last_border = NULL;
|
|
|
|
static int _hold_count = 0;
|
|
|
|
static int _hold_mod = 0;
|
2012-12-20 02:58:21 -08:00
|
|
|
static E_Winlist_Activate_Type _activate_type = 0;
|
2010-08-18 14:04:39 -07:00
|
|
|
static Eina_List *_handlers = NULL;
|
|
|
|
static Ecore_X_Window _input_window = 0;
|
|
|
|
static int _warp_to = 0;
|
|
|
|
static int _warp_to_x = 0;
|
|
|
|
static int _warp_to_y = 0;
|
|
|
|
static int _warp_x = 0;
|
|
|
|
static int _warp_y = 0;
|
2010-08-19 14:09:58 -07:00
|
|
|
static int _old_warp_x = 0;
|
|
|
|
static int _old_warp_y = 0;
|
2010-08-18 14:04:39 -07:00
|
|
|
static int _scroll_to = 0;
|
|
|
|
static double _scroll_align_to = 0.0;
|
|
|
|
static double _scroll_align = 0.0;
|
|
|
|
static Ecore_Timer *_warp_timer = NULL;
|
|
|
|
static Ecore_Timer *_scroll_timer = NULL;
|
|
|
|
static Ecore_Animator *_animator = NULL;
|
|
|
|
static const Ecore_X_Window *_win = NULL;
|
|
|
|
static E_Border *_bd_next = NULL;
|
2005-06-11 23:50:34 -07:00
|
|
|
|
2011-02-27 06:29:41 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_wmclass_picked(const Eina_List *lst, const char *wmclass)
|
|
|
|
{
|
|
|
|
const Eina_List *l;
|
|
|
|
const char *s;
|
|
|
|
|
|
|
|
if (!wmclass) return EINA_FALSE;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(lst, l, s)
|
2012-08-23 00:57:47 -07:00
|
|
|
if (s == wmclass)
|
2011-02-27 06:29:41 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2005-06-07 06:05:18 -07:00
|
|
|
/* externally accessible functions */
|
2010-01-22 12:28:39 -08:00
|
|
|
int
|
2005-06-07 06:05:18 -07:00
|
|
|
e_winlist_init(void)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-01-22 12:28:39 -08:00
|
|
|
int
|
2005-06-07 06:05:18 -07:00
|
|
|
e_winlist_shutdown(void)
|
|
|
|
{
|
2005-06-07 06:53:27 -07:00
|
|
|
e_winlist_hide();
|
2005-06-07 06:05:18 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-01-22 12:28:39 -08:00
|
|
|
int
|
2011-02-27 06:29:41 -08:00
|
|
|
e_winlist_show(E_Zone *zone, E_Winlist_Filter filter)
|
2005-06-07 06:53:27 -07:00
|
|
|
{
|
|
|
|
int x, y, w, h;
|
|
|
|
Evas_Object *o;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2005-06-11 23:50:34 -07:00
|
|
|
E_Desk *desk;
|
2011-02-27 06:29:41 -08:00
|
|
|
E_Border *bd;
|
|
|
|
Eina_List *wmclasses = NULL;
|
2010-07-07 14:36:23 -07:00
|
|
|
|
2005-10-19 02:31:35 -07:00
|
|
|
E_OBJECT_CHECK_RETURN(zone, 0);
|
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
|
2010-07-07 14:36:23 -07:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_winlist) return 0;
|
2005-06-07 06:53:27 -07:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
_input_window = ecore_x_window_input_new(zone->container->win, 0, 0, 1, 1);
|
|
|
|
ecore_x_window_show(_input_window);
|
|
|
|
if (!e_grabinput_get(_input_window, 0, _input_window))
|
2006-06-20 06:10:08 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
ecore_x_window_free(_input_window);
|
|
|
|
_input_window = 0;
|
|
|
|
return 0;
|
2006-06-20 06:10:08 -07:00
|
|
|
}
|
2005-09-28 21:27:49 -07:00
|
|
|
|
2005-06-14 03:19:25 -07:00
|
|
|
w = (double)zone->w * e_config->winlist_pos_size_w;
|
|
|
|
if (w > e_config->winlist_pos_max_w) w = e_config->winlist_pos_max_w;
|
2012-06-20 00:01:53 -07:00
|
|
|
else if (w < e_config->winlist_pos_min_w)
|
|
|
|
w = e_config->winlist_pos_min_w;
|
2005-06-14 03:19:25 -07:00
|
|
|
if (w > zone->w) w = zone->w;
|
|
|
|
x = (double)(zone->w - w) * e_config->winlist_pos_align_x;
|
2010-07-07 14:36:23 -07:00
|
|
|
|
2005-06-14 03:19:25 -07:00
|
|
|
h = (double)zone->h * e_config->winlist_pos_size_h;
|
|
|
|
if (h > e_config->winlist_pos_max_h) h = e_config->winlist_pos_max_h;
|
2012-06-20 00:01:53 -07:00
|
|
|
else if (h < e_config->winlist_pos_min_h)
|
|
|
|
h = e_config->winlist_pos_min_h;
|
2005-06-14 03:19:25 -07:00
|
|
|
if (h > zone->h) h = zone->h;
|
|
|
|
y = (double)(zone->h - h) * e_config->winlist_pos_align_y;
|
2010-07-07 14:36:23 -07:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
_winlist = e_popup_new(zone, x, y, w, h);
|
|
|
|
if (!_winlist)
|
2009-12-22 12:41:06 -08:00
|
|
|
{
|
2010-08-18 14:04:39 -07:00
|
|
|
ecore_x_window_free(_input_window);
|
|
|
|
e_grabinput_release(_input_window, _input_window);
|
|
|
|
_input_window = 0;
|
2009-12-22 12:41:06 -08:00
|
|
|
return 0;
|
|
|
|
}
|
2010-11-07 04:34:50 -08:00
|
|
|
e_border_move_cancel();
|
|
|
|
e_border_resize_cancel();
|
2007-08-04 21:41:55 -07:00
|
|
|
e_border_focus_track_freeze();
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
evas_event_feed_mouse_in(_winlist->evas, ecore_x_current_time_get(), NULL);
|
2010-08-19 14:09:58 -07:00
|
|
|
evas_event_feed_mouse_move(_winlist->evas, -1000000, -1000000,
|
|
|
|
ecore_x_current_time_get(), NULL);
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2012-10-02 01:54:35 -07:00
|
|
|
e_popup_layer_set(_winlist, E_LAYER_POPUP);
|
2010-08-18 14:04:39 -07:00
|
|
|
evas_event_freeze(_winlist->evas);
|
|
|
|
o = edje_object_add(_winlist->evas);
|
|
|
|
_bg_object = o;
|
2005-06-07 06:53:27 -07:00
|
|
|
e_theme_edje_object_set(o, "base/theme/winlist",
|
2012-06-20 00:01:53 -07:00
|
|
|
"e/widgets/winlist/main");
|
2005-06-07 06:53:27 -07:00
|
|
|
evas_object_move(o, 0, 0);
|
|
|
|
evas_object_resize(o, w, h);
|
|
|
|
evas_object_show(o);
|
2010-08-18 14:04:39 -07:00
|
|
|
e_popup_edje_bg_object_set(_winlist, o);
|
2005-06-11 23:50:34 -07:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
o = e_box_add(_winlist->evas);
|
|
|
|
_list_object = o;
|
2005-06-11 23:50:34 -07:00
|
|
|
e_box_align_set(o, 0.5, 0.0);
|
|
|
|
e_box_orientation_set(o, 0);
|
|
|
|
e_box_homogenous_set(o, 1);
|
2010-08-18 14:04:39 -07:00
|
|
|
edje_object_part_swallow(_bg_object, "e.swallow.list", o);
|
|
|
|
edje_object_part_text_set(_bg_object, "e.text.title", _("Select a window"));
|
2005-06-11 23:50:34 -07:00
|
|
|
evas_object_show(o);
|
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
_last_border = e_border_focused_get();
|
2010-07-09 03:34:20 -07:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
desk = e_desk_current_get(_winlist->zone);
|
|
|
|
e_box_freeze(_list_object);
|
2011-02-27 06:29:41 -08:00
|
|
|
EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd)
|
2005-06-11 23:50:34 -07:00
|
|
|
{
|
2011-02-27 06:29:41 -08:00
|
|
|
Eina_Bool pick;
|
|
|
|
switch (filter)
|
|
|
|
{
|
|
|
|
case E_WINLIST_FILTER_CLASS_WINDOWS:
|
2012-06-23 22:35:49 -07:00
|
|
|
if (!_last_border)
|
|
|
|
pick = EINA_FALSE;
|
|
|
|
else
|
2012-08-23 00:57:47 -07:00
|
|
|
pick = _last_border->client.icccm.class == bd->client.icccm.class;
|
2012-06-20 00:01:53 -07:00
|
|
|
break;
|
2011-02-27 06:29:41 -08:00
|
|
|
case E_WINLIST_FILTER_CLASSES:
|
2012-06-20 00:01:53 -07:00
|
|
|
pick = (!_wmclass_picked(wmclasses, bd->client.icccm.class));
|
|
|
|
if (pick)
|
|
|
|
wmclasses = eina_list_append(wmclasses, bd->client.icccm.class);
|
|
|
|
break;
|
|
|
|
|
2011-02-27 06:29:41 -08:00
|
|
|
default:
|
2012-06-20 00:01:53 -07:00
|
|
|
pick = EINA_TRUE;
|
2011-02-27 06:29:41 -08:00
|
|
|
}
|
|
|
|
if (pick) _e_winlist_border_add(bd, _winlist->zone, desk);
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
2010-08-18 14:04:39 -07:00
|
|
|
e_box_thaw(_list_object);
|
2011-02-27 06:29:41 -08:00
|
|
|
eina_list_free(wmclasses);
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
if (!_wins)
|
2005-06-12 20:55:39 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
e_winlist_hide();
|
|
|
|
return 1;
|
2005-06-12 20:55:39 -07:00
|
|
|
}
|
2007-03-02 09:00:20 -08:00
|
|
|
|
|
|
|
if (e_config->winlist_list_show_other_desk_windows ||
|
|
|
|
e_config->winlist_list_show_other_screen_windows)
|
2010-08-18 14:04:39 -07:00
|
|
|
_last_desk = e_desk_current_get(_winlist->zone);
|
2007-03-02 09:00:20 -08:00
|
|
|
if (e_config->winlist_warp_while_selecting)
|
2010-08-18 14:04:39 -07:00
|
|
|
ecore_x_pointer_xy_get(_winlist->zone->container->win,
|
|
|
|
&_last_pointer_x, &_last_pointer_y);
|
|
|
|
if (_last_border)
|
2005-07-04 03:24:22 -07:00
|
|
|
{
|
2010-08-18 14:04:39 -07:00
|
|
|
if (!_last_border->lock_focus_out)
|
|
|
|
e_border_focus_set(_last_border, 0, 0);
|
2007-03-02 09:00:20 -08:00
|
|
|
else
|
2010-08-18 14:04:39 -07:00
|
|
|
_last_border = NULL;
|
2005-07-04 03:24:22 -07:00
|
|
|
}
|
2005-06-14 03:52:05 -07:00
|
|
|
_e_winlist_activate_nth(1);
|
2010-08-18 14:04:39 -07:00
|
|
|
evas_event_thaw(_winlist->evas);
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_size_adjust();
|
|
|
|
|
2012-11-01 01:25:35 -07:00
|
|
|
E_LIST_HANDLER_APPEND(_handlers, E_EVENT_BORDER_ADD, _e_winlist_cb_event_border_add, NULL);
|
|
|
|
E_LIST_HANDLER_APPEND(_handlers, E_EVENT_BORDER_REMOVE, _e_winlist_cb_event_border_remove, NULL);
|
|
|
|
E_LIST_HANDLER_APPEND(_handlers, ECORE_EVENT_KEY_DOWN, _e_winlist_cb_key_down, NULL);
|
|
|
|
E_LIST_HANDLER_APPEND(_handlers, ECORE_EVENT_KEY_UP, _e_winlist_cb_key_up, NULL);
|
|
|
|
E_LIST_HANDLER_APPEND(_handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_winlist_cb_mouse_down, NULL);
|
|
|
|
E_LIST_HANDLER_APPEND(_handlers, ECORE_EVENT_MOUSE_BUTTON_UP, _e_winlist_cb_mouse_up, NULL);
|
|
|
|
E_LIST_HANDLER_APPEND(_handlers, ECORE_EVENT_MOUSE_WHEEL, _e_winlist_cb_mouse_wheel, NULL);
|
|
|
|
E_LIST_HANDLER_APPEND(_handlers, ECORE_EVENT_MOUSE_MOVE, _e_winlist_cb_mouse_move, NULL);
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
e_popup_show(_winlist);
|
2005-06-11 23:50:34 -07:00
|
|
|
return 1;
|
2005-06-07 06:53:27 -07:00
|
|
|
}
|
|
|
|
|
2010-01-22 12:28:39 -08:00
|
|
|
void
|
2005-06-07 06:53:27 -07:00
|
|
|
e_winlist_hide(void)
|
|
|
|
{
|
2005-06-12 20:50:23 -07:00
|
|
|
E_Border *bd = NULL;
|
|
|
|
E_Winlist_Win *ww;
|
2009-12-22 12:41:06 -08:00
|
|
|
Ecore_Event_Handler *handler;
|
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
if (!_winlist) return;
|
|
|
|
if (_win_selected)
|
2005-06-12 20:50:23 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
ww = _win_selected->data;
|
|
|
|
bd = ww->border;
|
2005-06-12 20:50:23 -07:00
|
|
|
}
|
2010-08-18 14:04:39 -07:00
|
|
|
evas_event_freeze(_winlist->evas);
|
|
|
|
e_popup_hide(_winlist);
|
|
|
|
e_box_freeze(_list_object);
|
|
|
|
while (_wins)
|
2005-06-11 23:50:34 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
ww = _wins->data;
|
|
|
|
evas_object_del(ww->bg_object);
|
|
|
|
if (ww->icon_object) evas_object_del(ww->icon_object);
|
|
|
|
_wins = eina_list_remove_list(_wins, _wins);
|
|
|
|
if ((!bd) || (ww->border != bd))
|
|
|
|
e_object_unref(E_OBJECT(ww->border));
|
|
|
|
free(ww);
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
2010-08-18 14:04:39 -07:00
|
|
|
e_box_thaw(_list_object);
|
|
|
|
_win_selected = NULL;
|
|
|
|
if (_icon_object)
|
2005-06-12 09:22:06 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
evas_object_del(_icon_object);
|
|
|
|
_icon_object = NULL;
|
2005-06-12 09:22:06 -07:00
|
|
|
}
|
2010-08-18 14:04:39 -07:00
|
|
|
evas_object_del(_list_object);
|
|
|
|
_list_object = NULL;
|
|
|
|
evas_object_del(_bg_object);
|
|
|
|
_bg_object = NULL;
|
|
|
|
evas_event_thaw(_winlist->evas);
|
|
|
|
e_object_del(E_OBJECT(_winlist));
|
2007-08-04 21:41:55 -07:00
|
|
|
e_border_focus_track_thaw();
|
2010-08-18 14:04:39 -07:00
|
|
|
_winlist = NULL;
|
|
|
|
_hold_count = 0;
|
|
|
|
_hold_mod = 0;
|
2012-12-20 02:58:21 -08:00
|
|
|
_activate_type = 0;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
EINA_LIST_FREE(_handlers, handler)
|
2009-12-22 12:41:06 -08:00
|
|
|
ecore_event_handler_del(handler);
|
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_warp_timer)
|
2005-06-12 23:59:44 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
ecore_timer_del(_warp_timer);
|
|
|
|
_warp_timer = NULL;
|
2005-06-12 23:59:44 -07:00
|
|
|
}
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_scroll_timer)
|
2005-06-12 23:59:44 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
ecore_timer_del(_scroll_timer);
|
|
|
|
_scroll_timer = NULL;
|
2005-06-12 23:59:44 -07:00
|
|
|
}
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_animator)
|
2005-06-12 23:59:44 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
ecore_animator_del(_animator);
|
|
|
|
_animator = NULL;
|
2005-06-12 23:59:44 -07:00
|
|
|
}
|
2005-06-12 20:50:23 -07:00
|
|
|
if (bd)
|
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (bd->shaded)
|
|
|
|
{
|
|
|
|
if (!bd->lock_user_shade)
|
|
|
|
e_border_unshade(bd, bd->shade.dir);
|
|
|
|
}
|
|
|
|
else if (bd->desk)
|
|
|
|
{
|
|
|
|
if (!bd->sticky) e_desk_show(bd->desk);
|
|
|
|
}
|
|
|
|
if (!bd->lock_user_stacking)
|
|
|
|
e_border_raise(bd);
|
|
|
|
|
|
|
|
if (!bd->lock_focus_out)
|
|
|
|
{
|
|
|
|
e_border_focus_set(bd, 1, 1);
|
|
|
|
e_border_focus_latest_set(bd);
|
2012-08-24 20:33:31 -07:00
|
|
|
e_border_focus_set(bd, 1, 1);
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
2012-08-23 02:09:58 -07:00
|
|
|
if ((e_config->focus_policy != E_FOCUS_CLICK) ||
|
2012-06-20 00:01:53 -07:00
|
|
|
(e_config->winlist_warp_at_end) ||
|
|
|
|
(e_config->winlist_warp_while_selecting))
|
2012-08-24 21:17:46 -07:00
|
|
|
{
|
|
|
|
_warp_to_x = bd->x + (bd->w / 2);
|
|
|
|
if (_warp_to_x < (bd->zone->x + 1))
|
|
|
|
_warp_to_x = bd->zone->x +
|
|
|
|
((bd->x + bd->w - bd->zone->x) / 2);
|
|
|
|
else if (_warp_to_x >= (bd->zone->x + bd->zone->w - 1))
|
|
|
|
_warp_to_x = (bd->zone->x + bd->zone->w + bd->x) / 2;
|
|
|
|
|
|
|
|
_warp_to_y = bd->y + (bd->h / 2);
|
|
|
|
if (_warp_to_y < (bd->zone->y + 1))
|
|
|
|
_warp_to_y = bd->zone->y +
|
|
|
|
((bd->y + bd->h - bd->zone->y) / 2);
|
|
|
|
else if (_warp_to_y >= (bd->zone->y + bd->zone->h - 1))
|
|
|
|
_warp_to_y = (bd->zone->y + bd->zone->h + bd->y) / 2;
|
|
|
|
ecore_x_pointer_warp(bd->zone->container->win, _warp_to_x, _warp_to_y);
|
|
|
|
}
|
2012-06-20 00:01:53 -07:00
|
|
|
|
|
|
|
e_object_unref(E_OBJECT(bd));
|
2005-06-12 20:50:23 -07:00
|
|
|
}
|
2012-08-24 21:12:59 -07:00
|
|
|
|
|
|
|
e_border_idler_before();
|
2010-04-28 12:53:13 -07:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
ecore_x_window_free(_input_window);
|
|
|
|
e_grabinput_release(_input_window, _input_window);
|
|
|
|
_input_window = 0;
|
2005-06-07 06:53:27 -07:00
|
|
|
}
|
|
|
|
|
2010-01-22 12:28:39 -08:00
|
|
|
void
|
2005-06-07 06:53:27 -07:00
|
|
|
e_winlist_next(void)
|
|
|
|
{
|
2010-08-18 14:04:39 -07:00
|
|
|
if (!_winlist) return;
|
|
|
|
if (eina_list_count(_wins) == 1)
|
2005-07-31 00:16:14 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (!_win_selected)
|
|
|
|
{
|
|
|
|
_win_selected = _wins;
|
|
|
|
_e_winlist_show_active();
|
|
|
|
_e_winlist_activate();
|
|
|
|
}
|
|
|
|
return;
|
2005-07-31 00:16:14 -07:00
|
|
|
}
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_deactivate();
|
2010-08-18 14:04:39 -07:00
|
|
|
if (!_win_selected)
|
|
|
|
_win_selected = _wins;
|
2005-06-12 21:18:29 -07:00
|
|
|
else
|
2010-08-18 14:04:39 -07:00
|
|
|
_win_selected = _win_selected->next;
|
|
|
|
if (!_win_selected) _win_selected = _wins;
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_show_active();
|
|
|
|
_e_winlist_activate();
|
2005-06-07 06:53:27 -07:00
|
|
|
}
|
|
|
|
|
2010-01-22 12:28:39 -08:00
|
|
|
void
|
2005-06-07 06:53:27 -07:00
|
|
|
e_winlist_prev(void)
|
|
|
|
{
|
2010-08-18 14:04:39 -07:00
|
|
|
if (!_winlist) return;
|
|
|
|
if (eina_list_count(_wins) == 1)
|
2005-07-31 00:16:14 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (!_win_selected)
|
|
|
|
{
|
|
|
|
_win_selected = _wins;
|
|
|
|
_e_winlist_show_active();
|
|
|
|
_e_winlist_activate();
|
|
|
|
}
|
|
|
|
return;
|
2005-07-31 00:16:14 -07:00
|
|
|
}
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_deactivate();
|
2010-08-18 14:04:39 -07:00
|
|
|
if (!_win_selected)
|
|
|
|
_win_selected = _wins;
|
2005-06-12 21:18:29 -07:00
|
|
|
else
|
2010-08-18 14:04:39 -07:00
|
|
|
_win_selected = _win_selected->prev;
|
|
|
|
if (!_win_selected) _win_selected = eina_list_last(_wins);
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_show_active();
|
|
|
|
_e_winlist_activate();
|
2005-06-07 06:53:27 -07:00
|
|
|
}
|
|
|
|
|
2010-07-07 14:36:23 -07:00
|
|
|
void
|
|
|
|
e_winlist_left(E_Zone *zone)
|
|
|
|
{
|
2012-05-04 02:38:52 -07:00
|
|
|
E_Border *bd;
|
2010-07-07 14:36:23 -07:00
|
|
|
Eina_List *l;
|
|
|
|
E_Desk *desk;
|
|
|
|
E_Border *bd_orig;
|
2010-08-19 14:09:58 -07:00
|
|
|
int delta = INT_MAX;
|
2012-09-15 02:57:38 -07:00
|
|
|
int delta2 = INT_MAX;
|
2010-07-07 14:36:23 -07:00
|
|
|
int center;
|
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
_bd_next = NULL;
|
2010-07-07 14:36:23 -07:00
|
|
|
|
|
|
|
E_OBJECT_CHECK_RETURN(zone, 0);
|
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
|
|
|
|
|
|
|
|
bd_orig = e_border_focused_get();
|
|
|
|
if (!bd_orig) return;
|
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
center = bd_orig->x + bd_orig->w / 2;
|
2010-07-07 14:36:23 -07:00
|
|
|
|
|
|
|
desk = e_desk_current_get(zone);
|
2012-05-04 02:38:52 -07:00
|
|
|
EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd)
|
2010-07-07 14:36:23 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
int center_next;
|
|
|
|
int delta_next;
|
2012-09-15 02:57:38 -07:00
|
|
|
int delta2_next;
|
2012-06-20 00:01:53 -07:00
|
|
|
|
|
|
|
if (bd == bd_orig) continue;
|
|
|
|
if ((!bd->client.icccm.accepts_focus) &&
|
|
|
|
(!bd->client.icccm.take_focus)) continue;
|
|
|
|
if (bd->client.netwm.state.skip_taskbar) continue;
|
|
|
|
if (bd->user_skip_winlist) continue;
|
|
|
|
if (bd->iconic)
|
|
|
|
{
|
|
|
|
if (!e_config->winlist_list_show_iconified) continue;
|
|
|
|
if ((bd->zone != zone) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(!e_config->winlist_list_show_other_screen_iconified))
|
2010-08-19 09:14:53 -07:00
|
|
|
continue;
|
2012-06-20 00:01:53 -07:00
|
|
|
if ((bd->desk != desk) &&
|
2010-08-19 09:14:53 -07:00
|
|
|
(!e_config->winlist_list_show_other_desk_iconified)) continue;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bd->sticky)
|
|
|
|
{
|
|
|
|
if ((bd->zone != zone) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(!e_config->winlist_list_show_other_screen_windows))
|
2010-08-19 09:14:53 -07:00
|
|
|
continue;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bd->desk != desk)
|
|
|
|
{
|
|
|
|
if ((bd->zone) && (bd->zone != zone))
|
|
|
|
{
|
|
|
|
if (!e_config->winlist_list_show_other_screen_windows)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (!e_config->winlist_list_show_other_desk_windows)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* bd is suitable */
|
|
|
|
center_next = bd->x + bd->w / 2;
|
|
|
|
if (center_next >= center) continue;
|
|
|
|
delta_next = bd_orig->x - (bd->x + bd->w);
|
|
|
|
if (delta_next < 0) delta_next = center - center_next;
|
2012-09-15 02:57:38 -07:00
|
|
|
delta2_next = abs(bd_orig->y - bd_orig->h / 2 - bd->y + bd->h/2);
|
|
|
|
if (delta_next >= 0 && delta_next <= delta &&
|
|
|
|
delta2_next >= 0 && delta2_next <= delta2)
|
2012-06-20 00:01:53 -07:00
|
|
|
{
|
|
|
|
_bd_next = bd;
|
|
|
|
delta = delta_next;
|
2012-09-15 02:57:38 -07:00
|
|
|
delta2 = delta2_next;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
2010-07-07 14:36:23 -07:00
|
|
|
}
|
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_bd_next)
|
2010-07-07 14:36:23 -07:00
|
|
|
{
|
|
|
|
if (!bd_orig->lock_focus_out)
|
|
|
|
e_border_focus_set(bd_orig, 0, 0);
|
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
if ((e_config->focus_policy != E_FOCUS_CLICK) ||
|
|
|
|
(e_config->winlist_warp_at_end) ||
|
|
|
|
(e_config->winlist_warp_while_selecting))
|
|
|
|
{
|
|
|
|
_warp_to_x = _bd_next->x + (_bd_next->w / 2);
|
|
|
|
if (_warp_to_x < (_bd_next->zone->x + 1))
|
|
|
|
_warp_to_x = _bd_next->zone->x +
|
|
|
|
((_bd_next->x + _bd_next->w - _bd_next->zone->x) / 2);
|
|
|
|
else if (_warp_to_x >= (_bd_next->zone->x + _bd_next->zone->w - 1))
|
|
|
|
_warp_to_x = (_bd_next->zone->x + _bd_next->zone->w + _bd_next->x) / 2;
|
|
|
|
|
|
|
|
_warp_to_y = _bd_next->y + (_bd_next->h / 2);
|
|
|
|
if (_warp_to_y < (_bd_next->zone->y + 1))
|
|
|
|
_warp_to_y = _bd_next->zone->y +
|
|
|
|
((_bd_next->y + _bd_next->h - _bd_next->zone->y) / 2);
|
|
|
|
else if (_warp_to_y >= (_bd_next->zone->y + _bd_next->zone->h - 1))
|
|
|
|
_warp_to_y = (_bd_next->zone->y + _bd_next->zone->h + _bd_next->y) / 2;
|
2010-08-19 14:09:58 -07:00
|
|
|
|
|
|
|
_old_warp_x = _old_warp_y = INT_MAX;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
ecore_x_pointer_xy_get(zone->container->win, &_warp_x, &_warp_y);
|
|
|
|
_win = &zone->container->win;
|
|
|
|
_warp_to = 1;
|
|
|
|
if (!_warp_timer)
|
|
|
|
_warp_timer = ecore_timer_add(0.01, _e_winlist_warp_timer, NULL);
|
|
|
|
if (!_animator)
|
|
|
|
_animator = ecore_animator_add(_e_winlist_animator, NULL);
|
|
|
|
|
|
|
|
if ((!_bd_next->lock_user_stacking) &&
|
2010-08-19 09:14:53 -07:00
|
|
|
(e_config->winlist_list_raise_while_selecting))
|
2012-06-20 00:01:53 -07:00
|
|
|
e_border_raise(_bd_next);
|
|
|
|
if ((!_bd_next->lock_focus_out) &&
|
2010-08-19 09:14:53 -07:00
|
|
|
(e_config->winlist_list_focus_while_selecting))
|
2012-06-20 00:01:53 -07:00
|
|
|
e_border_focus_set(_bd_next, 1, 1);
|
2010-07-07 14:36:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_winlist_down(E_Zone *zone)
|
|
|
|
{
|
2012-05-04 02:38:52 -07:00
|
|
|
E_Border *bd;
|
2010-07-07 14:36:23 -07:00
|
|
|
Eina_List *l;
|
|
|
|
E_Desk *desk;
|
|
|
|
E_Border *bd_orig;
|
2010-08-19 14:09:58 -07:00
|
|
|
int delta = INT_MAX;
|
2012-09-15 02:57:38 -07:00
|
|
|
int delta2 = INT_MAX;
|
2010-07-07 14:36:23 -07:00
|
|
|
int center;
|
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
_bd_next = NULL;
|
2010-07-07 14:36:23 -07:00
|
|
|
|
|
|
|
E_OBJECT_CHECK_RETURN(zone, 0);
|
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
|
|
|
|
|
|
|
|
bd_orig = e_border_focused_get();
|
|
|
|
if (!bd_orig) return;
|
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
center = bd_orig->y + bd_orig->h / 2;
|
2010-07-07 14:36:23 -07:00
|
|
|
|
|
|
|
desk = e_desk_current_get(zone);
|
2012-05-04 02:38:52 -07:00
|
|
|
EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd)
|
2010-07-07 14:36:23 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
int center_next;
|
|
|
|
int delta_next;
|
2012-09-15 02:57:38 -07:00
|
|
|
int delta2_next;
|
2012-06-20 00:01:53 -07:00
|
|
|
|
|
|
|
if (bd == bd_orig) continue;
|
|
|
|
if ((!bd->client.icccm.accepts_focus) &&
|
|
|
|
(!bd->client.icccm.take_focus)) continue;
|
|
|
|
if (bd->client.netwm.state.skip_taskbar) continue;
|
|
|
|
if (bd->user_skip_winlist) continue;
|
|
|
|
if (bd->iconic)
|
|
|
|
{
|
|
|
|
if (!e_config->winlist_list_show_iconified) continue;
|
|
|
|
if ((bd->zone != zone) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(!e_config->winlist_list_show_other_screen_iconified))
|
2010-08-19 09:14:53 -07:00
|
|
|
continue;
|
2012-06-20 00:01:53 -07:00
|
|
|
if ((bd->desk != desk) &&
|
2010-08-19 09:14:53 -07:00
|
|
|
(!e_config->winlist_list_show_other_desk_iconified)) continue;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bd->sticky)
|
|
|
|
{
|
|
|
|
if ((bd->zone != zone) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(!e_config->winlist_list_show_other_screen_windows))
|
2010-08-19 09:14:53 -07:00
|
|
|
continue;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bd->desk != desk)
|
|
|
|
{
|
|
|
|
if ((bd->zone) && (bd->zone != zone))
|
|
|
|
{
|
|
|
|
if (!e_config->winlist_list_show_other_screen_windows)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (!e_config->winlist_list_show_other_desk_windows)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* bd is suitable */
|
|
|
|
center_next = bd->y + bd->h / 2;
|
|
|
|
if (center_next <= center) continue;
|
|
|
|
delta_next = bd->y - (bd_orig->y + bd_orig->h);
|
|
|
|
if (delta_next < 0) delta_next = center - center_next;
|
2012-09-15 02:57:38 -07:00
|
|
|
delta2_next = abs(bd_orig->x - bd_orig->w / 2 - bd->x + bd->w/2);
|
|
|
|
if (delta_next >= 0 && delta_next <= delta &&
|
|
|
|
delta2_next >= 0 && delta2_next <= delta2)
|
2012-06-20 00:01:53 -07:00
|
|
|
{
|
|
|
|
_bd_next = bd;
|
|
|
|
delta = delta_next;
|
2012-09-15 02:57:38 -07:00
|
|
|
delta2 = delta2_next;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
2010-07-07 14:36:23 -07:00
|
|
|
}
|
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_bd_next)
|
2010-07-07 14:36:23 -07:00
|
|
|
{
|
|
|
|
if (!bd_orig->lock_focus_out)
|
|
|
|
e_border_focus_set(bd_orig, 0, 0);
|
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
if ((e_config->focus_policy != E_FOCUS_CLICK) ||
|
|
|
|
(e_config->winlist_warp_at_end) ||
|
|
|
|
(e_config->winlist_warp_while_selecting))
|
|
|
|
{
|
|
|
|
_warp_to_x = _bd_next->x + (_bd_next->w / 2);
|
|
|
|
if (_warp_to_x < (_bd_next->zone->x + 1))
|
|
|
|
_warp_to_x = _bd_next->zone->x +
|
|
|
|
((_bd_next->x + _bd_next->w - _bd_next->zone->x) / 2);
|
|
|
|
else if (_warp_to_x >= (_bd_next->zone->x + _bd_next->zone->w - 1))
|
|
|
|
_warp_to_x = (_bd_next->zone->x + _bd_next->zone->w + _bd_next->x) / 2;
|
|
|
|
|
|
|
|
_warp_to_y = _bd_next->y + (_bd_next->h / 2);
|
|
|
|
if (_warp_to_y < (_bd_next->zone->y + 1))
|
|
|
|
_warp_to_y = _bd_next->zone->y +
|
|
|
|
((_bd_next->y + _bd_next->h - _bd_next->zone->y) / 2);
|
|
|
|
else if (_warp_to_y >= (_bd_next->zone->y + _bd_next->zone->h - 1))
|
|
|
|
_warp_to_y = (_bd_next->zone->y + _bd_next->zone->h + _bd_next->y) / 2;
|
2010-08-19 14:09:58 -07:00
|
|
|
|
|
|
|
_old_warp_x = _old_warp_y = INT_MAX;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
ecore_x_pointer_xy_get(zone->container->win, &_warp_x, &_warp_y);
|
|
|
|
_win = &zone->container->win;
|
|
|
|
_warp_to = 1;
|
|
|
|
if (!_warp_timer)
|
|
|
|
_warp_timer = ecore_timer_add(0.01, _e_winlist_warp_timer, NULL);
|
|
|
|
if (!_animator)
|
|
|
|
_animator = ecore_animator_add(_e_winlist_animator, NULL);
|
|
|
|
|
|
|
|
if ((!_bd_next->lock_user_stacking) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(e_config->winlist_list_raise_while_selecting))
|
2012-06-20 00:01:53 -07:00
|
|
|
e_border_raise(_bd_next);
|
|
|
|
if ((!_bd_next->lock_focus_out) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(e_config->winlist_list_focus_while_selecting))
|
2012-06-20 00:01:53 -07:00
|
|
|
e_border_focus_set(_bd_next, 1, 1);
|
2010-07-07 14:36:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_winlist_up(E_Zone *zone)
|
|
|
|
{
|
2012-05-04 02:38:52 -07:00
|
|
|
E_Border *bd;
|
2010-07-07 14:36:23 -07:00
|
|
|
Eina_List *l;
|
|
|
|
E_Desk *desk;
|
|
|
|
E_Border *bd_orig;
|
2010-08-19 14:09:58 -07:00
|
|
|
int delta = INT_MAX;
|
2012-09-15 02:57:38 -07:00
|
|
|
int delta2 = INT_MAX;
|
2010-07-07 14:36:23 -07:00
|
|
|
int center;
|
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
_bd_next = NULL;
|
2010-07-07 14:36:23 -07:00
|
|
|
|
|
|
|
E_OBJECT_CHECK_RETURN(zone, 0);
|
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
|
|
|
|
|
|
|
|
bd_orig = e_border_focused_get();
|
|
|
|
if (!bd_orig) return;
|
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
center = bd_orig->y + bd_orig->h / 2;
|
2010-07-07 14:36:23 -07:00
|
|
|
|
|
|
|
desk = e_desk_current_get(zone);
|
2012-05-04 02:38:52 -07:00
|
|
|
EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd)
|
2010-07-07 14:36:23 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
int center_next;
|
|
|
|
int delta_next;
|
2012-09-15 02:57:38 -07:00
|
|
|
int delta2_next;
|
2012-06-20 00:01:53 -07:00
|
|
|
|
|
|
|
if (bd == bd_orig) continue;
|
|
|
|
if ((!bd->client.icccm.accepts_focus) &&
|
|
|
|
(!bd->client.icccm.take_focus)) continue;
|
|
|
|
if (bd->client.netwm.state.skip_taskbar) continue;
|
|
|
|
if (bd->user_skip_winlist) continue;
|
|
|
|
if (bd->iconic)
|
|
|
|
{
|
|
|
|
if (!e_config->winlist_list_show_iconified) continue;
|
|
|
|
if ((bd->zone != zone) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(!e_config->winlist_list_show_other_screen_iconified))
|
2010-08-19 09:14:53 -07:00
|
|
|
continue;
|
2012-06-20 00:01:53 -07:00
|
|
|
if ((bd->desk != desk) &&
|
2010-08-19 09:14:53 -07:00
|
|
|
(!e_config->winlist_list_show_other_desk_iconified)) continue;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bd->sticky)
|
|
|
|
{
|
|
|
|
if ((bd->zone != zone) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(!e_config->winlist_list_show_other_screen_windows))
|
2010-08-19 09:14:53 -07:00
|
|
|
continue;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bd->desk != desk)
|
|
|
|
{
|
|
|
|
if ((bd->zone) && (bd->zone != zone))
|
|
|
|
{
|
|
|
|
if (!e_config->winlist_list_show_other_screen_windows)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (!e_config->winlist_list_show_other_desk_windows)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* bd is suitable */
|
|
|
|
center_next = bd->y + bd->h / 2;
|
|
|
|
if (center_next >= center) continue;
|
|
|
|
delta_next = bd_orig->y - (bd->y + bd->h);
|
|
|
|
if (delta_next < 0) delta_next = center - center_next;
|
2012-09-15 02:57:38 -07:00
|
|
|
delta2_next = abs(bd_orig->x - bd_orig->w / 2 - bd->x + bd->w/2);
|
|
|
|
if (delta_next >= 0 && delta_next <= delta &&
|
|
|
|
delta2_next >= 0 && delta2_next <= delta2)
|
2012-06-20 00:01:53 -07:00
|
|
|
{
|
|
|
|
_bd_next = bd;
|
|
|
|
delta = delta_next;
|
2012-09-15 02:57:38 -07:00
|
|
|
delta2 = delta2_next;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
2010-07-07 14:36:23 -07:00
|
|
|
}
|
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_bd_next)
|
2010-07-07 14:36:23 -07:00
|
|
|
{
|
|
|
|
if (!bd_orig->lock_focus_out)
|
|
|
|
e_border_focus_set(bd_orig, 0, 0);
|
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
if ((e_config->focus_policy != E_FOCUS_CLICK) ||
|
|
|
|
(e_config->winlist_warp_at_end) ||
|
|
|
|
(e_config->winlist_warp_while_selecting))
|
|
|
|
{
|
|
|
|
_warp_to_x = _bd_next->x + (_bd_next->w / 2);
|
|
|
|
if (_warp_to_x < (_bd_next->zone->x + 1))
|
|
|
|
_warp_to_x = _bd_next->zone->x +
|
|
|
|
((_bd_next->x + _bd_next->w - _bd_next->zone->x) / 2);
|
|
|
|
else if (_warp_to_x >= (_bd_next->zone->x + _bd_next->zone->w - 1))
|
|
|
|
_warp_to_x = (_bd_next->zone->x + _bd_next->zone->w + _bd_next->x) / 2;
|
|
|
|
|
|
|
|
_warp_to_y = _bd_next->y + (_bd_next->h / 2);
|
|
|
|
if (_warp_to_y < (_bd_next->zone->y + 1))
|
|
|
|
_warp_to_y = _bd_next->zone->y +
|
|
|
|
((_bd_next->y + _bd_next->h - _bd_next->zone->y) / 2);
|
|
|
|
else if (_warp_to_y >= (_bd_next->zone->y + _bd_next->zone->h - 1))
|
|
|
|
_warp_to_y = (_bd_next->zone->y + _bd_next->zone->h + _bd_next->y) / 2;
|
2010-08-19 14:09:58 -07:00
|
|
|
|
|
|
|
_old_warp_x = _old_warp_y = INT_MAX;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
ecore_x_pointer_xy_get(zone->container->win, &_warp_x, &_warp_y);
|
|
|
|
_win = &zone->container->win;
|
|
|
|
_warp_to = 1;
|
|
|
|
if (!_warp_timer)
|
|
|
|
_warp_timer = ecore_timer_add(0.01, _e_winlist_warp_timer, NULL);
|
|
|
|
if (!_animator)
|
|
|
|
_animator = ecore_animator_add(_e_winlist_animator, NULL);
|
|
|
|
|
|
|
|
if ((!_bd_next->lock_user_stacking) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(e_config->winlist_list_raise_while_selecting))
|
2012-06-20 00:01:53 -07:00
|
|
|
e_border_raise(_bd_next);
|
|
|
|
if ((!_bd_next->lock_focus_out) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(e_config->winlist_list_focus_while_selecting))
|
2012-06-20 00:01:53 -07:00
|
|
|
e_border_focus_set(_bd_next, 1, 1);
|
2010-07-07 14:36:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_winlist_right(E_Zone *zone)
|
|
|
|
{
|
2012-05-04 02:38:52 -07:00
|
|
|
E_Border *bd;
|
2010-07-07 14:36:23 -07:00
|
|
|
Eina_List *l;
|
|
|
|
E_Desk *desk;
|
|
|
|
E_Border *bd_orig;
|
2010-08-19 14:09:58 -07:00
|
|
|
int delta = INT_MAX;
|
2012-09-15 02:57:38 -07:00
|
|
|
int delta2 = INT_MAX;
|
2010-07-07 14:36:23 -07:00
|
|
|
int center;
|
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
_bd_next = NULL;
|
2010-07-07 14:36:23 -07:00
|
|
|
|
|
|
|
E_OBJECT_CHECK_RETURN(zone, 0);
|
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
|
|
|
|
|
|
|
|
bd_orig = e_border_focused_get();
|
|
|
|
if (!bd_orig) return;
|
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
center = bd_orig->x + bd_orig->w / 2;
|
2010-07-07 14:36:23 -07:00
|
|
|
|
|
|
|
desk = e_desk_current_get(zone);
|
2012-05-04 02:38:52 -07:00
|
|
|
EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd)
|
2010-07-07 14:36:23 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
int center_next;
|
|
|
|
int delta_next;
|
2012-09-15 02:57:38 -07:00
|
|
|
int delta2_next;
|
2012-06-20 00:01:53 -07:00
|
|
|
|
|
|
|
if (bd == bd_orig) continue;
|
|
|
|
if ((!bd->client.icccm.accepts_focus) &&
|
|
|
|
(!bd->client.icccm.take_focus)) continue;
|
|
|
|
if (bd->client.netwm.state.skip_taskbar) continue;
|
|
|
|
if (bd->user_skip_winlist) continue;
|
|
|
|
if (bd->iconic)
|
|
|
|
{
|
|
|
|
if (!e_config->winlist_list_show_iconified) continue;
|
|
|
|
if ((bd->zone != zone) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(!e_config->winlist_list_show_other_screen_iconified))
|
2010-08-19 09:14:53 -07:00
|
|
|
continue;
|
2012-06-20 00:01:53 -07:00
|
|
|
if ((bd->desk != desk) &&
|
2010-08-19 09:14:53 -07:00
|
|
|
(!e_config->winlist_list_show_other_desk_iconified)) continue;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bd->sticky)
|
|
|
|
{
|
|
|
|
if ((bd->zone != zone) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(!e_config->winlist_list_show_other_screen_windows))
|
2010-08-19 09:14:53 -07:00
|
|
|
continue;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bd->desk != desk)
|
|
|
|
{
|
|
|
|
if ((bd->zone) && (bd->zone != zone))
|
|
|
|
{
|
|
|
|
if (!e_config->winlist_list_show_other_screen_windows)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (!e_config->winlist_list_show_other_desk_windows)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* bd is suitable */
|
|
|
|
center_next = bd->x + bd->w / 2;
|
|
|
|
if (center_next <= center) continue;
|
|
|
|
delta_next = bd->x - (bd_orig->x + bd_orig->w);
|
|
|
|
if (delta_next < 0) delta = center_next - center;
|
2012-09-15 02:57:38 -07:00
|
|
|
delta2_next = abs(bd_orig->y - bd_orig->h / 2 - bd->y + bd->h/2);
|
|
|
|
if (delta_next >= 0 && delta_next <= delta &&
|
|
|
|
delta2_next >= 0 && delta2_next <= delta2)
|
2012-06-20 00:01:53 -07:00
|
|
|
{
|
|
|
|
_bd_next = bd;
|
|
|
|
delta = delta_next;
|
2012-09-15 02:57:38 -07:00
|
|
|
delta2 = delta2_next;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
2010-07-07 14:36:23 -07:00
|
|
|
}
|
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_bd_next)
|
2010-07-07 14:36:23 -07:00
|
|
|
{
|
|
|
|
if (!bd_orig->lock_focus_out)
|
|
|
|
e_border_focus_set(bd_orig, 0, 0);
|
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
if ((e_config->focus_policy != E_FOCUS_CLICK) ||
|
|
|
|
(e_config->winlist_warp_at_end) ||
|
|
|
|
(e_config->winlist_warp_while_selecting))
|
|
|
|
{
|
|
|
|
_warp_to_x = _bd_next->x + (_bd_next->w / 2);
|
|
|
|
if (_warp_to_x < (_bd_next->zone->x + 1))
|
|
|
|
_warp_to_x = _bd_next->zone->x +
|
|
|
|
((_bd_next->x + _bd_next->w - _bd_next->zone->x) / 2);
|
|
|
|
else if (_warp_to_x >= (_bd_next->zone->x + _bd_next->zone->w - 1))
|
|
|
|
_warp_to_x = (_bd_next->zone->x + _bd_next->zone->w + _bd_next->x) / 2;
|
|
|
|
|
|
|
|
_warp_to_y = _bd_next->y + (_bd_next->h / 2);
|
|
|
|
if (_warp_to_y < (_bd_next->zone->y + 1))
|
|
|
|
_warp_to_y = _bd_next->zone->y +
|
|
|
|
((_bd_next->y + _bd_next->h - _bd_next->zone->y) / 2);
|
|
|
|
else if (_warp_to_y >= (_bd_next->zone->y + _bd_next->zone->h - 1))
|
|
|
|
_warp_to_y = (_bd_next->zone->y + _bd_next->zone->h + _bd_next->y) / 2;
|
2010-08-19 14:09:58 -07:00
|
|
|
|
|
|
|
_old_warp_x = _old_warp_y = INT_MAX;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
ecore_x_pointer_xy_get(zone->container->win, &_warp_x, &_warp_y);
|
|
|
|
_win = &zone->container->win;
|
|
|
|
_warp_to = 1;
|
|
|
|
if (!_warp_timer)
|
|
|
|
_warp_timer = ecore_timer_add(0.01, _e_winlist_warp_timer, NULL);
|
|
|
|
if (!_animator)
|
|
|
|
_animator = ecore_animator_add(_e_winlist_animator, NULL);
|
|
|
|
|
|
|
|
if ((!_bd_next->lock_user_stacking) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(e_config->winlist_list_raise_while_selecting))
|
2012-06-20 00:01:53 -07:00
|
|
|
e_border_raise(_bd_next);
|
|
|
|
if ((!_bd_next->lock_focus_out) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(e_config->winlist_list_focus_while_selecting))
|
2012-06-20 00:01:53 -07:00
|
|
|
e_border_focus_set(_bd_next, 1, 1);
|
2010-07-07 14:36:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-22 12:28:39 -08:00
|
|
|
void
|
2012-12-20 02:58:21 -08:00
|
|
|
e_winlist_modifiers_set(int mod, E_Winlist_Activate_Type type)
|
2005-06-07 06:53:27 -07:00
|
|
|
{
|
2010-08-18 14:04:39 -07:00
|
|
|
if (!_winlist) return;
|
|
|
|
_hold_mod = mod;
|
|
|
|
_hold_count = 0;
|
2012-12-20 02:58:21 -08:00
|
|
|
_activate_type = type;
|
2012-12-20 03:16:09 -08:00
|
|
|
if (type == E_WINLIST_ACTIVATE_TYPE_MOUSE) _hold_count++;
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_hold_mod & ECORE_EVENT_MODIFIER_SHIFT) _hold_count++;
|
2012-06-20 00:01:53 -07:00
|
|
|
if (_hold_mod & ECORE_EVENT_MODIFIER_CTRL) _hold_count++;
|
|
|
|
if (_hold_mod & ECORE_EVENT_MODIFIER_ALT) _hold_count++;
|
|
|
|
if (_hold_mod & ECORE_EVENT_MODIFIER_WIN) _hold_count++;
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* local subsystem functions */
|
|
|
|
static void
|
|
|
|
_e_winlist_size_adjust(void)
|
|
|
|
{
|
|
|
|
Evas_Coord mw, mh;
|
2005-06-14 03:19:25 -07:00
|
|
|
E_Zone *zone;
|
2010-07-07 14:36:23 -07:00
|
|
|
int x, y, w, h;
|
2005-06-11 23:50:34 -07:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
e_box_freeze(_list_object);
|
|
|
|
e_box_size_min_get(_list_object, &mw, &mh);
|
2014-06-07 09:29:17 -07:00
|
|
|
evas_object_size_hint_min_set(_list_object, mw, mh);
|
2010-08-18 14:04:39 -07:00
|
|
|
edje_object_part_swallow(_bg_object, "e.swallow.list", _list_object);
|
|
|
|
edje_object_size_min_calc(_bg_object, &mw, &mh);
|
2014-06-07 09:29:17 -07:00
|
|
|
evas_object_size_hint_min_set(_list_object, -1, -1);
|
2010-08-18 14:04:39 -07:00
|
|
|
edje_object_part_swallow(_bg_object, "e.swallow.list", _list_object);
|
|
|
|
e_box_thaw(_list_object);
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
zone = _winlist->zone;
|
2005-06-14 03:19:25 -07:00
|
|
|
w = (double)zone->w * e_config->winlist_pos_size_w;
|
|
|
|
if (w < mw) w = mw;
|
|
|
|
if (w > e_config->winlist_pos_max_w) w = e_config->winlist_pos_max_w;
|
2012-06-20 00:01:53 -07:00
|
|
|
else if (w < e_config->winlist_pos_min_w)
|
|
|
|
w = e_config->winlist_pos_min_w;
|
2005-06-14 03:19:25 -07:00
|
|
|
if (w > zone->w) w = zone->w;
|
|
|
|
x = (double)(zone->w - w) * e_config->winlist_pos_align_x;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2005-06-11 23:50:34 -07:00
|
|
|
h = mh;
|
2005-06-14 03:19:25 -07:00
|
|
|
if (h > e_config->winlist_pos_max_h) h = e_config->winlist_pos_max_h;
|
2012-06-20 00:01:53 -07:00
|
|
|
else if (h < e_config->winlist_pos_min_h)
|
|
|
|
h = e_config->winlist_pos_min_h;
|
2005-06-14 03:19:25 -07:00
|
|
|
if (h > zone->h) h = zone->h;
|
|
|
|
y = (double)(zone->h - h) * e_config->winlist_pos_align_y;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
evas_object_resize(_bg_object, w, h);
|
|
|
|
e_popup_move_resize(_winlist, x, y, w, h);
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_winlist_border_add(E_Border *bd, E_Zone *zone, E_Desk *desk)
|
|
|
|
{
|
2007-11-18 13:01:31 -08:00
|
|
|
E_Winlist_Win *ww;
|
|
|
|
Evas_Coord mw, mh;
|
|
|
|
Evas_Object *o;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2005-08-21 20:22:46 -07:00
|
|
|
if ((!bd->client.icccm.accepts_focus) &&
|
2007-11-18 13:01:31 -08:00
|
|
|
(!bd->client.icccm.take_focus)) return;
|
|
|
|
if (bd->client.netwm.state.skip_taskbar) return;
|
|
|
|
if (bd->user_skip_winlist) return;
|
2005-06-14 03:19:25 -07:00
|
|
|
if (bd->iconic)
|
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (!e_config->winlist_list_show_iconified) return;
|
|
|
|
if ((bd->zone != zone) &&
|
|
|
|
(!e_config->winlist_list_show_other_screen_iconified)) return;
|
|
|
|
if ((bd->desk != desk) &&
|
|
|
|
(!e_config->winlist_list_show_other_desk_iconified)) return;
|
2005-06-14 03:19:25 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (bd->sticky)
|
|
|
|
{
|
|
|
|
if ((bd->zone != zone) &&
|
|
|
|
(!e_config->winlist_list_show_other_screen_windows)) return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bd->desk != desk)
|
|
|
|
{
|
|
|
|
if ((bd->zone) && (bd->zone != zone))
|
|
|
|
{
|
|
|
|
if (!e_config->winlist_list_show_other_screen_windows)
|
2009-12-22 12:41:06 -08:00
|
|
|
return;
|
2012-09-12 00:53:57 -07:00
|
|
|
if (bd->zone && bd->desk && (bd->desk != e_desk_current_get(bd->zone)))
|
|
|
|
{
|
|
|
|
if (!e_config->winlist_list_show_other_desk_windows)
|
|
|
|
return;
|
|
|
|
}
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
else if (!e_config->winlist_list_show_other_desk_windows)
|
2009-12-22 12:41:06 -08:00
|
|
|
return;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
}
|
2005-06-14 03:19:25 -07:00
|
|
|
}
|
2007-11-18 13:01:31 -08:00
|
|
|
|
2009-12-22 12:41:06 -08:00
|
|
|
ww = E_NEW(E_Winlist_Win, 1);
|
2007-11-18 13:01:31 -08:00
|
|
|
if (!ww) return;
|
|
|
|
ww->border = bd;
|
2010-08-18 14:04:39 -07:00
|
|
|
_wins = eina_list_append(_wins, ww);
|
|
|
|
o = edje_object_add(_winlist->evas);
|
2007-11-18 13:01:31 -08:00
|
|
|
ww->bg_object = o;
|
|
|
|
e_theme_edje_object_set(o, "base/theme/winlist",
|
2012-06-20 00:01:53 -07:00
|
|
|
"e/widgets/winlist/item");
|
2007-11-18 13:01:31 -08:00
|
|
|
edje_object_part_text_set(o, "e.text.label", e_border_name_get(ww->border));
|
|
|
|
evas_object_show(o);
|
|
|
|
if (edje_object_part_exists(ww->bg_object, "e.swallow.icon"))
|
2005-06-11 23:50:34 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
o = e_border_icon_add(bd, _winlist->evas);
|
|
|
|
ww->icon_object = o;
|
|
|
|
edje_object_part_swallow(ww->bg_object, "e.swallow.icon", o);
|
|
|
|
evas_object_show(o);
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
2007-11-18 13:01:31 -08:00
|
|
|
if (bd->shaded)
|
2009-12-22 12:41:06 -08:00
|
|
|
edje_object_signal_emit(ww->bg_object, "e,state,shaded", "e");
|
2007-11-18 13:01:31 -08:00
|
|
|
else if (bd->iconic)
|
2009-12-22 12:41:06 -08:00
|
|
|
edje_object_signal_emit(ww->bg_object, "e,state,iconified", "e");
|
2007-11-18 13:01:31 -08:00
|
|
|
else if (bd->desk != desk)
|
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (!((bd->sticky) && (bd->zone == zone)))
|
|
|
|
edje_object_signal_emit(ww->bg_object, "e,state,invisible", "e");
|
2007-11-18 13:01:31 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
edje_object_size_min_calc(ww->bg_object, &mw, &mh);
|
2010-08-18 14:04:39 -07:00
|
|
|
e_box_pack_end(_list_object, ww->bg_object);
|
2010-07-07 14:36:23 -07:00
|
|
|
e_box_pack_options_set(ww->bg_object,
|
2012-06-20 00:01:53 -07:00
|
|
|
1, 1, /* fill */
|
|
|
|
1, 0, /* expand */
|
|
|
|
0.5, 0.5, /* align */
|
|
|
|
mw, mh, /* min */
|
|
|
|
9999, mh /* max */
|
|
|
|
);
|
2007-11-18 13:01:31 -08:00
|
|
|
e_object_ref(E_OBJECT(ww->border));
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_winlist_border_del(E_Border *bd)
|
|
|
|
{
|
2011-08-07 05:35:21 -07:00
|
|
|
E_Winlist_Win *ww;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
if (bd == _last_border) _last_border = NULL;
|
2011-08-07 05:35:21 -07:00
|
|
|
EINA_LIST_FOREACH(_wins, l, ww)
|
2005-06-11 23:50:34 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (ww->border == bd)
|
|
|
|
{
|
2007-06-09 20:51:20 -07:00
|
|
|
e_object_unref(E_OBJECT(ww->border));
|
2012-06-20 00:01:53 -07:00
|
|
|
if (l == _win_selected)
|
|
|
|
{
|
|
|
|
_win_selected = l->next;
|
|
|
|
if (!_win_selected) _win_selected = l->prev;
|
|
|
|
_e_winlist_show_active();
|
|
|
|
_e_winlist_activate();
|
|
|
|
}
|
|
|
|
evas_object_del(ww->bg_object);
|
|
|
|
if (ww->icon_object) evas_object_del(ww->icon_object);
|
|
|
|
E_FREE(ww);
|
|
|
|
_wins = eina_list_remove_list(_wins, l);
|
|
|
|
return;
|
|
|
|
}
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_winlist_activate_nth(int n)
|
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2005-06-14 03:58:45 -07:00
|
|
|
int cnt;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_deactivate();
|
2010-08-18 14:04:39 -07:00
|
|
|
cnt = eina_list_count(_wins);
|
2005-06-14 03:58:45 -07:00
|
|
|
if (n >= cnt) n = cnt - 1;
|
2010-08-18 14:04:39 -07:00
|
|
|
l = eina_list_nth_list(_wins, n);
|
2005-06-11 23:50:34 -07:00
|
|
|
if (l)
|
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
_win_selected = l;
|
|
|
|
_e_winlist_show_active();
|
|
|
|
_e_winlist_activate();
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_winlist_activate(void)
|
|
|
|
{
|
|
|
|
E_Winlist_Win *ww;
|
2005-06-12 09:22:06 -07:00
|
|
|
Evas_Object *o;
|
2009-12-22 12:41:06 -08:00
|
|
|
int ok = 0;
|
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
if (!_win_selected) return;
|
|
|
|
ww = _win_selected->data;
|
2006-08-22 00:39:11 -07:00
|
|
|
edje_object_signal_emit(ww->bg_object, "e,state,selected", "e");
|
2012-06-20 00:01:53 -07:00
|
|
|
if (ww->icon_object)
|
|
|
|
edje_object_signal_emit(ww->icon_object,
|
|
|
|
"e,state,selected", "e");
|
2005-06-14 03:19:25 -07:00
|
|
|
|
|
|
|
if ((ww->border->iconic) &&
|
|
|
|
(e_config->winlist_list_uncover_while_selecting))
|
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (!ww->border->lock_user_iconify)
|
|
|
|
e_border_uniconify(ww->border);
|
|
|
|
ww->was_iconified = 1;
|
|
|
|
ok = 1;
|
2005-06-14 03:19:25 -07:00
|
|
|
}
|
|
|
|
if ((!ww->border->sticky) &&
|
2010-08-18 14:04:39 -07:00
|
|
|
(ww->border->desk != e_desk_current_get(_winlist->zone)) &&
|
2005-06-14 03:19:25 -07:00
|
|
|
(e_config->winlist_list_jump_desk_while_selecting))
|
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (ww->border->desk) e_desk_show(ww->border->desk);
|
|
|
|
ok = 1;
|
2005-06-14 03:19:25 -07:00
|
|
|
}
|
2005-06-14 03:52:05 -07:00
|
|
|
if (((ww->border->shaded) ||
|
2012-06-20 00:01:53 -07:00
|
|
|
((ww->border->changes.shaded) &&
|
|
|
|
(ww->border->shade.val != ww->border->shaded) &&
|
|
|
|
(ww->border->shade.val))) &&
|
2010-08-18 14:04:39 -07:00
|
|
|
(ww->border->desk == e_desk_current_get(_winlist->zone)) &&
|
2005-06-14 03:19:25 -07:00
|
|
|
(e_config->winlist_list_uncover_while_selecting))
|
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (!ww->border->lock_user_shade)
|
|
|
|
e_border_unshade(ww->border, ww->border->shade.dir);
|
|
|
|
ww->was_shaded = 1;
|
|
|
|
ok = 1;
|
2005-06-14 03:19:25 -07:00
|
|
|
}
|
2005-06-12 20:50:23 -07:00
|
|
|
if ((!ww->border->iconic) &&
|
2010-08-18 14:04:39 -07:00
|
|
|
((ww->border->desk == e_desk_current_get(_winlist->zone)) ||
|
2012-06-20 00:01:53 -07:00
|
|
|
(ww->border->sticky)))
|
2005-06-14 03:19:25 -07:00
|
|
|
ok = 1;
|
|
|
|
if (ok)
|
2005-06-12 20:50:23 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if ((e_config->focus_policy != E_FOCUS_CLICK) ||
|
|
|
|
(e_config->winlist_warp_at_end) ||
|
|
|
|
(e_config->winlist_warp_while_selecting))
|
|
|
|
{
|
|
|
|
_warp_to_x = ww->border->x + (ww->border->w / 2);
|
|
|
|
if (_warp_to_x < (ww->border->zone->x + 1))
|
|
|
|
_warp_to_x = ww->border->zone->x +
|
|
|
|
((ww->border->x + ww->border->w - ww->border->zone->x) / 2);
|
|
|
|
else if (_warp_to_x >= (ww->border->zone->x + ww->border->zone->w - 1))
|
|
|
|
_warp_to_x = (ww->border->zone->x +
|
2010-08-19 14:09:58 -07:00
|
|
|
ww->border->zone->w + ww->border->x) / 2;
|
2010-08-18 14:04:39 -07:00
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
_warp_to_y = ww->border->y + (ww->border->h / 2);
|
|
|
|
if (_warp_to_y < (ww->border->zone->y + 1))
|
|
|
|
_warp_to_y = ww->border->zone->y +
|
|
|
|
((ww->border->y + ww->border->h - ww->border->zone->y) / 2);
|
|
|
|
else if (_warp_to_y >= (ww->border->zone->y + ww->border->zone->h - 1))
|
|
|
|
_warp_to_y = (ww->border->zone->y +
|
2010-08-19 14:09:58 -07:00
|
|
|
ww->border->zone->h + ww->border->y) / 2;
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
if (e_config->winlist_warp_while_selecting)
|
|
|
|
{
|
|
|
|
ecore_x_pointer_xy_get(_winlist->zone->container->win,
|
2010-08-19 14:09:58 -07:00
|
|
|
&_warp_x, &_warp_y);
|
2012-06-20 00:01:53 -07:00
|
|
|
_win = &_winlist->zone->container->win;
|
|
|
|
e_border_focus_latest_set(ww->border);
|
|
|
|
_warp_to = 1;
|
|
|
|
if (!_warp_timer)
|
|
|
|
_warp_timer = ecore_timer_add(0.01, _e_winlist_warp_timer, NULL);
|
|
|
|
if (!_animator)
|
|
|
|
_animator = ecore_animator_add(_e_winlist_animator, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_warp_to = 0;
|
|
|
|
if (_warp_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(_warp_timer);
|
|
|
|
_warp_timer = NULL;
|
|
|
|
}
|
|
|
|
if (_animator)
|
|
|
|
{
|
|
|
|
ecore_animator_del(_animator);
|
|
|
|
_animator = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((!ww->border->lock_user_stacking) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(e_config->winlist_list_raise_while_selecting))
|
2012-06-20 00:01:53 -07:00
|
|
|
e_border_raise(ww->border);
|
|
|
|
if ((!ww->border->lock_focus_out) &&
|
2010-08-19 14:09:58 -07:00
|
|
|
(e_config->winlist_list_focus_while_selecting))
|
2012-12-03 07:12:58 -08:00
|
|
|
e_border_focus_set(ww->border, 1, 0);
|
2005-06-12 20:50:23 -07:00
|
|
|
}
|
2010-08-19 14:09:58 -07:00
|
|
|
edje_object_part_text_set(_bg_object, "e.text.label",
|
|
|
|
e_border_name_get(ww->border));
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_icon_object)
|
2005-06-12 09:22:06 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
evas_object_del(_icon_object);
|
|
|
|
_icon_object = NULL;
|
2005-06-12 09:22:06 -07:00
|
|
|
}
|
2010-08-18 14:04:39 -07:00
|
|
|
if (edje_object_part_exists(_bg_object, "e.swallow.icon"))
|
2005-06-12 09:22:06 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
o = e_border_icon_add(ww->border, _winlist->evas);
|
|
|
|
_icon_object = o;
|
|
|
|
edje_object_part_swallow(_bg_object, "e.swallow.icon", o);
|
|
|
|
evas_object_show(o);
|
2005-06-12 09:22:06 -07:00
|
|
|
}
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
edje_object_signal_emit(_bg_object, "e,state,selected", "e");
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_winlist_deactivate(void)
|
|
|
|
{
|
|
|
|
E_Winlist_Win *ww;
|
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
if (!_win_selected) return;
|
|
|
|
ww = _win_selected->data;
|
2005-06-14 03:19:25 -07:00
|
|
|
if (ww->was_shaded)
|
2005-07-04 03:24:22 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (!ww->border->lock_user_shade)
|
|
|
|
e_border_shade(ww->border, ww->border->shade.dir);
|
2005-07-04 03:24:22 -07:00
|
|
|
}
|
2005-06-14 03:19:25 -07:00
|
|
|
if (ww->was_iconified)
|
2005-07-04 03:24:22 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (!ww->border->lock_user_iconify)
|
|
|
|
e_border_iconify(ww->border);
|
2005-07-04 03:24:22 -07:00
|
|
|
}
|
2005-06-14 03:19:25 -07:00
|
|
|
ww->was_shaded = 0;
|
|
|
|
ww->was_iconified = 0;
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_icon_object)
|
2005-06-12 09:22:06 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
evas_object_del(_icon_object);
|
|
|
|
_icon_object = NULL;
|
2005-06-12 09:22:06 -07:00
|
|
|
}
|
2010-08-18 14:04:39 -07:00
|
|
|
edje_object_part_text_set(_bg_object, "e.text.label", "");
|
2006-08-22 00:39:11 -07:00
|
|
|
edje_object_signal_emit(ww->bg_object, "e,state,unselected", "e");
|
2012-06-20 00:01:53 -07:00
|
|
|
if (ww->icon_object)
|
|
|
|
edje_object_signal_emit(ww->icon_object,
|
|
|
|
"e,state,unselected", "e");
|
2005-07-04 03:24:22 -07:00
|
|
|
if (!ww->border->lock_focus_in)
|
|
|
|
e_border_focus_set(ww->border, 0, 0);
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_winlist_show_active(void)
|
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2005-06-12 23:59:44 -07:00
|
|
|
int i, n;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
if (!_wins) return;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
for (i = 0, l = _wins; l; l = l->next, i++)
|
|
|
|
if (l == _win_selected) break;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
n = eina_list_count(_wins);
|
2005-06-12 23:59:44 -07:00
|
|
|
if (n <= 1) return;
|
2010-08-18 14:04:39 -07:00
|
|
|
_scroll_align_to = (double)i / (double)(n - 1);
|
2005-06-14 03:19:25 -07:00
|
|
|
if (e_config->winlist_scroll_animate)
|
2005-06-12 23:59:44 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
_scroll_to = 1;
|
|
|
|
if (!_scroll_timer)
|
|
|
|
_scroll_timer = ecore_timer_add(0.01, _e_winlist_scroll_timer, NULL);
|
|
|
|
if (!_animator)
|
|
|
|
_animator = ecore_animator_add(_e_winlist_animator, NULL);
|
2005-06-12 23:59:44 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
_scroll_align = _scroll_align_to;
|
|
|
|
e_box_align_set(_list_object, 0.5, _scroll_align);
|
2005-06-12 23:59:44 -07:00
|
|
|
}
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
|
|
|
|
2007-03-02 09:00:20 -08:00
|
|
|
static void
|
|
|
|
_e_winlist_restore_desktop(void)
|
|
|
|
{
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_last_desk &&
|
2007-03-02 09:00:20 -08:00
|
|
|
(e_config->winlist_list_show_other_desk_windows ||
|
|
|
|
e_config->winlist_list_show_other_screen_windows))
|
2010-08-18 14:04:39 -07:00
|
|
|
e_desk_show(_last_desk);
|
2007-03-02 09:00:20 -08:00
|
|
|
if (e_config->winlist_warp_while_selecting)
|
2010-08-18 14:04:39 -07:00
|
|
|
ecore_x_pointer_warp(_winlist->zone->container->win,
|
|
|
|
_last_pointer_x, _last_pointer_y);
|
2007-03-02 09:00:20 -08:00
|
|
|
_e_winlist_deactivate();
|
2010-08-18 14:04:39 -07:00
|
|
|
_win_selected = NULL;
|
2007-03-02 09:00:20 -08:00
|
|
|
e_winlist_hide();
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_last_border)
|
2007-03-02 09:00:20 -08:00
|
|
|
{
|
2010-08-18 14:04:39 -07:00
|
|
|
e_border_focus_set(_last_border, 1, 1);
|
|
|
|
_last_border = NULL;
|
2007-03-02 09:00:20 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2010-08-19 14:09:58 -07:00
|
|
|
_e_winlist_cb_event_border_add(void *data __UNUSED__, int type __UNUSED__,
|
|
|
|
void *event)
|
2005-06-11 23:50:34 -07:00
|
|
|
{
|
|
|
|
E_Event_Border_Add *ev;
|
|
|
|
|
|
|
|
ev = event;
|
2010-08-18 14:04:39 -07:00
|
|
|
_e_winlist_border_add(ev->border, _winlist->zone,
|
2012-06-20 00:01:53 -07:00
|
|
|
e_desk_current_get(_winlist->zone));
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_size_adjust();
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2010-08-19 14:09:58 -07:00
|
|
|
_e_winlist_cb_event_border_remove(void *data __UNUSED__, int type __UNUSED__,
|
|
|
|
void *event)
|
2005-06-11 23:50:34 -07:00
|
|
|
{
|
|
|
|
E_Event_Border_Remove *ev;
|
|
|
|
|
|
|
|
ev = event;
|
|
|
|
_e_winlist_border_del(ev->border);
|
|
|
|
_e_winlist_size_adjust();
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2010-08-19 09:14:53 -07:00
|
|
|
_e_winlist_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2005-06-11 23:50:34 -07:00
|
|
|
{
|
2009-03-16 09:24:43 -07:00
|
|
|
Ecore_Event_Key *ev;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2005-06-11 23:50:34 -07:00
|
|
|
ev = event;
|
2010-08-18 14:04:39 -07:00
|
|
|
if (ev->window != _input_window) return ECORE_CALLBACK_PASS_ON;
|
2009-12-22 12:41:06 -08:00
|
|
|
if (!strcmp(ev->key, "Up"))
|
2005-06-11 23:50:34 -07:00
|
|
|
e_winlist_prev();
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "Down"))
|
2005-06-11 23:50:34 -07:00
|
|
|
e_winlist_next();
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "Left"))
|
2005-06-11 23:50:34 -07:00
|
|
|
e_winlist_prev();
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "Right"))
|
2005-06-11 23:50:34 -07:00
|
|
|
e_winlist_next();
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "Return"))
|
2005-06-11 23:50:34 -07:00
|
|
|
e_winlist_hide();
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "space"))
|
2005-06-11 23:50:34 -07:00
|
|
|
e_winlist_hide();
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "Escape"))
|
2007-03-02 09:00:20 -08:00
|
|
|
_e_winlist_restore_desktop();
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "1"))
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_activate_nth(0);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "2"))
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_activate_nth(1);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "3"))
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_activate_nth(2);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "4"))
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_activate_nth(3);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "5"))
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_activate_nth(4);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "6"))
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_activate_nth(5);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "7"))
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_activate_nth(6);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "8"))
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_activate_nth(7);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "9"))
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_activate_nth(8);
|
2009-03-16 09:24:43 -07:00
|
|
|
else if (!strcmp(ev->key, "0"))
|
2005-06-11 23:50:34 -07:00
|
|
|
_e_winlist_activate_nth(9);
|
|
|
|
else
|
2007-12-17 13:52:27 -08:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
Eina_List *l;
|
|
|
|
E_Config_Binding_Key *binding;
|
|
|
|
E_Binding_Modifier mod;
|
2007-12-17 13:52:27 -08:00
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
EINA_LIST_FOREACH(e_config->key_bindings, l, binding)
|
|
|
|
{
|
2012-08-23 00:57:47 -07:00
|
|
|
if (binding->action != _winlist_act) continue;
|
2007-12-17 13:52:27 -08:00
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
mod = 0;
|
2007-12-17 13:52:27 -08:00
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
|
2009-12-22 12:41:06 -08:00
|
|
|
mod |= E_BINDING_MODIFIER_SHIFT;
|
2012-06-20 00:01:53 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)
|
2009-12-22 12:41:06 -08:00
|
|
|
mod |= E_BINDING_MODIFIER_CTRL;
|
2012-06-20 00:01:53 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT)
|
2009-12-22 12:41:06 -08:00
|
|
|
mod |= E_BINDING_MODIFIER_ALT;
|
2012-06-20 00:01:53 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN)
|
2009-12-22 12:41:06 -08:00
|
|
|
mod |= E_BINDING_MODIFIER_WIN;
|
2007-12-17 13:52:27 -08:00
|
|
|
|
2014-03-13 10:00:57 -07:00
|
|
|
if (binding->key && (!strcmp(binding->key, ev->key)) &&
|
2012-06-20 00:01:53 -07:00
|
|
|
((binding->modifiers == mod) || (binding->any_mod)))
|
|
|
|
{
|
2012-08-23 00:57:47 -07:00
|
|
|
if (!_act_winlist) continue;
|
|
|
|
if (_act_winlist->func.go_key)
|
|
|
|
_act_winlist->func.go_key(E_OBJECT(_winlist->zone), binding->params, ev);
|
|
|
|
else if (_act_winlist->func.go)
|
|
|
|
_act_winlist->func.go(E_OBJECT(_winlist->zone), binding->params);
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
|
|
|
}
|
2007-12-17 13:52:27 -08:00
|
|
|
}
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2010-08-19 09:14:53 -07:00
|
|
|
_e_winlist_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2005-06-11 23:50:34 -07:00
|
|
|
{
|
2009-03-16 09:24:43 -07:00
|
|
|
Ecore_Event_Key *ev;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2012-05-04 02:38:52 -07:00
|
|
|
E_Config_Binding_Key *binding;
|
2007-12-17 13:52:27 -08:00
|
|
|
E_Binding_Modifier mod;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2005-06-11 23:50:34 -07:00
|
|
|
ev = event;
|
2010-08-18 14:04:39 -07:00
|
|
|
if (!_winlist) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
if (_hold_mod)
|
2005-06-11 23:50:34 -07:00
|
|
|
{
|
2012-12-20 04:26:19 -08:00
|
|
|
#define KEY_CHECK(MOD, NAME) \
|
|
|
|
if ((_hold_mod & ECORE_EVENT_MODIFIER_##MOD) && (!strcmp(ev->key, NAME))) \
|
|
|
|
_hold_count--, _hold_mod &= ~ECORE_EVENT_MODIFIER_##MOD
|
|
|
|
KEY_CHECK(SHIFT, "Shift_L");
|
|
|
|
else KEY_CHECK(SHIFT, "Shift_R");
|
|
|
|
else KEY_CHECK(CTRL, "Control_L");
|
|
|
|
else KEY_CHECK(CTRL, "Control_R");
|
|
|
|
else KEY_CHECK(ALT, "Alt_L");
|
|
|
|
else KEY_CHECK(ALT, "Alt_R");
|
|
|
|
else KEY_CHECK(ALT, "Meta_L");
|
|
|
|
else KEY_CHECK(ALT, "Meta_R");
|
|
|
|
else KEY_CHECK(WIN, "Meta_L");
|
|
|
|
else KEY_CHECK(WIN, "Meta_R");
|
|
|
|
else KEY_CHECK(ALT, "Super_L");
|
|
|
|
else KEY_CHECK(ALT, "Super_R");
|
|
|
|
else KEY_CHECK(WIN, "Super_L");
|
|
|
|
else KEY_CHECK(WIN, "Super_R");
|
|
|
|
else KEY_CHECK(WIN, "Mode_switch");
|
|
|
|
|
2012-12-20 04:28:47 -08:00
|
|
|
if ((_hold_count <= 0) || ((!_hold_mod) && (_activate_type == E_WINLIST_ACTIVATE_TYPE_KEY)))
|
2012-06-20 00:01:53 -07:00
|
|
|
{
|
|
|
|
e_winlist_hide();
|
|
|
|
return 1;
|
|
|
|
}
|
2005-06-11 23:50:34 -07:00
|
|
|
}
|
2007-12-17 13:52:27 -08:00
|
|
|
|
2012-05-04 02:38:52 -07:00
|
|
|
EINA_LIST_FOREACH(e_config->key_bindings, l, binding)
|
2007-12-17 13:52:27 -08:00
|
|
|
{
|
2012-08-23 00:57:47 -07:00
|
|
|
if (binding->action != _winlist_act) continue;
|
2012-06-20 00:01:53 -07:00
|
|
|
mod = 0;
|
2007-12-17 13:52:27 -08:00
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
|
2009-12-22 12:41:06 -08:00
|
|
|
mod |= E_BINDING_MODIFIER_SHIFT;
|
2012-06-20 00:01:53 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)
|
2009-12-22 12:41:06 -08:00
|
|
|
mod |= E_BINDING_MODIFIER_CTRL;
|
2012-06-20 00:01:53 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT)
|
2009-12-22 12:41:06 -08:00
|
|
|
mod |= E_BINDING_MODIFIER_ALT;
|
2012-06-20 00:01:53 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN)
|
2009-12-22 12:41:06 -08:00
|
|
|
mod |= E_BINDING_MODIFIER_WIN;
|
2007-12-17 13:52:27 -08:00
|
|
|
|
2014-03-13 10:00:57 -07:00
|
|
|
if (binding->key && (!strcmp(binding->key, ev->key)) &&
|
2012-06-20 00:01:53 -07:00
|
|
|
((binding->modifiers == mod) || (binding->any_mod)))
|
|
|
|
{
|
2012-08-23 00:57:47 -07:00
|
|
|
if (!_act_winlist) continue;
|
|
|
|
if (_act_winlist->func.end_key)
|
|
|
|
_act_winlist->func.end_key(E_OBJECT(_winlist->zone), binding->params, ev);
|
|
|
|
else if (_act_winlist->func.end)
|
|
|
|
_act_winlist->func.end(E_OBJECT(_winlist->zone), binding->params);
|
2012-06-20 00:01:53 -07:00
|
|
|
}
|
2007-12-17 13:52:27 -08:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2005-06-07 06:53:27 -07:00
|
|
|
}
|
2005-06-12 21:18:29 -07:00
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2010-08-19 09:14:53 -07:00
|
|
|
_e_winlist_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2005-06-13 08:56:15 -07:00
|
|
|
{
|
2009-03-16 09:24:43 -07:00
|
|
|
Ecore_Event_Mouse_Button *ev;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2005-06-13 08:56:15 -07:00
|
|
|
ev = event;
|
2010-08-18 14:04:39 -07:00
|
|
|
if (ev->window != _input_window) return ECORE_CALLBACK_PASS_ON;
|
2005-06-13 08:56:15 -07:00
|
|
|
e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_WINLIST,
|
2012-06-20 00:01:53 -07:00
|
|
|
E_OBJECT(_winlist->zone), ev);
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2005-06-13 08:56:15 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2010-08-19 09:14:53 -07:00
|
|
|
_e_winlist_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2005-06-13 08:56:15 -07:00
|
|
|
{
|
2009-03-16 09:24:43 -07:00
|
|
|
Ecore_Event_Mouse_Button *ev;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2005-06-13 08:56:15 -07:00
|
|
|
ev = event;
|
2010-08-18 14:04:39 -07:00
|
|
|
if (ev->window != _input_window) return ECORE_CALLBACK_PASS_ON;
|
2012-12-20 03:16:09 -08:00
|
|
|
if (e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_WINLIST, E_OBJECT(_winlist->zone), ev))
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
if (_activate_type != E_WINLIST_ACTIVATE_TYPE_MOUSE) return ECORE_CALLBACK_RENEW;
|
|
|
|
if (!--_hold_count) e_winlist_hide();
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2005-06-13 08:56:15 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2010-08-19 09:14:53 -07:00
|
|
|
_e_winlist_cb_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2005-06-13 08:56:15 -07:00
|
|
|
{
|
2009-03-16 09:24:43 -07:00
|
|
|
Ecore_Event_Mouse_Wheel *ev;
|
2009-12-22 12:41:06 -08:00
|
|
|
int i;
|
|
|
|
|
2005-06-13 08:56:15 -07:00
|
|
|
ev = event;
|
2010-08-18 14:04:39 -07:00
|
|
|
if (ev->window != _input_window) return ECORE_CALLBACK_PASS_ON;
|
2005-09-22 05:47:45 -07:00
|
|
|
e_bindings_wheel_event_handle(E_BINDING_CONTEXT_WINLIST,
|
2012-06-20 00:01:53 -07:00
|
|
|
E_OBJECT(_winlist->zone), ev);
|
2005-06-13 08:56:15 -07:00
|
|
|
if (ev->z < 0) /* up */
|
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
for (i = ev->z; i < 0; i++)
|
2009-12-22 12:41:06 -08:00
|
|
|
e_winlist_prev();
|
2005-06-13 08:56:15 -07:00
|
|
|
}
|
|
|
|
else if (ev->z > 0) /* down */
|
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
for (i = ev->z; i > 0; i--)
|
2009-12-22 12:41:06 -08:00
|
|
|
e_winlist_next();
|
2005-06-13 08:56:15 -07:00
|
|
|
}
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2005-06-13 08:56:15 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2010-08-19 09:14:53 -07:00
|
|
|
_e_winlist_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2006-09-30 11:59:14 -07:00
|
|
|
{
|
2009-03-16 09:24:43 -07:00
|
|
|
Ecore_Event_Mouse_Move *ev;
|
2006-09-30 11:59:14 -07:00
|
|
|
|
|
|
|
ev = event;
|
2010-08-18 14:04:39 -07:00
|
|
|
if (ev->window != _input_window) return ECORE_CALLBACK_PASS_ON;
|
2006-09-30 11:59:14 -07:00
|
|
|
|
2010-08-18 14:04:39 -07:00
|
|
|
evas_event_feed_mouse_move(_winlist->evas, ev->x - _winlist->x +
|
2010-08-19 14:09:58 -07:00
|
|
|
_winlist->zone->x, ev->y - _winlist->y +
|
2010-08-19 09:14:53 -07:00
|
|
|
_winlist->zone->y, ev->timestamp, NULL);
|
2006-09-30 11:59:14 -07:00
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2006-09-30 11:59:14 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2010-08-19 09:14:53 -07:00
|
|
|
_e_winlist_scroll_timer(void *data __UNUSED__)
|
2005-06-12 23:59:44 -07:00
|
|
|
{
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_scroll_to)
|
2005-06-12 23:59:44 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
double spd;
|
2005-06-12 23:59:44 -07:00
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
spd = e_config->winlist_scroll_speed;
|
|
|
|
_scroll_align = (_scroll_align * (1.0 - spd)) +
|
2010-08-19 09:14:53 -07:00
|
|
|
(_scroll_align_to * spd);
|
2012-06-20 00:01:53 -07:00
|
|
|
return 1;
|
2005-06-12 23:59:44 -07:00
|
|
|
}
|
2010-08-18 14:04:39 -07:00
|
|
|
_scroll_timer = NULL;
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2005-06-12 23:59:44 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2010-08-19 09:14:53 -07:00
|
|
|
_e_winlist_warp_timer(void *data __UNUSED__)
|
2005-06-12 23:59:44 -07:00
|
|
|
{
|
2010-08-19 14:09:58 -07:00
|
|
|
if (_warp_to && _warp_timer)
|
2005-06-12 23:59:44 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
double spd = e_config->winlist_warp_speed;
|
2009-12-22 12:41:06 -08:00
|
|
|
|
2012-06-20 00:01:53 -07:00
|
|
|
_old_warp_x = _warp_x;
|
|
|
|
_old_warp_y = _warp_y;
|
|
|
|
_warp_x = (_warp_x * (1.0 - spd)) + (_warp_to_x * spd);
|
|
|
|
_warp_y = (_warp_y * (1.0 - spd)) + (_warp_to_y * spd);
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
2005-06-12 23:59:44 -07:00
|
|
|
}
|
2010-08-18 14:04:39 -07:00
|
|
|
_warp_timer = NULL;
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2005-06-12 23:59:44 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2010-08-19 09:14:53 -07:00
|
|
|
_e_winlist_animator(void *data __UNUSED__)
|
2005-06-12 21:18:29 -07:00
|
|
|
{
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_warp_to)
|
2005-06-12 23:59:44 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (_warp_x == _old_warp_x && _warp_y == _old_warp_y)
|
|
|
|
{
|
|
|
|
_warp_x = _warp_to_x;
|
|
|
|
_warp_y = _warp_to_y;
|
|
|
|
_warp_to = 0;
|
|
|
|
}
|
|
|
|
if (_win) ecore_x_pointer_warp(*_win, _warp_x, _warp_y);
|
2005-06-12 23:59:44 -07:00
|
|
|
}
|
2010-08-18 14:04:39 -07:00
|
|
|
if (_scroll_to)
|
2005-06-12 23:59:44 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
double da;
|
|
|
|
|
|
|
|
da = _scroll_align - _scroll_align_to;
|
|
|
|
if (da < 0.0) da = -da;
|
|
|
|
if (da < 0.01)
|
|
|
|
{
|
|
|
|
_scroll_align = _scroll_align_to;
|
|
|
|
_scroll_to = 0;
|
|
|
|
}
|
2010-08-18 14:04:39 -07:00
|
|
|
e_box_align_set(_list_object, 0.5, 1.0 - _scroll_align);
|
2005-06-12 23:59:44 -07:00
|
|
|
}
|
2010-08-18 14:04:39 -07:00
|
|
|
if ((_warp_to) || (_scroll_to)) return ECORE_CALLBACK_RENEW;
|
|
|
|
if (_bd_next)
|
2010-07-07 14:36:23 -07:00
|
|
|
{
|
2012-06-20 00:01:53 -07:00
|
|
|
if (_bd_next->iconic)
|
|
|
|
{
|
|
|
|
if (!_bd_next->lock_user_iconify)
|
|
|
|
e_border_uniconify(_bd_next);
|
|
|
|
}
|
|
|
|
if (_bd_next->shaded)
|
|
|
|
{
|
|
|
|
if (!_bd_next->lock_user_shade)
|
|
|
|
e_border_unshade(_bd_next, _bd_next->shade.dir);
|
|
|
|
}
|
|
|
|
else if (_bd_next->desk)
|
|
|
|
{
|
|
|
|
if (!_bd_next->sticky) e_desk_show(_bd_next->desk);
|
|
|
|
}
|
|
|
|
if (!_bd_next->lock_user_stacking)
|
|
|
|
e_border_raise(_bd_next);
|
|
|
|
|
|
|
|
if (!_bd_next->lock_focus_out)
|
|
|
|
{
|
|
|
|
e_border_focus_set(_bd_next, 1, 1);
|
|
|
|
e_border_focus_latest_set(_bd_next);
|
|
|
|
}
|
|
|
|
if ((e_config->focus_policy != E_FOCUS_CLICK) ||
|
|
|
|
(e_config->winlist_warp_at_end) ||
|
|
|
|
(e_config->winlist_warp_while_selecting))
|
|
|
|
ecore_x_pointer_warp(_bd_next->zone->container->win,
|
2010-08-19 14:09:58 -07:00
|
|
|
_warp_to_x, _warp_to_y);
|
2012-06-20 00:01:53 -07:00
|
|
|
_bd_next = NULL;
|
2010-07-07 14:36:23 -07:00
|
|
|
}
|
2010-08-19 14:09:58 -07:00
|
|
|
_animator = NULL;
|
2010-08-18 14:04:39 -07:00
|
|
|
_win = NULL;
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2005-06-12 21:18:29 -07:00
|
|
|
}
|
2006-09-30 11:59:14 -07:00
|
|
|
|
2006-12-28 06:15:10 -08:00
|
|
|
#if 0
|
2010-07-07 14:36:23 -07:00
|
|
|
static void
|
2009-12-22 12:41:06 -08:00
|
|
|
_e_winlist_cb_item_mouse_in(void *data, Evas *evas, Evas_Object *obj, void *event_info)
|
2006-09-30 11:59:14 -07:00
|
|
|
{
|
|
|
|
E_Winlist_Win *ww;
|
2012-05-04 02:38:52 -07:00
|
|
|
E_Winlist_Win *lww;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2006-09-30 11:59:14 -07:00
|
|
|
|
|
|
|
if (!(ww = data)) return;
|
2010-08-18 14:04:39 -07:00
|
|
|
if (!_wins) return;
|
2012-05-04 02:38:52 -07:00
|
|
|
EINA_LIST_FOREACH(_wins, l, lww)
|
|
|
|
if (lww == ww) break;
|
2006-09-30 11:59:14 -07:00
|
|
|
_e_winlist_deactivate();
|
2010-08-18 14:04:39 -07:00
|
|
|
_win_selected = l;
|
2006-09-30 11:59:14 -07:00
|
|
|
_e_winlist_show_active();
|
|
|
|
_e_winlist_activate();
|
|
|
|
}
|
2012-06-20 00:01:53 -07:00
|
|
|
|
2006-12-28 06:15:10 -08:00
|
|
|
#endif
|