mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-07 13:29:49 -05:00
Merge branch 'hidpi'
This commit is contained in:
commit
425713b837
14 changed files with 134 additions and 40 deletions
|
|
@ -261,8 +261,8 @@ void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
|
|||
mapping = wlr_output_layout_get_box(cur->state->layout, NULL);
|
||||
}
|
||||
|
||||
double x = mapping->width * x_mm + mapping->x;
|
||||
double y = mapping->height * y_mm + mapping->y;
|
||||
double x = x_mm > 0 ? mapping->width * x_mm + mapping->x : cur->x;
|
||||
double y = y_mm > 0 ? mapping->height * y_mm + mapping->y : cur->y;
|
||||
|
||||
wlr_cursor_warp_unchecked(cur, x, y);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,7 +231,6 @@ void wlr_output_destroy(struct wlr_output *output) {
|
|||
|
||||
void wlr_output_effective_resolution(struct wlr_output *output,
|
||||
int *width, int *height) {
|
||||
// TODO: Scale factor
|
||||
if (output->transform % 2 == 1) {
|
||||
*width = output->height;
|
||||
*height = output->width;
|
||||
|
|
@ -239,6 +238,8 @@ void wlr_output_effective_resolution(struct wlr_output *output,
|
|||
*width = output->width;
|
||||
*height = output->height;
|
||||
}
|
||||
*width /= output->scale;
|
||||
*height /= output->scale;
|
||||
}
|
||||
|
||||
void wlr_output_make_current(struct wlr_output *output) {
|
||||
|
|
@ -269,6 +270,8 @@ static void output_cursor_render(struct wlr_output_cursor *cursor) {
|
|||
output_box.x = output_box.y = 0;
|
||||
wlr_output_effective_resolution(cursor->output, &output_box.width,
|
||||
&output_box.height);
|
||||
output_box.width *= cursor->output->scale;
|
||||
output_box.height *= cursor->output->scale;
|
||||
|
||||
struct wlr_box cursor_box;
|
||||
output_cursor_get_box(cursor, &cursor_box);
|
||||
|
|
@ -471,7 +474,10 @@ void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
|
|||
}
|
||||
}
|
||||
|
||||
bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y) {
|
||||
bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
|
||||
double x, double y) {
|
||||
x *= cursor->output->scale;
|
||||
y *= cursor->output->scale;
|
||||
cursor->x = x;
|
||||
cursor->y = y;
|
||||
|
||||
|
|
@ -483,7 +489,7 @@ bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y) {
|
|||
if (!cursor->output->impl->move_cursor) {
|
||||
return false;
|
||||
}
|
||||
return cursor->output->impl->move_cursor(cursor->output, x, y);
|
||||
return cursor->output->impl->move_cursor(cursor->output, (int)x, (int)y);
|
||||
}
|
||||
|
||||
struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output) {
|
||||
|
|
|
|||
|
|
@ -649,8 +649,8 @@ void wlr_surface_get_matrix(struct wlr_surface *surface,
|
|||
float (*matrix)[16],
|
||||
const float (*projection)[16],
|
||||
const float (*transform)[16]) {
|
||||
int width = surface->texture->width / surface->current->scale;
|
||||
int height = surface->texture->height / surface->current->scale;
|
||||
int width = surface->texture->width;
|
||||
int height = surface->texture->height;
|
||||
float scale[16];
|
||||
wlr_matrix_identity(matrix);
|
||||
if (transform) {
|
||||
|
|
@ -905,3 +905,27 @@ struct wlr_subsurface *wlr_surface_subsurface_at(struct wlr_surface *surface,
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wlr_surface_send_enter(struct wlr_surface *surface,
|
||||
struct wlr_output *output) {
|
||||
struct wl_client *client = wl_resource_get_client(surface->resource);
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &output->wl_resources) {
|
||||
if (client == wl_resource_get_client(resource)) {
|
||||
wl_surface_send_enter(surface->resource, resource);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wlr_surface_send_leave(struct wlr_surface *surface,
|
||||
struct wlr_output *output) {
|
||||
struct wl_client *client = wl_resource_get_client(surface->resource);
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &output->wl_resources) {
|
||||
if (client == wl_resource_get_client(resource)) {
|
||||
wl_surface_send_leave(surface->resource, resource);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue