_e_output_zoom_get_angle(E_Output *output)
{
E_Client *ec = NULL;
- int angle = 0;
int ec_angle = 0;
ec = _e_output_zoom_top_visible_ec_get();
if (ec)
ec_angle = ec->e.state.rot.ang.curr;
- angle = (ec_angle + output->config.rotation) % 360;
-
- return angle;
+ return ec_angle;
}
static void
-_e_output_zoom_coordinate_cal_with_angle(E_Output *output, int angle)
+_e_output_zoom_raw_xy_get(E_Output *output, int *x, int *y)
{
- int x, y;
- int w, h;
+ int w = 0, h = 0;
- if (angle == 0 || angle == 180)
- {
- w = output->config.geom.w;
- h = output->config.geom.h;
- }
- else
- {
- w = output->config.geom.h;
- h = output->config.geom.w;
- }
+ e_output_size_get(output, &w, &h);
+
+ if (w <= 0 || h <= 0)
+ return;
- if (angle == output->zoom_conf.init_angle)
+ if ((output->zoom_conf.init_screen_rotation == 0) || (output->zoom_conf.init_screen_rotation == 180))
{
- if (angle == 0)
+ if (output->zoom_conf.current_screen_rotation == 0)
{
- output->zoom_conf.adjusted_cx = output->zoom_conf.init_cx;
- output->zoom_conf.adjusted_cy = output->zoom_conf.init_cy;
+ *x = output->zoom_conf.init_cx;
+ *y = output->zoom_conf.init_cy;
}
- else if (angle == 90)
+ else if (output->zoom_conf.current_screen_rotation == 90)
{
- output->zoom_conf.adjusted_cx = output->zoom_conf.init_cy;
- output->zoom_conf.adjusted_cy = w - output->zoom_conf.init_cx - 1;
+ *x = (float)w / h * output->zoom_conf.init_cy;
+ *y = h - (float)h / w * output->zoom_conf.init_cx - 1;
}
- else if (angle == 180)
+ else if (output->zoom_conf.current_screen_rotation == 180)
{
- output->zoom_conf.adjusted_cx = w - output->zoom_conf.init_cx - 1;
- output->zoom_conf.adjusted_cy = h - output->zoom_conf.init_cy - 1;
+ *x = w - output->zoom_conf.init_cx - 1;
+ *y = h - output->zoom_conf.init_cy - 1;
}
- else /* angle == 270 */
+ else /* output->zoom_conf.current_screen_rotation == 270 */
{
- output->zoom_conf.adjusted_cx = h - output->zoom_conf.init_cy - 1;
- output->zoom_conf.adjusted_cy = output->zoom_conf.init_cx;
+ *x = w - (float)w / h * output->zoom_conf.init_cy - 1;
+ *y = (float)h / w * output->zoom_conf.init_cx;
}
}
- else
+ else /* (output->zoom_conf.init_screen_rotation == 90) || (output->zoom_conf.init_screen_rotation == 270) */
{
- if ((angle % 180) == (output->zoom_conf.init_angle % 180)) /* 180 changed from init, don't have to cal ratio */
- {
- x = output->zoom_conf.init_cx;
- y = output->zoom_conf.init_cy;
- }
- else /* 90 or 270 changed from init, need ratio cal*/
- {
- if (angle == 90 || angle == 270)
- {
- x = (float)output->config.geom.h / output->config.geom.w * output->zoom_conf.init_cx;
- y = (float)output->config.geom.w / output->config.geom.h * output->zoom_conf.init_cy;
- }
- else /* 0 or 180 */
- {
- x = (float)output->config.geom.w / output->config.geom.h * output->zoom_conf.init_cx;
- y = (float)output->config.geom.h / output->config.geom.w * output->zoom_conf.init_cy;
- }
- }
- if (angle == 0)
+ if (output->zoom_conf.current_screen_rotation == 0)
{
- output->zoom_conf.adjusted_cx = x;
- output->zoom_conf.adjusted_cy = y;
+ *x = (float)w / h * output->zoom_conf.init_cx;
+ *y = (float)h / w * output->zoom_conf.init_cy;
}
- else if (angle == 90)
+ else if (output->zoom_conf.current_screen_rotation == 90)
{
- output->zoom_conf.adjusted_cx = y;
- output->zoom_conf.adjusted_cy = w - x - 1;
+ *x = output->zoom_conf.init_cy;
+ *y = h - output->zoom_conf.init_cx - 1;
}
- else if (angle == 180)
+ else if (output->zoom_conf.current_screen_rotation == 180)
{
- output->zoom_conf.adjusted_cx = w - x - 1;
- output->zoom_conf.adjusted_cy = h - y - 1;
+ *x = w - (float)w / h * output->zoom_conf.init_cx - 1;
+ *y = h - (float)h / w * output->zoom_conf.init_cy - 1;
}
- else /* angle == 270 */
+ else /* output->zoom_conf.current_screen_rotation == 270 */
{
- output->zoom_conf.adjusted_cx = h - y - 1;
- output->zoom_conf.adjusted_cy = x;
+ *x = w - output->zoom_conf.init_cy - 1;
+ *y = output->zoom_conf.init_cx;
}
}
}
rect->y = (int)(dy / zoomy);
}
+static void
+_e_output_zoom_coordinate_cal(E_Output *output)
+{
+ int x = 0, y = 0;
+ int w = 0, h = 0;
+ int zoomx = 0, zoomy = 0;
+ int rotation_diff = 0;
+
+ rotation_diff = (360 + output->zoom_conf.current_screen_rotation - output->zoom_conf.init_screen_rotation) % 360;
+
+ e_output_size_get(output, &w, &h);
+
+ _e_output_zoom_raw_xy_get(output, &x, &y);
+
+ output->zoom_conf.adjusted_cx = x;
+ output->zoom_conf.adjusted_cy = y;
+
+ if (rotation_diff == 90 || rotation_diff == 270)
+ {
+ zoomx = output->zoom_conf.zoomy;
+ zoomy = output->zoom_conf.zoomx;
+ }
+ else
+ {
+ zoomx = output->zoom_conf.zoomx;
+ zoomy = output->zoom_conf.zoomy;
+ }
+
+ /* get the scaled rect */
+ _e_output_zoom_scaled_rect_get(w, h, zoomx, zoomy, x, y,
+ &output->zoom_conf.rect);
+}
+
static Eina_Bool
_e_output_zoom_touch_transform(E_Output *output, Eina_Bool set)
{
if (set)
ret = e_input_device_touch_transformation_set(dev,
- output->zoom_conf.rect.x, output->zoom_conf.rect.y,
- output->zoom_conf.rect.w, output->zoom_conf.rect.h);
+ output->zoom_conf.rect_touch.x, output->zoom_conf.rect_touch.y,
+ output->zoom_conf.rect_touch.w, output->zoom_conf.rect_touch.h);
else
{
e_output_size_get(output, &w, &h);
e_output_render(output);
}
+static E_Client *
+_e_output_top_visible_ec_get()
+{
+ E_Client *ec;
+ Evas_Object *o;
+ E_Comp_Wl_Client_Data *cdata;
+
+ for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
+ {
+ ec = evas_object_data_get(o, "E_Client");
+
+ /* check e_client and skip e_clients not intersects with zone */
+ if (!ec) continue;
+ if (e_object_is_del(E_OBJECT(ec))) continue;
+ if (e_client_util_ignored_get(ec)) continue;
+ if (ec->iconic) continue;
+ if (ec->visible == 0) continue;
+ if (!(ec->visibility.obscured == 0 || ec->visibility.obscured == 1)) continue;
+ if (!ec->frame) continue;
+ if (!evas_object_visible_get(ec->frame)) continue;
+ /* if ec is subsurface, skip this */
+ cdata = (E_Comp_Wl_Client_Data *)ec->comp_data;
+ if (cdata && cdata->sub.data) continue;
+
+ return ec;
+ }
+
+ return NULL;
+}
+
+static int
+_e_output_top_ec_angle_get(void)
+{
+ E_Client *ec = NULL;
+
+ ec = _e_output_top_visible_ec_get();
+ if (ec)
+ return ec->e.state.rot.ang.curr;
+
+ return 0;
+}
+
+static void
+_e_output_zoom_touch_rect_get(E_Output *output)
+{
+ int x = 0, y = 0;
+ int w = 0, h = 0;
+ int zoomx = 0, zoomy = 0;
+ int rotation_diff = 0;
+
+ rotation_diff = (360 + output->zoom_conf.current_screen_rotation - output->zoom_conf.init_screen_rotation) % 360;
+
+ if (output->zoom_conf.current_screen_rotation == 0 || output->zoom_conf.current_screen_rotation == 180)
+ e_output_size_get(output, &w, &h);
+ else
+ e_output_size_get(output, &h, &w);
+
+ if ((rotation_diff == 90) || (rotation_diff == 270))
+ {
+ x = (float)h / w * output->zoom_conf.init_cx;
+ y = (float)w / h * output->zoom_conf.init_cy;
+ zoomx = output->zoom_conf.zoomy;
+ zoomy = output->zoom_conf.zoomx;
+ }
+ else
+ {
+ x = output->zoom_conf.init_cx;
+ y = output->zoom_conf.init_cy;
+ zoomx = output->zoom_conf.zoomx;
+ zoomy = output->zoom_conf.zoomy;
+ }
+
+ _e_output_zoom_scaled_rect_get(w, h, zoomx, zoomy, x, y,
+ &output->zoom_conf.rect_touch);
+}
+
static void
_e_output_zoom_rotate(E_Output *output)
{
e_output_size_get(output, &w, &h);
- _e_output_zoom_coordinate_cal_with_angle(output, output->zoom_conf.current_angle);
+ _e_output_zoom_coordinate_cal(output);
+ _e_output_zoom_touch_rect_get(output);
- /* get the scaled rect */
- _e_output_zoom_scaled_rect_get(w, h, output->zoom_conf.zoomx, output->zoom_conf.zoomy,
- output->zoom_conf.adjusted_cx, output->zoom_conf.adjusted_cy, &output->zoom_conf.rect);
DBG("zoom_rect rotate(x:%d,y:%d) (w:%d,h:%d)",
output->zoom_conf.rect.x, output->zoom_conf.rect.y, output->zoom_conf.rect.w, output->zoom_conf.rect.h);
int angle = 0;
angle = _e_output_zoom_get_angle(output);
- if (output->zoom_conf.current_angle != angle)
+ if ((output->zoom_conf.current_angle != angle) ||
+ (output->zoom_conf.current_screen_rotation != output->config.rotation))
{
output->zoom_conf.current_angle = angle;
+ output->zoom_conf.current_screen_rotation = output->config.rotation;
_e_output_zoom_rotate(output);
}
}
return aligned_width;
}
-static E_Client *
-_e_output_top_visible_ec_get()
-{
- E_Client *ec;
- Evas_Object *o;
- E_Comp_Wl_Client_Data *cdata;
-
- for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
- {
- ec = evas_object_data_get(o, "E_Client");
-
- /* check e_client and skip e_clients not intersects with zone */
- if (!ec) continue;
- if (e_object_is_del(E_OBJECT(ec))) continue;
- if (e_client_util_ignored_get(ec)) continue;
- if (ec->iconic) continue;
- if (ec->visible == 0) continue;
- if (!(ec->visibility.obscured == 0 || ec->visibility.obscured == 1)) continue;
- if (!ec->frame) continue;
- if (!evas_object_visible_get(ec->frame)) continue;
- /* if ec is subsurface, skip this */
- cdata = (E_Comp_Wl_Client_Data *)ec->comp_data;
- if (cdata && cdata->sub.data) continue;
-
- return ec;
- }
-
- return NULL;
-}
-
-static int
-_e_output_top_ec_angle_get(void)
-{
- E_Client *ec = NULL;
-
- ec = _e_output_top_visible_ec_get();
- if (ec)
- return ec->e.state.rot.ang.curr;
-
- return 0;
-}
-
static E_Output_Capture *
_e_output_tdm_stream_capture_find_data(E_Output *output, tbm_surface_h tsurface)
{
if (cx < 0 || cy < 0) return EINA_FALSE;
if (zoomx <= 0 || zoomy <= 0) return EINA_FALSE;
- if (angle % 180 == 0)
+
+ if (output->config.rotation % 180 == 0)
{
- if (cx >= w || cy >= h) return EINA_FALSE;
+ if (cx >= w || cy >= h)
+ return EINA_FALSE;
}
else
{
- if (cx >= h || cy >= w) return EINA_FALSE;
+ if (cx >= h || cy >= w)
+ return EINA_FALSE;
}
ep = e_output_fb_target_get(output);
output->zoom_conf.init_cy = cy;
output->zoom_conf.init_angle = angle;
output->zoom_conf.current_angle = angle;
+ output->zoom_conf.init_screen_rotation = output->config.rotation;
+ output->zoom_conf.current_screen_rotation = output->config.rotation;
- _e_output_zoom_coordinate_cal_with_angle(output, angle);
-
- /* get the scaled rect */
- _e_output_zoom_scaled_rect_get(w, h, output->zoom_conf.zoomx, output->zoom_conf.zoomy,
- output->zoom_conf.adjusted_cx, output->zoom_conf.adjusted_cy, &output->zoom_conf.rect);
+ _e_output_zoom_coordinate_cal(output);
+ _e_output_zoom_touch_rect_get(output);
if (!e_plane_zoom_set(ep, &output->zoom_conf.rect))
{
output->zoom_conf.rect.y = 0;
output->zoom_conf.rect.w = 0;
output->zoom_conf.rect.h = 0;
+ output->zoom_conf.rect_touch.x = 0;
+ output->zoom_conf.rect_touch.y = 0;
+ output->zoom_conf.rect_touch.w = 0;
+ output->zoom_conf.rect_touch.h = 0;
e_plane_zoom_unset(ep);