forked from enlightenment/enlightenment
winlist alt-tab works (and dhift-alt-tab to go in reverse)... it is NOT
complete... gfx are ugly. i have fixme's. it doesnt work with pointer focus really... etc. SVN revision: 15264
This commit is contained in:
parent
4e125e3bff
commit
76bda119c0
2
TODO
2
TODO
|
@ -55,6 +55,8 @@ Also look at all the .c files - they have their own localized TODO lists
|
|||
|
||||
These are in no particular order:
|
||||
|
||||
* coudl speedup dropshadow's gaussian blurr with mmx and sse by doign 2 or 4 rows at once
|
||||
* make it easy for moduels to hook into ipc and extend it for themselves
|
||||
* check evas has eet support early on.
|
||||
* add locale and encoding fields to eapp files (to launch eapp in that locale+encoding)
|
||||
* add input method selector stuff to eapp - same as locale
|
||||
|
|
|
@ -28,7 +28,8 @@ default_temperature.edc \
|
|||
default_error.edc \
|
||||
default_cpufreq.edc \
|
||||
default_ibox.edc \
|
||||
default_start.edc
|
||||
default_start.edc \
|
||||
default_winlist.edc
|
||||
|
||||
default.edj: Makefile $(EXTRA_DIST)
|
||||
$(EDJE_CC) $(EDJE_FLAGS) \
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
fonts {
|
||||
font: "Vera.ttf" "Edje Vera";
|
||||
// font: "kochi-gothic.ttf" "Edje Vera";
|
||||
font: "VeraBd.ttf" "Edje Vera Bold";
|
||||
}
|
||||
|
||||
|
@ -38,5 +37,6 @@ collections {
|
|||
#include "default_cpufreq.edc"
|
||||
#include "default_ibox.edc"
|
||||
#include "default_start.edc"
|
||||
#include "default_winlist.edc"
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,226 @@
|
|||
images {
|
||||
image: "e17_menu_bg.png" COMP;
|
||||
}
|
||||
group {
|
||||
name: "widgets/winlist/main";
|
||||
parts {
|
||||
part {
|
||||
name: "base";
|
||||
mouse_events: 0;
|
||||
type: RECT;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
relative: 0.0 1.0;
|
||||
offset: 1 0;
|
||||
to_y: "base2";
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -2 -2;
|
||||
}
|
||||
color: 221 221 221 255;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "base2";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
max: 99999 48;
|
||||
align: 0.5 0.0;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 1 1;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -2 -2;
|
||||
}
|
||||
image {
|
||||
normal: "e17_menu_bg.png";
|
||||
}
|
||||
fill {
|
||||
smooth: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "base3";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 0 0;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -1 -1;
|
||||
}
|
||||
image {
|
||||
normal: "e17_menu_bg_border.png";
|
||||
border: 1 1 1 1;
|
||||
middle: 0;
|
||||
}
|
||||
fill {
|
||||
smooth: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "list_swallow";
|
||||
type: SWALLOW;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
color: 0 0 0 0;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 16 16;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -17 -17;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group {
|
||||
name: "widgets/winlist/item";
|
||||
parts {
|
||||
part {
|
||||
name: "base";
|
||||
mouse_events: 0;
|
||||
type: RECT;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
relative: 0.0 1.0;
|
||||
offset: 1 0;
|
||||
to_y: "base2";
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -2 -2;
|
||||
}
|
||||
color: 221 221 221 255;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "base2";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
max: 99999 48;
|
||||
align: 0.5 0.0;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 1 1;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -2 -2;
|
||||
}
|
||||
image {
|
||||
normal: "e17_menu_bg.png";
|
||||
}
|
||||
fill {
|
||||
smooth: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "base3";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 0 0;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -1 -1;
|
||||
}
|
||||
image {
|
||||
normal: "e17_menu_bg_border.png";
|
||||
border: 1 1 1 1;
|
||||
middle: 0;
|
||||
}
|
||||
fill {
|
||||
smooth: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "icon_swallow";
|
||||
type: SWALLOW;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
color: 0 0 0 0;
|
||||
aspect: 1.0 1.0;
|
||||
align: 0.0 0.5;
|
||||
aspect_preference: VERTICAL;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 4 4;
|
||||
}
|
||||
rel2 {
|
||||
relative: 0.0 1.0;
|
||||
offset: 4 -5;
|
||||
}
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "title_text";
|
||||
type: TEXT;
|
||||
effect: SHADOW;
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
color: 0 0 0 128;
|
||||
color3: 255 255 255 128;
|
||||
rel1 {
|
||||
to_x: "icon_swallow";
|
||||
relative: 1.0 0.0;
|
||||
offset: 4 4;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -5 -5;
|
||||
}
|
||||
text {
|
||||
text: "";
|
||||
font: "Edje Vera";
|
||||
size: 10;
|
||||
min: 0 1;
|
||||
align: 0.0 0.5;
|
||||
text_class: "title_bar";
|
||||
}
|
||||
}
|
||||
description {
|
||||
state: "active" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
color: 0 0 0 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
programs {
|
||||
program {
|
||||
name: "go_active";
|
||||
signal: "active";
|
||||
source: "";
|
||||
action: STATE_SET "active" 0.0;
|
||||
target: "title_text";
|
||||
}
|
||||
program {
|
||||
name: "go_passive";
|
||||
signal: "passive";
|
||||
source: "";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "title_text";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -520,6 +520,107 @@ ACT_FN_GO(app)
|
|||
}
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
ACT_FN_GO(winlist)
|
||||
{
|
||||
E_Zone *zone = NULL;
|
||||
|
||||
if (!obj) return;
|
||||
if (obj->type == E_MANAGER_TYPE)
|
||||
zone = e_util_zone_current_get((E_Manager *)obj);
|
||||
else if (obj->type == E_ZONE_TYPE)
|
||||
zone = (E_Zone *)obj;
|
||||
if (zone)
|
||||
{
|
||||
if (params)
|
||||
{
|
||||
if (!strcmp(params, "next"))
|
||||
{
|
||||
e_winlist_show(zone);
|
||||
e_winlist_next();
|
||||
}
|
||||
else if (!strcmp(params, "prev"))
|
||||
{
|
||||
e_winlist_show(zone);
|
||||
e_winlist_prev();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
e_winlist_show(zone);
|
||||
e_winlist_next();
|
||||
}
|
||||
}
|
||||
}
|
||||
ACT_FN_GO_MOUSE(winlist)
|
||||
{
|
||||
E_Zone *zone = NULL;
|
||||
|
||||
if (!obj) return;
|
||||
if (obj->type == E_MANAGER_TYPE)
|
||||
zone = e_util_zone_current_get((E_Manager *)obj);
|
||||
else if (obj->type == E_ZONE_TYPE)
|
||||
zone = (E_Zone *)obj;
|
||||
if (zone)
|
||||
{
|
||||
if (params)
|
||||
{
|
||||
if (!strcmp(params, "next"))
|
||||
{
|
||||
if (e_winlist_show(zone))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
e_winlist_next();
|
||||
}
|
||||
else if (!strcmp(params, "prev"))
|
||||
{
|
||||
if (e_winlist_show(zone))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
e_winlist_prev();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e_winlist_show(zone))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
e_winlist_next();
|
||||
}
|
||||
}
|
||||
}
|
||||
ACT_FN_GO_KEY(winlist)
|
||||
{
|
||||
E_Zone *zone = NULL;
|
||||
|
||||
if (!obj) return;
|
||||
if (obj->type == E_MANAGER_TYPE)
|
||||
zone = e_util_zone_current_get((E_Manager *)obj);
|
||||
else if (obj->type == E_ZONE_TYPE)
|
||||
zone = (E_Zone *)obj;
|
||||
if (zone)
|
||||
{
|
||||
if (params)
|
||||
{
|
||||
if (!strcmp(params, "next"))
|
||||
{
|
||||
if (e_winlist_show(zone))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
e_winlist_next();
|
||||
}
|
||||
else if (!strcmp(params, "prev"))
|
||||
{
|
||||
if (e_winlist_show(zone))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
e_winlist_prev();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e_winlist_show(zone))
|
||||
e_winlist_modifiers_set(ev->modifiers);
|
||||
e_winlist_next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* local subsystem globals */
|
||||
static Evas_Hash *actions = NULL;
|
||||
|
@ -577,6 +678,10 @@ e_actions_init(void)
|
|||
|
||||
ACT_GO(app);
|
||||
|
||||
ACT_GO(winlist);
|
||||
ACT_GO_MOUSE(winlist);
|
||||
ACT_GO_KEY(winlist);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ e_bindings_key_down_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_X_
|
|||
if (_e_bindings_context_match(bind->ctxt, ctxt))
|
||||
{
|
||||
E_Action *act;
|
||||
|
||||
|
||||
act = e_action_find(bind->action);
|
||||
if (act)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,8 @@ typedef enum _E_Binding_Context
|
|||
E_BINDING_CONTEXT_BORDER,
|
||||
E_BINDING_CONTEXT_ZONE,
|
||||
E_BINDING_CONTEXT_MANAGER,
|
||||
E_BINDING_CONTEXT_MENU,
|
||||
E_BINDING_CONTEXT_WINLIST,
|
||||
E_BINDING_CONTEXT_ANY
|
||||
} E_Binding_Context;
|
||||
|
||||
|
|
|
@ -129,7 +129,9 @@ static E_Border *move = NULL;
|
|||
static Ecore_Timer *focus_fix_timer = NULL;
|
||||
|
||||
static int grabbed = 0;
|
||||
|
||||
|
||||
static Evas_List *focus_stack = NULL;
|
||||
|
||||
int E_EVENT_BORDER_ADD = 0;
|
||||
int E_EVENT_BORDER_REMOVE = 0;
|
||||
int E_EVENT_BORDER_ZONE_SET = 0;
|
||||
|
@ -457,6 +459,8 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map)
|
|||
desk[1] = desky;
|
||||
ecore_x_window_prop_card32_set(win, E_ATOM_DESK, desk, 2);
|
||||
|
||||
focus_stack = evas_list_append(focus_stack, bd);
|
||||
|
||||
return bd;
|
||||
}
|
||||
|
||||
|
@ -804,6 +808,8 @@ e_border_focus_set(E_Border *bd, int focus, int set)
|
|||
// printf("flag focus to %i\n", focus);
|
||||
if ((focus) && (!bd->focused))
|
||||
{
|
||||
focus_stack = evas_list_remove(focus_stack, bd);
|
||||
focus_stack = evas_list_prepend(focus_stack, bd);
|
||||
edje_object_signal_emit(bd->bg_object, "active", "");
|
||||
e_focus_event_focus_in(bd);
|
||||
}
|
||||
|
@ -1560,6 +1566,12 @@ e_border_button_bindings_grab_all(void)
|
|||
}
|
||||
}
|
||||
|
||||
Evas_List *
|
||||
e_border_focus_stack_get(void)
|
||||
{
|
||||
return focus_stack;
|
||||
}
|
||||
|
||||
/* local subsystem functions */
|
||||
static void
|
||||
_e_border_free(E_Border *bd)
|
||||
|
@ -1633,7 +1645,8 @@ _e_border_free(E_Border *bd)
|
|||
borders_hash = evas_hash_del(borders_hash, _e_border_winid_str_get(bd->bg_win), bd);
|
||||
borders_hash = evas_hash_del(borders_hash, _e_border_winid_str_get(bd->win), bd);
|
||||
borders = evas_list_remove(borders, bd);
|
||||
|
||||
focus_stack = evas_list_remove(focus_stack, bd);
|
||||
|
||||
free(bd);
|
||||
}
|
||||
|
||||
|
@ -1656,7 +1669,7 @@ static void
|
|||
_e_border_del(E_Border *bd)
|
||||
{
|
||||
E_Event_Border_Remove *ev;
|
||||
|
||||
|
||||
if (!bd->dangling_ref_check)
|
||||
bd->dangling_ref_check = ecore_timer_add(1.0, _e_border_del_dangling_ref_check, bd);
|
||||
if (!bd->already_unparented)
|
||||
|
|
|
@ -439,7 +439,9 @@ EAPI Evas_Object *e_border_icon_add(E_Border *bd, Evas *evas);
|
|||
|
||||
EAPI void e_border_button_bindings_ungrab_all(void);
|
||||
EAPI void e_border_button_bindings_grab_all(void);
|
||||
|
||||
|
||||
EAPI Evas_List *e_border_focus_stack_get(void);
|
||||
|
||||
extern EAPI int E_EVENT_BORDER_RESIZE;
|
||||
extern EAPI int E_EVENT_BORDER_MOVE;
|
||||
extern EAPI int E_EVENT_BORDER_ADD;
|
||||
|
|
|
@ -650,6 +650,24 @@ e_config_init(void)
|
|||
eb->params = strdup("Eterm");
|
||||
e_config->key_bindings = evas_list_append(e_config->key_bindings, eb);
|
||||
|
||||
eb = E_NEW(E_Config_Binding_Key, 1);
|
||||
eb->context = E_BINDING_CONTEXT_ANY;
|
||||
eb->key = strdup("Tab");
|
||||
eb->modifiers = E_BINDING_MODIFIER_ALT;
|
||||
eb->any_mod = 0;
|
||||
eb->action = strdup("winlist");
|
||||
eb->params = strdup("next");
|
||||
e_config->key_bindings = evas_list_append(e_config->key_bindings, eb);
|
||||
|
||||
eb = E_NEW(E_Config_Binding_Key, 1);
|
||||
eb->context = E_BINDING_CONTEXT_ANY;
|
||||
eb->key = strdup("Tab");
|
||||
eb->modifiers = E_BINDING_MODIFIER_SHIFT | E_BINDING_MODIFIER_ALT;
|
||||
eb->any_mod = 0;
|
||||
eb->action = strdup("winlist");
|
||||
eb->params = strdup("prev");
|
||||
e_config->key_bindings = evas_list_append(e_config->key_bindings, eb);
|
||||
|
||||
/* should do these - can't yet due to other things missing... */
|
||||
|
||||
/* need a yes/no dialog for these - to stop accidental logouts. for this
|
||||
|
|
|
@ -46,7 +46,7 @@ typedef Eet_Data_Descriptor E_Config_DD;
|
|||
* defaults for e to work - started at 100 when we introduced this config
|
||||
* versioning feature
|
||||
*/
|
||||
#define E_CONFIG_FILE_VERSION 107
|
||||
#define E_CONFIG_FILE_VERSION 108
|
||||
|
||||
#define E_EVAS_ENGINE_DEFAULT 0
|
||||
#define E_EVAS_ENGINE_SOFTWARE_X11 1
|
||||
|
|
|
@ -468,7 +468,7 @@ _e_manager_cb_key_down(void *data, int ev_type __UNUSED__, void *ev)
|
|||
|
||||
man = data;
|
||||
e = ev;
|
||||
printf("KEY %s [win=%x event_win=%x]\n", e->keyname, e->win, e->event_win);
|
||||
// printf("KEY %s [win=%x event_win=%x]\n", e->keyname, e->win, e->event_win);
|
||||
if (e->event_win != man->root) return 1;
|
||||
if (e_bindings_key_down_event_handle(E_BINDING_CONTEXT_MANAGER, E_OBJECT(man), ev))
|
||||
return 0;
|
||||
|
|
|
@ -4,9 +4,41 @@
|
|||
#include "e.h"
|
||||
|
||||
/* local subsystem functions */
|
||||
typedef struct _E_Winlist_Win E_Winlist_Win;
|
||||
|
||||
struct _E_Winlist_Win
|
||||
{
|
||||
Evas_Object *bg_object;
|
||||
Evas_Object *icon_object;
|
||||
E_Border *border;
|
||||
};
|
||||
|
||||
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 int _e_winlist_cb_event_border_add(void *data, int type, void *event);
|
||||
static int _e_winlist_cb_event_border_remove(void *data, int type, void *event);
|
||||
static int _e_winlist_cb_key_down(void *data, int type, void *event);
|
||||
static int _e_winlist_cb_key_up(void *data, int type, void *event);
|
||||
|
||||
/* local subsystem globals */
|
||||
static E_Popup *winlist = NULL;
|
||||
static Evas_Object *bg_object = NULL;
|
||||
static Evas_Object *list_object = NULL;
|
||||
static Evas_List *wins = NULL;
|
||||
static Evas_List *win_selected = NULL;
|
||||
static int hold_count = 0;
|
||||
static int hold_mod = 0;
|
||||
static Evas_List *handlers = NULL;
|
||||
static Ecore_X_Window input_window = 0;
|
||||
|
||||
/* FIXME: gfx are UGLY. theyare test gfx and nothng more atm */
|
||||
/* FIXME: support optional warp pointer to window */
|
||||
/* FIXME: add mouse downa nd up handlers and pass events to bindings from them incase mouse binding starst winlist */
|
||||
|
||||
/* externally accessible functions */
|
||||
int
|
||||
|
@ -22,72 +54,386 @@ e_winlist_shutdown(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* how to handle? on show, grab keyboard (and mouse) like menus
|
||||
* set "modifier keys active" if spawning event had modfiers active
|
||||
* if "modifier keys active" and if all modifier keys are released or is found not active on start = end
|
||||
* up/left == prev
|
||||
* down/right == next
|
||||
* escape = end
|
||||
* 1 - 9, 0 = select window 1 - 9, 10
|
||||
* local subsystem functions
|
||||
*/
|
||||
|
||||
void
|
||||
int
|
||||
e_winlist_show(E_Zone *zone)
|
||||
{
|
||||
int x, y, w, h;
|
||||
Evas_Object *o;
|
||||
Evas_List *l;
|
||||
E_Desk *desk;
|
||||
E_Border *bd;
|
||||
|
||||
if (winlist) return;
|
||||
if (winlist) return 0;
|
||||
|
||||
/* FIXME: should be config */
|
||||
/* FIXME: sizes/pos should be config */
|
||||
w = zone->w / 2;
|
||||
if (w > 400) w = 400;
|
||||
if (w > 320) w = 320;
|
||||
h = zone->h / 2;
|
||||
if (h > 800) h = 800;
|
||||
else if (h < 400) h = 400;
|
||||
x = (zone->w - w) / 2;
|
||||
y = (zone->h - h) / 2;
|
||||
|
||||
winlist = e_popup_new(zone, x, y, w, h);
|
||||
if (!winlist) return;
|
||||
e_popup_layer_set(winlist, 255);
|
||||
evas_event_freeze(winlist->evas);
|
||||
o = edje_object_add(winlist->evas);
|
||||
/* FIXME: need theme stuff */
|
||||
bg_object = o;
|
||||
e_theme_edje_object_set(o, "base/theme/winlist",
|
||||
"widgets/winlist/main");
|
||||
evas_object_move(o, 0, 0);
|
||||
evas_object_resize(o, w, h);
|
||||
evas_object_show(o);
|
||||
e_popup_edje_bg_object_set(winlist, o);
|
||||
/* FIXME: bg obj needs to be stored */
|
||||
/* FIXME: create and swallow box */
|
||||
/* FIXME: fill box with current clients */
|
||||
/* FIXME: configure list with current focused window */
|
||||
/* FIXME: grab mouse and keyboard */
|
||||
|
||||
o = e_box_add(winlist->evas);
|
||||
list_object = o;
|
||||
e_box_align_set(o, 0.5, 0.0);
|
||||
e_box_orientation_set(o, 0);
|
||||
e_box_homogenous_set(o, 1);
|
||||
edje_object_part_swallow(bg_object, "list_swallow", o);
|
||||
evas_object_show(o);
|
||||
|
||||
desk = e_desk_current_get(winlist->zone);
|
||||
e_box_freeze(list_object);
|
||||
for (l = e_border_focus_stack_get(); l; l = l->next)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
bd = l->data;
|
||||
_e_winlist_border_add(bd, winlist->zone, desk);
|
||||
}
|
||||
e_box_thaw(list_object);
|
||||
bd = e_border_focused_get();
|
||||
if (bd) e_border_focus_set(bd, 0, 0);
|
||||
_e_winlist_activate_nth(0);
|
||||
evas_event_thaw(winlist->evas);
|
||||
_e_winlist_size_adjust();
|
||||
|
||||
input_window = ecore_x_window_input_new(zone->container->win, 0, 0, 1, 1);
|
||||
ecore_x_window_show(input_window);
|
||||
ecore_x_pointer_grab(input_window);
|
||||
ecore_x_keyboard_grab(input_window);
|
||||
handlers = evas_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(E_EVENT_BORDER_ADD, _e_winlist_cb_event_border_add, NULL));
|
||||
handlers = evas_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(E_EVENT_BORDER_REMOVE, _e_winlist_cb_event_border_remove, NULL));
|
||||
handlers = evas_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(ECORE_X_EVENT_KEY_DOWN, _e_winlist_cb_key_down, NULL));
|
||||
handlers = evas_list_append
|
||||
(handlers, ecore_event_handler_add
|
||||
(ECORE_X_EVENT_KEY_UP, _e_winlist_cb_key_up, NULL));
|
||||
|
||||
e_popup_show(winlist);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
e_winlist_hide(void)
|
||||
{
|
||||
if (!winlist) return;
|
||||
|
||||
/* FIXME: ensure whatever window is selected is focused after we finish cleanup */
|
||||
|
||||
evas_event_freeze(winlist->evas);
|
||||
e_popup_hide(winlist);
|
||||
e_box_freeze(list_object);
|
||||
while (wins)
|
||||
{
|
||||
E_Winlist_Win *ww;
|
||||
|
||||
ww = wins->data;
|
||||
evas_object_del(ww->bg_object);
|
||||
evas_object_del(ww->icon_object);
|
||||
free(ww);
|
||||
wins = evas_list_remove_list(wins, wins);
|
||||
}
|
||||
e_box_thaw(list_object);
|
||||
win_selected = NULL;
|
||||
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));
|
||||
winlist = NULL;
|
||||
hold_count = 0;
|
||||
hold_mod = 0;
|
||||
while (handlers)
|
||||
{
|
||||
ecore_event_handler_del(handlers->data);
|
||||
handlers = evas_list_remove_list(handlers, handlers);
|
||||
}
|
||||
ecore_x_window_del(input_window);
|
||||
input_window = 0;
|
||||
}
|
||||
|
||||
void
|
||||
e_winlist_next(void)
|
||||
{
|
||||
_e_winlist_deactivate();
|
||||
win_selected = win_selected->next;
|
||||
if (!win_selected) win_selected = wins;
|
||||
_e_winlist_show_active();
|
||||
_e_winlist_activate();
|
||||
}
|
||||
|
||||
void
|
||||
e_winlist_prev(void)
|
||||
{
|
||||
_e_winlist_deactivate();
|
||||
win_selected = win_selected->prev;
|
||||
if (!win_selected) win_selected = evas_list_last(wins);
|
||||
_e_winlist_show_active();
|
||||
_e_winlist_activate();
|
||||
}
|
||||
|
||||
void
|
||||
e_winlist_modifiers_set(int mod)
|
||||
{
|
||||
hold_mod = mod;
|
||||
hold_count = 0;
|
||||
if (hold_mod & ECORE_X_MODIFIER_SHIFT) hold_count++;
|
||||
if (hold_mod & ECORE_X_MODIFIER_CTRL) hold_count++;
|
||||
if (hold_mod & ECORE_X_MODIFIER_ALT) hold_count++;
|
||||
if (hold_mod & ECORE_X_MODIFIER_WIN) hold_count++;
|
||||
}
|
||||
|
||||
/* local subsystem functions */
|
||||
static void
|
||||
_e_winlist_size_adjust(void)
|
||||
{
|
||||
Evas_Coord mw, mh;
|
||||
int x, y, w, h;
|
||||
|
||||
e_box_freeze(list_object);
|
||||
e_box_min_size_get(list_object, &mw, &mh);
|
||||
edje_extern_object_min_size_set(list_object, mw, mh);
|
||||
edje_object_part_swallow(bg_object, "list_swallow", list_object);
|
||||
edje_object_size_min_calc(bg_object, &mw, &mh);
|
||||
edje_extern_object_min_size_set(list_object, -1, -1);
|
||||
e_box_thaw(list_object);
|
||||
|
||||
/* FIXME: sizes/pos should be config */
|
||||
w = winlist->zone->w / 2;
|
||||
if (w > 320) w = 320;
|
||||
h = mh;
|
||||
if (h > 800) h = 800;
|
||||
x = (winlist->zone->w - w) / 2;
|
||||
y = (winlist->zone->h - h) / 2;
|
||||
evas_object_resize(bg_object, w, h);
|
||||
e_popup_move_resize(winlist, x, y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_winlist_border_add(E_Border *bd, E_Zone *zone, E_Desk *desk)
|
||||
{
|
||||
if ((bd->zone) &&
|
||||
(bd->zone == zone) &&
|
||||
((bd->desk == desk) || (bd->sticky)))
|
||||
{
|
||||
E_Winlist_Win *ww;
|
||||
Evas_Coord mw, mh;
|
||||
Evas_Object *o;
|
||||
|
||||
ww = calloc(1, sizeof(E_Winlist_Win));
|
||||
if (!ww) return;
|
||||
ww->border = bd;
|
||||
wins = evas_list_append(wins, ww);
|
||||
o = edje_object_add(winlist->evas);
|
||||
ww->bg_object = o;
|
||||
e_theme_edje_object_set(o, "base/theme/winlist",
|
||||
"widgets/winlist/item");
|
||||
if (bd->client.netwm.name)
|
||||
edje_object_part_text_set(o, "title_text", bd->client.netwm.name);
|
||||
else if (bd->client.icccm.title)
|
||||
edje_object_part_text_set(o, "title_text", bd->client.icccm.title);
|
||||
evas_object_show(o);
|
||||
o = e_border_icon_add(bd, winlist->evas);
|
||||
ww->icon_object = o;
|
||||
edje_object_part_swallow(ww->bg_object, "icon_swallow", o);
|
||||
evas_object_show(o);
|
||||
edje_object_size_min_calc(ww->bg_object, &mw, &mh);
|
||||
e_box_pack_end(list_object, ww->bg_object);
|
||||
e_box_pack_options_set(ww->bg_object,
|
||||
1, 1, /* fill */
|
||||
1, 0, /* expand */
|
||||
0.5, 0.5, /* align */
|
||||
mw, mh, /* min */
|
||||
9999, mh /* max */
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_winlist_border_del(E_Border *bd)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
for (l = wins; l; l = l->next)
|
||||
{
|
||||
E_Winlist_Win *ww;
|
||||
|
||||
ww = l->data;
|
||||
if (ww->border == bd)
|
||||
{
|
||||
evas_object_del(ww->bg_object);
|
||||
evas_object_del(ww->icon_object);
|
||||
free(ww);
|
||||
wins = evas_list_remove_list(wins, l);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_winlist_activate_nth(int n)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
_e_winlist_deactivate();
|
||||
l = evas_list_nth_list(wins, n);
|
||||
if (l)
|
||||
{
|
||||
win_selected = l;
|
||||
_e_winlist_show_active();
|
||||
_e_winlist_activate();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_e_winlist_activate(void)
|
||||
{
|
||||
E_Winlist_Win *ww;
|
||||
|
||||
if (!win_selected) return;
|
||||
ww = win_selected->data;
|
||||
edje_object_signal_emit(ww->bg_object, "active", "");
|
||||
e_border_raise(ww->border);
|
||||
e_border_focus_set(ww->border, 1, 1);
|
||||
edje_object_signal_emit(bg_object, "active", "");
|
||||
}
|
||||
|
||||
static void
|
||||
_e_winlist_deactivate(void)
|
||||
{
|
||||
E_Winlist_Win *ww;
|
||||
|
||||
if (!win_selected) return;
|
||||
ww = win_selected->data;
|
||||
edje_object_signal_emit(ww->bg_object, "passive", "");
|
||||
e_border_focus_set(ww->border, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_winlist_show_active(void)
|
||||
{
|
||||
/* FIXME: scroll so the selected win is visible */
|
||||
}
|
||||
|
||||
static int
|
||||
_e_winlist_cb_event_border_add(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Add *ev;
|
||||
|
||||
ev = event;
|
||||
_e_winlist_border_add(ev->border, winlist->zone,
|
||||
e_desk_current_get(winlist->zone));
|
||||
_e_winlist_size_adjust();
|
||||
}
|
||||
|
||||
static int
|
||||
_e_winlist_cb_event_border_remove(void *data, int type, void *event)
|
||||
{
|
||||
E_Event_Border_Remove *ev;
|
||||
|
||||
ev = event;
|
||||
_e_winlist_border_del(ev->border);
|
||||
_e_winlist_size_adjust();
|
||||
}
|
||||
|
||||
static int
|
||||
_e_winlist_cb_key_down(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Key_Down *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->win != input_window) return 1;
|
||||
if (!strcmp(ev->keysymbol, "Up"))
|
||||
e_winlist_prev();
|
||||
else if (!strcmp(ev->keysymbol, "Down"))
|
||||
e_winlist_next();
|
||||
else if (!strcmp(ev->keysymbol, "Left"))
|
||||
e_winlist_prev();
|
||||
else if (!strcmp(ev->keysymbol, "Right"))
|
||||
e_winlist_next();
|
||||
else if (!strcmp(ev->keysymbol, "Return"))
|
||||
e_winlist_hide();
|
||||
else if (!strcmp(ev->keysymbol, "space"))
|
||||
e_winlist_hide();
|
||||
else if (!strcmp(ev->keysymbol, "Escape"))
|
||||
e_winlist_hide();
|
||||
else if (!strcmp(ev->keysymbol, "1"))
|
||||
_e_winlist_activate_nth(0);
|
||||
else if (!strcmp(ev->keysymbol, "2"))
|
||||
_e_winlist_activate_nth(1);
|
||||
else if (!strcmp(ev->keysymbol, "3"))
|
||||
_e_winlist_activate_nth(2);
|
||||
else if (!strcmp(ev->keysymbol, "4"))
|
||||
_e_winlist_activate_nth(3);
|
||||
else if (!strcmp(ev->keysymbol, "5"))
|
||||
_e_winlist_activate_nth(4);
|
||||
else if (!strcmp(ev->keysymbol, "6"))
|
||||
_e_winlist_activate_nth(5);
|
||||
else if (!strcmp(ev->keysymbol, "7"))
|
||||
_e_winlist_activate_nth(6);
|
||||
else if (!strcmp(ev->keysymbol, "8"))
|
||||
_e_winlist_activate_nth(7);
|
||||
else if (!strcmp(ev->keysymbol, "9"))
|
||||
_e_winlist_activate_nth(8);
|
||||
else if (!strcmp(ev->keysymbol, "0"))
|
||||
_e_winlist_activate_nth(9);
|
||||
else
|
||||
e_bindings_key_down_event_handle(E_BINDING_CONTEXT_WINLIST,
|
||||
E_OBJECT(winlist->zone), ev);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_winlist_cb_key_up(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_X_Event_Key_Up *ev;
|
||||
|
||||
ev = event;
|
||||
if (ev->win != input_window) return 1;
|
||||
if (hold_mod)
|
||||
{
|
||||
if ((hold_mod & ECORE_X_MODIFIER_SHIFT) && (!strcmp(ev->keysymbol, "Shift_L"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_SHIFT) && (!strcmp(ev->keysymbol, "Shift_R"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_CTRL) && (!strcmp(ev->keysymbol, "Control_L"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_CTRL) && (!strcmp(ev->keysymbol, "Control_R"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_ALT) && (!strcmp(ev->keysymbol, "Alt_L"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_ALT) && (!strcmp(ev->keysymbol, "Alt_R"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_ALT) && (!strcmp(ev->keysymbol, "Meta_L"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_ALT) && (!strcmp(ev->keysymbol, "Meta_R"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_ALT) && (!strcmp(ev->keysymbol, "Super_L"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_ALT) && (!strcmp(ev->keysymbol, "Super_R"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_WIN) && (!strcmp(ev->keysymbol, "Super_L"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_WIN) && (!strcmp(ev->keysymbol, "Super_R"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_WIN) && (!strcmp(ev->keysymbol, "Mode_switch"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_WIN) && (!strcmp(ev->keysymbol, "Meta_L"))) hold_count--;
|
||||
else if ((hold_mod & ECORE_X_MODIFIER_WIN) && (!strcmp(ev->keysymbol, "Meta_R"))) hold_count--;
|
||||
if (hold_count <= 0)
|
||||
{
|
||||
e_winlist_hide();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
e_bindings_key_up_event_handle(E_BINDING_CONTEXT_WINLIST,
|
||||
E_OBJECT(winlist->zone), ev);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
EAPI int e_winlist_init(void);
|
||||
EAPI int e_winlist_shutdown(void);
|
||||
|
||||
EAPI void e_winlist_show(E_Zone *zone);
|
||||
EAPI int e_winlist_show(E_Zone *zone);
|
||||
EAPI void e_winlist_hide(void);
|
||||
EAPI void e_winlist_next(void);
|
||||
EAPI void e_winlist_prev(void);
|
||||
|
|
|
@ -365,12 +365,12 @@ _pager_face_new(E_Zone *zone)
|
|||
e_gadman_client_domain_set(face->gmc, "module.pager", _pager_count++);
|
||||
e_gadman_client_zone_set(face->gmc, face->zone);
|
||||
e_gadman_client_policy_set(face->gmc,
|
||||
// E_GADMAN_POLICY_FIXED_ZONE |
|
||||
E_GADMAN_POLICY_ANYWHERE |
|
||||
E_GADMAN_POLICY_HMOVE |
|
||||
E_GADMAN_POLICY_VMOVE |
|
||||
E_GADMAN_POLICY_HSIZE |
|
||||
E_GADMAN_POLICY_VSIZE |
|
||||
E_GADMAN_POLICY_FIXED_ZONE);
|
||||
E_GADMAN_POLICY_VSIZE);
|
||||
e_gadman_client_min_size_set(face->gmc, 8, 8);
|
||||
e_gadman_client_max_size_set(face->gmc, 600, 600);
|
||||
e_gadman_client_auto_size_set(face->gmc, 186, 40);
|
||||
|
|
Loading…
Reference in New Issue