From bf6d1d43ae9a98437784ba4897f8d99369bc0785 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Tue, 19 Feb 2013 11:01:08 +0000 Subject: [PATCH] Start on poller code. Signed-off-by: Christopher Michael SVN revision: 84226 --- src/bin/e_randr.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/bin/e_randr.c b/src/bin/e_randr.c index f3d47fb23..67878f293 100644 --- a/src/bin/e_randr.c +++ b/src/bin/e_randr.c @@ -12,11 +12,14 @@ static Eina_Bool _e_randr_event_cb_crtc_change(void *data EINA_UNUSED, int type static Eina_Bool _e_randr_event_cb_output_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event); static Eina_Bool _e_randr_event_cb_property_change(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED); +static Eina_Bool _e_randr_poller_cb_check(void *data EINA_UNUSED); + /* local variables */ static Eina_List *_randr_event_handlers = NULL; static E_Config_DD *_e_randr_edd = NULL; static E_Config_DD *_e_randr_crtc_edd = NULL; static E_Config_DD *_e_randr_output_edd = NULL; +static Ecore_Poller *_e_randr_poller = NULL; /* external variables */ EAPI E_Randr_Config *e_randr_cfg = NULL; @@ -60,6 +63,12 @@ e_randr_init(void) _e_randr_event_cb_property_change, NULL); } + /* setup poller for when hotplug events happen and the video card + * may not report them */ + _e_randr_poller = + ecore_poller_add(ECORE_POLLER_CORE, e_randr_cfg->poll_interval, + _e_randr_poller_cb_check, NULL); + return EINA_TRUE; } @@ -69,6 +78,9 @@ e_randr_shutdown(void) /* check if randr is available */ if (!ecore_x_randr_query()) return 1; + /* remove the poller */ + if (_e_randr_poller) ecore_poller_del(_e_randr_poller); + if (ecore_x_randr_version_get() >= E_RANDR_VERSION_1_2) { Ecore_X_Window root = 0; @@ -591,3 +603,9 @@ _e_randr_event_cb_property_change(void *data EINA_UNUSED, int type EINA_UNUSED, printf("E_RANDR Event: Property Change\n"); return ECORE_CALLBACK_RENEW; } + +static Eina_Bool +_e_randr_poller_cb_check(void *data EINA_UNUSED) +{ + return ECORE_CALLBACK_RENEW; +}