summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonin Décimo2021-11-02 09:53:08 +0100
committerAntonin Décimo2021-11-02 09:53:08 +0100
commitc7bc150d8942769527ef2320000d10f9ae13a62f (patch)
tree1e891c1c2d4684de5eac0d60deffad69dcefb582
parent1fce9c70422c952f3afb7065519a8bc67b1222fc (diff)
downloadaur-c7bc150d8942769527ef2320000d10f9ae13a62f.tar.gz
Switch wlroots dev repo to freedesktop.org GitLab
-rw-r--r--.SRCINFO6
-rw-r--r--0001-xwayland-add-support-for-global-scale-factor.patch164
-rw-r--r--0002-xwayland-add-support-for-changing-global-scale-facto.patch134
-rw-r--r--PKGBUILD13
4 files changed, 310 insertions, 7 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 6e64f9e8176f..886f6aaf719d 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -29,8 +29,10 @@ pkgbase = wlroots-hidpi-git
conflicts = wlroots-git
options = debug
source = wlroots-hidpi-git::git+https://github.com/swaywm/wlroots
- source = xwayland_hidpi.diff::https://github.com/swaywm/wlroots/compare/master...MisterDA:xwayland_hidpi.diff
+ source = 0001-xwayland-add-support-for-global-scale-factor.patch
+ source = 0002-xwayland-add-support-for-changing-global-scale-facto.patch
sha256sums = SKIP
- sha256sums = bd3a5295c404be332372d1504177d1e7c7fd8649b0bc9ef603c586843a46f4b4
+ sha256sums = 68f1c7c550a317d8175311325b6c4809b0ec761b0badba7926eca7475d1bc27f
+ sha256sums = 9004f727c18129c667804fa987938c8d4a1a27ec8fed6bb2668f03284a884dcc
pkgname = wlroots-hidpi-git
diff --git a/0001-xwayland-add-support-for-global-scale-factor.patch b/0001-xwayland-add-support-for-global-scale-factor.patch
new file mode 100644
index 000000000000..0050a8a27ed7
--- /dev/null
+++ b/0001-xwayland-add-support-for-global-scale-factor.patch
@@ -0,0 +1,164 @@
+From c84ece04da099f7d6bae6d3341918f4f80bf9e29 Mon Sep 17 00:00:00 2001
+From: Dario Nieuwenhuis <dirbaio@dirbaio.net>
+Date: Fri, 31 Jan 2020 22:57:48 +0100
+Subject: [PATCH 1/2] xwayland: add support for global scale factor
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This does the necessary changes to support HiDPI in xwayland
+applications, with the following xwayland patch:
+https://gitlab.freedesktop.org/xorg/xserver/merge_requests/111
+
+[Antonin Décimo: rebase after 27609ba]
+[Antonin Décimo: rebase after 99f3c64]
+[Antonin Décimo: rebase after 79be26f]
+Co-authored-by: Antonin Décimo <antonin.decimo@gmail.com>
+---
+ include/wlr/xwayland.h | 4 ++++
+ xwayland/server.c | 2 ++
+ xwayland/xwayland.c | 4 ++++
+ xwayland/xwm.c | 47 ++++++++++++++++++++++++++++++------------
+ 4 files changed, 44 insertions(+), 13 deletions(-)
+
+diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h
+index 3689b8b3..00cee542 100644
+--- a/include/wlr/xwayland.h
++++ b/include/wlr/xwayland.h
+@@ -32,6 +32,8 @@ struct wlr_xwayland_server {
+
+ time_t server_start;
+
++ int32_t scale;
++
+ /* Anything above display is reset on Xwayland restart, rest is conserved */
+
+ int display;
+@@ -262,6 +264,8 @@ struct wlr_xwayland *wlr_xwayland_create(struct wl_display *wl_display,
+
+ void wlr_xwayland_destroy(struct wlr_xwayland *wlr_xwayland);
+
++void wlr_xwayland_set_scale(struct wlr_xwayland *wlr_xwayland, int32_t scale);
++
+ void wlr_xwayland_set_cursor(struct wlr_xwayland *wlr_xwayland,
+ uint8_t *pixels, uint32_t stride, uint32_t width, uint32_t height,
+ int32_t hotspot_x, int32_t hotspot_y);
+diff --git a/xwayland/server.c b/xwayland/server.c
+index 7af01b6f..fa4dfb34 100644
+--- a/xwayland/server.c
++++ b/xwayland/server.c
+@@ -449,6 +449,8 @@ struct wlr_xwayland_server *wlr_xwayland_server_create(
+ server->wl_fd[0] = server->wl_fd[1] = -1;
+ server->wm_fd[0] = server->wm_fd[1] = -1;
+
++ server->scale = 1;
++
+ wl_signal_init(&server->events.ready);
+ wl_signal_init(&server->events.destroy);
+
+diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c
+index 86e8c6eb..a6397a1a 100644
+--- a/xwayland/xwayland.c
++++ b/xwayland/xwayland.c
+@@ -104,6 +104,10 @@ struct wlr_xwayland *wlr_xwayland_create(struct wl_display *wl_display,
+ return xwayland;
+ }
+
++void wlr_xwayland_set_scale(struct wlr_xwayland *xwayland, int32_t scale) {
++ xwayland->server->scale = scale;
++}
++
+ void wlr_xwayland_set_cursor(struct wlr_xwayland *xwayland,
+ uint8_t *pixels, uint32_t stride, uint32_t width, uint32_t height,
+ int32_t hotspot_x, int32_t hotspot_y) {
+diff --git a/xwayland/xwm.c b/xwayland/xwm.c
+index 313bfc0a..d0423126 100644
+--- a/xwayland/xwm.c
++++ b/xwayland/xwm.c
+@@ -20,6 +20,14 @@
+ #include "util/signal.h"
+ #include "xwayland/xwm.h"
+
++static int32_t scale(struct wlr_xwm *xwm, int32_t val) {
++ return val * xwm->xwayland->server->scale;
++}
++
++static int32_t unscale(struct wlr_xwm *xwm, int32_t val) {
++ return (val + xwm->xwayland->server->scale/2) / xwm->xwayland->server->scale;
++}
++
+ const char *const atom_map[ATOM_LAST] = {
+ [WL_SURFACE_ID] = "WL_SURFACE_ID",
+ [WM_DELETE_WINDOW] = "WM_DELETE_WINDOW",
+@@ -948,8 +956,13 @@ static void xwm_handle_create_notify(struct wlr_xwm *xwm,
+ return;
+ }
+
+- xwayland_surface_create(xwm, ev->window, ev->x, ev->y,
+- ev->width, ev->height, ev->override_redirect);
++ xwayland_surface_create(xwm, ev->window,
++ unscale(xwm, ev->x),
++ unscale(xwm, ev->y),
++ unscale(xwm, ev->width),
++ unscale(xwm, ev->height),
++ ev->override_redirect
++ );
+ }
+
+ static void xwm_handle_destroy_notify(struct wlr_xwm *xwm,
+@@ -980,10 +993,10 @@ static void xwm_handle_configure_request(struct wlr_xwm *xwm,
+
+ struct wlr_xwayland_surface_configure_event wlr_event = {
+ .surface = surface,
+- .x = mask & XCB_CONFIG_WINDOW_X ? ev->x : surface->x,
+- .y = mask & XCB_CONFIG_WINDOW_Y ? ev->y : surface->y,
+- .width = mask & XCB_CONFIG_WINDOW_WIDTH ? ev->width : surface->width,
+- .height = mask & XCB_CONFIG_WINDOW_HEIGHT ? ev->height : surface->height,
++ .x = unscale(xwm, mask & XCB_CONFIG_WINDOW_X ? ev->x : surface->x),
++ .y = unscale(xwm, mask & XCB_CONFIG_WINDOW_Y ? ev->y : surface->y),
++ .width = unscale(xwm, mask & XCB_CONFIG_WINDOW_WIDTH ? ev->width : surface->width),
++ .height = unscale(xwm, mask & XCB_CONFIG_WINDOW_HEIGHT ? ev->height : surface->height),
+ .mask = mask,
+ };
+
+@@ -998,14 +1011,16 @@ static void xwm_handle_configure_notify(struct wlr_xwm *xwm,
+ }
+
+ bool geometry_changed =
+- (xsurface->x != ev->x || xsurface->y != ev->y ||
+- xsurface->width != ev->width || xsurface->height != ev->height);
++ (xsurface->x != unscale(xwm, ev->x) ||
++ xsurface->y != unscale(xwm, ev->y) ||
++ xsurface->width != unscale(xwm, ev->width) ||
++ xsurface->height != unscale(xwm, ev->height));
+
+ if (geometry_changed) {
+- xsurface->x = ev->x;
+- xsurface->y = ev->y;
+- xsurface->width = ev->width;
+- xsurface->height = ev->height;
++ xsurface->x = unscale(xwm, ev->x);
++ xsurface->y = unscale(xwm, ev->y);
++ xsurface->width = unscale(xwm, ev->width);
++ xsurface->height = unscale(xwm, ev->height);
+ }
+
+ if (xsurface->override_redirect != ev->override_redirect) {
+@@ -1717,7 +1732,13 @@ void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *xsurface,
+ uint32_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
+ XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT |
+ XCB_CONFIG_WINDOW_BORDER_WIDTH;
+- uint32_t values[] = {x, y, width, height, 0};
++ uint32_t values[] = {
++ scale(xsurface->xwm, x),
++ scale(xsurface->xwm, y),
++ scale(xsurface->xwm, width),
++ scale(xsurface->xwm, height),
++ 0,
++ };
+ xcb_configure_window(xwm->xcb_conn, xsurface->window_id, mask, values);
+ xcb_flush(xwm->xcb_conn);
+ }
+--
+2.33.1
+
diff --git a/0002-xwayland-add-support-for-changing-global-scale-facto.patch b/0002-xwayland-add-support-for-changing-global-scale-facto.patch
new file mode 100644
index 000000000000..dcad54666126
--- /dev/null
+++ b/0002-xwayland-add-support-for-changing-global-scale-facto.patch
@@ -0,0 +1,134 @@
+From eae4b468fc2d04e9db5688abaf4e34ea472d8aaf Mon Sep 17 00:00:00 2001
+From: Dario Nieuwenhuis <dirbaio@dirbaio.net>
+Date: Tue, 10 Mar 2020 23:21:11 +0100
+Subject: [PATCH 2/2] xwayland: add support for changing global scale factor on
+ the fly via x extension.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+[Antonin Décimo: rebase after e0f239f]
+[Antonin Décimo: rebase after 1eb38e0]
+[Antonin Décimo: rebase after 79be26f]
+---
+ include/xwayland/xwm.h | 3 +++
+ xwayland/xwayland.c | 3 +++
+ xwayland/xwm.c | 44 ++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 50 insertions(+)
+
+diff --git a/include/xwayland/xwm.h b/include/xwayland/xwm.h
+index 0cdf6ea1..367605d9 100644
+--- a/include/xwayland/xwm.h
++++ b/include/xwayland/xwm.h
+@@ -122,6 +122,7 @@ struct wlr_xwm {
+
+ const xcb_query_extension_reply_t *xfixes;
+ const xcb_query_extension_reply_t *xres;
++ const xcb_query_extension_reply_t *xwayland_ext;
+ #if HAS_XCB_ERRORS
+ xcb_errors_context_t *errors_context;
+ #endif
+@@ -156,4 +157,6 @@ char *xwm_get_atom_name(struct wlr_xwm *xwm, xcb_atom_t atom);
+ bool xwm_atoms_contains(struct wlr_xwm *xwm, xcb_atom_t *atoms,
+ size_t num_atoms, enum atom_name needle);
+
++void xwm_scale_changed(struct wlr_xwm *xwm);
++
+ #endif
+diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c
+index a6397a1a..8868b10f 100644
+--- a/xwayland/xwayland.c
++++ b/xwayland/xwayland.c
+@@ -106,6 +106,9 @@ struct wlr_xwayland *wlr_xwayland_create(struct wl_display *wl_display,
+
+ void wlr_xwayland_set_scale(struct wlr_xwayland *xwayland, int32_t scale) {
+ xwayland->server->scale = scale;
++ if (xwayland->xwm != NULL) {
++ xwm_scale_changed(xwayland->xwm);
++ }
+ }
+
+ void wlr_xwayland_set_cursor(struct wlr_xwayland *xwayland,
+diff --git a/xwayland/xwm.c b/xwayland/xwm.c
+index d0423126..a20a89d9 100644
+--- a/xwayland/xwm.c
++++ b/xwayland/xwm.c
+@@ -17,6 +17,7 @@
+ #include <xcb/res.h>
+ #include <xcb/xcb_icccm.h>
+ #include <xcb/xfixes.h>
++#include <xcb/xcbext.h>
+ #include "util/signal.h"
+ #include "xwayland/xwm.h"
+
+@@ -28,6 +29,10 @@ static int32_t unscale(struct wlr_xwm *xwm, int32_t val) {
+ return (val + xwm->xwayland->server->scale/2) / xwm->xwayland->server->scale;
+ }
+
++static xcb_extension_t xwayland_ext_id = {
++ .name = "XWAYLAND",
++};
++
+ const char *const atom_map[ATOM_LAST] = {
+ [WL_SURFACE_ID] = "WL_SURFACE_ID",
+ [WM_DELETE_WINDOW] = "WM_DELETE_WINDOW",
+@@ -1832,6 +1837,7 @@ static void xwm_get_resources(struct wlr_xwm *xwm) {
+ xcb_prefetch_extension_data(xwm->xcb_conn, &xcb_xfixes_id);
+ xcb_prefetch_extension_data(xwm->xcb_conn, &xcb_composite_id);
+ xcb_prefetch_extension_data(xwm->xcb_conn, &xcb_res_id);
++ xcb_prefetch_extension_data(xwm->xcb_conn, &xwayland_ext_id); // TODO what if extension is not present??
+
+ size_t i;
+ xcb_intern_atom_cookie_t cookies[ATOM_LAST];
+@@ -1863,6 +1869,8 @@ static void xwm_get_resources(struct wlr_xwm *xwm) {
+ wlr_log(WLR_DEBUG, "xfixes not available");
+ }
+
++ xwm->xwayland_ext = xcb_get_extension_data(xwm->xcb_conn, &xwayland_ext_id);
++
+ xcb_xfixes_query_version_cookie_t xfixes_cookie;
+ xcb_xfixes_query_version_reply_t *xfixes_reply;
+ xfixes_cookie =
+@@ -2253,3 +2261,39 @@ enum wlr_xwayland_icccm_input_model wlr_xwayland_icccm_input_model(
+ }
+ return WLR_ICCCM_INPUT_MODEL_NONE;
+ }
++
++
++typedef struct {
++ uint8_t major_opcode;
++ uint8_t minor_opcode;
++ uint16_t length;
++ uint16_t screen;
++ uint16_t scale;
++} xwayland_ext_set_scale_request_t;
++
++void xwm_scale_changed(struct wlr_xwm *xwm) {
++ xcb_protocol_request_t req = {
++ .count = 1,
++ .ext = &xwayland_ext_id,
++ .opcode = 1,
++ .isvoid = false,
++ };
++
++ xwayland_ext_set_scale_request_t xcb_out = {
++ .screen = 0,
++ .scale = xwm->xwayland->server->scale,
++ };
++
++ struct iovec xcb_parts[3];
++ xcb_parts[2].iov_base = (char *) &xcb_out;
++ xcb_parts[2].iov_len = sizeof(xcb_out);
++ xcb_send_request(xwm->xcb_conn, 0, xcb_parts+2, &req);
++
++ // Reconfigure all surfaces with the new scale.
++ struct wlr_xwayland_surface *surface;
++ wl_list_for_each(surface, &xwm->surfaces, link) {
++ wlr_xwayland_surface_configure(surface, surface->x, surface->y, surface->width, surface->height);
++ }
++
++ xcb_flush(xwm->xcb_conn);
++}
+--
+2.33.1
+
diff --git a/PKGBUILD b/PKGBUILD
index ed0dc8d450ed..9e95b8253157 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Antonin Décimo <antonin dot decimo at gmail dot com>
# Contributor: Adrian Perez de Castro <aperez@igalia.com>
pkgname=wlroots-hidpi-git
-pkgver=0.14.0.r303.gf7ea33da
+pkgver=0.14.0.r330.g0855cdac
pkgrel=1
license=(custom:MIT)
pkgdesc='Modular Wayland compositor library, with XWayland HiDPI (git version)'
@@ -30,12 +30,14 @@ makedepends=(
vulkan-headers
wayland-protocols
xorgproto)
+# https://gitlab.freedesktop.org/MisterDA/wlroots/-/tree/xwayland_hidpi
source=("${pkgname}::git+${url}"
- # "xwayland_hidpi.diff::https://github.com/swaywm/wlroots/pull/2064.diff"
- "xwayland_hidpi.diff::https://github.com/swaywm/wlroots/compare/master...MisterDA:xwayland_hidpi.diff"
+ "0001-xwayland-add-support-for-global-scale-factor.patch"
+ "0002-xwayland-add-support-for-changing-global-scale-facto.patch"
)
sha256sums=('SKIP'
- 'bd3a5295c404be332372d1504177d1e7c7fd8649b0bc9ef603c586843a46f4b4')
+ '68f1c7c550a317d8175311325b6c4809b0ec761b0badba7926eca7475d1bc27f'
+ '9004f727c18129c667804fa987938c8d4a1a27ec8fed6bb2668f03284a884dcc')
pkgver () {
cd "${pkgname}"
@@ -48,7 +50,8 @@ pkgver () {
prepare () {
cd "${pkgname}"
- patch --forward --strip=1 --input="${srcdir}/xwayland_hidpi.diff"
+ patch -Np1 < "${srcdir}/0001-xwayland-add-support-for-global-scale-factor.patch"
+ patch -Np1 < "${srcdir}/0002-xwayland-add-support-for-changing-global-scale-facto.patch"
}
build () {