Skip to content

Instantly share code, notes, and snippets.

@zmike
Last active March 7, 2016 17:52
Show Gist options
  • Select an option

  • Save zmike/152636ccd8f7529c9655 to your computer and use it in GitHub Desktop.

Select an option

Save zmike/152636ccd8f7529c9655 to your computer and use it in GitHub Desktop.
diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c
index 1f6b33b..e09895b 100644
--- a/src/bin/e_comp_object.c
+++ b/src/bin/e_comp_object.c
@@ -350,11 +350,17 @@ _e_comp_object_cb_signal_bind(void *data, Evas_Object *obj EINA_UNUSED, const ch
/* handle evas mouse-in events on client object */
static void
-_e_comp_object_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+_e_comp_object_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_In *ev = event_info;
E_Comp_Object *cw = data;
+ if (e_pixmap_is_x(cw->ec->pixmap))
+ {
+ if (!e_comp_object_frame_allowed(obj)) return;
+ if (E_INSIDE(ev->output.x, ev->output.y, cw->ec->client.x, cw->ec->client.y,
+ cw->ec->client.w, cw->ec->client.h)) return;
+ }
e_client_mouse_in(cw->ec, ev->output.x, ev->output.y);
}
diff --git a/src/bin/e_comp_x.c b/src/bin/e_comp_x.c
index ea5dec3..b1b04f3 100644
--- a/src/bin/e_comp_x.c
+++ b/src/bin/e_comp_x.c
@@ -52,6 +52,12 @@ static Eina_Hash *damages_hash = NULL;
static Eina_Hash *frame_extents = NULL;
static Eina_Hash *alarm_hash = NULL;
+static Evas_Point mouse_in_coords = {-1, -1};
+static Ecore_Job *mouse_in_job;
+static E_Client *focus_job_client;
+static Ecore_Job *focus_job;
+static E_Client *unfocus_job_client;
+static Ecore_Job *unfocus_job;
static Ecore_Idle_Enterer *_e_comp_x_post_client_idler = NULL;
static Ecore_Idle_Enterer *_x_idle_flush = NULL;
static Eina_List *post_clients = NULL;
@@ -2236,6 +2242,14 @@ _e_comp_x_mapping_change(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_E
return ECORE_CALLBACK_PASS_ON;
}
+static void
+_e_comp_x_mouse_in_job(void *d EINA_UNUSED)
+{
+ if (mouse_client)
+ e_client_mouse_in(mouse_client, e_comp_canvas_x_root_adjust(mouse_in_coords.x), e_comp_canvas_x_root_adjust(mouse_in_coords.y));
+ mouse_in_job = NULL;
+}
+
static Eina_Bool
_e_comp_x_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Mouse_In *ev)
{
@@ -2248,19 +2262,22 @@ _e_comp_x_mouse_in(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_M
{
if (ev->detail == ECORE_X_EVENT_DETAIL_INFERIOR)
{
- if (ev->win != e_client_util_win_get(ec)) return ECORE_CALLBACK_RENEW;
- if (ev->event_win != e_client_util_pwin_get(ec)) return ECORE_CALLBACK_RENEW;
+ if (ev->win != e_client_util_pwin_get(ec)) return ECORE_CALLBACK_RENEW;
+ if (ev->event_win != e_client_util_win_get(ec)) return ECORE_CALLBACK_RENEW;
}
if (ev->detail == ECORE_X_EVENT_DETAIL_VIRTUAL)
{
- if (ev->win != e_client_util_pwin_get(ec)) return ECORE_CALLBACK_RENEW;
- if (ev->event_win != e_client_util_win_get(ec)) return ECORE_CALLBACK_RENEW;
+ if (ev->win != e_client_util_win_get(ec)) return ECORE_CALLBACK_RENEW;
+ if (ev->event_win != e_client_util_pwin_get(ec)) return ECORE_CALLBACK_RENEW;
}
if (!evas_object_visible_get(ec->frame)) return ECORE_CALLBACK_RENEW;
}
if (_e_comp_x_client_data_get(ec)->deleted) return ECORE_CALLBACK_RENEW;
mouse_client = ec;
- e_client_mouse_in(ec, e_comp_canvas_x_root_adjust(ev->root.x), e_comp_canvas_x_root_adjust(ev->root.y));
+ if (!mouse_in_job)
+ mouse_in_job = ecore_job_add(_e_comp_x_mouse_in_job, NULL);
+ mouse_in_coords.x = ev->root.x;
+ mouse_in_coords.y = ev->root.y;
return ECORE_CALLBACK_RENEW;
}
@@ -2281,8 +2298,13 @@ _e_comp_x_mouse_out(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_
ec = _e_comp_x_client_find_by_window(ev->win);
if (!ec) return ECORE_CALLBACK_RENEW;
if (_e_comp_x_client_data_get(ec)->deleted) return ECORE_CALLBACK_RENEW;
- if (mouse_client == ec) mouse_client = NULL;
- e_client_mouse_out(ec, e_comp_canvas_x_root_adjust(ev->root.x), e_comp_canvas_x_root_adjust(ev->root.y));
+ if (mouse_client == ec)
+ {
+ mouse_client = NULL;
+ E_FREE_FUNC(mouse_in_job, ecore_job_del);
+ }
+ if (ec->mouse.in)
+ e_client_mouse_out(ec, e_comp_canvas_x_root_adjust(ev->root.x), e_comp_canvas_x_root_adjust(ev->root.y));
return ECORE_CALLBACK_RENEW;
}
@@ -2387,7 +2409,8 @@ _e_comp_x_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_M
if (!evas_object_visible_get(tec->frame)) continue;
if (E_INSIDE(x, y, tec->x, tec->y, tec->w, tec->h)) return ECORE_CALLBACK_RENEW;
}
- e_client_mouse_in(ec, x, y);
+ if (!mouse_in_job)
+ e_client_mouse_in(ec, x, y);
}
return ECORE_CALLBACK_RENEW;
}
@@ -4452,16 +4475,32 @@ _e_comp_x_hook_client_new(void *d EINA_UNUSED, E_Client *ec)
}
static void
-_e_comp_x_hook_client_focus_unset(void *d EINA_UNUSED, E_Client *ec)
+_e_comp_x_hook_client_focus_unset_job(void *d EINA_UNUSED)
{
+ E_Client *ec = unfocus_job_client;
+ unfocus_job = NULL;
+ if (!unfocus_job_client) return;
+ unfocus_job_client = NULL;
E_COMP_X_PIXMAP_CHECK;
_e_comp_x_focus_setup(ec);
_e_comp_x_focus_check();
}
static void
-_e_comp_x_hook_client_focus_set(void *d EINA_UNUSED, E_Client *ec)
+_e_comp_x_hook_client_focus_unset(void *d EINA_UNUSED, E_Client *ec)
{
+ unfocus_job_client = ec;
+ if (!unfocus_job)
+ unfocus_job = ecore_job_add(_e_comp_x_hook_client_focus_unset_job, NULL);
+}
+
+static void
+_e_comp_x_hook_client_focus_set_job(void *d EINA_UNUSED)
+{
+ E_Client *ec = focus_job_client;
+ focus_job = NULL;
+ if (!focus_job_client) return;
+ focus_job_client = NULL;
focus_time = ecore_x_current_time_get();
focus_canvas_time = 0;
if (!e_client_has_xwindow(ec))
@@ -4487,6 +4526,14 @@ _e_comp_x_hook_client_focus_set(void *d EINA_UNUSED, E_Client *ec)
}
static void
+_e_comp_x_hook_client_focus_set(void *d EINA_UNUSED, E_Client *ec)
+{
+ focus_job_client = ec;
+ if (!focus_job)
+ focus_job = ecore_job_add(_e_comp_x_hook_client_focus_set_job, NULL);
+}
+
+static void
_e_comp_x_hook_client_redirect(void *d EINA_UNUSED, E_Client *ec)
{
E_COMP_X_PIXMAP_CHECK;
@@ -4544,6 +4591,8 @@ _e_comp_x_hook_client_del(void *d EINA_UNUSED, E_Client *ec)
cd = _e_comp_x_client_data_get(ec);
if (mouse_client == ec) mouse_client = NULL;
+ if (focus_job_client == ec) focus_job_client = NULL;
+ if (unfocus_job_client == ec) unfocus_job_client = NULL;
if ((!stopping) && cd && (!cd->deleted))
ecore_x_window_prop_card32_set(win, E_ATOM_MANAGED, &visible, 1);
if ((!ec->already_unparented) && cd && cd->reparented)
@@ -4936,6 +4985,9 @@ _e_comp_x_del(E_Comp *c)
eina_list_free(c->x_comp_data->retry_clients);
ecore_timer_del(c->x_comp_data->retry_timer);
+ E_FREE_FUNC(mouse_in_job, ecore_job_del);
+ E_FREE_FUNC(focus_job, ecore_job_del);
+ E_FREE_FUNC(unfocus_job, ecore_job_del);
free(c->x_comp_data);
}
diff --git a/src/bin/e_desk.c b/src/bin/e_desk.c
index 48a8dc6..01bfcd0 100644
--- a/src/bin/e_desk.c
+++ b/src/bin/e_desk.c
@@ -624,11 +624,6 @@ e_desk_flip_end(E_Desk *desk)
_e_desk_event_desk_after_show_free, NULL);
e_comp_shape_queue();
- if (e_comp->comp_type == E_PIXMAP_TYPE_X)
- {
- evas_event_feed_mouse_out(e_comp->evas, 0, NULL);
- evas_event_feed_mouse_in(e_comp->evas, 0, NULL);
- }
if (!e_config->focus_last_focused_per_desktop) return;
if ((e_config->focus_policy == E_FOCUS_MOUSE) ||
(e_config->focus_policy == E_FOCUS_SLOPPY))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment