Add code to handle when cloning monitors so that the size, mode and

orient of each will match (NB: This is required by XRandR in order for
cloning to be successful).

Signed-off-by: Christopher Michael <cp.michael@samsung.com>

SVN revision: 84212
This commit is contained in:
Christopher Michael 2013-02-19 10:59:44 +00:00 committed by Christopher Michael
parent eec7305dfc
commit 994586d509
1 changed files with 37 additions and 2 deletions

View File

@ -5,7 +5,7 @@
#define RESIZE_FUZZ 80
#define ROTATE_FUZZ 45
#define BG_DBG 1
//#define BG_DBG 1
/* local structure */
typedef struct _E_Smart_Data E_Smart_Data;
@ -124,6 +124,9 @@ struct _E_Smart_Data
/* mini representation when cloned */
Evas_Object *o_clone;
/* record what changed */
E_Smart_Monitor_Changes changes;
};
/* smart function prototypes */
@ -364,7 +367,6 @@ e_smart_monitor_output_set(Evas_Object *obj, Ecore_X_Randr_Output output)
/* set monitor name */
edje_object_part_text_set(sd->o_frame, "e.text.name", name);
printf("Created Monitor %s For Crtc %d\n", name, sd->crtc.id);
/* free any memory allocated from ecore_x_randr */
free(name);
@ -491,6 +493,39 @@ e_smart_monitor_clone_set(Evas_Object *obj, Evas_Object *parent)
evas_object_hide(obj);
/* check if parent is larger */
if ((psd->current.w > sd->current.w) ||
(psd->current.h > sd->current.h))
{
/* NB: X RandR does not allow clones of different size or mode.
* They both must match. Because of that, if the parent is
* larger, then we need to resize the parent down and set the mode */
/* set the parent mode to this mode */
psd->current.mode = sd->current.mode;
psd->current.orient = sd->current.orient;
psd->current.w = sd->current.w;
psd->current.h = sd->current.h;
_e_smart_monitor_resolution_set(psd, psd->current.w, psd->current.h);
evas_object_grid_pack(psd->grid.obj, parent,
psd->current.x, psd->current.y,
psd->current.w, psd->current.h);
}
else if ((sd->current.w > psd->current.w) ||
(sd->current.h > psd->current.h))
{
sd->current.mode = psd->current.mode;
sd->current.orient = psd->current.orient;
sd->current.w = psd->current.w;
sd->current.h = psd->current.h;
_e_smart_monitor_resolution_set(sd, sd->current.w, sd->current.h);
evas_object_grid_pack(sd->grid.obj, obj,
sd->current.x, sd->current.y,
sd->current.w, sd->current.h);
}
_e_smart_monitor_coord_virtual_to_canvas(sd, sd->current.w, sd->current.h, &fw, &fh);
if (fw < 1) fw = (sd->current.w / 10);
if (fh < 1) fh = (sd->current.h / 10);