Some fixes for Intel cards:

Do not set enabled until after a current mode is set.
Update original size after we set current mode.
Add an original cloned value we can track.
Add code to apply just cloning changes.

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

SVN revision: 82329
This commit is contained in:
Christopher Michael 2013-01-07 07:39:54 +00:00 committed by Christopher Michael
parent 4c76f30a57
commit 721d4385a9
1 changed files with 62 additions and 69 deletions

View File

@ -279,10 +279,8 @@ e_smart_monitor_setup(Evas_Object *obj)
* NB: This clears old modes and also sets the min & max resolutions */ * NB: This clears old modes and also sets the min & max resolutions */
_e_smart_monitor_modes_fill(sd); _e_smart_monitor_modes_fill(sd);
/* check if enabled */ /* default to disabled */
sd->orig.enabled = EINA_FALSE; sd->orig.enabled = EINA_FALSE;
if ((sd->crtc) && (sd->crtc->current_mode))
sd->orig.enabled = EINA_TRUE;
/* if we have a crtc, get the x/y location of it and current refresh rate /* if we have a crtc, get the x/y location of it and current refresh rate
* *
@ -292,42 +290,29 @@ e_smart_monitor_setup(Evas_Object *obj)
/* set original geometry */ /* set original geometry */
sd->orig.x = sd->crtc->geometry.x; sd->orig.x = sd->crtc->geometry.x;
sd->orig.y = sd->crtc->geometry.y; sd->orig.y = sd->crtc->geometry.y;
sd->orig.w = sd->crtc->geometry.w;
sd->orig.h = sd->crtc->geometry.h;
/* if we do not have a current mode, then this monitor is
* considered disabled. conversly if we do have when then we are
* enabled */
if (sd->crtc->current_mode) sd->orig.enabled = EINA_TRUE;
/* pick the largest possible resolution for a disabled monitor */
if (!sd->crtc->current_mode) if (!sd->crtc->current_mode)
{
sd->crtc->current_mode = eina_list_last_data_get(sd->modes); sd->crtc->current_mode = eina_list_last_data_get(sd->modes);
/* set original mode */ /* set original mode */
sd->orig.mode = sd->crtc->current_mode; sd->orig.mode = sd->crtc->current_mode;
if ((sd->orig.w == 0) || (sd->orig.h == 0))
if (!sd->orig.mode)
{
sd->orig.w = 640;
sd->orig.h = 480;
sd->orig.refresh_rate = 60;
}
else
{ {
sd->orig.w = sd->orig.mode->width; sd->orig.w = sd->orig.mode->width;
sd->orig.h = sd->orig.mode->height; sd->orig.h = sd->orig.mode->height;
}
/* set original refresh rate */ /* set original refresh rate */
sd->orig.refresh_rate = sd->orig.refresh_rate =
_e_smart_monitor_refresh_rate_get(sd->orig.mode); _e_smart_monitor_refresh_rate_get(sd->orig.mode);
}
}
else
{
/* set original mode */
sd->orig.mode = sd->crtc->current_mode;
sd->orig.w = sd->orig.mode->width;
sd->orig.h = sd->orig.mode->height;
/* set original refresh rate */
sd->orig.refresh_rate =
_e_smart_monitor_refresh_rate_get(sd->orig.mode);
}
/* set the original orientation */ /* set the original orientation */
sd->orig.orientation = sd->crtc->current_orientation; sd->orig.orientation = sd->crtc->current_orientation;
@ -445,6 +430,7 @@ e_smart_monitor_changes_reset(Evas_Object *obj)
sd->orig.refresh_rate = sd->current.refresh_rate; sd->orig.refresh_rate = sd->current.refresh_rate;
sd->orig.rotation = sd->current.rotation; sd->orig.rotation = sd->current.rotation;
sd->orig.enabled = sd->current.enabled; sd->orig.enabled = sd->current.enabled;
sd->orig.cloned = sd->current.cloned;
} }
void void
@ -499,7 +485,7 @@ e_smart_monitor_changes_apply(Evas_Object *obj)
noutputs, mx, my, noutputs, mx, my,
sd->current.mode->xid, sd->current.mode->xid,
sd->current.orientation); sd->current.orientation);
free(outputs); if (outputs) free(outputs);
} }
} }
else else
@ -510,9 +496,8 @@ e_smart_monitor_changes_apply(Evas_Object *obj)
reset = EINA_TRUE; reset = EINA_TRUE;
} }
if (sd->changes & E_SMART_MONITOR_CHANGED_POSITION) if ((sd->changes & E_SMART_MONITOR_CHANGED_POSITION) ||
{ (sd->changes & E_SMART_MONITOR_CHANGED_CLONED))
if (sd->crtc)
{ {
Evas_Coord mx, my; Evas_Coord mx, my;
Evas_Coord cx, cy; Evas_Coord cx, cy;
@ -520,6 +505,18 @@ e_smart_monitor_changes_apply(Evas_Object *obj)
mx = sd->current.x; mx = sd->current.x;
my = sd->current.y; my = sd->current.y;
if (sd->current.cloned)
{
E_Smart_Data *psd;
/* grab the parent location and apply that to the clone */
if ((psd = evas_object_smart_data_get(sd->parent)))
{
mx = psd->current.x;
my = psd->current.y;
}
}
ecore_x_randr_crtc_pos_get(root, sd->crtc->xid, &cx, &cy); ecore_x_randr_crtc_pos_get(root, sd->crtc->xid, &cx, &cy);
if ((cx != mx) || (cy != my)) if ((cx != mx) || (cy != my))
{ {
@ -527,7 +524,6 @@ e_smart_monitor_changes_apply(Evas_Object *obj)
reset = EINA_TRUE; reset = EINA_TRUE;
} }
} }
}
if (sd->changes & E_SMART_MONITOR_CHANGED_ROTATION) if (sd->changes & E_SMART_MONITOR_CHANGED_ROTATION)
{ {
@ -536,7 +532,7 @@ e_smart_monitor_changes_apply(Evas_Object *obj)
Ecore_X_Randr_Orientation orient; Ecore_X_Randr_Orientation orient;
orient = sd->current.orientation; orient = sd->current.orientation;
if ((sd->crtc) && (orient != sd->crtc->current_orientation)) if (orient != sd->crtc->current_orientation)
{ {
ecore_x_randr_crtc_orientation_set(root, ecore_x_randr_crtc_orientation_set(root,
sd->crtc->xid, orient); sd->crtc->xid, orient);
@ -639,15 +635,9 @@ e_smart_monitor_clone_add(Evas_Object *obj, Evas_Object *mon)
/* set appropriate changes */ /* set appropriate changes */
if (msd->orig.cloned != msd->current.cloned) if (msd->orig.cloned != msd->current.cloned)
{
msd->changes |= E_SMART_MONITOR_CHANGED_CLONED; msd->changes |= E_SMART_MONITOR_CHANGED_CLONED;
msd->changes |= E_SMART_MONITOR_CHANGED_POSITION;
}
else else
{
msd->changes &= ~(E_SMART_MONITOR_CHANGED_CLONED); msd->changes &= ~(E_SMART_MONITOR_CHANGED_CLONED);
msd->changes &= ~(E_SMART_MONITOR_CHANGED_POSITION);
}
/* set cloned parent */ /* set cloned parent */
msd->parent = obj; msd->parent = obj;
@ -779,15 +769,15 @@ e_smart_monitor_clone_del(Evas_Object *obj, Evas_Object *mon)
* *
* NB: Needed in the case that we have no previous setup, we are in a clone * NB: Needed in the case that we have no previous setup, we are in a clone
* situation (from X), and we were not manually moved */ * situation (from X), and we were not manually moved */
if (msd->orig.cloned) if ((msd->orig.cloned) || (msd->cw == 0) || (msd->ch == 0))
{
if ((msd->cw == 0) || (msd->ch == 0))
{ {
e_layout_child_geometry_get(mon, &x, &y, &w, &h); e_layout_child_geometry_get(mon, &x, &y, &w, &h);
msd->current.x = x; msd->current.x = x;
msd->current.y = y; msd->current.y = y;
} }
}
/* set the resolution name */
_e_smart_monitor_resolution_set(msd, w, h);
/* set parent object */ /* set parent object */
msd->parent = NULL; msd->parent = NULL;
@ -811,7 +801,7 @@ e_smart_monitor_cloned_set(Evas_Object *obj, Eina_Bool cloned)
if (!(sd = evas_object_smart_data_get(obj))) return; if (!(sd = evas_object_smart_data_get(obj))) return;
/* set cloned flag */ /* set cloned flag */
sd->orig.cloned = cloned; sd->orig.cloned = sd->current.cloned = cloned;
} }
void void
@ -1194,7 +1184,8 @@ _e_smart_monitor_refresh_rates_fill(Evas_Object *obj)
char buff[1024]; char buff[1024];
/* create radio group for rates */ /* create radio group for rates */
if (!rg) rg = e_widget_radio_group_new(&sd->current.refresh_rate); if (!rg)
rg = e_widget_radio_group_new(&sd->current.refresh_rate);
/* calculate rate */ /* calculate rate */
rate = _e_smart_monitor_refresh_rate_get(mode); rate = _e_smart_monitor_refresh_rate_get(mode);
@ -1317,7 +1308,6 @@ _e_smart_monitor_background_set(E_Smart_Data *sd, Evas_Coord dx, Evas_Coord dy)
/* tell the thumbnail to use this object for preview */ /* tell the thumbnail to use this object for preview */
e_livethumb_thumb_set(sd->o_thumb, o); e_livethumb_thumb_set(sd->o_thumb, o);
eina_stringshare_del(bg);
} }
} }
@ -1627,6 +1617,9 @@ _e_smart_monitor_move_event(E_Smart_Data *sd, Evas_Object *mon, void *event)
if (ny < sy) ny = sy; if (ny < sy) ny = sy;
} }
if (nx < sd->layout.x) nx = sd->layout.x;
if (ny < sd->layout.y) ny = sd->layout.y;
/* constrain to the layout bounds */ /* constrain to the layout bounds */
if ((nx + mw) > sd->layout.vw) if ((nx + mw) > sd->layout.vw)
nx = (sd->layout.vw - mw); nx = (sd->layout.vw - mw);