WL_EXPORT void weston_output_update_zoom(struct weston_output *output, uint32_t type) { struct weston_seat *seat = weston_zoom_pick_seat(output->compositor); wl_fixed_t x = seat->pointer->x; wl_fixed_t y = seat->pointer->y; zoom_area_center_from_pointer(output, &x, &y); if (type == ZOOM_FOCUS_POINTER) { if (wl_list_empty(&output->zoom.animation_xy.link)) { output->zoom.current.x = seat->pointer->x; output->zoom.current.y = seat->pointer->y; } else { output->zoom.to.x = x; output->zoom.to.y = y; } } if (type == ZOOM_FOCUS_TEXT) { if (wl_list_empty(&output->zoom.animation_xy.link)) { output->zoom.current.x = output->zoom.text_cursor.x; output->zoom.current.y = output->zoom.text_cursor.y; } else { output->zoom.to.x = output->zoom.text_cursor.x; output->zoom.to.y = output->zoom.text_cursor.y; } } weston_zoom_transition(output, type, x, y); weston_output_update_zoom_transform(output); }
static void weston_output_update_zoom_transform(struct weston_output *output) { uint32_t type = output->zoom.type; float global_x, global_y; wl_fixed_t x = output->zoom.current.x; wl_fixed_t y = output->zoom.current.y; float trans_min, trans_max; float ratio, level; level = output->zoom.spring_z.current; ratio = 1 / level; if (!output->zoom.active || level > output->zoom.max_level || level == 0.0f) return; if (type == ZOOM_FOCUS_POINTER && wl_list_empty(&output->zoom.animation_xy.link)) zoom_area_center_from_pointer(output, &x, &y); global_x = wl_fixed_to_double(x); global_y = wl_fixed_to_double(y); output->zoom.trans_x = ((((global_x - output->x) / output->width) * (level * 2)) - level) * ratio; output->zoom.trans_y = ((((global_y - output->y) / output->height) * (level * 2)) - level) * ratio; weston_zoom_apply_output_transform(output, &output->zoom.trans_x, &output->zoom.trans_y); trans_max = level * 2 - level; trans_min = -trans_max; /* Clip zoom area to output */ if (output->zoom.trans_x > trans_max) output->zoom.trans_x = trans_max; else if (output->zoom.trans_x < trans_min) output->zoom.trans_x = trans_min; if (output->zoom.trans_y > trans_max) output->zoom.trans_y = trans_max; else if (output->zoom.trans_y < trans_min) output->zoom.trans_y = trans_min; }
WL_EXPORT void weston_output_update_zoom(struct weston_output *output) { struct weston_seat *seat = weston_zoom_pick_seat(output->compositor); wl_fixed_t x = seat->pointer->x; wl_fixed_t y = seat->pointer->y; zoom_area_center_from_pointer(output, &x, &y); if (wl_list_empty(&output->zoom.animation_xy.link)) { output->zoom.current.x = seat->pointer->x; output->zoom.current.y = seat->pointer->y; } else { output->zoom.to.x = x; output->zoom.to.y = y; } weston_zoom_transition(output, x, y); weston_output_update_zoom_transform(output); }