From 994586d5095aefd439d716ce6671c7ac90a3ea84 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Tue, 19 Feb 2013 10:59:44 +0000 Subject: [PATCH] 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 SVN revision: 84212 --- src/modules/conf_randr/e_smart_monitor.c | 39 ++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/modules/conf_randr/e_smart_monitor.c b/src/modules/conf_randr/e_smart_monitor.c index 3b1596f..af0f3e8 100644 --- a/src/modules/conf_randr/e_smart_monitor.c +++ b/src/modules/conf_randr/e_smart_monitor.c @@ -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); -- 2.7.4