Skip to content

Commit a564eb4

Browse files
committed
Scale wayland input coordinates
1 parent 6fa62cc commit a564eb4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/icon.h

-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ cairo_surface_t *gdk_pixbuf_to_cairo_surface(GdkPixbuf *pixbuf);
1313
* @param filename A string representing a readable file path
1414
* @param min_size An iteger representing the desired minimum unscaled icon size.
1515
* @param max_size An iteger representing the desired maximum unscaled icon size.
16-
* @param scale An integer representing the output dpi scaling.
1716
*
1817
* @return an instance of `GdkPixbuf`
1918
* @retval NULL: file does not exist, not readable, etc..
@@ -56,7 +55,6 @@ char *get_path_from_icon_name(const char *iconname, int size);
5655
* like described in the notification spec.
5756
* @param id (necessary) A unique identifier of the returned pixbuf.
5857
* Only filled, if the return value is non-NULL.
59-
* @param dpi_scale An integer representing the output dpi scaling.
6058
* @param min_size An integer representing the desired minimum unscaled icon size.
6159
* @param max_size An integer representing the desired maximum unscaled icon size.
6260
* @return an instance of `GdkPixbuf` derived from the GVariant

src/wayland/wl_seat.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "../log.h"
1919
#include "../settings.h"
2020
#include "wl_ctx.h"
21+
#include "wl.h"
2122

2223
static void touch_handle_motion(void *data, struct wl_touch *wl_touch,
2324
uint32_t time, int32_t id,
@@ -50,8 +51,10 @@ static void touch_handle_up(void *data, struct wl_touch *wl_touch,
5051
if (id >= MAX_TOUCHPOINTS) {
5152
return;
5253
}
54+
55+
double scale = wl_get_scale();
5356
input_handle_click(BTN_TOUCH, false,
54-
seat->touch.pts[id].x, seat->touch.pts[id].y);
57+
seat->touch.pts[id].x/scale, seat->touch.pts[id].y/scale);
5558

5659
}
5760

@@ -100,7 +103,8 @@ static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer,
100103
uint32_t button_state) {
101104
struct dunst_seat *seat = data;
102105

103-
input_handle_click(button, button_state, seat->pointer.x, seat->pointer.y);
106+
double scale = wl_get_scale();
107+
input_handle_click(button, button_state, seat->pointer.x/scale, seat->pointer.y/scale);
104108
}
105109

106110
static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer,

0 commit comments

Comments
 (0)