e winlist focus and input - fix to work with basic wheel/mouse ev

this fixes T6415

@fix
devs/devilhorns/rotation
Carsten Haitzler 4 years ago
parent 6b1f5560b4
commit 5ba54b7aa8
  1. 20
      src/bin/e_grabinput.c
  2. 1
      src/bin/e_grabinput.h
  3. 29
      src/modules/winlist/e_mod_main.c
  4. 11
      src/modules/winlist/e_winlist.c

@ -14,6 +14,9 @@ static double last_focus_time = 0.0;
static Ecore_Window focus_fix_win = 0;
static E_Focus_Method focus_fix_method = E_FOCUS_METHOD_NO_INPUT;
static void (*lost_cb) (void *data) = NULL;
static void *lost_data = NULL;
/* externally accessible functions */
EINTERN int
e_grabinput_init(void)
@ -27,9 +30,18 @@ e_grabinput_shutdown(void)
return 1;
}
E_API void
e_grabinput_lost_cb_set(void (*cb) (void *data), void *data)
{
lost_cb = cb;
lost_data = data;
}
E_API int
e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win)
{
Eina_Bool ungrabbed = EINA_FALSE;
if (grab_mouse_win)
{
#ifndef HAVE_WAYLAND_ONLY
@ -37,6 +49,7 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win)
ecore_x_pointer_ungrab();
#endif
grab_mouse_win = 0;
ungrabbed = EINA_TRUE;
}
if (grab_key_win)
{
@ -47,6 +60,13 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win)
grab_key_win = 0;
focus_win = 0;
ungrabbed = EINA_TRUE;
}
if (ungrabbed)
{
if (lost_cb) lost_cb(lost_data);
lost_cb = NULL;
lost_data = NULL;
}
if (mouse_win)
{

@ -14,6 +14,7 @@ typedef enum _E_Focus_Method
EINTERN int e_grabinput_init(void);
EINTERN int e_grabinput_shutdown(void);
E_API void e_grabinput_lost_cb_set(void (*cb) (void *data), void *data);
E_API int e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win);
E_API void e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win);
E_API void e_grabinput_focus(Ecore_Window win, E_Focus_Method method);

@ -4,6 +4,7 @@
/* actual module specifics */
static void _e_mod_action_winlist_cb(E_Object *obj, const char *params);
static Eina_Bool _e_mod_action_winlist_mouse_cb(E_Object *obj, const char *params, E_Binding_Event_Mouse_Button *ev);
static Eina_Bool _e_mod_action_winlist_wheel_cb(E_Object *obj, const char *params, E_Binding_Event_Wheel *ev);
static void _e_mod_action_winlist_key_cb(E_Object *obj, const char *params, Ecore_Event_Key *ev);
static void _e_mod_action_winlist_edge_cb(E_Object *obj, const char *params, E_Event_Zone_Edge *ev);
static void _e_mod_action_winlist_signal_cb(E_Object *obj, const char *params, const char *sig, const char *src);
@ -34,6 +35,7 @@ e_modapi_init(E_Module *m)
{
_act_winlist->func.go = _e_mod_action_winlist_cb;
_act_winlist->func.go_mouse = _e_mod_action_winlist_mouse_cb;
_act_winlist->func.go_wheel = _e_mod_action_winlist_wheel_cb;
_act_winlist->func.go_key = _e_mod_action_winlist_key_cb;
_act_winlist->func.go_edge = _e_mod_action_winlist_edge_cb;
_act_winlist->func.go_signal = _e_mod_action_winlist_signal_cb;
@ -113,7 +115,6 @@ _e_mod_action_winlist_cb_helper(E_Object *obj EINA_UNUSED, const char *params, i
E_Winlist_Filter filter = E_WINLIST_FILTER_NONE;
int direction = 0; // -1 for prev, 1 for next;
int udlr = -1; // 0 for up, 1 for down, 2 for left, 3 for right
Eina_Bool ok = EINA_TRUE;
zone = e_zone_current_get();
if (!zone) return EINA_FALSE;
@ -143,20 +144,11 @@ _e_mod_action_winlist_cb_helper(E_Object *obj EINA_UNUSED, const char *params, i
}
else
direction = 1;
if (direction)
ok = !e_winlist_show(zone, filter);
if (!ok)
{
if (!type) return EINA_FALSE;
e_winlist_modifiers_set(modifiers, type);
return EINA_TRUE;
}
if (direction == 1)
e_winlist_next();
else if (direction == -1)
e_winlist_prev();
else
e_winlist_direction_select(zone, udlr);
e_winlist_modifiers_set(modifiers, type);
if (direction) e_winlist_show(zone, filter);
if (direction == 1) e_winlist_next();
else if (direction == -1) e_winlist_prev();
else e_winlist_direction_select(zone, udlr);
return EINA_TRUE;
}
@ -173,6 +165,13 @@ _e_mod_action_winlist_mouse_cb(E_Object *obj, const char *params, E_Binding_Even
e_bindings_modifiers_to_ecore_convert(ev->modifiers), E_WINLIST_ACTIVATE_TYPE_MOUSE);
}
static Eina_Bool
_e_mod_action_winlist_wheel_cb(E_Object *obj, const char *params, E_Binding_Event_Wheel *ev)
{
return _e_mod_action_winlist_cb_helper(obj, params,
e_bindings_modifiers_to_ecore_convert(ev->modifiers), E_WINLIST_ACTIVATE_TYPE_MOUSE);
}
static void
_e_mod_action_winlist_key_cb(E_Object *obj, const char *params, Ecore_Event_Key *ev)
{

@ -73,6 +73,12 @@ _wmclass_picked(const Eina_List *lst, const char *wmclass)
return EINA_FALSE;
}
static void
_cb_lost(void *data EINA_UNUSED)
{
e_winlist_hide();
}
/* externally accessible functions */
int
e_winlist_init(void)
@ -101,7 +107,7 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter)
E_OBJECT_CHECK_RETURN(zone, 0);
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
if (_winlist) return 0;
if (_winlist) return 1;
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
@ -117,6 +123,7 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter)
_input_window = 0;
return 0;
}
e_grabinput_lost_cb_set(_cb_lost, NULL);
}
#endif
if (e_comp->comp_type != E_PIXMAP_TYPE_X)
@ -155,6 +162,7 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter)
evas_event_freeze(e_comp->evas);
o = edje_object_add(e_comp->evas);
evas_object_pass_events_set(o, EINA_TRUE);
_winlist = e_comp_object_util_add(o, E_COMP_OBJECT_TYPE_POPUP);
evas_object_layer_set(_winlist, E_LAYER_CLIENT_POPUP);
evas_object_move(_winlist, x, y);
@ -561,7 +569,6 @@ e_winlist_direction_select(E_Zone *zone, int dir)
void
e_winlist_modifiers_set(int mod, E_Winlist_Activate_Type type)
{
if (!_winlist) return;
_hold_mod = mod;
_hold_count = 0;
_activate_type = type;

Loading…
Cancel
Save