diff --git a/src/bin/e_bindings.c b/src/bin/e_bindings.c index a71402f83..62a490f90 100644 --- a/src/bin/e_bindings.c +++ b/src/bin/e_bindings.c @@ -4,38 +4,6 @@ #include "e.h" /* local subsystem functions */ -typedef struct _E_Binding_Mouse E_Binding_Mouse; -typedef struct _E_Binding_Key E_Binding_Key; -typedef struct _E_Binding_Signal E_Binding_Signal; - -struct _E_Binding_Mouse -{ - E_Binding_Context ctxt; - int button; - E_Binding_Modifier mod; - unsigned char any_mod : 1; - char *action; - char *params; -}; - -struct _E_Binding_Key -{ - E_Binding_Context ctxt; - char *key; - E_Binding_Modifier mod; - unsigned char any_mod : 1; - char *action; - char *params; -}; - -struct _E_Binding_Signal -{ - E_Binding_Context ctxt; - char *sig; - char *src; - char *action; - char *params; -}; static void _e_bindings_mouse_free(E_Binding_Mouse *bind); static void _e_bindings_key_free(E_Binding_Key *bind); @@ -195,7 +163,7 @@ e_bindings_mouse_ungrab(E_Binding_Context ctxt, Ecore_X_Window win) } E_Action * -e_bindings_mouse_down_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Mouse_Button_Down *ev) +e_bindings_mouse_down_find(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Mouse_Button_Down *ev, E_Binding_Mouse **bind_ret) { E_Binding_Modifier mod = 0; Evas_List *l; @@ -217,15 +185,57 @@ e_bindings_mouse_down_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_ E_Action *act; act = e_action_find(bind->action); - if (act) - { - if (act->func.go_mouse) - act->func.go_mouse(obj, bind->params, ev); - else if (act->func.go) - act->func.go(obj, bind->params); - return act; - } - return NULL; + if (bind_ret) *bind_ret = bind; + return act; + } + } + } + return NULL; +} + +E_Action * +e_bindings_mouse_down_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Mouse_Button_Down *ev) +{ + E_Action *act; + E_Binding_Mouse *bind; + + act = e_bindings_mouse_down_find(ctxt, obj, ev, &bind); + if (act) + { + if (act->func.go_mouse) + act->func.go_mouse(obj, bind->params, ev); + else if (act->func.go) + act->func.go(obj, bind->params); + return act; + } + return act; +} + +E_Action * +e_bindings_mouse_up_find(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Mouse_Button_Up *ev, E_Binding_Mouse **bind_ret) +{ + E_Binding_Modifier mod = 0; + Evas_List *l; + + if (ev->modifiers & ECORE_X_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT; + if (ev->modifiers & ECORE_X_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL; + if (ev->modifiers & ECORE_X_MODIFIER_ALT) mod |= E_BINDING_MODIFIER_ALT; + if (ev->modifiers & ECORE_X_MODIFIER_WIN) mod |= E_BINDING_MODIFIER_WIN; + for (l = mouse_bindings; l; l = l->next) + { + E_Binding_Mouse *bind; + + bind = l->data; + if ((bind->button == ev->button) && + ((bind->any_mod) || (bind->mod == mod))) + { + if (_e_bindings_context_match(bind->ctxt, ctxt)) + { + E_Action *act; + + act = e_action_find(bind->action); + if (bind_ret) *bind_ret = bind; + return act; } } } @@ -235,39 +245,19 @@ e_bindings_mouse_down_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_ E_Action * e_bindings_mouse_up_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Mouse_Button_Up *ev) { - E_Binding_Modifier mod = 0; - Evas_List *l; + E_Action *act; + E_Binding_Mouse *bind; - if (ev->modifiers & ECORE_X_MODIFIER_SHIFT) mod |= E_BINDING_MODIFIER_SHIFT; - if (ev->modifiers & ECORE_X_MODIFIER_CTRL) mod |= E_BINDING_MODIFIER_CTRL; - if (ev->modifiers & ECORE_X_MODIFIER_ALT) mod |= E_BINDING_MODIFIER_ALT; - if (ev->modifiers & ECORE_X_MODIFIER_WIN) mod |= E_BINDING_MODIFIER_WIN; - for (l = mouse_bindings; l; l = l->next) + act = e_bindings_mouse_up_find(ctxt, obj, ev, &bind); + if (act) { - E_Binding_Mouse *bind; - - bind = l->data; - if ((bind->button == ev->button) && - ((bind->any_mod) || (bind->mod == mod))) - { - if (_e_bindings_context_match(bind->ctxt, ctxt)) - { - E_Action *act; - - act = e_action_find(bind->action); - if (act) - { - if (act->func.end_mouse) - act->func.end_mouse(obj, bind->params, ev); - else if (act->func.end) - act->func.end(obj, bind->params); - return act; - } - return NULL; - } - } + if (act->func.end_mouse) + act->func.end_mouse(obj, bind->params, ev); + else if (act->func.end) + act->func.end(obj, bind->params); + return act; } - return NULL; + return act; } /* FIXME: finish off key bindings */ diff --git a/src/bin/e_bindings.h b/src/bin/e_bindings.h index 0c42515ae..1ce34f126 100644 --- a/src/bin/e_bindings.h +++ b/src/bin/e_bindings.h @@ -26,10 +26,43 @@ typedef enum _E_Binding_Modifier E_BINDING_MODIFIER_WIN = (1 << 3) } E_Binding_Modifier; +typedef struct _E_Binding_Mouse E_Binding_Mouse; +typedef struct _E_Binding_Key E_Binding_Key; +typedef struct _E_Binding_Signal E_Binding_Signal; + #else #ifndef E_BINDINGS_H #define E_BINDINGS_H +struct _E_Binding_Mouse +{ + E_Binding_Context ctxt; + int button; + E_Binding_Modifier mod; + unsigned char any_mod : 1; + char *action; + char *params; +}; + +struct _E_Binding_Key +{ + E_Binding_Context ctxt; + char *key; + E_Binding_Modifier mod; + unsigned char any_mod : 1; + char *action; + char *params; +}; + +struct _E_Binding_Signal +{ + E_Binding_Context ctxt; + char *sig; + char *src; + char *action; + char *params; +}; + EAPI int e_bindings_init(void); EAPI int e_bindings_shutdown(void); @@ -37,7 +70,9 @@ EAPI void e_bindings_mouse_add(E_Binding_Context ctxt, int button, E_Bind EAPI void e_bindings_mouse_del(E_Binding_Context ctxt, int button, E_Binding_Modifier mod, int any_mod, char *action, char *params); EAPI void e_bindings_mouse_grab(E_Binding_Context ctxt, Ecore_X_Window win); EAPI void e_bindings_mouse_ungrab(E_Binding_Context ctxt, Ecore_X_Window win); +EAPI E_Action *e_bindings_mouse_down_find(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Mouse_Button_Down *ev, E_Binding_Mouse **bind_ret); EAPI E_Action *e_bindings_mouse_down_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Mouse_Button_Down *ev); +EAPI E_Action *e_bindings_mouse_up_find(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Mouse_Button_Up *ev, E_Binding_Mouse **bind_ret); EAPI E_Action *e_bindings_mouse_up_event_handle(E_Binding_Context ctxt, E_Object *obj, Ecore_X_Event_Mouse_Button_Up *ev); EAPI void e_bindings_key_add(E_Binding_Context ctxt, char *key, E_Binding_Modifier mod, int any_mod, char *action, char *params); diff --git a/src/bin/e_border.c b/src/bin/e_border.c index c4eed7d10..70ab1027b 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -1379,6 +1379,7 @@ e_border_button_bindings_ungrab_all(void) E_Border *bd; bd = l->data; + e_focus_setdown(bd); e_bindings_mouse_ungrab(E_BINDING_CONTEXT_BORDER, bd->win); } } @@ -1394,6 +1395,7 @@ e_border_button_bindings_grab_all(void) bd = l->data; e_bindings_mouse_grab(E_BINDING_CONTEXT_BORDER, bd->win); + e_focus_setup(bd); } } @@ -2448,8 +2450,7 @@ _e_border_cb_mouse_down(void *data, int type, void *event) 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); + e_focus_event_mouse_down(bd); } if (ev->win != bd->event_win) return 1; if ((ev->button >= 1) && (ev->button <= 3)) @@ -2504,6 +2505,7 @@ _e_border_cb_mouse_up(void *data, int type, void *event) /* ... 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 */ + printf("mouse up after grab!\n"); if (bd->cur_mouse_action) { if (bd->cur_mouse_action->func.end_mouse) @@ -2655,17 +2657,25 @@ _e_border_cb_mouse_wheel(void *data, int type, void *event) static int _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 *ev; + if (type != ECORE_X_EVENT_MOUSE_BUTTON_DOWN) return 0; + + ev = event; + if ((e_config->pass_click_on) || (e_config->always_click_to_raise)) { - Ecore_X_Event_Mouse_Button_Down *e; - - e = event; - if ((e_config->pass_click_on) || - (e_config->always_click_to_raise)) + E_Border *bd; + + bd = e_border_find_by_window(ev->event_win); + if (bd) { - printf("ALLOW PRESS\n"); - return 1; + if (bd->cur_mouse_action) return 0; + if (ev->event_win == bd->win) + { + if (!e_bindings_mouse_down_find(E_BINDING_CONTEXT_BORDER, + E_OBJECT(bd), ev, NULL)) + return 1; + } } } return 0; diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 715bedbc3..e594f4e89 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -207,7 +207,7 @@ e_config_init(void) e_config->language = strdup(""); e_config->focus_policy = E_FOCUS_MOUSE; e_config->pass_click_on = 1; - e_config->always_click_to_raise = 1; + e_config->always_click_to_raise = 0; e_config->use_auto_raise = 0; e_config->auto_raise_delay = 0.5; { @@ -670,7 +670,6 @@ 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); diff --git a/src/bin/e_config.h b/src/bin/e_config.h index 8aa4f1391..f3cbf24dc 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -100,6 +100,7 @@ struct _E_Config double auto_raise_delay; }; +/* FIXME: all of thsie needs to become eet lumps for enmcode/decode */ struct _E_Config_Module { char *name; diff --git a/src/bin/e_focus.c b/src/bin/e_focus.c index 0a24c06ce..1f277c0bd 100644 --- a/src/bin/e_focus.c +++ b/src/bin/e_focus.c @@ -30,7 +30,6 @@ e_focus_idler_before(void) void e_focus_event_mouse_in(E_Border* bd) { - /* If focus follows mouse */ if (e_config->focus_policy == E_FOCUS_MOUSE) e_border_focus_set(bd, 1, 1); @@ -47,7 +46,6 @@ e_focus_event_mouse_in(E_Border* bd) void e_focus_event_mouse_out(E_Border* bd) { - /* If focus follows mouse */ if (e_config->focus_policy == E_FOCUS_MOUSE) e_border_focus_set(bd, 0, 1); @@ -66,6 +64,10 @@ e_focus_event_mouse_down(E_Border* bd) e_border_focus_set(bd, 1, 1); e_border_raise(bd); } + else if (e_config->always_click_to_raise) + { + e_border_raise(bd); + } } void @@ -80,7 +82,9 @@ e_focus_event_focus_in(E_Border *bd) (!e_config->always_click_to_raise)) { if (!bd->button_grabbed) return; + e_bindings_mouse_ungrab(E_BINDING_CONTEXT_BORDER, bd->win); ecore_x_window_button_ungrab(bd->win, 1, 0, 1); + e_bindings_mouse_grab(E_BINDING_CONTEXT_BORDER, bd->win); bd->button_grabbed = 0; } } @@ -92,7 +96,10 @@ e_focus_event_focus_out(E_Border *bd) (!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); + ecore_x_window_button_grab(bd->win, 0, + ECORE_X_EVENT_MASK_MOUSE_DOWN | + ECORE_X_EVENT_MASK_MOUSE_UP | + ECORE_X_EVENT_MASK_MOUSE_MOVE, 0, 1); bd->button_grabbed = 1; } } @@ -104,7 +111,10 @@ e_focus_setup(E_Border *bd) (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); + ecore_x_window_button_grab(bd->win, 0, + ECORE_X_EVENT_MASK_MOUSE_DOWN | + ECORE_X_EVENT_MASK_MOUSE_UP | + ECORE_X_EVENT_MASK_MOUSE_MOVE, 0, 1); bd->button_grabbed = 1; } } @@ -113,7 +123,9 @@ void e_focus_setdown(E_Border *bd) { if (!bd->button_grabbed) return; + e_bindings_mouse_ungrab(E_BINDING_CONTEXT_BORDER, bd->win); ecore_x_window_button_ungrab(bd->win, 1, 0, 1); + e_bindings_mouse_grab(E_BINDING_CONTEXT_BORDER, bd->win); bd->button_grabbed = 0; } diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c index 6984bee2d..c84c8dd62 100644 --- a/src/bin/e_ipc.c +++ b/src/bin/e_ipc.c @@ -736,12 +736,13 @@ _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: + e_border_button_bindings_ungrab_all(); if (e_ipc_codec_int_dec(e->data, e->size, &(e_config->focus_policy))) { - /* FIXME: if going to/from click to focus grab/ungrab */ e_config_save_queue(); } + e_border_button_bindings_grab_all(); break; case E_IPC_OP_FOCUS_POLICY_GET: _e_ipc_reply_int_send(e->client, diff --git a/src/bin/e_zone.c b/src/bin/e_zone.c index c292c3fb9..ab5a84c11 100644 --- a/src/bin/e_zone.c +++ b/src/bin/e_zone.c @@ -88,6 +88,7 @@ e_zone_new(E_Container *con, int num, int x, int y, int w, int h) evas_object_move(o, x, y); evas_object_resize(o, w, h); evas_object_color_set(o, 255, 255, 255, 255); + evas_object_repeat_events_set(o, 1); evas_object_show(o); o = edje_object_add(con->bg_evas);