mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-19 06:59:48 -05:00
Introduce fractional scaling
This commit is contained in:
parent
23fb663ea4
commit
51db087210
10 changed files with 24 additions and 20 deletions
|
|
@ -299,11 +299,11 @@ void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
|
|||
|
||||
void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels,
|
||||
int32_t stride, uint32_t width, uint32_t height, int32_t hotspot_x,
|
||||
int32_t hotspot_y, uint32_t scale) {
|
||||
int32_t hotspot_y, float scale) {
|
||||
struct wlr_cursor_output_cursor *output_cursor;
|
||||
wl_list_for_each(output_cursor, &cur->state->output_cursors, link) {
|
||||
if (scale != 0 &&
|
||||
output_cursor->output_cursor->output->scale != scale) {
|
||||
float output_scale = output_cursor->output_cursor->output->scale;
|
||||
if (scale > 0 && output_scale != scale) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
|
|||
}
|
||||
}
|
||||
if (version >= WL_OUTPUT_SCALE_SINCE_VERSION) {
|
||||
wl_output_send_scale(resource, output->scale);
|
||||
wl_output_send_scale(resource, (uint32_t)ceil(output->scale));
|
||||
}
|
||||
if (version >= WL_OUTPUT_DONE_SINCE_VERSION) {
|
||||
wl_output_send_done(resource);
|
||||
|
|
@ -240,7 +240,7 @@ void wlr_output_set_position(struct wlr_output *output, int32_t lx,
|
|||
}
|
||||
}
|
||||
|
||||
void wlr_output_set_scale(struct wlr_output *output, uint32_t scale) {
|
||||
void wlr_output_set_scale(struct wlr_output *output, float scale) {
|
||||
if (output->scale == scale) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -256,6 +256,10 @@ void wlr_output_set_scale(struct wlr_output *output, uint32_t scale) {
|
|||
wl_signal_emit(&output->events.scale, output);
|
||||
}
|
||||
|
||||
uint32_t wlr_output_integral_scale(struct wlr_output *output) {
|
||||
return ceil(output->scale);
|
||||
}
|
||||
|
||||
void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
||||
const struct wlr_output_impl *impl) {
|
||||
assert(impl->make_current && impl->swap_buffers && impl->transform);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ void wlr_xcursor_manager_destroy(struct wlr_xcursor_manager *manager) {
|
|||
}
|
||||
|
||||
int wlr_xcursor_manager_load(struct wlr_xcursor_manager *manager,
|
||||
uint32_t scale) {
|
||||
float scale) {
|
||||
struct wlr_xcursor_manager_theme *theme;
|
||||
wl_list_for_each(theme, &manager->scaled_themes, link) {
|
||||
if (theme->scale == scale) {
|
||||
|
|
@ -56,7 +56,7 @@ int wlr_xcursor_manager_load(struct wlr_xcursor_manager *manager,
|
|||
}
|
||||
|
||||
struct wlr_xcursor *wlr_xcursor_manager_get_xcursor(
|
||||
struct wlr_xcursor_manager *manager, const char *name, uint32_t scale) {
|
||||
struct wlr_xcursor_manager *manager, const char *name, float scale) {
|
||||
struct wlr_xcursor_manager_theme *theme;
|
||||
wl_list_for_each(theme, &manager->scaled_themes, link) {
|
||||
if (theme->scale == scale) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue