summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2013-06-27 10:57:36 +0100
committerDeon Thomas <PrinceAMD.Elive@gmail.com>2013-06-28 03:28:53 -0400
commitb80fd54f7f01a381af8b05cf36e834afa2f7cda9 (patch)
tree8f5f4fed4dad4383712089eec96cde6f4acc303c
parent1482c7e7e87fc7a1da09130b8842436d58528a87 (diff)
downloadenlightenment-b80fd54f7f01a381af8b05cf36e834afa2f7cda9.tar.gz
Backport: fa9104b :: bugfix T86: If an output does not have a crtc, find a possible one. If it has no mode set yet, then we try to get the preferred mode. If that fails we will try the crtc size, if That fails we will fallback to a safe 640x480. When getting preferred size, if the output does not specifiy a preferred mode (but does list availabe modes), then we will assume the largest size.
Signed-off-by: Chris Michael <cp.michael@samsung.com> Signed-off-by: Deon Thomas <PrinceAMD.Elive@gmail.com>
-rw-r--r--src/modules/conf_randr/e_smart_randr.c95
1 files changed, 40 insertions, 55 deletions
diff --git a/src/modules/conf_randr/e_smart_randr.c b/src/modules/conf_randr/e_smart_randr.c
index c55ba653f4..4a9297920e 100644
--- a/src/modules/conf_randr/e_smart_randr.c
+++ b/src/modules/conf_randr/e_smart_randr.c
@@ -209,6 +209,7 @@ e_smart_randr_monitors_create(Evas_Object *obj)
Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0;
Ecore_X_Randr_Connection_Status status =
ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN;
+ Ecore_X_Randr_Mode mode = 0;
/* ask X if this output is connected */
status =
@@ -242,63 +243,35 @@ e_smart_randr_monitors_create(Evas_Object *obj)
/* tell monitor what the grid is and it's geometry */
e_smart_monitor_grid_set(mon, sd->o_grid, gx, gy, gw, gh);
- /* try to get the crtc of this output */
- if ((crtc = ecore_x_randr_output_crtc_get(root, outputs[i])))
- {
- Ecore_X_Randr_Mode mode = 0;
-
- /* get the geometry for this crtc */
- ecore_x_randr_crtc_geometry_get(root, crtc,
- &cx, &cy, &cw, &ch);
-
- e_smart_monitor_crtc_set(mon, crtc, cx, cy, cw, ch);
-
- mode = ecore_x_randr_crtc_mode_get(root, crtc);
-
- /* if this crtc has no mode, or it's size is 0,
- * then it's disabled */
- if ((!mode) || ((cw == 0) && (ch == 0)))
- {
- /* get the size of the preferred mode for this output */
- _e_smart_randr_monitor_preferred_mode_size_get(outputs[i],
- &mw, &mh);
-
- /* tell monitor what it's current position is
- * NB: This also packs into the grid */
- e_smart_monitor_current_geometry_set(mon, nx, 0, mw, mh);
+ /* try to get the crtc of this output. If it does not have one
+ * we will try to find a usable one */
+ if (!(crtc = ecore_x_randr_output_crtc_get(root, outputs[i])))
+ crtc = _e_smart_randr_crtc_find(outputs[i]);
- /* tell monitor to set the background preview */
- e_smart_monitor_background_set(mon, nx, 0);
+ /* get the geometry for this crtc */
+ ecore_x_randr_crtc_geometry_get(root, crtc,
+ &cx, &cy, &cw, &ch);
- crtcx = nx;
- crtcy = 0;
- nx += mw;
- }
- else
- {
- /* tell monitor what it's current position is
- * NB: This also packs into the grid */
- e_smart_monitor_current_geometry_set(mon, cx, cy,
- cw, ch);
+ e_smart_monitor_crtc_set(mon, crtc, cx, cy, cw, ch);
- /* tell monitor to set the background preview */
- e_smart_monitor_background_set(mon, cx, cy);
+ mode = ecore_x_randr_crtc_mode_get(root, crtc);
- crtcx = cx;
- crtcy = cy;
- nx += cw;
- }
- }
- else
+ /* if this crtc has no mode, or it's size is 0,
+ * then it's disabled */
+ if ((!mode) || ((cw == 0) && (ch == 0)))
{
- crtc = _e_smart_randr_crtc_find(outputs[i]);
-
/* get the size of the preferred mode for this output */
_e_smart_randr_monitor_preferred_mode_size_get(outputs[i],
&mw, &mh);
+ if ((mw == 0) && (mh == 0))
+ ecore_x_randr_crtc_size_get(root, crtc, &mw, &mh);
- /* no crtc assigned to this output. it's disabled */
- e_smart_monitor_crtc_set(mon, crtc, nx, 0, mw, mh);
+ /* safety */
+ if ((mw == 0) && (mh == 0))
+ {
+ mw = 640;
+ mh = 480;
+ }
/* tell monitor what it's current position is
* NB: This also packs into the grid */
@@ -311,6 +284,20 @@ e_smart_randr_monitors_create(Evas_Object *obj)
crtcy = 0;
nx += mw;
}
+ else
+ {
+ /* tell monitor what it's current position is
+ * NB: This also packs into the grid */
+ e_smart_monitor_current_geometry_set(mon, cx, cy,
+ cw, ch);
+
+ /* tell monitor to set the background preview */
+ e_smart_monitor_background_set(mon, cx, cy);
+
+ crtcx = cx;
+ crtcy = cy;
+ nx += cw;
+ }
/* tell monitor what output it uses */
e_smart_monitor_output_set(mon, outputs[i]);
@@ -812,6 +799,7 @@ _e_smart_randr_monitor_preferred_mode_size_get(Ecore_X_Randr_Output output, Evas
if (mw) *mw = 0;
if (mh) *mh = 0;
+
if (!output) return;
root = ecore_x_window_root_first_get();
@@ -819,13 +807,10 @@ _e_smart_randr_monitor_preferred_mode_size_get(Ecore_X_Randr_Output output, Evas
if (!(modes = ecore_x_randr_output_modes_get(root, output, &n, &p)))
return;
- if (n == 0)
- {
- if (modes) free(modes);
- return;
- }
-
- ecore_x_randr_mode_size_get(root, modes[p - 1], mw, mh);
+ if ((n > 0) && (p > 0))
+ ecore_x_randr_mode_size_get(root, modes[p - 1], mw, mh);
+ else if (n > 0)
+ ecore_x_randr_mode_size_get(root, modes[0], mw, mh);
free(modes);
}