Revert "move x11 suspend window grabbing to comp_x, ungrab on resume"

This reverts commit 7bc179da5a.

this now totally broke the glitch fix and it now animates in reverse
on suspend and does nothng on resume... testing might be a good idea
beforehand...
devs/bu5hm4n/debug_code
Carsten Haitzler 6 years ago
parent 7bc179da5a
commit e90f63b25b
  1. 99
      src/bin/e_comp.c
  2. 4
      src/bin/e_comp.h
  3. 90
      src/bin/e_comp_x.c
  4. 3
      src/bin/e_comp_x.h
  5. 10
      src/bin/e_sys.c

@ -893,6 +893,7 @@ _e_comp_screensaver_on(void *data EINA_UNUSED, int type EINA_UNUSED, void *event
edje_object_signal_emit(zone->base, "e,state,screensaver,on", "e");
edje_object_signal_emit(zone->over, "e,state,screensaver,on", "e");
}
e_comp_screen_suspend();
return ECORE_CALLBACK_PASS_ON;
}
@ -906,6 +907,7 @@ _e_comp_screensaver_off(void *data EINA_UNUSED, int type EINA_UNUSED, void *even
ecore_animator_frametime_set(ecore_frametime);
if (!e_comp->saver) return ECORE_CALLBACK_RENEW;
e_comp_screen_resume();
e_comp_override_del();
e_comp->saver = EINA_FALSE;
if (!e_comp->nocomp)
@ -1800,3 +1802,100 @@ e_comp_util_object_is_above_nocomp(Evas_Object *obj)
return EINA_TRUE;
return EINA_FALSE;
}
#ifndef HAVE_WAYLAND_ONLY
static void
_e_comp_pointer_grab(void)
{
if (e_comp->suspend_grabbed) ecore_x_window_free(e_comp->suspend_grabbed);
e_comp->suspend_grabbed = ecore_x_window_input_new(e_comp->root, 0, 0, 1, 1);
ecore_x_window_show(e_comp->suspend_grabbed);
if (!e_grabinput_get(e_comp->suspend_grabbed, 0, e_comp->suspend_grabbed))
{
ecore_x_window_free(e_comp->suspend_grabbed);
e_comp->suspend_grabbed = 0;
}
}
static void
_e_comp_pointer_ungrab(void)
{
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
{
e_grabinput_release(e_comp->suspend_grabbed, e_comp->suspend_grabbed);
ecore_x_window_free(e_comp->suspend_grabbed);
}
}
static void
_e_comp_cb_pointer_suspend_resume_done(void *data, Evas_Object *obj, const char *emission, const char *source)
{
edje_object_signal_callback_del(obj, emission, source,
_e_comp_cb_pointer_suspend_resume_done);
if (!data) _e_comp_pointer_ungrab();
}
#endif
E_API void
e_comp_screen_suspend(void)
{
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type != E_PIXMAP_TYPE_X) return;
_e_comp_pointer_ungrab();
_e_comp_pointer_grab();
if (!e_comp->suspend_grabbed) return;
if ((e_comp->pointer) && (e_comp->pointer->o_ptr))
{
const char *s = edje_object_data_get(e_comp->pointer->o_ptr,
"can_suspend");
if ((s) && (atoi(s) == 1))
{
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,suspend,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,resume,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
edje_object_signal_callback_add(e_comp->pointer->o_ptr,
"e,state,mouse,suspend,done",
"e",
_e_comp_cb_pointer_suspend_resume_done,
e_comp);
edje_object_signal_emit(e_comp->pointer->o_ptr,
"e,state,mouse,suspend", "e");
}
}
#endif
}
E_API void
e_comp_screen_resume(void)
{
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type != E_PIXMAP_TYPE_X) return;
_e_comp_pointer_ungrab();
_e_comp_pointer_grab();
if (!e_comp->suspend_grabbed) return;
if ((e_comp->pointer) && (e_comp->pointer->o_ptr))
{
const char *s = edje_object_data_get(e_comp->pointer->o_ptr,
"can_suspend");
if ((s) && (atoi(s) == 1))
{
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,suspend,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,resume,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
edje_object_signal_callback_add(e_comp->pointer->o_ptr,
"e,state,mouse,resume,done",
"e",
_e_comp_cb_pointer_suspend_resume_done,
NULL);
edje_object_signal_emit(e_comp->pointer->o_ptr,
"e,state,mouse,resume", "e");
}
}
#endif
}

@ -97,6 +97,7 @@ struct _E_Comp
Ecore_Window win; // input overlay
Ecore_Window root; //x11 root window
Ecore_Window suspend_grabbed; // window grabber for suspending pointer
Ecore_Evas *ee; //canvas
Ecore_Window ee_win; //canvas window
E_Comp_Canvas *canvas;
@ -232,6 +233,9 @@ EINTERN Evas_Object *e_comp_style_selector_create(Evas *evas, const char **sourc
E_API E_Config_Dialog *e_int_config_comp(Evas_Object *parent, const char *params);
E_API E_Config_Dialog *e_int_config_comp_match(Evas_Object *parent, const char *params);
E_API void e_comp_screen_suspend(void);
E_API void e_comp_screen_resume(void);
E_API Eina_Bool e_comp_util_kbd_grabbed(void);
E_API Eina_Bool e_comp_util_mouse_grabbed(void);

@ -70,8 +70,6 @@ extern double e_bl_val;
static Eina_Hash *dead_wins;
static Ecore_Window _e_comp_x_suspend_grabbed; // window grabber for suspending pointer
static void _e_comp_x_hook_client_pre_frame_assign(void *d EINA_UNUSED, E_Client *ec);
static inline E_Comp_X_Client_Data *
@ -4927,92 +4925,6 @@ _e_comp_x_cb_ping(void *data EINA_UNUSED, int ev_type EINA_UNUSED, Ecore_X_Event
return ECORE_CALLBACK_PASS_ON;
}
static void
_e_comp_pointer_grab(void)
{
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, _e_comp_x_suspend_grabbed))
{
ecore_x_window_free(_e_comp_x_suspend_grabbed);
_e_comp_x_suspend_grabbed = 0;
}
}
static void
_e_comp_pointer_ungrab(void)
{
e_grabinput_release(_e_comp_x_suspend_grabbed, _e_comp_x_suspend_grabbed);
ecore_x_window_free(_e_comp_x_suspend_grabbed);
}
static void
_e_comp_cb_pointer_suspend_resume_done(void *data, Evas_Object *obj, const char *emission, const char *source)
{
edje_object_signal_callback_del(obj, emission, source,
_e_comp_cb_pointer_suspend_resume_done);
if (!data) _e_comp_pointer_ungrab();
}
EINTERN Eina_Bool
_e_comp_x_screensaver_on()
{
_e_comp_pointer_ungrab();
_e_comp_pointer_grab();
if (!_e_comp_x_suspend_grabbed) return ECORE_CALLBACK_RENEW;
if ((e_comp->pointer) && (e_comp->pointer->o_ptr))
{
const char *s = edje_object_data_get(e_comp->pointer->o_ptr,
"can_suspend");
if ((s) && (atoi(s) == 1))
{
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,suspend,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,resume,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
edje_object_signal_callback_add(e_comp->pointer->o_ptr,
"e,state,mouse,suspend,done",
"e",
_e_comp_cb_pointer_suspend_resume_done,
e_comp);
edje_object_signal_emit(e_comp->pointer->o_ptr,
"e,state,mouse,suspend", "e");
}
}
return ECORE_CALLBACK_RENEW;
}
EINTERN Eina_Bool
_e_comp_x_screensaver_off()
{
_e_comp_pointer_ungrab();
if ((e_comp->pointer) && (e_comp->pointer->o_ptr))
{
const char *s = edje_object_data_get(e_comp->pointer->o_ptr,
"can_suspend");
if ((s) && (atoi(s) == 1))
{
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,suspend,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
edje_object_signal_callback_del(e_comp->pointer->o_ptr,
"e,state,mouse,resume,done", "e",
_e_comp_cb_pointer_suspend_resume_done);
edje_object_signal_callback_add(e_comp->pointer->o_ptr,
"e,state,mouse,resume,done",
"e",
_e_comp_cb_pointer_suspend_resume_done,
NULL);
edje_object_signal_emit(e_comp->pointer->o_ptr,
"e,state,mouse,resume", "e");
}
}
return ECORE_CALLBACK_RENEW;
}
static Ecore_Timer *screensaver_eval_timer = NULL;
static Eina_Bool saver_on = EINA_FALSE;
@ -5759,8 +5671,6 @@ e_comp_x_init(void)
if (e_comp->comp_type != E_PIXMAP_TYPE_WL)
{
ecore_x_screensaver_event_listen_set(1);
E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON, _e_comp_x_screensaver_on, NULL);
E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON, _e_comp_x_screensaver_off, NULL);
E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_SCREENSAVER_NOTIFY, _e_comp_x_screensaver_notify_cb, NULL);
ecore_x_screensaver_custom_blanking_enable();

@ -118,8 +118,5 @@ EINTERN void e_comp_x_xwayland_client_setup(E_Client *ec, E_Client *wc);
E_API E_Pixmap *e_comp_x_client_pixmap_get(const E_Client *ec);
EINTERN Eina_Bool _e_comp_x_screensaver_on();
EINTERN Eina_Bool _e_comp_x_screensaver_off();
# endif
#endif

@ -162,10 +162,7 @@ _e_sys_comp_emit_cb_wait(E_Sys_Action a, const char *sig, const char *rep, Eina_
else e_comp_override_timed_pop();
_e_sys_comp_zones_fade(sig, nocomp_push);
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
_e_comp_x_screensaver_on();
#endif
e_comp_screen_suspend();
if (rep)
{
@ -220,10 +217,7 @@ _e_sys_comp_resume2(void *data EINA_UNUSED)
Eina_List *l;
E_Zone *zone;
#ifndef HAVE_WAYLAND_ONLY
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
_e_comp_x_screensaver_off();
#endif
e_comp_screen_resume();
EINA_LIST_FOREACH(e_comp->zones, l, zone)
e_backlight_level_set(zone, e_config->backlight.normal, -1.0);
_e_sys_comp_zones_fade("e,state,sys,resume", EINA_FALSE);

Loading…
Cancel
Save