}
static void
-_e_hwc_window_cursor_position_get(E_Pointer *ptr, E_Output *output, int width, int height, unsigned int *x, unsigned int *y)
+_e_hwc_window_cursor_position_get(E_Pointer *ptr, E_Output *output, int width, int height,
+ double zx, double zy, unsigned int *x, unsigned int *y)
{
int rotation;
- int hot_x, hot_y;
- float ratio_w, ratio_h;
+ int ptr_x, ptr_y;
- rotation = ptr->rotation;
+ if (!ptr->view_client)
+ {
+ if (x) *x = 0;
+ if (y) *y = 0;
+ return;
+ }
- hot_x = ptr->hot.x;
- hot_y = ptr->hot.y;
+ e_view_client_geometry_get(ptr->view_client, &ptr_x, &ptr_y, NULL, NULL);
+ rotation = ptr->rotation;
- if (e_config->cursor_configured_output_resolution.use)
+ if ((zx != 1.0) || (zy != 1.0))
{
- ratio_w = (float)output->config.geom.w / (float)e_config->cursor_configured_output_resolution.w;
- ratio_h = (float)output->config.geom.h / (float)e_config->cursor_configured_output_resolution.h;
-
- if ((ratio_w > 1.0) && (ratio_h > 1.0))
+ if ((rotation == 90) || (rotation == 270))
{
- hot_x = (int)((float)hot_x * (float)ratio_w);
- hot_y = (int)((float)hot_y * (float)ratio_h);
+ width = (int)((double)width * (double)zy);
+ height = (int)((double)height * (double)zx);
+ }
+ else
+ {
+ width = (int)((double)width * (double)zx);
+ height = (int)((double)height * (double)zy);
}
}
switch (rotation)
{
case 0:
- *x = ptr->x - hot_x;
- *y = ptr->y - hot_y;
+ if (x) *x = ptr_x;
+ if (y) *y = ptr_y;
break;
case 90:
- *x = ptr->x - hot_y;
- *y = ptr->y + hot_x - width;
+ if (x) *x = ptr_x;
+ if (y) *y = ptr_y - width;
break;
case 180:
- *x = ptr->x + hot_x - width;
- *y = ptr->y + hot_y - height;
+ if (x) *x = ptr_x - width;
+ if (y) *y = ptr_y - height;
break;
case 270:
- *x = ptr->x + hot_y - height;
- *y = ptr->y - hot_x;
+ if (x) *x = ptr_x - height;
+ if (y) *y = ptr_y;
break;
default:
- *x = ptr->x - hot_x;
- *y = ptr->y - hot_y;
+ if (x) *x = ptr_x;
+ if (y) *y = ptr_y;
break;
}
}
E_Pointer *pointer;
E_Zone *zone;
int rotation;
+ E_Desk *desk;
+ double zx = 1.0, zy = 1.0;
if (!e_hwc_window_is_cursor(hwc_window)) return EINA_FALSE;
pointer = e_pointer_get(ec);
if (!pointer) return EINA_TRUE;
+ if (e_pointer_desk_zoom_enable_get())
+ {
+ desk = e_desk_current_get(hwc_window->zone);
+ if (desk)
+ e_desk_zoom_get(desk, &zx, &zy, NULL, NULL);
+ }
+
hwc_win_info->src_config.format = TBM_FORMAT_ARGB8888;
hwc_win_info->src_config.pos.x = 0;
hwc_win_info->src_config.pos.y = 0;
_e_hwc_window_cursor_position_get(pointer, output,
hwc_win_info->src_config.pos.w,
hwc_win_info->src_config.pos.h,
+ zx, zy,
&hwc_win_info->dst_pos.x,
&hwc_win_info->dst_pos.y);
break;
}
+ if ((zx != 1.0) || (zy != 1.0))
+ {
+ if ((rotation == 90) || (rotation == 270))
+ {
+ hwc_win_info->dst_pos.w = (int)((double)hwc_win_info->dst_pos.w * zy);
+ hwc_win_info->dst_pos.h = (int)((double)hwc_win_info->dst_pos.h * zx);
+ }
+ else
+ {
+ hwc_win_info->dst_pos.w = (int)((double)hwc_win_info->dst_pos.w * zx);
+ hwc_win_info->dst_pos.h = (int)((double)hwc_win_info->dst_pos.h * zy);
+ }
+ }
+
return EINA_TRUE;
}
/* local variables */
static Eina_List *_ptrs = NULL;
static Eina_Bool _initted = EINA_FALSE;
+static Eina_List *event_handlers = NULL;
+static Eina_Bool _desk_zoom_enable = EINA_FALSE;
static int _e_pointer_hooks_delete = 0;
static int _e_pointer_hooks_walking = 0;
*ratio = cal_ratio;
}
+static void
+_e_pointer_desk_zoom_get(double *zx, double *zy)
+{
+ E_Zone *zone;
+ E_Desk *desk;
+
+ if (!_desk_zoom_enable) return;
+
+ zone = e_zone_current_get();
+ if (!zone) return;
+
+ desk = e_desk_current_get(zone);
+ if (!desk) return;
+
+ e_desk_zoom_get(desk, zx, zy, NULL, NULL);
+}
+
/* move the cursor image with the calcaultion of the hot spot */
static void
_e_pointer_position_update(E_Pointer *ptr)
double ratio = 1.0;
int hot_x = 0, hot_y = 0;
E_View *view;
+ double zx = 1.0, zy = 1.0;
if (!ptr->view_client) return;
view = e_view_client_view_get(ptr->view_client);
e_view_client_geometry_get(ptr->view_client, NULL, NULL, &cursor_w, &cursor_h);
_e_pointer_configured_output_resolution_ratio_get(ec, &ratio);
+ _e_pointer_desk_zoom_get(&zx, &zy);
+
+ hot_x = ptr->hot.x;
+ hot_y = ptr->hot.y;
if (ratio != 1.0)
{
- hot_x = (int)((double)ptr->hot.x * ratio);
- hot_y = (int)((double)ptr->hot.y * ratio);
+ hot_x = (int)((double)hot_x * ratio);
+ hot_y = (int)((double)hot_y * ratio);
}
- else
+
+ if ((zx != 1.0) || (zy != 1.0))
{
- hot_x = ptr->hot.x;
- hot_y = ptr->hot.y;
+ if ((rotation == 90) || (rotation == 270))
+ {
+ hot_x = (int)((double)hot_x * zy);
+ hot_y = (int)((double)hot_y * zx);
+ }
+ else
+ {
+ hot_x = (int)((double)hot_x * zx);
+ hot_y = (int)((double)hot_y * zy);
+ }
}
switch (rotation)
int rotation = 0;
double ratio = 1.0;
E_View *view;
+ double zx = 1.0, zy = 1.0;
EINA_SAFETY_ON_NULL_RETURN(ptr);
if (!ptr->view_client) return;
EINA_SAFETY_ON_NULL_RETURN(ec);
_e_pointer_configured_output_resolution_ratio_get(ec, &ratio);
+ _e_pointer_desk_zoom_get(&zx, &zy);
rotation = ptr->rotation;
if ((ratio == 1.0) &&
- ((rotation == 0) || (rotation % 90 != 0) || (rotation / 90 > 3)))
+ ((rotation == 0) || (rotation % 90 != 0) || (rotation / 90 > 3)) &&
+ ((zx == 1.0) && (zy == 1.0)))
{
e_client_map_enable_set(ec, EINA_FALSE);
e_client_map_set(ec, NULL);
e_map_util_rotate(map, rotation, x, y);
}
+ if ((ratio != 1.0) || (zx != 1.0) || (zy != 1.0))
+ e_map_util_zoom(map, ratio * zx, ratio * zy, x, y);
+
e_map_util_points_color_set(map, 255, 255, 255, 255);
e_map_util_object_move_sync_set(map, EINA_TRUE);
return !!e_object_unref(E_OBJECT(ptr));
}
+static Eina_Bool
+_e_pointer_cb_desk_zoom_set(void *data, int type, void *event)
+{
+ E_Pointer *ptr;
+ Eina_List *l;
+
+ if (!_desk_zoom_enable)
+ return ECORE_CALLBACK_PASS_ON;
+
+ EINA_LIST_FOREACH(_ptrs, l, ptr)
+ {
+ _e_pointer_map_apply(ptr);
+ _e_pointer_position_update(ptr);
+ }
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_pointer_cb_desk_zoom_unset(void *data, int type, void *event)
+{
+ E_Pointer *ptr;
+ Eina_List *l;
+
+ if (!_desk_zoom_enable)
+ return ECORE_CALLBACK_PASS_ON;
+
+ EINA_LIST_FOREACH(_ptrs, l, ptr)
+ {
+ _e_pointer_map_apply(ptr);
+ _e_pointer_position_update(ptr);
+ }
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
EINTERN int
e_pointer_init(void)
{
+ E_LIST_HANDLER_APPEND(event_handlers, E_EVENT_DESK_ZOOM_SET,
+ _e_pointer_cb_desk_zoom_set, NULL);
+ E_LIST_HANDLER_APPEND(event_handlers, E_EVENT_DESK_ZOOM_UNSET,
+ _e_pointer_cb_desk_zoom_unset, NULL);
+
_initted = EINA_TRUE;
return 1;
}
EINTERN int
e_pointer_shutdown(void)
{
+ E_FREE_LIST(event_handlers, ecore_event_handler_del);
+
_initted = EINA_FALSE;
return 1;
}
else
_e_pointer_hooks_delete++;
}
+
+E_API Eina_Bool
+e_pointer_desk_zoom_enable_set(Eina_Bool set)
+{
+ E_Pointer *ptr;
+ Eina_List *l;
+
+ if (_desk_zoom_enable == set)
+ return EINA_TRUE;
+
+ _desk_zoom_enable = set;
+
+ EINA_LIST_FOREACH(_ptrs, l, ptr)
+ {
+ _e_pointer_map_apply(ptr);
+ _e_pointer_position_update(ptr);
+ }
+
+ ELOGF("POINTER", "desk_zoom_enable set:%d", NULL, set);
+
+ return EINA_TRUE;
+}
+
+E_API Eina_Bool
+e_pointer_desk_zoom_enable_get(void)
+{
+ return _desk_zoom_enable;
+}