Careful here Mike ...

We not have to Check that an app has changed it ... but that Does Not 
mean an App Did Not change it ;)

think we should still have a listener/handler for that/those cases ... 
That being said, can we tell from the handler/signlar if it was an App 
change or an X change ? and handle accordingly ?

dh


On 21/01/14 21:49, Mike Blumenkrantz wrote:
> discomfitor pushed a commit to branch master.
>
> http://git.enlightenment.org/core/enlightenment.git/commit/?id=215c0409e00b435a2f87a7eca6e0f8dfe87da7a5
>
>  commit 215c0409e00b435a2f87a7eca6e0f8dfe87da7a5 Author: Mike
> Blumenkrantz <zm...@samsung.com> Date:   Tue Jan 21 16:48:09 2014
> -0500
>
> feature: handle xrandr backlight using a single, accurate handler
>
> there's an event from ecore-x which tells us when this property has
> changed, which means we no longer have to be constantly checking to
> see if other apps have changed it --- src/bin/e_backlight.c | 88
> ---------------------------------------------------
> src/bin/e_comp_x.c    | 20 +++++++++++- 2 files changed, 19
> insertions(+), 89 deletions(-)
>
> diff --git a/src/bin/e_backlight.c b/src/bin/e_backlight.c index
> e1978d3..e9879b2 100644 --- a/src/bin/e_backlight.c +++
> b/src/bin/e_backlight.c @@ -17,20 +17,10 @@ static int sysmode =
> MODE_NONE; static Ecore_Animator *bl_anim = NULL; static Eina_List
> *bl_devs = NULL;
>
> -static Ecore_Event_Handler *_e_backlight_handler_config_mode =
> NULL; -static Ecore_Event_Handler
> *_e_backlight_handler_border_fullscreen = NULL; -static
> Ecore_Event_Handler *_e_backlight_handler_border_unfullscreen =
> NULL; -static Ecore_Event_Handler *_e_backlight_handler_border_remove
> = NULL; -static Ecore_Event_Handler
> *_e_backlight_handler_border_iconify = NULL; -static
> Ecore_Event_Handler *_e_backlight_handler_border_uniconify = NULL;
> -static Ecore_Event_Handler *_e_backlight_handler_border_desk_set =
> NULL; -static Ecore_Event_Handler *_e_backlight_handler_desk_show =
> NULL; - static void      _e_backlight_update(E_Zone *zone); static
> void      _e_backlight_set(E_Zone *zone, double val); static
> Eina_Bool _bl_anim(void *data, double pos); static Eina_Bool bl_avail
> = EINA_TRUE; -static Eina_Bool _e_backlight_handler(void *d, int
> type, void *ev); #ifndef WAYLAND_ONLY static Eina_Bool xbl_avail =
> EINA_FALSE; #endif @@ -57,30 +47,6 @@ e_backlight_init(void)
> eeze_init(); #endif
>
> -   _e_backlight_handler_config_mode = ecore_event_handler_add -
> (E_EVENT_CONFIG_MODE_CHANGED, _e_backlight_handler, NULL); - -
> _e_backlight_handler_border_fullscreen = ecore_event_handler_add -
> (E_EVENT_CLIENT_FULLSCREEN, _e_backlight_handler, NULL); - -
> _e_backlight_handler_border_unfullscreen = ecore_event_handler_add -
> (E_EVENT_CLIENT_UNFULLSCREEN, _e_backlight_handler, NULL); - -
> _e_backlight_handler_border_remove = ecore_event_handler_add -
> (E_EVENT_CLIENT_REMOVE, _e_backlight_handler, NULL); - -
> _e_backlight_handler_border_iconify = ecore_event_handler_add -
> (E_EVENT_CLIENT_ICONIFY, _e_backlight_handler, NULL); - -
> _e_backlight_handler_border_uniconify = ecore_event_handler_add -
> (E_EVENT_CLIENT_UNICONIFY, _e_backlight_handler, NULL); - -
> _e_backlight_handler_border_desk_set = ecore_event_handler_add -
> (E_EVENT_CLIENT_DESK_SET, _e_backlight_handler, NULL); - -
> _e_backlight_handler_desk_show = ecore_event_handler_add -
> (E_EVENT_DESK_SHOW, _e_backlight_handler, NULL); - #ifndef
> WAYLAND_ONLY if (e_comp_get(NULL)->man->root) xbl_avail =
> ecore_x_randr_output_backlight_available(); @@ -119,53 +85,7 @@
> e_backlight_shutdown(void) bl_sys_pending_set = EINA_FALSE;
> eeze_shutdown(); #endif -   if (_e_backlight_handler_config_mode) -
> { -
> ecore_event_handler_del(_e_backlight_handler_config_mode); -
> _e_backlight_handler_config_mode = NULL; -     } - -   if
> (_e_backlight_handler_border_fullscreen) -     { -
> ecore_event_handler_del(_e_backlight_handler_border_fullscreen); -
> _e_backlight_handler_border_fullscreen = NULL; -     }
>
> -   if (_e_backlight_handler_border_unfullscreen) -     { -
> ecore_event_handler_del(_e_backlight_handler_border_unfullscreen); -
> _e_backlight_handler_border_unfullscreen = NULL; -     } - -   if
> (_e_backlight_handler_border_remove) -     { -
> ecore_event_handler_del(_e_backlight_handler_border_remove); -
> _e_backlight_handler_border_remove = NULL; -     } - -   if
> (_e_backlight_handler_border_iconify) -     { -
> ecore_event_handler_del(_e_backlight_handler_border_iconify); -
> _e_backlight_handler_border_iconify = NULL; -     } - -   if
> (_e_backlight_handler_border_uniconify) -     { -
> ecore_event_handler_del(_e_backlight_handler_border_uniconify); -
> _e_backlight_handler_border_uniconify = NULL; -     } - -   if
> (_e_backlight_handler_border_desk_set) -     { -
> ecore_event_handler_del(_e_backlight_handler_border_desk_set); -
> _e_backlight_handler_border_desk_set = NULL; -     } - -   if
> (_e_backlight_handler_desk_show) -     { -
> ecore_event_handler_del(_e_backlight_handler_desk_show); -
> _e_backlight_handler_desk_show = NULL; -     } return 1; }
>
> @@ -273,14 +193,6 @@ e_backlight_devices_get(void)
>
> /* local subsystem functions */
>
> -static Eina_Bool -_e_backlight_handler(void *d __UNUSED__, int type
> __UNUSED__, void *ev __UNUSED__) -{ -   if (!bl_anim) -
> e_backlight_update(); -   return ECORE_CALLBACK_PASS_ON; -} - static
> void _e_backlight_update(E_Zone *zone) { diff --git
> a/src/bin/e_comp_x.c b/src/bin/e_comp_x.c index 43e3306..98b312f
> 100644 --- a/src/bin/e_comp_x.c +++ b/src/bin/e_comp_x.c @@ -1,6 +1,9
> @@ #include "e.h" #include <Ecore_X.h>
>
> +# define RANDR_VERSION_1_3 ((1 << 16) | 3) +# define
> RANDR_VERSION_1_4 ((1 << 16) | 4) + #define GRAV_SET(ec, grav)
> \ ecore_x_window_gravity_set(e_client_util_pwin_get(ec), grav);
> \ if (ec->comp_data->lock_win)
> ecore_x_window_gravity_set(ec->comp_data->lock_win, grav);  \ @@
> -51,6 +54,7 @@ static int screen_size_index = -1; static Ecore_Timer
> *screensaver_idle_timer = NULL; static Eina_Bool screensaver_dimmed =
> EINA_FALSE;
>
> +static Ecore_X_Atom backlight_atom = 0;
>
> static inline Ecore_X_Window _e_comp_x_client_window_get(const
> E_Client *ec) @@ -4301,6 +4305,14 @@
> _e_comp_x_screensaver_notify_cb(void *data __UNUSED__, int type
> __UNUSED__, Ecor }
>
> static Eina_Bool +_e_comp_x_backlight_notify_cb(void *data
> EINA_UNUSED, int t EINA_UNUSED,
> Ecore_X_Event_Randr_Output_Property_Notify *ev) +{ +   if
> (ev->property == backlight_atom) +     e_backlight_update(); +
> return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool
> _e_comp_x_cb_frame_extents_request(void *data EINA_UNUSED, int
> ev_type EINA_UNUSED, Ecore_X_Event_Frame_Extents_Request *ev) {
> E_Manager *man; @@ -5087,7 +5099,13 @@ e_comp_x_init(void)
> _e_comp_x_cb_frame_extents_request, NULL);
> E_LIST_HANDLER_APPEND(handlers, ECORE_X_EVENT_PING,
> _e_comp_x_cb_ping, NULL); -   E_LIST_HANDLER_APPEND(handlers,
> ECORE_X_EVENT_SCREENSAVER_NOTIFY, _e_comp_x_screensaver_notify_cb,
> NULL);; +   E_LIST_HANDLER_APPEND(handlers,
> ECORE_X_EVENT_SCREENSAVER_NOTIFY, _e_comp_x_screensaver_notify_cb,
> NULL); +   E_LIST_HANDLER_APPEND(handlers,
> ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY,
> _e_comp_x_backlight_notify_cb, NULL); +   if
> (ecore_x_randr_version_get() >= RANDR_VERSION_1_3) +
> backlight_atom = ecore_x_atom_get("Backlight"); + +   if
> (!backlight_atom) +     backlight_atom =
> ecore_x_atom_get("BACKLIGHT");
>
> ecore_x_screensaver_custom_blanking_enable();
>
>


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to