use event_grabber to simulate explicit grab during window move/resize actions

this grabs the client's frame as well as any existing edge objects during drags

ref T5552
This commit is contained in:
Mike Blumenkrantz 2017-06-09 20:18:20 -04:00
parent b0a7c98faf
commit d0f45a48a4
3 changed files with 55 additions and 1 deletions

View File

@ -42,6 +42,7 @@ static Eina_List *focus_stack = NULL;
static Eina_List *raise_stack = NULL;
static Eina_Bool comp_grabbed = EINA_FALSE;
static Evas_Object *action_rect;
static Eina_List *handlers = NULL;
//static Eina_Bool client_grabbed = EINA_FALSE;
@ -364,6 +365,7 @@ _e_client_action_input_win_del(void)
if (!comp_grabbed) return 0;
comp_grabbed = 0;
E_FREE_FUNC(action_rect, evas_object_del);
e_comp_ungrab_input(1, 1);
return 1;
}
@ -745,6 +747,25 @@ _e_client_action_input_win_new(void)
return comp_grabbed;
}
static void
_e_client_action_event_grabber_mouse_up(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
if (action_client && action_client->moving)
e_client_act_move_end(action_client, NULL);
}
static void
_e_client_action_event_grabber_init(E_Client *ec)
{
action_rect = e_comp_canvas_event_grabber_add();
evas_object_event_callback_add(action_rect, EVAS_CALLBACK_MOUSE_UP, _e_client_action_event_grabber_mouse_up, NULL);
evas_object_smart_member_add(ec->frame, action_rect);
evas_object_resize(action_rect, e_comp->w, e_comp->h);
evas_object_layer_set(action_rect, EVAS_LAYER_MAX - 100);
evas_object_show(action_rect);
}
static void
_e_client_action_init(E_Client *ec)
{
@ -821,6 +842,7 @@ _e_client_move_begin(E_Client *ec)
return 0;
}
E_FREE_FUNC(ec->raise_timer, ecore_timer_del);
_e_client_action_event_grabber_init(ec);
return 1;
}
@ -5147,6 +5169,7 @@ e_client_resize_begin(E_Client *ec)
return EINA_FALSE;
}
E_FREE_FUNC(ec->raise_timer, ecore_timer_del);
_e_client_action_event_grabber_init(ec);
return EINA_TRUE;
error:
ec->resize_mode = E_POINTER_RESIZE_NONE;

View File

@ -848,6 +848,37 @@ e_comp_canvas_feed_mouse_up(unsigned int activate_time)
}
}
E_API Evas_Object *
e_comp_canvas_event_grabber_add(void)
{
E_Zone *zone;
Eina_List *l;
Evas_Object *o;
o = evas_object_event_grabber_add(e_comp->evas);
EINA_LIST_FOREACH(e_comp->zones, l, zone)
{
#define EDGE_ADD(E) \
if (zone->E) \
evas_object_smart_member_add(zone->E, o)
EDGE_ADD(edge.top);
EDGE_ADD(edge.right);
EDGE_ADD(edge.bottom);
EDGE_ADD(edge.left);
EDGE_ADD(corner.left_top);
EDGE_ADD(corner.right_top);
EDGE_ADD(corner.top_left);
EDGE_ADD(corner.top_right);
EDGE_ADD(corner.left_bottom);
EDGE_ADD(corner.right_bottom);
EDGE_ADD(corner.bottom_left);
EDGE_ADD(corner.bottom_right);
}
return o;
}
EINTERN void
e_comp_canvas_intercept(void)
{

View File

@ -28,7 +28,7 @@ E_API E_Layer e_comp_canvas_client_layer_map_nearest(int layer);
E_API void e_comp_canvas_keys_grab(void);
E_API void e_comp_canvas_keys_ungrab(void);
E_API void e_comp_canvas_feed_mouse_up(unsigned int activate_time);
E_API Evas_Object *e_comp_canvas_event_grabber_add(void);
EINTERN void e_comp_canvas_intercept(void);
/* the following functions are used for adjusting root window coordinates