{
/* reference to the grid we are packed into */
Evas_Object *obj;
+
Evas_Coord x, y, w, h;
- } grid;
- /* virtual size of the grid */
- Evas_Coord vw, vh;
+ /* virtual size of the grid */
+ Evas_Coord vw, vh;
+ } grid;
/* test object */
/* Evas_Object *o_bg; */
/* background thumbnail */
Evas_Object *o_thumb;
- /* crtc config */
- Ecore_X_Randr_Crtc crtc;
-
- /* crtc geometry */
- Evas_Coord cx, cy, cw, ch;
+ struct
+ {
+ Ecore_X_Randr_Crtc id;
+ Evas_Coord x, y, w, h;
+ } crtc;
/* output config */
Ecore_X_Randr_Output output;
if (!(sd = evas_object_smart_data_get(obj))) return;
/* set the crtc config */
- sd->crtc = crtc;
+ sd->crtc.id = crtc;
/* record the crtc geometry */
- sd->cx = cx;
- sd->cy = cy;
- sd->cw = cw;
- sd->ch = ch;
+ sd->crtc.x = cx;
+ sd->crtc.y = cy;
+ sd->crtc.w = cw;
+ sd->crtc.h = ch;
/* set monitor position text */
- _e_smart_monitor_position_set(sd, sd->cx, sd->cy);
+ _e_smart_monitor_position_set(sd, sd->crtc.x, sd->crtc.y);
/* set monitor resolution text */
- _e_smart_monitor_resolution_set(sd, sd->cw, sd->ch);
+ _e_smart_monitor_resolution_set(sd, sd->crtc.w, sd->crtc.h);
/* get the root window */
root = ecore_x_window_root_first_get();
/* check if orientation is possible and disable if not */
if (orients <= ECORE_X_RANDR_ORIENTATION_ROT_0)
edje_object_signal_emit(sd->o_frame, "e,state,rotate,disabled", "e");
+
+ /* TODO: check crtc current mode to determine if enabled */
}
void
/* try to get the objects smart data */
if (!(sd = evas_object_smart_data_get(obj))) return;
- sd->vw = vw;
- sd->vh = vh;
+ sd->grid.vw = vw;
+ sd->grid.vh = vh;
}
void
sd->zone_num = zone->num;
/* get the desk */
- if (!(desk = e_desk_at_xy_get(zone, sd->cx, sd->cy)))
+ if (!(desk = e_desk_at_xy_get(zone, sd->crtc.x, sd->crtc.y)))
desk = e_desk_current_get(zone);
/* set the background image */
((ev->zone < 0) || (ev->zone == (int)sd->zone_num)))
{
/* check this bg event happened on our desktop */
- if (((ev->desk_x < 0) || (ev->desk_x == sd->cx)) &&
- ((ev->desk_y < 0) || (ev->desk_y == sd->cy)))
+ if (((ev->desk_x < 0) || (ev->desk_x == sd->crtc.x)) &&
+ ((ev->desk_y < 0) || (ev->desk_y == sd->crtc.y)))
{
/* set the livethumb preview to the background of this desktop */
_e_smart_monitor_background_set(sd, ev->desk_x, ev->desk_y);
static inline void
_e_smart_monitor_coord_virtual_to_canvas(E_Smart_Data *sd, double vx, double vy, double *cx, double *cy)
{
- if (cx) *cx = (vx * ((double)(sd->grid.w) / sd->vw)) + sd->grid.x;
- if (cy) *cy = (vy * ((double)(sd->grid.h) / sd->vh)) + sd->grid.y;
+ if (cx) *cx = (vx * ((double)(sd->grid.w) / sd->grid.vw)) + sd->grid.x;
+ if (cy) *cy = (vy * ((double)(sd->grid.h) / sd->grid.vh)) + sd->grid.y;
}
static inline void
_e_smart_monitor_coord_canvas_to_virtual(E_Smart_Data *sd, double cx, double cy, double *vx, double *vy)
{
- if (vx) *vx = ((cx - sd->grid.x) * sd->vw) / (double)sd->grid.w;
- if (vy) *vy = ((cy - sd->grid.y) * sd->vh) / (double)sd->grid.h;
+ if (vx) *vx = ((cx - sd->grid.x) * sd->grid.vw) / (double)sd->grid.w;
+ if (vy) *vy = ((cy - sd->grid.y) * sd->grid.vh) / (double)sd->grid.h;
}
static Ecore_X_Randr_Mode_Info *
evas_pointer_canvas_xy_get(sd->evas, &sd->rx, &sd->ry);
/* record current size of monitor */
- evas_object_grid_pack_get(sd->grid.obj, mon, NULL, NULL, &sd->cw, &sd->ch);
+ evas_object_grid_pack_get(sd->grid.obj, mon, NULL, NULL,
+ &sd->crtc.w, &sd->crtc.h);
/* set resizing flag */
sd->resizing = EINA_TRUE;
if (!(sd = evas_object_smart_data_get(mon))) return;
/* record current size of monitor */
- evas_object_grid_pack_get(sd->grid.obj, mon, NULL, NULL, &sd->cw, &sd->ch);
+ evas_object_grid_pack_get(sd->grid.obj, mon, NULL, NULL,
+ &sd->crtc.w, &sd->crtc.h);
/* set resizing flag */
sd->resizing = EINA_FALSE;
if ((dx == 0) && (dy == 0)) return;
/* convert monitor size to canvas size */
- _e_smart_monitor_coord_virtual_to_canvas(sd, sd->cw, sd->ch, &mw, &mh);
+ _e_smart_monitor_coord_virtual_to_canvas(sd, sd->crtc.w, sd->crtc.h,
+ &mw, &mh);
/* factor in resize difference and convert to virtual */
_e_smart_monitor_coord_canvas_to_virtual(sd, (mw + dx), (mh + dy), &nw, &nh);
if (nh > sd->max.mode_height) nh = sd->max.mode_height;
/* update current size values */
- sd->cw = nw;
- sd->ch = nh;
+ sd->crtc.w = nw;
+ sd->crtc.h = nh;
/* try to find a mode that matches this new size */
if ((mode = _e_smart_monitor_mode_find(sd, nw, nh, EINA_FALSE)))
{
/* update monitor size in the grid */
- evas_object_grid_pack(sd->grid.obj, mon,
- sd->cx, sd->cy, mode->width, mode->height);
+ evas_object_grid_pack(sd->grid.obj, mon, sd->crtc.x, sd->crtc.y,
+ mode->width, mode->height);
/* update resolution text */
_e_smart_monitor_resolution_set(sd, mode->width, mode->height);