forked from enlightenment/enlightenment
Add function to randr widget to return the best layout size.
Modify widget creation to use randr layout size function: NB: Needed because we cannot rely on E_RANDR_12->current_size to provide us with something usable. Signed-off-by: Christopher Michael <cp.michael@samsung.com> SVN revision: 81108
This commit is contained in:
parent
99d170a6a9
commit
a3cf759911
|
@ -94,6 +94,12 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
/* try to create randr smart widget */
|
||||
if ((cfdata->o_randr = e_smart_randr_add(evas)))
|
||||
{
|
||||
Evas_Coord lw = 0, lh = 0;
|
||||
|
||||
/* ask randr widget to compute best layout size based on the
|
||||
* size of available crtcs */
|
||||
e_smart_randr_layout_size_get(cfdata->o_randr, &lw, &lh);
|
||||
|
||||
/* calculate virtual size
|
||||
*
|
||||
* NB: Get which size is larger. This is done so that the
|
||||
|
@ -101,10 +107,8 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
* repositioned easily in a horizontal or vertical layout.
|
||||
* Without using MAX (and just using current size) than a
|
||||
* horizontal layout cannot be changed into a vertical layout */
|
||||
cw = MAX(E_RANDR_12->current_size.width,
|
||||
E_RANDR_12->current_size.height);
|
||||
ch = MAX(E_RANDR_12->current_size.width,
|
||||
E_RANDR_12->current_size.height);
|
||||
cw = MAX(lw, lh);
|
||||
ch = MAX(lw, lh);
|
||||
|
||||
/* set the virtual size for the randr widget */
|
||||
e_smart_randr_current_size_set(cfdata->o_randr, cw, ch);
|
||||
|
@ -120,7 +124,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
e_widget_list_object_append(o, cfdata->o_randr, 1, 1, 0.5);
|
||||
}
|
||||
|
||||
/* set a minimum size to 1/10th scale */
|
||||
/* set a minimum size to 1/10th */
|
||||
e_widget_size_min_set(o, (E_RANDR_12->current_size.width / 10),
|
||||
(E_RANDR_12->current_size.height / 10));
|
||||
|
||||
|
@ -134,6 +138,8 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|||
static int
|
||||
_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
/* TODO: Store settings into E_Randr_Serialized_Setup */
|
||||
|
||||
/* tell randr widget to apply changes */
|
||||
e_smart_randr_changes_apply(cfdata->o_randr, cfd->con->manager->root);
|
||||
|
||||
|
|
|
@ -67,6 +67,28 @@ e_smart_randr_add(Evas *evas)
|
|||
return evas_object_smart_add(evas, smart);
|
||||
}
|
||||
|
||||
void
|
||||
e_smart_randr_layout_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
Eina_List *l;
|
||||
E_Randr_Crtc_Info *crtc;
|
||||
Evas_Coord mw = 0, mh = 0;
|
||||
|
||||
/* try to get the objects smart data */
|
||||
if (!(sd = evas_object_smart_data_get(obj))) return;
|
||||
|
||||
/* loop the crtcs, checking for valid output */
|
||||
EINA_LIST_FOREACH(E_RANDR_12->crtcs, l, crtc)
|
||||
{
|
||||
mw += crtc->geometry.w;
|
||||
mh += crtc->geometry.h;
|
||||
}
|
||||
|
||||
if (w) *w = mw;
|
||||
if (h) *h = mh;
|
||||
}
|
||||
|
||||
void
|
||||
e_smart_randr_current_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
# define E_SMART_RANDR_H
|
||||
|
||||
Evas_Object *e_smart_randr_add(Evas *evas);
|
||||
void e_smart_randr_layout_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
|
||||
void e_smart_randr_current_size_set(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
|
||||
void e_smart_randr_monitors_create(Evas_Object *obj);
|
||||
void e_smart_randr_monitor_add(Evas_Object *obj, Evas_Object *mon);
|
||||
|
|
Loading…
Reference in New Issue