aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-11-14 18:15:26 +0900
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-11-20 10:42:03 -0500
commite276b75b5d56ae8f113e8b299b0092127bd8e1a9 (patch)
tree9b0b960657bfdcca7c44ab23ee2091b1be589c7e
parentuse last client from E_Exec_Instance list when updating luncher popups (diff)
downloadenlightenment-e276b75b5d56ae8f113e8b299b0092127bd8e1a9.tar.gz
fix mouse hangs after unblank
-rw-r--r--src/bin/e_comp_x.c28
-rw-r--r--src/bin/e_pointer.c28
-rw-r--r--src/bin/e_pointer.h4
3 files changed, 41 insertions, 19 deletions
diff --git a/src/bin/e_comp_x.c b/src/bin/e_comp_x.c
index 91faf9f88..a133f2a6a 100644
--- a/src/bin/e_comp_x.c
+++ b/src/bin/e_comp_x.c
@@ -5075,13 +5075,11 @@ _e_comp_x_cb_ping(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_X_Event
static void
_e_comp_pointer_grab(void)
{
- fprintf(stderr, "E_COMP_X: 06 create grab win and grab pointer\n");
if (_e_comp_x_suspend_grabbed) ecore_x_window_free(_e_comp_x_suspend_grabbed);
_e_comp_x_suspend_grabbed = ecore_x_window_input_new(e_comp->root, 0, 0, 1, 1);
ecore_x_window_show(_e_comp_x_suspend_grabbed);
if (!e_grabinput_get(_e_comp_x_suspend_grabbed, 0, 0))
{
- fprintf(stderr, "E_COMP_X: 07 grab failed\n");
ecore_x_window_free(_e_comp_x_suspend_grabbed);
_e_comp_x_suspend_grabbed = 0;
}
@@ -5091,7 +5089,6 @@ static void
_e_comp_pointer_ungrab(void)
{
if (!_e_comp_x_suspend_grabbed) return;
- fprintf(stderr, "E_COMP_X: 6 really ungrab input and free window\n");
e_grabinput_release(_e_comp_x_suspend_grabbed, 0);
ecore_x_window_free(_e_comp_x_suspend_grabbed);
_e_comp_x_suspend_grabbed = 0;
@@ -5100,17 +5097,20 @@ _e_comp_pointer_ungrab(void)
static void
_e_comp_cb_pointer_suspend_resume_done(void *data, Evas_Object *obj, const char *emission, const char *source)
{
- fprintf(stderr, "E_COMP_X: 5 cursor suspend/resume done\n");
edje_object_signal_callback_del(obj, emission, source,
_e_comp_cb_pointer_suspend_resume_done);
- if (!data) _e_comp_pointer_ungrab();
+ if (!data)
+ {
+ _e_comp_pointer_ungrab();
+ e_pointer_grab_set(e_comp->pointer, EINA_FALSE);
+ }
}
EINTERN Eina_Bool
_e_comp_x_screensaver_on()
{
const char *s;
- fprintf(stderr, "E_COMP_X: 01 screensaver on\n");
+
if ((!e_comp->pointer) || (!e_comp->pointer->o_ptr)) return ECORE_CALLBACK_RENEW;
s = edje_object_data_get(e_comp->pointer->o_ptr, "can_suspend");
@@ -5118,13 +5118,12 @@ _e_comp_x_screensaver_on()
{
if (!e_desklock_state_get())
{
- fprintf(stderr, "E_COMP_X: 02 ungrab then grab pointer\n");
_e_comp_pointer_ungrab();
+ e_pointer_grab_set(e_comp->pointer, EINA_FALSE);
+ e_pointer_grab_set(e_comp->pointer, EINA_TRUE);
_e_comp_pointer_grab();
- fprintf(stderr, "E_COMP_X: 03 no desklock but abort pointer suspend\n");
if (!_e_comp_x_suspend_grabbed) return ECORE_CALLBACK_RENEW;
}
- fprintf(stderr, "E_COMP_X: 04 emit suspend signals to pointer\n");
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,suspend,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
@@ -5147,8 +5146,8 @@ _e_comp_x_screensaver_off()
{
const char *s;
- fprintf(stderr, "E_COMP_X: 1 screensaver off\n");
_e_comp_pointer_ungrab();
+ e_pointer_grab_set(e_comp->pointer, EINA_FALSE);
if ((!e_comp->pointer) || (!e_comp->pointer->o_ptr)) return ECORE_CALLBACK_RENEW;
s = edje_object_data_get(e_comp->pointer->o_ptr, "can_suspend");
@@ -5156,15 +5155,10 @@ _e_comp_x_screensaver_off()
{
if (!e_desklock_state_get())
{
- fprintf(stderr, "E_COMP_X: 2 re-grab pointer because desklock not on\n");
+ e_pointer_grab_set(e_comp->pointer, EINA_TRUE);
_e_comp_pointer_grab();
- if (!_e_comp_x_suspend_grabbed)
- {
- fprintf(stderr, "E_COMP_X: 3 no desklock but abort pointer unsuspend\n");
- return ECORE_CALLBACK_RENEW;
- }
+ if (!_e_comp_x_suspend_grabbed) return ECORE_CALLBACK_RENEW;
}
- fprintf(stderr, "E_COMP_X: 4 emit resume signals to pointer\n");
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,suspend,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
diff --git a/src/bin/e_pointer.c b/src/bin/e_pointer.c
index 4f3648bc8..4387ede26 100644
--- a/src/bin/e_pointer.c
+++ b/src/bin/e_pointer.c
@@ -354,6 +354,7 @@ _e_pointer_cb_free(E_Pointer *ptr)
E_FREE_LIST(ptr->stack, _e_pointer_stack_free);
eina_stringshare_del(ptr->type);
+ eina_stringshare_del(ptr->deferred_type);
E_FREE_FUNC(ptr->idle_tmr, ecore_timer_del);
E_FREE_FUNC(ptr->idle_poll, ecore_poller_del);
@@ -431,6 +432,11 @@ _e_pointer_type_set(E_Pointer *ptr, const char *type)
/* check if pointer type is already set */
if (!e_util_strcmp(ptr->type, type)) return;
+ if (ptr->grabcount > 0)
+ {
+ eina_stringshare_replace(&(ptr->deferred_type), type);
+ return;
+ }
eina_stringshare_replace(&ptr->type, type);
/* don't show cursor if in hidden mode */
@@ -462,7 +468,6 @@ _e_pointer_type_set(E_Pointer *ptr, const char *type)
e_pointer_object_set(ptr, NULL, 0, 0);
else
evas_object_show(ptr->o_ptr);
-
}
else
_e_pointer_x11_setup(ptr, NULL);
@@ -641,7 +646,7 @@ e_pointer_type_pop(E_Pointer *ptr, void *obj, const char *type)
_e_pointer_type_set(ptr, stack->type);
- eina_stringshare_refplace(&ptr->type, stack->type);
+ eina_stringshare_replace(&ptr->type, stack->type);
}
E_API void
@@ -820,6 +825,25 @@ e_pointer_window_add(E_Pointer *ptr, Ecore_Window win)
_e_pointer_x11_setup(ptr, "default");
}
+E_API void
+e_pointer_grab_set(E_Pointer *ptr, Eina_Bool grab)
+{
+ if (grab) ptr->grabcount++;
+ else
+ {
+ if (ptr->grabcount > 0)
+ {
+ ptr->grabcount--;
+ if ((ptr->grabcount == 0) && (ptr->deferred_type))
+ {
+ _e_pointer_type_set(ptr, ptr->deferred_type);
+ eina_stringshare_del(ptr->deferred_type);
+ ptr->deferred_type = NULL;
+ }
+ }
+ }
+}
+
EINTERN void
e_pointers_freeze_set(Eina_Bool set)
{
diff --git a/src/bin/e_pointer.h b/src/bin/e_pointer.h
index 37b6e1952..5786fef09 100644
--- a/src/bin/e_pointer.h
+++ b/src/bin/e_pointer.h
@@ -45,6 +45,7 @@ struct _E_Pointer
int *pixels;
int x, y, w, h;
const char *type;
+ const char *deferred_type;
struct
{
@@ -57,6 +58,8 @@ struct _E_Pointer
Eina_List *stack;
+ unsigned short grabcount;
+
Eina_Bool e_cursor : 1;
Eina_Bool color : 1;
Eina_Bool idle : 1;
@@ -80,5 +83,6 @@ E_API void e_pointer_mode_pop(void *obj, E_Pointer_Mode mode);
E_API void e_pointer_idler_before(void);
E_API void e_pointer_object_set(E_Pointer *ptr, Evas_Object *obj, int x, int y);
E_API void e_pointer_window_add(E_Pointer *ptr, Ecore_Window win);
+E_API void e_pointer_grab_set(E_Pointer *ptr, Eina_Bool grab);
# endif
#endif