aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/wayland/wl_seat.c9
-rw-r--r--include/rootston/config.h2
-rw-r--r--include/wlr/types/wlr_cursor.h2
-rw-r--r--include/wlr/types/wlr_output.h4
-rw-r--r--include/wlr/types/wlr_xcursor_manager.h6
-rw-r--r--rootston/config.c2
-rw-r--r--rootston/seat.c7
-rw-r--r--types/wlr_cursor.c6
-rw-r--r--types/wlr_output.c8
-rw-r--r--types/wlr_xcursor_manager.c4
10 files changed, 27 insertions, 23 deletions
diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c
index 9fcc48dd..0d4ebc8d 100644
--- a/backend/wayland/wl_seat.c
+++ b/backend/wayland/wl_seat.c
@@ -59,14 +59,15 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
&box.width, &box.height);
box.x = wl_fixed_to_int(surface_x);
box.y = wl_fixed_to_int(surface_y);
- struct wlr_box transformed;
+ struct wlr_box transformed;
wlr_box_transform(&box, wlr_output->transform, &transformed);
- box.x /= wlr_output->scale;
- box.y /= wlr_output->scale;
+ transformed.x /= wlr_output->scale;
+ transformed.y /= wlr_output->scale;
struct wlr_box layout_box;
- wlr_wl_output_layout_get_box(wlr_wl_pointer->current_output->backend, &layout_box);
+ wlr_wl_output_layout_get_box(wlr_wl_pointer->current_output->backend,
+ &layout_box);
struct wlr_event_pointer_motion_absolute wlr_event;
wlr_event.device = dev;
diff --git a/include/rootston/config.h b/include/rootston/config.h
index 1d54314e..d453a82c 100644
--- a/include/rootston/config.h
+++ b/include/rootston/config.h
@@ -9,7 +9,7 @@ struct roots_output_config {
char *name;
enum wl_output_transform transform;
int x, y;
- int scale;
+ float scale;
struct wl_list link;
struct {
int width, height;
diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h
index c73a4c8d..e072ca05 100644
--- a/include/wlr/types/wlr_cursor.h
+++ b/include/wlr/types/wlr_cursor.h
@@ -68,7 +68,7 @@ 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);
/**
* Set the cursor surface. The surface can be committed to update the cursor
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h
index 39aad718..037fa515 100644
--- a/include/wlr/types/wlr_output.h
+++ b/include/wlr/types/wlr_output.h
@@ -45,7 +45,7 @@ struct wlr_output {
char make[48];
char model[16];
char serial[16];
- uint32_t scale;
+ float scale;
int32_t width, height;
int32_t phys_width, phys_height; // mm
enum wl_output_subpixel subpixel;
@@ -92,7 +92,7 @@ bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
void wlr_output_set_transform(struct wlr_output *output,
enum wl_output_transform transform);
void wlr_output_set_position(struct wlr_output *output, int32_t lx, int32_t ly);
-void wlr_output_set_scale(struct wlr_output *output, uint32_t scale);
+void wlr_output_set_scale(struct wlr_output *output, float scale);
void wlr_output_destroy(struct wlr_output *output);
void wlr_output_effective_resolution(struct wlr_output *output,
int *width, int *height);
diff --git a/include/wlr/types/wlr_xcursor_manager.h b/include/wlr/types/wlr_xcursor_manager.h
index c78a6e8d..2a2c9035 100644
--- a/include/wlr/types/wlr_xcursor_manager.h
+++ b/include/wlr/types/wlr_xcursor_manager.h
@@ -9,7 +9,7 @@
* A scaled XCursor theme.
*/
struct wlr_xcursor_manager_theme {
- uint32_t scale;
+ float scale;
struct wlr_xcursor_theme *theme;
struct wl_list link;
};
@@ -38,10 +38,10 @@ struct wlr_xcursor_manager *wlr_xcursor_manager_create(const char *name,
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 *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);
/**
* Set a `wlr_cursor` image. The manager uses all currently loaded scaled
diff --git a/rootston/config.c b/rootston/config.c
index db77506f..ed91d4fd 100644
--- a/rootston/config.c
+++ b/rootston/config.c
@@ -270,7 +270,7 @@ static int config_ini_handler(void *user, const char *section, const char *name,
} else if (strcmp(name, "y") == 0) {
oc->y = strtol(value, NULL, 10);
} else if (strcmp(name, "scale") == 0) {
- oc->scale = strtol(value, NULL, 10);
+ oc->scale = strtof(value, NULL);
assert(oc->scale >= 1);
} else if (strcmp(name, "rotate") == 0) {
if (strcmp(value, "normal") == 0) {
diff --git a/rootston/seat.c b/rootston/seat.c
index 8a581157..ce0f1374 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -459,11 +459,10 @@ void roots_seat_configure_xcursor(struct roots_seat *seat) {
struct roots_output *output;
wl_list_for_each(output, &seat->input->server->desktop->outputs, link) {
- if (wlr_xcursor_manager_load(seat->cursor->xcursor_manager,
- output->wlr_output->scale)) {
+ float scale = output->wlr_output->scale;
+ if (wlr_xcursor_manager_load(seat->cursor->xcursor_manager, scale)) {
wlr_log(L_ERROR, "Cannot load xcursor theme for output '%s' "
- "with scale %d", output->wlr_output->name,
- output->wlr_output->scale);
+ "with scale %f", output->wlr_output->name, scale);
}
}
diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c
index ec66f7c7..a432c219 100644
--- a/types/wlr_cursor.c
+++ b/types/wlr_cursor.c
@@ -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;
}
diff --git a/types/wlr_output.c b/types/wlr_output.c
index 450d513a..0268d70c 100644
--- a/types/wlr_output.c
+++ b/types/wlr_output.c
@@ -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);
diff --git a/types/wlr_xcursor_manager.c b/types/wlr_xcursor_manager.c
index f32a96bc..d81b639d 100644
--- a/types/wlr_xcursor_manager.c
+++ b/types/wlr_xcursor_manager.c
@@ -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) {