forked from enlightenment/enlightenment
click to focus works... if you turn it on and restart.
SVN revision: 14869
This commit is contained in:
parent
45a7d1f244
commit
38ab99da69
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:
|
||||
|
||||
* breaking out config via ipc / e_remote is too much work. this needs to get
|
||||
easier.
|
||||
* for click to focus - grab the mouse on all new windows, ungrab on focus, grab again on unfocus
|
||||
* move all ipc codecs to use eet
|
||||
* make raise_timer a on/off flag and add a double for delay
|
||||
|
|
|
@ -219,6 +219,7 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map)
|
|||
bd->win = ecore_x_window_override_new(con->win, 0, 0, bd->w, bd->h);
|
||||
ecore_x_window_shape_events_select(bd->win, 1);
|
||||
e_bindings_mouse_grab(E_BINDING_CONTEXT_BORDER, bd->win);
|
||||
e_focus_setup(bd);
|
||||
if (e_canvas_engine_decide(e_config->evas_engine_borders) ==
|
||||
E_EVAS_ENGINE_GL_X11)
|
||||
{
|
||||
|
@ -673,9 +674,15 @@ e_border_focus_set(E_Border *bd, int focus, int set)
|
|||
if (!bd->client.icccm.accepts_focus) return;
|
||||
// printf("flag focus to %i\n", focus);
|
||||
if ((focus) && (!bd->focused))
|
||||
edje_object_signal_emit(bd->bg_object, "active", "");
|
||||
{
|
||||
edje_object_signal_emit(bd->bg_object, "active", "");
|
||||
e_focus_event_focus_in(bd);
|
||||
}
|
||||
else if ((!focus) && (bd->focused))
|
||||
edje_object_signal_emit(bd->bg_object, "passive", "");
|
||||
{
|
||||
edje_object_signal_emit(bd->bg_object, "passive", "");
|
||||
e_focus_event_focus_out(bd);
|
||||
}
|
||||
bd->focused = focus;
|
||||
if (set)
|
||||
{
|
||||
|
@ -1445,6 +1452,7 @@ _e_border_free(E_Border *bd)
|
|||
e_canvas_del(bd->bg_ecore_evas);
|
||||
ecore_evas_free(bd->bg_ecore_evas);
|
||||
ecore_x_window_del(bd->client.shell_win);
|
||||
e_focus_setdown(bd);
|
||||
e_bindings_mouse_ungrab(E_BINDING_CONTEXT_BORDER, bd->win);
|
||||
ecore_x_window_del(bd->win);
|
||||
|
||||
|
@ -2423,26 +2431,25 @@ _e_border_cb_mouse_down(void *data, int type, void *event)
|
|||
bd = data;
|
||||
if (ev->event_win == bd->win)
|
||||
{
|
||||
if(!e_focus_event_mouse_down(bd))
|
||||
if ((ev->button >= 1) && (ev->button <= 3))
|
||||
{
|
||||
if ((ev->button >= 1) && (ev->button <= 3))
|
||||
{
|
||||
bd->mouse.last_down[ev->button - 1].mx = ev->root.x;
|
||||
bd->mouse.last_down[ev->button - 1].my = ev->root.y;
|
||||
bd->mouse.last_down[ev->button - 1].x = bd->x;
|
||||
bd->mouse.last_down[ev->button - 1].y = bd->y;
|
||||
bd->mouse.last_down[ev->button - 1].w = bd->w;
|
||||
bd->mouse.last_down[ev->button - 1].h = bd->h;
|
||||
}
|
||||
bd->mouse.current.mx = ev->root.x;
|
||||
bd->mouse.current.my = ev->root.y;
|
||||
if (!bd->cur_mouse_action)
|
||||
{
|
||||
bd->cur_mouse_action =
|
||||
e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_BORDER,
|
||||
E_OBJECT(bd), ev);
|
||||
}
|
||||
bd->mouse.last_down[ev->button - 1].mx = ev->root.x;
|
||||
bd->mouse.last_down[ev->button - 1].my = ev->root.y;
|
||||
bd->mouse.last_down[ev->button - 1].x = bd->x;
|
||||
bd->mouse.last_down[ev->button - 1].y = bd->y;
|
||||
bd->mouse.last_down[ev->button - 1].w = bd->w;
|
||||
bd->mouse.last_down[ev->button - 1].h = bd->h;
|
||||
}
|
||||
bd->mouse.current.mx = ev->root.x;
|
||||
bd->mouse.current.my = ev->root.y;
|
||||
if (!bd->cur_mouse_action)
|
||||
{
|
||||
bd->cur_mouse_action =
|
||||
e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_BORDER,
|
||||
E_OBJECT(bd), ev);
|
||||
}
|
||||
if (!bd->cur_mouse_action)
|
||||
e_focus_event_mouse_down(bd);
|
||||
}
|
||||
if (ev->win != bd->event_win) return 1;
|
||||
if ((ev->button >= 1) && (ev->button <= 3))
|
||||
|
@ -2484,31 +2491,31 @@ _e_border_cb_mouse_up(void *data, int type, void *event)
|
|||
bd = data;
|
||||
if (ev->event_win == bd->win)
|
||||
{
|
||||
if(!e_focus_event_mouse_up(bd))
|
||||
if ((ev->button >= 1) && (ev->button <= 3))
|
||||
{
|
||||
if ((ev->button >= 1) && (ev->button <= 3))
|
||||
{
|
||||
bd->mouse.last_up[ev->button - 1].mx = ev->root.x;
|
||||
bd->mouse.last_up[ev->button - 1].my = ev->root.y;
|
||||
bd->mouse.last_up[ev->button - 1].x = bd->x;
|
||||
bd->mouse.last_up[ev->button - 1].y = bd->y;
|
||||
}
|
||||
bd->mouse.current.mx = ev->root.x;
|
||||
bd->mouse.current.my = ev->root.y;
|
||||
/* bug/problem. this action COULD be deleted during a move */
|
||||
/* ... VERY unlikely though... VERY */
|
||||
/* also we dont pass the same params that went in - then again that */
|
||||
/* should be ok as we are just ending the action if it has an end */
|
||||
if (bd->cur_mouse_action)
|
||||
{
|
||||
if (bd->cur_mouse_action->func.end_mouse)
|
||||
bd->cur_mouse_action->func.end_mouse(E_OBJECT(bd), "", ev);
|
||||
else if (bd->cur_mouse_action->func.end)
|
||||
bd->cur_mouse_action->func.end(E_OBJECT(bd), "");
|
||||
bd->cur_mouse_action = NULL;
|
||||
}
|
||||
else
|
||||
e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_BORDER, E_OBJECT(bd), ev);
|
||||
bd->mouse.last_up[ev->button - 1].mx = ev->root.x;
|
||||
bd->mouse.last_up[ev->button - 1].my = ev->root.y;
|
||||
bd->mouse.last_up[ev->button - 1].x = bd->x;
|
||||
bd->mouse.last_up[ev->button - 1].y = bd->y;
|
||||
}
|
||||
bd->mouse.current.mx = ev->root.x;
|
||||
bd->mouse.current.my = ev->root.y;
|
||||
/* bug/problem. this action COULD be deleted during a move */
|
||||
/* ... VERY unlikely though... VERY */
|
||||
/* also we dont pass the same params that went in - then again that */
|
||||
/* should be ok as we are just ending the action if it has an end */
|
||||
if (bd->cur_mouse_action)
|
||||
{
|
||||
if (bd->cur_mouse_action->func.end_mouse)
|
||||
bd->cur_mouse_action->func.end_mouse(E_OBJECT(bd), "", ev);
|
||||
else if (bd->cur_mouse_action->func.end)
|
||||
bd->cur_mouse_action->func.end(E_OBJECT(bd), "");
|
||||
bd->cur_mouse_action = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_BORDER, E_OBJECT(bd), ev))
|
||||
e_focus_event_mouse_up(bd);
|
||||
}
|
||||
}
|
||||
if (ev->win != bd->event_win) return 1;
|
||||
|
@ -2652,12 +2659,14 @@ _e_border_cb_grab_replay(void *data, int type, void *event)
|
|||
if (type == ECORE_X_EVENT_MOUSE_BUTTON_DOWN)
|
||||
{
|
||||
Ecore_X_Event_Mouse_Button_Down *e;
|
||||
E_Border *bd;
|
||||
|
||||
e = event;
|
||||
bd = e_border_find_by_client_window(e->win);
|
||||
if (!bd) bd = e_border_find_by_client_window(e->event_win);
|
||||
/* FIXME: return 1 if we pass this click on... */
|
||||
if ((e_config->pass_click_on) ||
|
||||
(e_config->always_click_to_raise))
|
||||
{
|
||||
printf("ALLOW PRESS\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ typedef enum _E_Stacking
|
|||
|
||||
typedef enum _E_Focus_Policy
|
||||
{
|
||||
E_FOCUS_FOLLOW_MOUSE = 1 << 0,
|
||||
E_FOCUS_AUTORAISE = 1 << 1
|
||||
E_FOCUS_CLICK = 0,
|
||||
E_FOCUS_MOUSE = 1
|
||||
} E_Focus_Policy;
|
||||
|
||||
|
||||
|
@ -194,6 +194,7 @@ struct _E_Border
|
|||
unsigned char fullscreen : 1;
|
||||
unsigned char already_unparented : 1;
|
||||
unsigned char need_reparent : 1;
|
||||
unsigned char button_grabbed : 1;
|
||||
|
||||
unsigned char changed : 1;
|
||||
|
||||
|
|
|
@ -139,6 +139,11 @@ e_config_init(void)
|
|||
E_CONFIG_LIST(D, T, path_append_icons, _e_config_path_append_edd); /**/
|
||||
E_CONFIG_LIST(D, T, path_append_modules, _e_config_path_append_edd); /**/
|
||||
E_CONFIG_LIST(D, T, path_append_backgrounds, _e_config_path_append_edd); /**/
|
||||
E_CONFIG_VAL(D, T, focus_policy, INT); /**/
|
||||
E_CONFIG_VAL(D, T, pass_click_on, INT);
|
||||
E_CONFIG_VAL(D, T, always_click_to_raise, INT);
|
||||
E_CONFIG_VAL(D, T, use_auto_raise, INT);
|
||||
E_CONFIG_VAL(D, T, auto_raise_delay, DOUBLE);
|
||||
|
||||
e_config = e_config_domain_load("e", _e_config_edd);
|
||||
if (e_config)
|
||||
|
@ -200,8 +205,11 @@ e_config_init(void)
|
|||
e_config->evas_engine_popups = E_EVAS_ENGINE_DEFAULT;
|
||||
e_config->evas_engine_drag = E_EVAS_ENGINE_DEFAULT;
|
||||
e_config->language = strdup("");
|
||||
e_config->focus_policy = E_FOCUS_FOLLOW_MOUSE;
|
||||
e_config->raise_timer = 0;
|
||||
e_config->focus_policy = E_FOCUS_MOUSE;
|
||||
e_config->pass_click_on = 1;
|
||||
e_config->always_click_to_raise = 1;
|
||||
e_config->use_auto_raise = 0;
|
||||
e_config->auto_raise_delay = 0.5;
|
||||
{
|
||||
E_Config_Module *em;
|
||||
|
||||
|
@ -662,6 +670,7 @@ e_config_init(void)
|
|||
e_config_save_queue();
|
||||
}
|
||||
// e_config->evas_engine_container = E_EVAS_ENGINE_GL_X11;
|
||||
e_config->focus_policy = E_FOCUS_MOUSE;
|
||||
|
||||
E_CONFIG_LIMIT(e_config->menus_scroll_speed, 1.0, 20000.0);
|
||||
E_CONFIG_LIMIT(e_config->menus_fast_mouse_move_threshhold, 1.0, 2000.0);
|
||||
|
@ -676,6 +685,8 @@ e_config_init(void)
|
|||
E_CONFIG_LIMIT(e_config->zone_desks_y_count, 1, 64);
|
||||
E_CONFIG_LIMIT(e_config->use_edge_flip, 0, 1);
|
||||
E_CONFIG_LIMIT(e_config->edge_flip_timeout, 0.0, 2.0);
|
||||
E_CONFIG_LIMIT(e_config->use_auto_raise, 0, 1);
|
||||
E_CONFIG_LIMIT(e_config->auto_raise_delay, 0.0, 5.0);
|
||||
|
||||
/* apply lang config - exception because config is loaded after intl setup */
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ typedef struct _E_Config_Module E_Config_Module;
|
|||
typedef struct _E_Config_Theme E_Config_Theme;
|
||||
typedef struct _E_Config_Binding_Mouse E_Config_Binding_Mouse;
|
||||
typedef struct _E_Config_Binding_Key E_Config_Binding_Key;
|
||||
typedef struct _E_Config_Focus_Policy E_Config_Focus_Policy;
|
||||
typedef Eet_Data_Descriptor E_Config_DD;
|
||||
|
||||
#else
|
||||
|
@ -47,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 104
|
||||
#define E_CONFIG_FILE_VERSION 105
|
||||
|
||||
#define E_EVAS_ENGINE_DEFAULT 0
|
||||
#define E_EVAS_ENGINE_SOFTWARE_X11 1
|
||||
|
@ -94,9 +93,11 @@ struct _E_Config
|
|||
Evas_List *path_append_icons;
|
||||
Evas_List *path_append_modules;
|
||||
Evas_List *path_append_backgrounds;
|
||||
E_Focus_Policy focus_policy;
|
||||
int raise_timer;
|
||||
|
||||
int focus_policy;
|
||||
int pass_click_on;
|
||||
int always_click_to_raise;
|
||||
int use_auto_raise;
|
||||
double auto_raise_delay;
|
||||
};
|
||||
|
||||
struct _E_Config_Module
|
||||
|
@ -131,14 +132,6 @@ struct _E_Config_Binding_Key
|
|||
unsigned char any_mod;
|
||||
};
|
||||
|
||||
struct _E_Config_Focus_Policy
|
||||
{
|
||||
E_Focus_Policy focus_policy;
|
||||
int raise_timer;
|
||||
};
|
||||
|
||||
|
||||
|
||||
EAPI int e_config_init(void);
|
||||
EAPI int e_config_shutdown(void);
|
||||
|
||||
|
|
|
@ -4,35 +4,20 @@
|
|||
#include "e.h"
|
||||
|
||||
/* local subsystem functions */
|
||||
static int _e_focus_cb_window_focus_in(void *data, int ev_type, void *ev);
|
||||
static int _e_focus_cb_window_focus_out(void *data, int ev_type, void *ev);
|
||||
static int _e_focus_cb_mouse_button_down(void *data, int ev_type, void *ev);
|
||||
static int _e_focus_raise_timer(void* data);
|
||||
|
||||
/* local subsystem globals */
|
||||
static Ecore_Event_Handler *_e_focus_focus_in_handler = NULL;
|
||||
static Ecore_Event_Handler *_e_focus_focus_out_handler = NULL;
|
||||
static Ecore_Event_Handler *_e_focus_mouse_down_handler = NULL;
|
||||
|
||||
/* externally accessible functions */
|
||||
int
|
||||
e_focus_init(void)
|
||||
{
|
||||
_e_focus_focus_in_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, _e_focus_cb_window_focus_in, NULL);
|
||||
_e_focus_focus_out_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, _e_focus_cb_window_focus_out, NULL);
|
||||
// _e_focus_mouse_down_handler = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_DOWN,
|
||||
// _e_focus_cb_mouse_button_down, NULL);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_focus_shutdown(void)
|
||||
{
|
||||
E_FN_DEL(ecore_event_handler_del, _e_focus_focus_in_handler);
|
||||
E_FN_DEL(ecore_event_handler_del, _e_focus_focus_out_handler);
|
||||
E_FN_DEL(ecore_event_handler_del, _e_focus_mouse_down_handler);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -42,174 +27,98 @@ e_focus_idler_before(void)
|
|||
return;
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
e_focus_event_mouse_in(E_Border* bd)
|
||||
{
|
||||
/* If focus follows mouse */
|
||||
if( e_config->focus_policy & E_FOCUS_FOLLOW_MOUSE)
|
||||
if (e_config->focus_policy == E_FOCUS_MOUSE)
|
||||
e_border_focus_set(bd, 1, 1);
|
||||
|
||||
bd->raise_timer = NULL;
|
||||
if (e_config->focus_policy & E_FOCUS_AUTORAISE)
|
||||
if (e_config->use_auto_raise)
|
||||
{
|
||||
if (e_config->raise_timer == 0)
|
||||
if (e_config->auto_raise_delay == 0.0)
|
||||
e_border_raise(bd);
|
||||
else
|
||||
bd->raise_timer = ecore_timer_add((double)e_config->raise_timer / 10.0,
|
||||
_e_focus_raise_timer, bd);
|
||||
bd->raise_timer = ecore_timer_add(e_config->auto_raise_delay, _e_focus_raise_timer, bd);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
e_focus_event_mouse_out(E_Border* bd)
|
||||
{
|
||||
/* If focus follows mouse */
|
||||
if (e_config->focus_policy & E_FOCUS_FOLLOW_MOUSE)
|
||||
if (e_config->focus_policy == E_FOCUS_MOUSE)
|
||||
e_border_focus_set(bd, 0, 1);
|
||||
|
||||
if (bd->raise_timer != NULL)
|
||||
if (bd->raise_timer)
|
||||
{
|
||||
ecore_timer_del(bd->raise_timer);
|
||||
bd->raise_timer = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
e_focus_event_mouse_down(E_Border* bd)
|
||||
{
|
||||
if (!(e_config->focus_policy & E_FOCUS_FOLLOW_MOUSE))
|
||||
if (e_config->focus_policy == E_FOCUS_CLICK)
|
||||
{
|
||||
e_border_focus_set(bd, 1, 1);
|
||||
e_border_raise(bd);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
e_focus_event_mouse_up(E_Border* bd)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
e_focus_event_focus_in(E_Border *bd)
|
||||
{
|
||||
if ((e_config->focus_policy == E_FOCUS_CLICK) &&
|
||||
(!e_config->always_click_to_raise))
|
||||
{
|
||||
if (!bd->button_grabbed) return;
|
||||
ecore_x_window_button_ungrab(bd->win, 1, 0, 1);
|
||||
bd->button_grabbed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
e_focus_event_focus_out(E_Border *bd)
|
||||
{
|
||||
if ((e_config->focus_policy == E_FOCUS_CLICK) &&
|
||||
(!e_config->always_click_to_raise))
|
||||
{
|
||||
if (bd->button_grabbed) return;
|
||||
ecore_x_window_button_grab(bd->win, 1, ECORE_X_EVENT_MASK_MOUSE_DOWN, 0, 1);
|
||||
bd->button_grabbed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
e_focus_setup(E_Border *bd)
|
||||
{
|
||||
if ((e_config->focus_policy == E_FOCUS_CLICK) ||
|
||||
(e_config->always_click_to_raise))
|
||||
{
|
||||
if (bd->button_grabbed) return;
|
||||
ecore_x_window_button_grab(bd->win, 1, ECORE_X_EVENT_MASK_MOUSE_DOWN, 0, 1);
|
||||
bd->button_grabbed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
e_focus_setdown(E_Border *bd)
|
||||
{
|
||||
if (!bd->button_grabbed) return;
|
||||
ecore_x_window_button_ungrab(bd->win, 1, 0, 1);
|
||||
bd->button_grabbed = 0;
|
||||
}
|
||||
|
||||
|
||||
/* local subsystem functions */
|
||||
static int
|
||||
_e_focus_cb_window_focus_in(void *data, int ev_type, void *ev)
|
||||
{
|
||||
Ecore_X_Event_Window_Focus_In *e;
|
||||
|
||||
e = ev;
|
||||
#if 0
|
||||
const char *modes[] = {
|
||||
"ECORE_X_EVENT_MODE_NORMAL",
|
||||
"ECORE_X_EVENT_MODE_WHILE_GRABBED",
|
||||
"ECORE_X_EVENT_MODE_GRAB",
|
||||
"ECORE_X_EVENT_MODE_UNGRAB"
|
||||
};
|
||||
const char *details[] = {
|
||||
"ECORE_X_EVENT_DETAIL_ANCESTOR",
|
||||
"ECORE_X_EVENT_DETAIL_VIRTUAL",
|
||||
"ECORE_X_EVENT_DETAIL_INFERIOR",
|
||||
"ECORE_X_EVENT_DETAIL_NON_LINEAR",
|
||||
"ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL",
|
||||
"ECORE_X_EVENT_DETAIL_POINTER",
|
||||
"ECORE_X_EVENT_DETAIL_POINTER_ROOT",
|
||||
"ECORE_X_EVENT_DETAIL_DETAIL_NONE"
|
||||
};
|
||||
|
||||
if (e_border_find_by_client_window(e->win))
|
||||
{
|
||||
printf("BI 0x%x md=%s dt=%s\n",
|
||||
e->win,
|
||||
modes[e->mode],
|
||||
details[e->detail]);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("FI 0x%x md=%s dt=%s\n",
|
||||
e->win,
|
||||
modes[e->mode],
|
||||
details[e->detail]);
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_focus_cb_window_focus_out(void *data, int ev_type, void *ev)
|
||||
{
|
||||
Ecore_X_Event_Window_Focus_Out *e;
|
||||
|
||||
e = ev;
|
||||
#if 0
|
||||
const char *modes[] = {
|
||||
"ECORE_X_EVENT_MODE_NORMAL",
|
||||
"ECORE_X_EVENT_MODE_WHILE_GRABBED",
|
||||
"ECORE_X_EVENT_MODE_GRAB",
|
||||
"ECORE_X_EVENT_MODE_UNGRAB"
|
||||
};
|
||||
const char *details[] = {
|
||||
"ECORE_X_EVENT_DETAIL_ANCESTOR",
|
||||
"ECORE_X_EVENT_DETAIL_VIRTUAL",
|
||||
"ECORE_X_EVENT_DETAIL_INFERIOR",
|
||||
"ECORE_X_EVENT_DETAIL_NON_LINEAR",
|
||||
"ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL",
|
||||
"ECORE_X_EVENT_DETAIL_POINTER",
|
||||
"ECORE_X_EVENT_DETAIL_POINTER_ROOT",
|
||||
"ECORE_X_EVENT_DETAIL_DETAIL_NONE"
|
||||
};
|
||||
|
||||
if (e_border_find_by_client_window(e->win))
|
||||
{
|
||||
printf("BO 0x%x md=%s dt=%s\n",
|
||||
e->win,
|
||||
modes[e->mode],
|
||||
details[e->detail]);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("FO 0x%x md=%s dt=%s\n",
|
||||
e->win,
|
||||
modes[e->mode],
|
||||
details[e->detail]);
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
_e_focus_cb_mouse_button_down(void *data, int ev_type, void *ev)
|
||||
{
|
||||
Ecore_X_Event_Mouse_Button_Down* e;
|
||||
E_Border* bd = NULL;
|
||||
|
||||
e = ev;
|
||||
|
||||
fprintf(stderr,"%s, %p\n",__FUNCTION__, e->win);
|
||||
|
||||
bd = e_border_find_by_client_window(e->win);
|
||||
if (!bd)
|
||||
bd = e_border_find_by_window(e->win);
|
||||
if (!bd)
|
||||
bd = e_border_find_by_frame_window(e->win);
|
||||
|
||||
if (!bd)
|
||||
bd = e_border_find_by_client_window(e->event_win);
|
||||
if (!bd)
|
||||
bd = e_border_find_by_window(e->event_win);
|
||||
if (!bd)
|
||||
bd = e_border_find_by_frame_window(e->event_win);
|
||||
|
||||
fprintf(stderr,"bd = %p\n", bd);
|
||||
|
||||
if (bd)
|
||||
e_focus_event_mouse_down(bd);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_e_focus_raise_timer(void* data)
|
||||
|
@ -218,4 +127,3 @@ _e_focus_raise_timer(void* data)
|
|||
((E_Border*)data)->raise_timer = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,14 @@ EAPI int e_focus_init(void);
|
|||
EAPI int e_focus_shutdown(void);
|
||||
EAPI void e_focus_idler_before(void);
|
||||
|
||||
EAPI int e_focus_event_mouse_in(E_Border* bd);
|
||||
EAPI int e_focus_event_mouse_out(E_Border* bd);
|
||||
EAPI int e_focus_event_mouse_down(E_Border* bd);
|
||||
EAPI int e_focus_event_mouse_up(E_Border* bd);
|
||||
EAPI void e_focus_event_mouse_in(E_Border* bd);
|
||||
EAPI void e_focus_event_mouse_out(E_Border* bd);
|
||||
EAPI void e_focus_event_mouse_down(E_Border* bd);
|
||||
EAPI void e_focus_event_mouse_up(E_Border* bd);
|
||||
EAPI void e_focus_event_focus_in(E_Border *bd);
|
||||
EAPI void e_focus_event_focus_out(E_Border *bd);
|
||||
EAPI void e_focus_setup(E_Border *bd);
|
||||
EAPI void e_focus_setdown(E_Border *bd);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -27,8 +27,6 @@ ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_key_binding_list_enc);
|
|||
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_key_binding_enc);
|
||||
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_key_binding_dec);
|
||||
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_path_list_enc);
|
||||
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_focus_policy_enc);
|
||||
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_focus_policy_dec);
|
||||
|
||||
/* local subsystem globals */
|
||||
static Ecore_Ipc_Server *_e_ipc_server = NULL;
|
||||
|
@ -738,35 +736,17 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
|
|||
E_IPC_OP_DESKS_GET_REPLY);
|
||||
break;
|
||||
case E_IPC_OP_FOCUS_POLICY_SET:
|
||||
if (e_ipc_codec_int_dec(e->data, e->size,
|
||||
&(e_config->focus_policy)))
|
||||
{
|
||||
E_Config_Focus_Policy policy;
|
||||
|
||||
_e_ipc_focus_policy_dec(e->data, e->size, &policy);
|
||||
e_config->focus_policy = policy.focus_policy;
|
||||
e_config->raise_timer = policy.raise_timer;
|
||||
|
||||
/* FIXME: if going to/from click to focus grab/ungrab */
|
||||
e_config_save_queue();
|
||||
}
|
||||
break;
|
||||
case E_IPC_OP_FOCUS_POLICY_GET:
|
||||
{
|
||||
int bytes;
|
||||
E_Config_Focus_Policy policy;
|
||||
char *data;
|
||||
|
||||
policy.focus_policy = e_config->focus_policy;
|
||||
policy.raise_timer = e_config->raise_timer;
|
||||
|
||||
data = _e_ipc_focus_policy_enc(&policy, &bytes);
|
||||
|
||||
ecore_ipc_client_send(e->client,
|
||||
E_IPC_DOMAIN_REPLY,
|
||||
E_IPC_OP_FOCUS_POLICY_GET_REPLY,
|
||||
0, 0, 0,
|
||||
data, bytes);
|
||||
|
||||
free(data);
|
||||
|
||||
}
|
||||
_e_ipc_reply_int_send(e->client,
|
||||
e_config->focus_policy,
|
||||
E_IPC_OP_FOCUS_POLICY_GET_REPLY);
|
||||
break;
|
||||
case E_IPC_OP_MODULE_DIRS_LIST:
|
||||
{
|
||||
|
@ -1519,22 +1499,3 @@ ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_path_list_enc)
|
|||
ECORE_IPC_PUTS(dir, l1);
|
||||
ECORE_IPC_ENC_EVAS_LIST_FOOT();
|
||||
}
|
||||
|
||||
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_focus_policy_enc)
|
||||
{
|
||||
ECORE_IPC_ENC_STRUCT_HEAD(E_Config_Focus_Policy,
|
||||
1 + 4);
|
||||
ECORE_IPC_PUT8(focus_policy);
|
||||
ECORE_IPC_PUT32(raise_timer);
|
||||
ECORE_IPC_ENC_STRUCT_FOOT();
|
||||
}
|
||||
|
||||
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_focus_policy_dec)
|
||||
{
|
||||
ECORE_IPC_DEC_STRUCT_HEAD_MIN(E_Config_Focus_Policy,
|
||||
1 + 4);
|
||||
ECORE_IPC_CHEKS();
|
||||
ECORE_IPC_GET8(focus_policy);
|
||||
ECORE_IPC_GET32(raise_timer);
|
||||
ECORE_IPC_DEC_STRUCT_FOOT();
|
||||
}
|
||||
|
|
|
@ -43,8 +43,6 @@ ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_key_binding_list_dec);
|
|||
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_key_binding_enc);
|
||||
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_key_binding_dec);
|
||||
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_path_list_dec);
|
||||
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_focus_policy_enc);
|
||||
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_focus_policy_dec);
|
||||
|
||||
/* local subsystem globals */
|
||||
static Ecore_Ipc_Server *_e_ipc_server = NULL;
|
||||
|
@ -242,79 +240,27 @@ _e_opt_binding_key_del(char **params)
|
|||
free(data);
|
||||
}
|
||||
|
||||
static void _e_opt_focus_policy_parse(E_Config_Focus_Policy* policy, char **params)
|
||||
{
|
||||
/* M1[|M2...] */
|
||||
{
|
||||
char *p, *pp;
|
||||
|
||||
policy->focus_policy = 0;
|
||||
pp = params[0];
|
||||
for (;;)
|
||||
{
|
||||
p = strchr(pp, '|');
|
||||
if (p)
|
||||
{
|
||||
if (!strncmp(pp, "FOLLOW|", 7))
|
||||
policy->focus_policy |= E_FOCUS_FOLLOW_MOUSE;
|
||||
else if (!strncmp(pp, "CLICK|", 6))
|
||||
policy->focus_policy &=
|
||||
~(E_FOCUS_FOLLOW_MOUSE | E_FOCUS_AUTORAISE);
|
||||
else if (!strncmp(pp, "AUTORAISE|", 10))
|
||||
policy->focus_policy |= E_FOCUS_AUTORAISE;
|
||||
else if (strlen(pp) > 0)
|
||||
{
|
||||
printf("OPT1 option. Must be or mask of:\n"
|
||||
" FOLLOW CLICK AUTORAISE\n");
|
||||
exit(-1);
|
||||
}
|
||||
pp = p + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!strcmp(pp, "FOLLOW"))
|
||||
policy->focus_policy |= E_FOCUS_FOLLOW_MOUSE;
|
||||
else if (!strcmp(pp, "CLICK"))
|
||||
policy->focus_policy &=
|
||||
~(E_FOCUS_FOLLOW_MOUSE | E_FOCUS_AUTORAISE);
|
||||
else if (!strcmp(pp, "AUTORAISE"))
|
||||
policy->focus_policy |= E_FOCUS_AUTORAISE;
|
||||
else if (strlen(pp) > 0)
|
||||
{
|
||||
printf("OPT1 option. Must be or mask of:\n"
|
||||
" FOLLOW CLICK AUTORAISE\n");
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(params[1][0] != 0)
|
||||
policy->raise_timer = atoi(params[1]);
|
||||
else if(policy->focus_policy & E_FOCUS_AUTORAISE)
|
||||
{
|
||||
printf("OPT2 option is should be seted, if you use AUTORAISE.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_e_opt_focus_policy_set(char** params)
|
||||
_e_opt_focus_policy_set(char **params)
|
||||
{
|
||||
E_Config_Focus_Policy policy;
|
||||
int bytes;
|
||||
char *data;
|
||||
|
||||
_e_opt_focus_policy_parse(&policy, params);
|
||||
data = _e_ipc_focus_policy_enc(&policy, &bytes);
|
||||
int value;
|
||||
|
||||
value = 0;
|
||||
if (!strcmp(params[0], "MOUSE")) value = E_FOCUS_MOUSE;
|
||||
else if (!strcmp(params[0], "CLICK")) value = E_FOCUS_CLICK;
|
||||
else
|
||||
{
|
||||
printf("focus must be MOUSE or CLICK\n");
|
||||
exit(-1);
|
||||
}
|
||||
data = e_ipc_codec_int_enc(value, &bytes);
|
||||
ecore_ipc_server_send(_e_ipc_server,
|
||||
E_IPC_DOMAIN_REQUEST,
|
||||
E_IPC_OP_FOCUS_POLICY_SET,
|
||||
0, 0, 0,
|
||||
data, bytes);
|
||||
|
||||
free(data);
|
||||
}
|
||||
|
||||
|
@ -424,7 +370,7 @@ E_IPC_Opt_Handler handlers[] =
|
|||
OREQ("-desks-get", "Get the number of virtual desktops", E_IPC_OP_DESKS_GET, 1),
|
||||
O2INT("-desks-set", "Set the number of virtual desktops (X x Y. OPT1 = X, OPT2 = Y)", E_IPC_OP_DESKS_SET, 0),
|
||||
OREQ("-desks-get", "Get the number of virtual desktops", E_IPC_OP_DESKS_GET, 1),
|
||||
OFNC("-focus-policy-set", "Set focus policy. OPT1 = Policy. OPT2 = Raise Time.", 2, _e_opt_focus_policy_set, 0),
|
||||
OFNC("-focus-policy-set", "Set focus policy. OPT1 = CLICK or MOUSE", 1, _e_opt_focus_policy_set, 0),
|
||||
OREQ("-focus-policy-get", "Get focus policy.", E_IPC_OP_FOCUS_POLICY_GET, 1)
|
||||
};
|
||||
|
||||
|
@ -1110,12 +1056,18 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
|
|||
}
|
||||
break;
|
||||
case E_IPC_OP_FOCUS_POLICY_GET_REPLY:
|
||||
if(e->data)
|
||||
if (e->data)
|
||||
{
|
||||
E_Config_Focus_Policy policy;
|
||||
|
||||
if(_e_ipc_focus_policy_dec(e->data, e->size, &policy))
|
||||
printf("REPLY: %i %i\n", policy.focus_policy, policy.raise_timer);
|
||||
int value;
|
||||
|
||||
if (e_ipc_codec_int_dec(e->data, e->size,
|
||||
&(value)))
|
||||
{
|
||||
if (value == E_FOCUS_MOUSE)
|
||||
printf("REPLY: MOUSE\n");
|
||||
else if (value == E_FOCUS_CLICK)
|
||||
printf("REPLY: CLICK\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1369,28 +1321,10 @@ ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_key_binding_dec)
|
|||
ECORE_IPC_GET8(any_mod);
|
||||
ECORE_IPC_DEC_STRUCT_FOOT();
|
||||
}
|
||||
|
||||
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_path_list_dec)
|
||||
{
|
||||
ECORE_IPC_DEC_EVAS_LIST_HEAD(E_Path_Dir);
|
||||
ECORE_IPC_GETS(dir);
|
||||
ECORE_IPC_DEC_EVAS_LIST_FOOT();
|
||||
}
|
||||
|
||||
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_focus_policy_enc)
|
||||
{
|
||||
ECORE_IPC_ENC_STRUCT_HEAD(E_Config_Focus_Policy,
|
||||
1 + 4);
|
||||
ECORE_IPC_PUT8(focus_policy);
|
||||
ECORE_IPC_PUT32(raise_timer);
|
||||
ECORE_IPC_ENC_STRUCT_FOOT();
|
||||
}
|
||||
|
||||
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_focus_policy_dec)
|
||||
{
|
||||
ECORE_IPC_DEC_STRUCT_HEAD_MIN(E_Config_Focus_Policy,
|
||||
1 + 4);
|
||||
ECORE_IPC_CHEKS();
|
||||
ECORE_IPC_GET8(focus_policy);
|
||||
ECORE_IPC_GET32(raise_timer);
|
||||
ECORE_IPC_DEC_STRUCT_FOOT();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue