git: cf018c369f95 - main - x11-wm/hyprland: update to 0.23.0.b

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Wed, 15 Mar 2023 01:07:03 UTC
The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cf018c369f9531dbd7ccaa5c7be2ef2de7f7e74e

commit cf018c369f9531dbd7ccaa5c7be2ef2de7f7e74e
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-03-14 21:56:31 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-03-15 01:06:14 +0000

    x11-wm/hyprland: update to 0.23.0.b
    
    Changes:        https://github.com/hyprwm/Hyprland/releases/tag/v0.23.0beta
    Reported by:    GitHub (watch releases)
---
 x11-wm/hyprland/Makefile                   |   9 +--
 x11-wm/hyprland/distinfo                   |   8 ++-
 x11-wm/hyprland/files/patch-system-wlroots |   8 +--
 x11-wm/hyprland/files/patch-wlroots-0.16   | 108 ++++++++++++++++++++++-------
 4 files changed, 97 insertions(+), 36 deletions(-)

diff --git a/x11-wm/hyprland/Makefile b/x11-wm/hyprland/Makefile
index 6ac2a155c985..d9ffaaac3fcb 100644
--- a/x11-wm/hyprland/Makefile
+++ b/x11-wm/hyprland/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	hyprland
 DISTVERSIONPREFIX=	v
-DISTVERSION=	0.22.0beta
+DISTVERSION=	0.23.0beta
 CATEGORIES=	x11-wm wayland
 
 MAINTAINER=	jbeich@FreeBSD.org
@@ -10,7 +10,8 @@ WWW=		https://hyprland.org/
 LICENSE=	BSD3CLAUSE
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BUILD_DEPENDS=	evdev-proto>0:devel/evdev-proto \
+BUILD_DEPENDS=	cmake:devel/cmake-core \
+		evdev-proto>0:devel/evdev-proto \
 		wayland-protocols>=1.25:graphics/wayland-protocols \
 		wlroots>=0.16.0<0.17.0:x11-toolkits/wlroots
 LIB_DEPENDS=	libwayland-server.so:graphics/wayland \
@@ -25,7 +26,8 @@ USE_GNOME=	cairo
 USE_XORG=	pixman
 GH_ACCOUNT=	hyprwm
 GH_PROJECT=	Hyprland
-GH_TUPLE=	hyprwm:hyprland-protocols:301733a:hyprland_protocols/subprojects/hyprland-protocols
+GH_TUPLE=	hyprwm:hyprland-protocols:301733a:hyprland_protocols/subprojects/hyprland-protocols \
+		canihavesomecoffee:udis86:1.7.2-186-g5336633:udis86/subprojects/udis86
 
 OPTIONS_DEFINE=	X11
 OPTIONS_DEFAULT=X11
@@ -58,7 +60,6 @@ post-install:
 . if exists(/usr/include/c++/v1/__algorithm/ranges_all_of.h) && !make(makesum) && !make(fetch)
 CXXFLAGS+=	-fexperimental-library # std::ranges::all_of
 . else
-BUILD_DEPENDS+=	${CMAKE_BIN}:devel/cmake-core
 USES+=		llvm:min=14,build
 CC=		clang${LLVM_VERSION}
 CXX=		clang++${LLVM_VERSION}
diff --git a/x11-wm/hyprland/distinfo b/x11-wm/hyprland/distinfo
index c31810a84e15..e284aaf4b3f5 100644
--- a/x11-wm/hyprland/distinfo
+++ b/x11-wm/hyprland/distinfo
@@ -1,7 +1,9 @@
-TIMESTAMP = 1676935051
-SHA256 (hyprwm-Hyprland-v0.22.0beta_GH0.tar.gz) = dd721975b15126a8165226d5ab2cbb88c5bd48dd768b6ee123149451af2fb0c1
-SIZE (hyprwm-Hyprland-v0.22.0beta_GH0.tar.gz) = 723020
+TIMESTAMP = 1678830991
+SHA256 (hyprwm-Hyprland-v0.23.0beta_GH0.tar.gz) = a866dc48d2c7fad6f9a57e890430a8c234ea9f8fcada6c6eafb95eaadadb1ab0
+SIZE (hyprwm-Hyprland-v0.23.0beta_GH0.tar.gz) = 745506
 SHA256 (hyprwm-hyprland-protocols-301733a_GH0.tar.gz) = 3b3b4e948525f1d823313390b2551ea8969d0cbf82bd72e2a4a2ce2750552330
 SIZE (hyprwm-hyprland-protocols-301733a_GH0.tar.gz) = 4852
+SHA256 (canihavesomecoffee-udis86-1.7.2-186-g5336633_GH0.tar.gz) = 69aff959179ff6247b375b92e797221dbd8e078eabbf1366280b0532617e7fb8
+SIZE (canihavesomecoffee-udis86-1.7.2-186-g5336633_GH0.tar.gz) = 116938
 SHA256 (llvm-llvm-project-llvmorg-16.0.0-rc2_GH0.tar.gz) = f066ee0f4e48d320a327215359f212164675e75ca7644dbbd54b1828a270b2fc
 SIZE (llvm-llvm-project-llvmorg-16.0.0-rc2_GH0.tar.gz) = 179117059
diff --git a/x11-wm/hyprland/files/patch-system-wlroots b/x11-wm/hyprland/files/patch-system-wlroots
index 21457e7c2728..d25e5aff58c8 100644
--- a/x11-wm/hyprland/files/patch-system-wlroots
+++ b/x11-wm/hyprland/files/patch-system-wlroots
@@ -1,8 +1,8 @@
 Allow system wlroots to reduce maintenance (wlroots has tons of options)
 
---- meson.build.orig	2022-11-07 12:16:30 UTC
+--- meson.build.orig	2023-03-14 21:56:31 UTC
 +++ meson.build
-@@ -37,8 +37,8 @@ add_project_arguments(
+@@ -39,8 +39,8 @@ add_project_arguments(
    ],
    language: 'cpp')
  
@@ -12,8 +12,8 @@ Allow system wlroots to reduce maintenance (wlroots has tons of options)
 +have_xwlr = wlroots.get_variable(pkgconfig: 'have_xwayland', internal: 'have_xwayland') == 'true'
  xcb_dep = dependency('xcb', required: get_option('xwayland'))
  
- if get_option('xwayland').enabled() and not have_xwlr
---- src/meson.build.orig	2023-01-05 22:30:24 UTC
+ cmake = import('cmake')
+--- src/meson.build.orig	2023-03-14 21:56:31 UTC
 +++ src/meson.build
 @@ -7,7 +7,7 @@ executable('Hyprland', src,
      server_protos,
diff --git a/x11-wm/hyprland/files/patch-wlroots-0.16 b/x11-wm/hyprland/files/patch-wlroots-0.16
index b82f3f578e4a..d63efaff3636 100644
--- a/x11-wm/hyprland/files/patch-wlroots-0.16
+++ b/x11-wm/hyprland/files/patch-wlroots-0.16
@@ -5,19 +5,20 @@ https://github.com/hyprwm/Hyprland/commit/df132e5ff339
 https://github.com/hyprwm/Hyprland/commit/c012e3d66b21
 https://github.com/hyprwm/Hyprland/commit/d6b3bfc48e22
 https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
+https://github.com/hyprwm/Hyprland/commit/a34b74766193
 
---- src/Compositor.cpp.orig	2023-02-03 14:12:28 UTC
+--- src/Compositor.cpp.orig	2023-03-14 21:56:31 UTC
 +++ src/Compositor.cpp
-@@ -63,7 +63,7 @@ CCompositor::CCompositor() {
-     wl_event_loop_add_signal(m_sWLEventLoop, SIGTERM, handleCritSignal, nullptr);
-     //wl_event_loop_add_signal(m_sWLEventLoop, SIGINT, handleCritSignal, nullptr);
+@@ -103,7 +103,7 @@ void CCompositor::initServer() {
+     if (LOGWLR && std::string(LOGWLR) == "1")
+         wlr_log_init(WLR_DEBUG, Debug::wlrLog);
  
 -    m_sWLRBackend = wlr_backend_autocreate(m_sWLDisplay, &m_sWLRSession);
 +    m_sWLRBackend = wlr_backend_autocreate(m_sWLDisplay);
  
      if (!m_sWLRBackend) {
          Debug::log(CRIT, "m_sWLRBackend was NULL!");
-@@ -86,10 +86,11 @@ CCompositor::CCompositor() {
+@@ -126,10 +126,11 @@ void CCompositor::initServer() {
      wlr_renderer_init_wl_shm(m_sWLRRenderer, m_sWLDisplay);
  
      if (wlr_renderer_get_dmabuf_texture_formats(m_sWLRRenderer)) {
@@ -31,7 +32,7 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
      }
  
      m_sWLRAllocator = wlr_allocator_autocreate(m_sWLRBackend, m_sWLRRenderer);
-@@ -141,7 +142,7 @@ CCompositor::CCompositor() {
+@@ -187,7 +188,7 @@ void CCompositor::initServer() {
  
      m_sWLRIdle = wlr_idle_create(m_sWLDisplay);
  
@@ -40,7 +41,7 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
  
      m_sWLRServerDecoMgr = wlr_server_decoration_manager_create(m_sWLDisplay);
      m_sWLRXDGDecoMgr    = wlr_xdg_decoration_manager_v1_create(m_sWLDisplay);
-@@ -181,6 +182,8 @@ CCompositor::CCompositor() {
+@@ -227,6 +228,8 @@ void CCompositor::initServer() {
      wlr_xdg_foreign_v2_create(m_sWLDisplay, m_sWLRForeignRegistry);
  
      m_sWLRPointerGestures = wlr_pointer_gestures_v1_create(m_sWLDisplay);
@@ -49,9 +50,9 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
  
      m_sWLRTextInputMgr = wlr_text_input_manager_v3_create(m_sWLDisplay);
  
---- src/events/Events.hpp.orig	2023-02-03 14:12:28 UTC
+--- src/events/Events.hpp.orig	2023-03-14 21:56:31 UTC
 +++ src/events/Events.hpp
-@@ -96,7 +96,6 @@ namespace Events {
+@@ -97,7 +97,6 @@ namespace Events {
      // Monitor part 2 the sequel
      DYNLISTENFUNC(monitorFrame);
      DYNLISTENFUNC(monitorDestroy);
@@ -59,9 +60,9 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
  
      // XWayland
      LISTENER(readyXWayland);
---- src/events/Monitors.cpp.orig	2023-02-03 14:12:28 UTC
+--- src/events/Monitors.cpp.orig	2023-03-14 21:56:31 UTC
 +++ src/events/Monitors.cpp
-@@ -277,10 +277,11 @@ void Events::listener_monitorFrame(void* owner, void* 
+@@ -281,10 +281,11 @@ void Events::listener_monitorFrame(void* owner, void* 
                  damageBlinkCleanup = 0;
          }
  
@@ -77,7 +78,7 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
      }
  
      g_pHyprOpenGL->end();
-@@ -351,11 +352,4 @@ void Events::listener_monitorDestroy(void* owner, void
+@@ -357,11 +358,4 @@ void Events::listener_monitorDestroy(void* owner, void
  
          std::erase_if(g_pCompositor->m_vRealMonitors, [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; });
      }
@@ -89,9 +90,9 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
 -
 -    wlr_output_commit_state(PMONITOR->output, E->state);
  }
---- src/events/Windows.cpp.orig	2023-02-03 14:12:28 UTC
+--- src/events/Windows.cpp.orig	2023-03-14 21:56:31 UTC
 +++ src/events/Windows.cpp
-@@ -816,7 +816,7 @@ void Events::listener_activateXDG(wl_listener* listene
+@@ -821,7 +821,7 @@ void Events::listener_activateXDG(wl_listener* listene
  
      Debug::log(LOG, "Activate request for surface at %x", E->surface);
  
@@ -100,7 +101,7 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
          return;
  
      const auto PWINDOW = g_pCompositor->getWindowFromSurface(E->surface);
---- src/helpers/Monitor.cpp.orig	2023-02-03 14:12:28 UTC
+--- src/helpers/Monitor.cpp.orig	2023-03-14 21:56:31 UTC
 +++ src/helpers/Monitor.cpp
 @@ -5,10 +5,8 @@ void CMonitor::onConnect(bool noRule) {
  void CMonitor::onConnect(bool noRule) {
@@ -113,7 +114,7 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
  
      if (m_bEnabled) {
          wlr_output_enable(output, 1);
-@@ -207,7 +205,7 @@ void CMonitor::onDisconnect() {
+@@ -209,7 +207,7 @@ void CMonitor::onDisconnect() {
      if (!BACKUPMON) {
          Debug::log(WARN, "Unplugged last monitor, entering an unsafe state. Good luck my friend.");
  
@@ -122,9 +123,9 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
          hyprListener_monitorDestroy.removeCallback();
  
          g_pCompositor->m_bUnsafeState = true;
---- src/helpers/Monitor.hpp.orig	2023-02-03 14:12:28 UTC
+--- src/helpers/Monitor.hpp.orig	2023-03-14 21:56:31 UTC
 +++ src/helpers/Monitor.hpp
-@@ -53,7 +53,7 @@ class CMonitor {
+@@ -56,7 +56,7 @@ class CMonitor {
  
      DYNLISTENER(monitorFrame);
      DYNLISTENER(monitorDestroy);
@@ -133,7 +134,7 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
  
      // hack: a group = workspaces on a monitor.
      // I don't really care lol :P
---- src/helpers/SubsurfaceTree.cpp.orig	2023-02-03 14:12:28 UTC
+--- src/helpers/SubsurfaceTree.cpp.orig	2023-03-14 21:56:31 UTC
 +++ src/helpers/SubsurfaceTree.cpp
 @@ -3,8 +3,8 @@ void addSurfaceGlobalOffset(SSurfaceTreeNode* node, in
  #include "../Compositor.hpp"
@@ -146,7 +147,7 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
  
      if (node->offsetfn) {
          // This is the root node
---- src/managers/XWaylandManager.cpp.orig	2023-02-03 14:12:28 UTC
+--- src/managers/XWaylandManager.cpp.orig	2023-03-14 21:56:31 UTC
 +++ src/managers/XWaylandManager.cpp
 @@ -35,16 +35,16 @@ void CHyprXWaylandManager::activateSurface(wlr_surface
      if (!pSurface)
@@ -170,9 +171,9 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
      }
  }
  
---- src/managers/input/InputMethodRelay.cpp.orig	2023-02-03 14:12:28 UTC
+--- src/managers/input/InputMethodRelay.cpp.orig	2023-03-14 21:56:31 UTC
 +++ src/managers/input/InputMethodRelay.cpp
-@@ -144,8 +144,8 @@ void CInputMethodRelay::updateInputPopup(SIMEPopup* pP
+@@ -184,8 +184,8 @@ void CInputMethodRelay::updateInputPopup(SIMEPopup* pP
      Vector2D   parentPos;
      Vector2D   parentSize;
  
@@ -183,9 +184,9 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
  
          if (PLS) {
              parentPos  = Vector2D(PLS->geometry.x, PLS->geometry.y) + g_pCompositor->getMonitorFromID(PLS->monitorID)->vecPosition;
-@@ -243,8 +243,8 @@ void CInputMethodRelay::damagePopup(SIMEPopup* pPopup)
+@@ -292,8 +292,8 @@ void CInputMethodRelay::damagePopup(SIMEPopup* pPopup)
  
-     const auto PFOCUSEDSURFACE = PFOCUSEDTI->pWlrInput->focused_surface;
+     const auto PFOCUSEDSURFACE = focusedSurface(PFOCUSEDTI);
  
 -    if (wlr_layer_surface_v1_try_from_wlr_surface(PFOCUSEDSURFACE)) {
 -        const auto PLS = g_pCompositor->getLayerSurfaceFromWlr(wlr_layer_surface_v1_try_from_wlr_surface(PFOCUSEDSURFACE));
@@ -194,7 +195,7 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
  
          if (PLS) {
              parentPos = Vector2D(PLS->geometry.x, PLS->geometry.y) + g_pCompositor->getMonitorFromID(PLS->monitorID)->vecPosition;
---- src/render/Renderer.cpp.orig	2023-02-03 14:12:28 UTC
+--- src/render/Renderer.cpp.orig	2023-03-14 21:56:31 UTC
 +++ src/render/Renderer.cpp
 @@ -37,7 +37,7 @@ void renderSurface(struct wlr_surface* surface, int x,
      rounding -= 1; // to fix a border issue
@@ -205,3 +206,60 @@ https://github.com/hyprwm/Hyprland/commit/a46abd8b1ada
              g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true);
          } else {
              if (RDATA->blur)
+@@ -746,20 +746,48 @@ void CHyprRenderer::setWindowScanoutMode(CWindow* pWin
+         return;
+     }
+ 
+-    const auto                                      PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
++    const auto RENDERERDRMFD = wlr_renderer_get_drm_fd(g_pCompositor->m_sWLRRenderer);
++    const auto BACKENDDRMFD  = wlr_backend_get_drm_fd(g_pCompositor->m_sWLRBackend);
+ 
+-    const wlr_linux_dmabuf_feedback_v1_init_options INIT_OPTIONS = {
+-        .main_renderer          = g_pCompositor->m_sWLRRenderer,
+-        .scanout_primary_output = PMONITOR->output,
++    if (RENDERERDRMFD < 0 || BACKENDDRMFD < 0)
++        return;
++
++    auto deviceIDFromFD = [](int fd, unsigned long* deviceID) -> bool {
++        struct stat stat;
++        if (fstat(fd, &stat) != 0) {
++            return false;
++        }
++        *deviceID = stat.st_rdev;
++        return true;
+     };
+ 
+-    wlr_linux_dmabuf_feedback_v1 feedback = {0};
++    unsigned long rendererDevice, scanoutDevice;
++    if (!deviceIDFromFD(RENDERERDRMFD, &rendererDevice) || !deviceIDFromFD(BACKENDDRMFD, &scanoutDevice))
++        return;
+ 
+-    if (!wlr_linux_dmabuf_feedback_v1_init_with_options(&feedback, &INIT_OPTIONS))
++    const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
++
++    const auto POUTPUTFORMATS = wlr_output_get_primary_formats(PMONITOR->output, WLR_BUFFER_CAP_DMABUF);
++    if (!POUTPUTFORMATS)
+         return;
+ 
+-    wlr_linux_dmabuf_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, g_pXWaylandManager->getWindowSurface(pWindow), &feedback);
+-    wlr_linux_dmabuf_feedback_v1_finish(&feedback);
++    const auto         PRENDERERFORMATS = wlr_renderer_get_dmabuf_texture_formats(g_pCompositor->m_sWLRRenderer);
++    wlr_drm_format_set scanoutFormats   = {0};
++
++    if (!wlr_drm_format_set_intersect(&scanoutFormats, POUTPUTFORMATS, PRENDERERFORMATS))
++        return;
++
++    const wlr_linux_dmabuf_feedback_v1_tranche TRANCHES[] = {
++        {.target_device = scanoutDevice, .flags = ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT, .formats = &scanoutFormats},
++        {.target_device = rendererDevice, .formats = PRENDERERFORMATS}};
++
++    const wlr_linux_dmabuf_feedback_v1 FEEDBACK = {.main_device = rendererDevice, .tranches_len = sizeof(TRANCHES) / sizeof(TRANCHES[0]), .tranches = TRANCHES};
++
++    if (!wlr_linux_dmabuf_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, g_pXWaylandManager->getWindowSurface(pWindow), &FEEDBACK)) {
++        Debug::log(ERR, "Error in scanout mode setting: wlr_linux_dmabuf_v1_set_surface_feedback returned false.");
++    }
++
++    wlr_drm_format_set_finish(&scanoutFormats);
+ 
+     Debug::log(LOG, "Scanout mode ON set for %x", pWindow);
+ }