From: Enlightenment S. <no-...@en...> - 2013-02-19 11:01:17
|
Log: Add poll_interval to e_randr_cfg. Signed-off-by: Christopher Michael <cp....@sa...> Author: devilhorns Date: 2013-02-19 03:01:05 -0800 (Tue, 19 Feb 2013) New Revision: 84225 Trac: http://trac.enlightenment.org/e/changeset/84225 Modified: trunk/e/src/bin/e_randr.c Modified: trunk/e/src/bin/e_randr.c =================================================================== --- trunk/e/src/bin/e_randr.c 2013-02-19 11:01:02 UTC (rev 84224) +++ trunk/e/src/bin/e_randr.c 2013-02-19 11:01:05 UTC (rev 84225) @@ -151,6 +151,7 @@ E_CONFIG_VAL(D, T, screen.height, INT); E_CONFIG_LIST(D, T, crtcs, _e_randr_crtc_edd); E_CONFIG_VAL(D, T, restore, UCHAR); + E_CONFIG_VAL(D, T, poll_interval, INT); /* try to load the randr config */ if ((e_randr_cfg = e_config_domain_load("e_randr", _e_randr_edd))) @@ -226,6 +227,9 @@ /* by default, restore config */ e_randr_cfg->restore = EINA_TRUE; + /* by default, use 4 sec poll interval */ + e_randr_cfg->poll_interval = 32; + /* grab the root window once */ root = ecore_x_window_root_first_get(); @@ -335,7 +339,7 @@ } /* set limits */ - /* E_CONFIG_LIMIT(); */ + E_CONFIG_LIMIT(e_randr_cfg->poll_interval, 1, 1024); /* save the new config */ e_randr_config_save(); |
From: Enlightenment S. <no-...@en...> - 2013-02-19 11:01:18
|
Log: Start on poller code. Signed-off-by: Christopher Michael <cp....@sa...> Author: devilhorns Date: 2013-02-19 03:01:08 -0800 (Tue, 19 Feb 2013) New Revision: 84226 Trac: http://trac.enlightenment.org/e/changeset/84226 Modified: trunk/e/src/bin/e_randr.c Modified: trunk/e/src/bin/e_randr.c =================================================================== --- trunk/e/src/bin/e_randr.c 2013-02-19 11:01:05 UTC (rev 84225) +++ trunk/e/src/bin/e_randr.c 2013-02-19 11:01:08 UTC (rev 84226) @@ -12,11 +12,14 @@ 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_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 @@ /* 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 @@ 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; +} |
From: Enlightenment S. <no-...@en...> - 2013-02-19 11:01:22
|
Log: Remove poller code for now (broken, does not work as expected, etc, etc). Add exists field for crtc and output. Fix output clones and connection status get to use the correct output. Add some notes and printfs. Signed-off-by: Christopher Michael <cp....@sa...> Author: devilhorns Date: 2013-02-19 03:01:11 -0800 (Tue, 19 Feb 2013) New Revision: 84227 Trac: http://trac.enlightenment.org/e/changeset/84227 Modified: trunk/e/src/bin/e_randr.c Modified: trunk/e/src/bin/e_randr.c =================================================================== --- trunk/e/src/bin/e_randr.c 2013-02-19 11:01:08 UTC (rev 84226) +++ trunk/e/src/bin/e_randr.c 2013-02-19 11:01:11 UTC (rev 84227) @@ -12,14 +12,11 @@ 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; @@ -63,12 +60,6 @@ _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; } @@ -78,9 +69,6 @@ /* 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; @@ -135,6 +123,7 @@ (char *)(&(eroc.clone_count)) - (char *)(&(eroc)), NULL, NULL); E_CONFIG_VAL(D, T, connected, UCHAR); + E_CONFIG_VAL(D, T, exists, UCHAR); /* define edd for crtc config */ _e_randr_crtc_edd = @@ -150,6 +139,7 @@ E_CONFIG_VAL(D, T, height, INT); E_CONFIG_VAL(D, T, orient, UINT); E_CONFIG_VAL(D, T, mode, UINT); + E_CONFIG_VAL(D, T, exists, UCHAR); E_CONFIG_LIST(D, T, outputs, _e_randr_output_edd); /* define edd for randr config */ @@ -269,6 +259,7 @@ /* assign the xid */ crtc_cfg->xid = crtcs[i]; + crtc_cfg->exists = EINA_TRUE; /* record the geometry of this crtc in our config */ ecore_x_randr_crtc_geometry_get(root, crtcs[i], @@ -308,8 +299,6 @@ /* set this output policy */ output_cfg->policy = ECORE_X_RANDR_OUTPUT_POLICY_NONE; - /* TODO: Add code to determine policy */ - /* get if this output is the primary */ output_cfg->primary = EINA_FALSE; if (outputs[j] == primary) @@ -322,18 +311,20 @@ /* get the clones for this output */ output_cfg->clones = - ecore_x_randr_output_clones_get(root, outputs[i], + ecore_x_randr_output_clones_get(root, outputs[j], &clone_count); output_cfg->clone_count = (long)clone_count; status = - ecore_x_randr_output_connection_status_get(root, outputs[i]); + ecore_x_randr_output_connection_status_get(root, outputs[j]); output_cfg->connected = EINA_FALSE; if (status == ECORE_X_RANDR_CONNECTION_STATUS_CONNECTED) output_cfg->connected = EINA_TRUE; + output_cfg->exists = EINA_TRUE; + /* add this output to the list for this crtc */ crtc_cfg->outputs = eina_list_append(crtc_cfg->outputs, output_cfg); @@ -411,6 +402,11 @@ /* grab the root window */ root = ecore_x_window_root_first_get(); + /* FIXME: !! + * + * Optimize and redo this !!! + */ + /* try to get the list of crtcs */ if ((crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs))) { @@ -504,7 +500,7 @@ ev = event; if (ev->crtc == 0) return ECORE_CALLBACK_RENEW; - printf("E_RANDR Event: Crtc Change\n"); + printf("E_RANDR Event: Crtc Change: %d\n", ev->crtc); EINA_LIST_FOREACH(e_randr_cfg->crtcs, l, crtc_cfg) { @@ -549,8 +545,11 @@ /* TODO: NB: Hmmm, this is problematic :( The spec says we should get an * event here when an output is disconnected (hotplug) if * the hardware (video card) is capable of detecting this HOWEVER, in my - * tests, my nvidia card does not detect this */ - printf("E_RANDR Event: Output Change\n"); + * tests, my nvidia card does not detect this. + * + * To work around this, we have added a poller to check X randr config + * against what we have saved in e_randr_cfg */ + printf("E_RANDR Event: Output Change: %d\n", ev->output); EINA_LIST_FOREACH(e_randr_cfg->crtcs, l, crtc_cfg) { @@ -578,8 +577,12 @@ if ((output_cfg->crtc != ev->crtc) || (output_cfg->connected != connected)) { + printf("Output Changed: %d\n", ev->output); + printf("\tConnected: %d\n", connected); + output_cfg->crtc = ev->crtc; output_cfg->connected = connected; + output_cfg->exists = connected; changed = EINA_TRUE; } @@ -603,9 +606,3 @@ 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; -} |
From: Enlightenment S. <no-...@en...> - 2013-02-19 11:01:26
|
Log: Add exists field to crtc and output. Signed-off-by: Christopher Michael <cp....@sa...> Author: devilhorns Date: 2013-02-19 03:01:23 -0800 (Tue, 19 Feb 2013) New Revision: 84231 Trac: http://trac.enlightenment.org/e/changeset/84231 Modified: trunk/e/src/bin/e_randr.h Modified: trunk/e/src/bin/e_randr.h =================================================================== --- trunk/e/src/bin/e_randr.h 2013-02-19 11:01:21 UTC (rev 84230) +++ trunk/e/src/bin/e_randr.h 2013-02-19 11:01:23 UTC (rev 84231) @@ -29,6 +29,7 @@ unsigned int *clones; // array of clones (each element of type ecore_x_randr output id (xid) unsigned long clone_count; // number of clones unsigned char connected; // connection status 0 == connected, 1 == disconnected + unsigned char exists; // is this output present in X ? }; struct _E_Randr_Crtc_Config @@ -37,6 +38,7 @@ int x, y, width, height; // geometry unsigned int orient; // value of the ecore_x_randr_orientation unsigned int mode; // ecore_x_randr mode id (xid) + unsigned char exists; // is this crtc present in X ? Eina_List *outputs; // list of outputs for this crtc }; |
From: Enlightenment S. <no-...@en...> - 2013-02-20 07:45:25
|
Log: Remove commented fixme (no time to optimize this routine right now). Signed-off-by: Christopher Michael <cp....@sa...> Author: devilhorns Date: 2013-02-19 23:45:13 -0800 (Tue, 19 Feb 2013) New Revision: 84255 Trac: http://trac.enlightenment.org/e/changeset/84255 Modified: trunk/e/src/bin/e_randr.c Modified: trunk/e/src/bin/e_randr.c =================================================================== --- trunk/e/src/bin/e_randr.c 2013-02-20 07:37:55 UTC (rev 84254) +++ trunk/e/src/bin/e_randr.c 2013-02-20 07:45:13 UTC (rev 84255) @@ -402,11 +402,6 @@ /* grab the root window */ root = ecore_x_window_root_first_get(); - /* FIXME: !! - * - * Optimize and redo this !!! - */ - /* try to get the list of crtcs */ if ((crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs))) { |