princeamd pushed a commit to branch enlightenment-0.17.
commit 42ebed15985107ec13378e29e92ab970ffd9a6fc
Author: Chris Michael <[email protected]>
Date: Fri May 24 13:04:58 2013 +0100
Backport: 9f95515 :: Record primary output in randr config.
Signed-off-by: Chris Michael <[email protected]>
Signed-off-by: Deon Thomas <[email protected]>
---
src/bin/e_randr.c | 29 +++++++++++++++++------------
src/bin/e_randr.h | 3 ++-
2 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/src/bin/e_randr.c b/src/bin/e_randr.c
index eefe094..4aa79b6 100644
--- a/src/bin/e_randr.c
+++ b/src/bin/e_randr.c
@@ -156,6 +156,7 @@ _e_randr_config_load(void)
E_CONFIG_VAL(D, T, restore, UCHAR);
E_CONFIG_VAL(D, T, poll_interval, INT);
E_CONFIG_VAL(D, T, config_timestamp, ULL);
+ E_CONFIG_VAL(D, T, primary, INT);
/* try to load the randr config */
if ((e_randr_cfg = e_config_domain_load("e_randr", _e_randr_edd)))
@@ -232,7 +233,7 @@ _e_randr_config_new(void)
root = ecore_x_window_root_first_get();
/* get which output is primary */
- primary = ecore_x_randr_primary_output_get(root);
+ e_randr_cfg->primary = ecore_x_randr_primary_output_get(root);
/* record the current screen size in our config */
ecore_x_randr_screen_current_size_get(root, &e_randr_cfg->screen.width,
@@ -277,7 +278,7 @@ _e_randr_config_new(void)
/* assign crtc for this output */
output_cfg->crtc = crtcs[i];
output_cfg->exists = EINA_TRUE;
- if (outputs[j] == primary)
+ if ((int)outputs[j] == e_randr_cfg->primary)
output_cfg->primary = EINA_TRUE;
if (!primary)
@@ -288,10 +289,10 @@ _e_randr_config_new(void)
/* if no primary is set, then we should
* use the first output listed by xrandr */
output_cfg->primary = EINA_TRUE;
- primary = outputs[j];
+ e_randr_cfg->primary = (int)outputs[j];
ecore_x_randr_primary_output_set(root,
- primary);
+
e_randr_cfg->primary);
}
}
@@ -550,7 +551,8 @@ _e_randr_config_restore(void)
crtc_cfg->orient);
EINA_LIST_FOREACH(valid_outputs, o, out)
- if (out->primary)
+ if ((out->primary) &&
+ ((int)out->xid == e_randr_cfg->primary))
{
ecore_x_randr_primary_output_set(root, out->xid);
break;
@@ -574,6 +576,7 @@ _e_randr_event_cb_screen_change(void *data EINA_UNUSED, int
type EINA_UNUSED, vo
{
Ecore_X_Event_Screen_Change *ev;
Eina_Bool changed = EINA_FALSE;
+ Ecore_X_Randr_Output primary = 0;
ev = event;
@@ -584,6 +587,14 @@ _e_randr_event_cb_screen_change(void *data EINA_UNUSED,
int type EINA_UNUSED, vo
if (ev->root != e_manager_current_get()->root)
return ECORE_CALLBACK_RENEW;
+ primary = ecore_x_randr_primary_output_get(ev->root);
+
+ if (e_randr_cfg->primary != (int)primary)
+ {
+ e_randr_cfg->primary = (int)primary;
+ changed = EINA_TRUE;
+ }
+
if (e_randr_cfg->screen.width != ev->size.width)
{
printf("\tWidth Changed\n");
@@ -861,13 +872,7 @@ _e_randr_event_cb_output_change(void *data EINA_UNUSED,
int type EINA_UNUSED, vo
/* if we added or removed any outputs, we need to reset */
if ((output_new) || (output_removed))
- {
- /* we need to inform X about the changes */
- /* easier just to call the restore function with the updated config */
- /* _e_randr_config_restore(); */
-
- ecore_x_randr_screen_reset(ev->win);
- }
+ ecore_x_randr_screen_reset(ev->win);
return ECORE_CALLBACK_RENEW;
}
diff --git a/src/bin/e_randr.h b/src/bin/e_randr.h
index ff5bcf5..4bae8ba 100644
--- a/src/bin/e_randr.h
+++ b/src/bin/e_randr.h
@@ -14,7 +14,7 @@ typedef struct _E_Randr_Config E_Randr_Config;
#define E_RANDR_VERSION_1_4 ((1 << 16) | 4)
#define E_RANDR_CONFIG_FILE_EPOCH 1
-#define E_RANDR_CONFIG_FILE_GENERATION 2
+#define E_RANDR_CONFIG_FILE_GENERATION 3
#define E_RANDR_CONFIG_FILE_VERSION \
((E_RANDR_CONFIG_FILE_EPOCH * 1000000) + E_RANDR_CONFIG_FILE_GENERATION)
@@ -56,6 +56,7 @@ struct _E_Randr_Config
int poll_interval;
unsigned char restore;
unsigned long config_timestamp;
+ int primary;
};
EINTERN Eina_Bool e_randr_init(void);
--
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev