Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package bemenu for openSUSE:Factory checked 
in at 2024-02-02 15:48:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/bemenu (Old)
 and      /work/SRC/openSUSE:Factory/.bemenu.new.1815 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "bemenu"

Fri Feb  2 15:48:02 2024 rev:22 rq:1143615 version:0.6.18

Changes:
--------
--- /work/SRC/openSUSE:Factory/bemenu/bemenu.changes    2024-01-29 
22:28:56.313276715 +0100
+++ /work/SRC/openSUSE:Factory/.bemenu.new.1815/bemenu.changes  2024-02-02 
15:48:38.507654069 +0100
@@ -1,0 +2,8 @@
+Fri Feb  2 11:41:08 UTC 2024 - Michael Vetter <mvet...@suse.com>
+
+- Update to 0.6.18:
+  * fix: buffer is not divisible #380
+  * implement wayland fractional scaling #379
+  * Reapply "implement wayland fractional scaling" #381
+
+-------------------------------------------------------------------

Old:
----
  bemenu-0.6.17.tar.gz

New:
----
  bemenu-0.6.18.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ bemenu.spec ++++++
--- /var/tmp/diff_new_pack.iOrOWP/_old  2024-02-02 15:48:39.135676899 +0100
+++ /var/tmp/diff_new_pack.iOrOWP/_new  2024-02-02 15:48:39.139677044 +0100
@@ -18,7 +18,7 @@
 
 %define bcond_with curses
 Name:           bemenu
-Version:        0.6.17
+Version:        0.6.18
 Release:        0
 Summary:        Dynamic menu library and client program inspired by dmenu
 License:        MIT

++++++ bemenu-0.6.17.tar.gz -> bemenu-0.6.18.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bemenu-0.6.17/.gitignore new/bemenu-0.6.18/.gitignore
--- old/bemenu-0.6.17/.gitignore        2024-01-27 15:53:56.000000000 +0100
+++ new/bemenu-0.6.18/.gitignore        2024-02-02 10:41:37.000000000 +0100
@@ -1 +1 @@
-*
+result/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bemenu-0.6.17/GNUmakefile 
new/bemenu-0.6.18/GNUmakefile
--- old/bemenu-0.6.17/GNUmakefile       2024-01-27 15:53:56.000000000 +0100
+++ new/bemenu-0.6.18/GNUmakefile       2024-02-02 10:41:37.000000000 +0100
@@ -85,15 +85,33 @@
 lib/renderers/wayland/wlr-layer-shell-unstable-v1.c: 
lib/renderers/wayland/wlr-layer-shell-unstable-v1.xml
        wayland-scanner private-code < $^ > $@
 
+lib/renderers/wayland/fractional-scale-v1.h: 
lib/renderers/wayland/fractional-scale-v1.xml
+       wayland-scanner client-header < $^ > $@
+
+lib/renderers/wayland/fractional-scale-v1.c: 
lib/renderers/wayland/fractional-scale-v1.xml
+       wayland-scanner private-code < $^ > $@
+
+lib/renderers/wayland/viewporter.h: lib/renderers/wayland/viewporter.xml
+       wayland-scanner client-header < $^ > $@
+
+lib/renderers/wayland/viewporter.c: lib/renderers/wayland/viewporter.xml
+       wayland-scanner private-code < $^ > $@
+
 xdg-shell.a: private override LDFLAGS += -fPIC
 xdg-shell.a: private override CPPFLAGS += $(shell $(PKG_CONFIG) 
--cflags-only-I wayland-client)
 xdg-shell.a: lib/renderers/wayland/xdg-shell.c
 wlr-layer-shell.a: private override LDFLAGS += -fPIC
 wlr-layer-shell.a: private override CPPFLAGS += $(shell $(PKG_CONFIG) 
--cflags-only-I wayland-client)
 wlr-layer-shell.a: lib/renderers/wayland/wlr-layer-shell-unstable-v1.c 
lib/renderers/wayland/wlr-layer-shell-unstable-v1.h
+fractional-scale.a: private override LDFLAGS += -fPIC
+fractional-scale.a: private override CPPFLAGS += $(shell $(PKG_CONFIG) 
--cflags-only-I wayland-client)
+fractional-scale.a: lib/renderers/wayland/fractional-scale-v1.c 
lib/renderers/wayland/fractional-scale-v1.h
+viewporter.a: private override LDFLAGS += -fPIC
+viewporter.a: private override CPPFLAGS += $(shell $(PKG_CONFIG) 
--cflags-only-I wayland-client)
+viewporter.a: lib/renderers/wayland/viewporter.c 
lib/renderers/wayland/viewporter.h
 bemenu-renderer-wayland.so: private override LDLIBS += $(shell $(PKG_CONFIG) 
--libs wayland-client cairo pango pangocairo xkbcommon)
 bemenu-renderer-wayland.so: private override CPPFLAGS += $(shell $(PKG_CONFIG) 
--cflags-only-I wayland-client cairo pango pangocairo xkbcommon)
-bemenu-renderer-wayland.so: lib/renderers/cairo_renderer.h 
lib/renderers/wayland/wayland.c lib/renderers/wayland/wayland.h 
lib/renderers/wayland/registry.c lib/renderers/wayland/window.c xdg-shell.a 
wlr-layer-shell.a util.a
+bemenu-renderer-wayland.so: lib/renderers/cairo_renderer.h 
lib/renderers/wayland/wayland.c lib/renderers/wayland/wayland.h 
lib/renderers/wayland/registry.c lib/renderers/wayland/window.c xdg-shell.a 
wlr-layer-shell.a fractional-scale.a viewporter.a util.a
 
 common.a: client/common/common.c client/common/common.h
 bemenu: common.a client/bemenu.c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bemenu-0.6.17/VERSION new/bemenu-0.6.18/VERSION
--- old/bemenu-0.6.17/VERSION   2024-01-27 15:53:56.000000000 +0100
+++ new/bemenu-0.6.18/VERSION   2024-02-02 10:41:37.000000000 +0100
@@ -1 +1 @@
-0.6.17
+0.6.18
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bemenu-0.6.17/default.nix 
new/bemenu-0.6.18/default.nix
--- old/bemenu-0.6.17/default.nix       2024-01-27 15:53:56.000000000 +0100
+++ new/bemenu-0.6.18/default.nix       2024-02-02 10:41:37.000000000 +0100
@@ -1,27 +1,41 @@
-{ pkgs ? import <nixpkgs> {}, lib ? pkgs.lib, stdenv ? pkgs.stdenv }:
+{
+  lib
+  , stdenv
+  , pkg-config
+  , scdoc
+  , ncurses
+  , cairo
+  , fribidi
+  , harfbuzz
+  , libxkbcommon
+  , pango
+  , wayland
+  , wayland-scanner
+  , wayland-protocols
+  , xorg
+}:
+
+with builtins;
+with lib;
 
 let
-  src = pkgs.copyPathToStore ./.;
-  semver = builtins.readFile "${src}/VERSION";
-  revision = builtins.readFile (pkgs.runCommand "get-rev" {
-    nativeBuildInputs = with pkgs; [ git ];
-  } "GIT_DIR=${src}/.git git rev-parse --short HEAD | tr -d '\n' > $out");
+  src = ./.;
+  version = readFile "${src}/VERSION";
 in stdenv.mkDerivation {
-  inherit src;
+  inherit src version;
   pname = "bemenu";
-  version = "${semver}${revision}";
 
   strictDeps = true;
-  nativeBuildInputs = with pkgs; [
+  nativeBuildInputs = [
     pkg-config
     scdoc
-  ] ++ lib.optionals (stdenv.isLinux) [
+  ] ++ optionals (stdenv.isLinux) [
     wayland-scanner
   ];
 
-  buildInputs = with pkgs; [
+  buildInputs = [
     ncurses
-  ] ++ lib.optionals (stdenv.isLinux) [
+  ] ++ optionals (stdenv.isLinux) [
     cairo
     fribidi
     harfbuzz
@@ -34,26 +48,27 @@
     xorg.libXdmcp xorg.libpthreadstubs xorg.libxcb
   ];
 
-  postPatch = "" + lib.optionalString (stdenv.isDarwin) ''
+  postPatch = "" + optionalString (stdenv.isDarwin) ''
     substituteInPlace GNUmakefile --replace '-soname' '-install_name'
   '';
 
   makeFlags = [ "PREFIX=$(out)" ];
-  buildFlags = [ "PREFIX=$(out)" "clients" "curses" ] ++ lib.optionals 
(stdenv.isLinux) [ "wayland" "x11" ];
+  buildFlags = [ "PREFIX=$(out)" "clients" "curses" ] ++ optionals 
(stdenv.isLinux) [ "wayland" "x11" ];
 
   # 
https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/fix-darwin-dylib-names.sh
   # ^ does not handle .so files
-  postInstall = "" + lib.optionalString (stdenv.isDarwin) ''
+  postInstall = "" + optionalString (stdenv.isDarwin) ''
     so="$(find "$out/lib" -name "libbemenu.so.[0-9]" -print -quit)"
     for f in "$out/bin/"*; do
         install_name_tool -change "$(basename $so)" "$so" $f
     done
   '';
 
-  meta = with pkgs.lib; {
+  meta = {
     homepage = "https://github.com/Cloudef/bemenu";;
     description = "Dynamic menu library and client program inspired by dmenu";
     license = licenses.gpl3Plus;
     platforms = with platforms; darwin ++ linux;
+    mainProgram = "bemenu-run";
   };
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bemenu-0.6.17/flake.lock new/bemenu-0.6.18/flake.lock
--- old/bemenu-0.6.17/flake.lock        1970-01-01 01:00:00.000000000 +0100
+++ new/bemenu-0.6.18/flake.lock        2024-02-02 10:41:37.000000000 +0100
@@ -0,0 +1,60 @@
+{
+  "nodes": {
+    "flake-utils": {
+      "inputs": {
+        "systems": "systems"
+      },
+      "locked": {
+        "lastModified": 1705309234,
+        "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1706847834,
+        "narHash": "sha256-h5oI1EYXFl9y6a9UplqposfGPL0hNGKH7bgT0mnLmQg=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "90f6c2d2b6132686cb6aa0f63fc0ce027d4e2c18",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "flake-utils": "flake-utils",
+        "nixpkgs": "nixpkgs"
+      }
+    },
+    "systems": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bemenu-0.6.17/flake.nix new/bemenu-0.6.18/flake.nix
--- old/bemenu-0.6.17/flake.nix 1970-01-01 01:00:00.000000000 +0100
+++ new/bemenu-0.6.18/flake.nix 2024-02-02 10:41:37.000000000 +0100
@@ -0,0 +1,16 @@
+{
+   description = "bemenu";
+
+   inputs = {
+      nixpkgs.url = "github:nixos/nixpkgs";
+      flake-utils.url = "github:numtide/flake-utils";
+   };
+
+   outputs = { self, nixpkgs, flake-utils }: let
+      outputs = (flake-utils.lib.eachDefaultSystem (system: let
+         pkgs = nixpkgs.outputs.legacyPackages.${system};
+      in {
+         packages.default = pkgs.callPackage ./default.nix {};
+      }));
+   in outputs;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bemenu-0.6.17/lib/renderers/cairo_renderer.h 
new/bemenu-0.6.18/lib/renderers/cairo_renderer.h
--- old/bemenu-0.6.17/lib/renderers/cairo_renderer.h    2024-01-27 
15:53:56.000000000 +0100
+++ new/bemenu-0.6.18/lib/renderers/cairo_renderer.h    2024-02-02 
10:41:37.000000000 +0100
@@ -12,7 +12,7 @@
     cairo_t *cr;
     cairo_surface_t *surface;
     PangoContext *pango;
-    int scale;
+    double scale;
 };
 
 struct cairo_color {
@@ -67,6 +67,8 @@
     if (!(cairo->pango = pango_cairo_create_context(cairo->cr)))
         goto fail;
 
+    cairo_set_antialias(cairo->cr, CAIRO_ANTIALIAS_NONE);
+
     cairo->surface = surface;
     assert(cairo->scale > 0);
     cairo_surface_set_device_scale(surface, cairo->scale, cairo->scale);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/bemenu-0.6.17/lib/renderers/wayland/fractional-scale-v1.xml 
new/bemenu-0.6.18/lib/renderers/wayland/fractional-scale-v1.xml
--- old/bemenu-0.6.17/lib/renderers/wayland/fractional-scale-v1.xml     
1970-01-01 01:00:00.000000000 +0100
+++ new/bemenu-0.6.18/lib/renderers/wayland/fractional-scale-v1.xml     
2024-02-02 10:41:37.000000000 +0100
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="fractional_scale_v1">
+  <copyright>
+    Copyright © 2022 Kenny Levinsen
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and associated documentation files (the "Software"),
+    to deal in the Software without restriction, including without limitation
+    the rights to use, copy, modify, merge, publish, distribute, sublicense,
+    and/or sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice (including the next
+    paragraph) shall be included in all copies or substantial portions of the
+    Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+  </copyright>
+
+  <description summary="Protocol for requesting fractional surface scales">
+    This protocol allows a compositor to suggest for surfaces to render at
+    fractional scales.
+
+    A client can submit scaled content by utilizing wp_viewport. This is done 
by
+    creating a wp_viewport object for the surface and setting the destination
+    rectangle to the surface size before the scale factor is applied.
+
+    The buffer size is calculated by multiplying the surface size by the
+    intended scale.
+
+    The wl_surface buffer scale should remain set to 1.
+
+    If a surface has a surface-local size of 100 px by 50 px and wishes to
+    submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
+    be used and the wp_viewport destination rectangle should be 100 px by 50 
px.
+
+    For toplevel surfaces, the size is rounded halfway away from zero. The
+    rounding algorithm for subsurface position and size is not defined.
+  </description>
+
+  <interface name="wp_fractional_scale_manager_v1" version="1">
+    <description summary="fractional surface scale information">
+      A global interface for requesting surfaces to use fractional scales.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="unbind the fractional surface scale interface">
+        Informs the server that the client will not be using this protocol
+        object anymore. This does not affect any other objects,
+        wp_fractional_scale_v1 objects included.
+      </description>
+    </request>
+
+    <enum name="error">
+      <entry name="fractional_scale_exists" value="0"
+        summary="the surface already has a fractional_scale object 
associated"/>
+    </enum>
+
+    <request name="get_fractional_scale">
+      <description summary="extend surface interface for scale information">
+        Create an add-on object for the the wl_surface to let the compositor
+        request fractional scales. If the given wl_surface already has a
+        wp_fractional_scale_v1 object associated, the fractional_scale_exists
+        protocol error is raised.
+      </description>
+      <arg name="id" type="new_id" interface="wp_fractional_scale_v1"
+           summary="the new surface scale info interface id"/>
+      <arg name="surface" type="object" interface="wl_surface"
+           summary="the surface"/>
+    </request>
+  </interface>
+
+  <interface name="wp_fractional_scale_v1" version="1">
+    <description summary="fractional scale interface to a wl_surface">
+      An additional interface to a wl_surface object which allows the 
compositor
+      to inform the client of the preferred scale.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="remove surface scale information for surface">
+        Destroy the fractional scale object. When this object is destroyed,
+        preferred_scale events will no longer be sent.
+      </description>
+    </request>
+
+    <event name="preferred_scale">
+      <description summary="notify of new preferred scale">
+        Notification of a new preferred scale for this surface that the
+        compositor suggests that the client should use.
+
+        The sent scale is the numerator of a fraction with a denominator of 
120.
+      </description>
+      <arg name="scale" type="uint" summary="the new preferred scale"/>
+    </event>
+  </interface>
+</protocol>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bemenu-0.6.17/lib/renderers/wayland/registry.c 
new/bemenu-0.6.18/lib/renderers/wayland/registry.c
--- old/bemenu-0.6.17/lib/renderers/wayland/registry.c  2024-01-27 
15:53:56.000000000 +0100
+++ new/bemenu-0.6.18/lib/renderers/wayland/registry.c  2024-02-02 
10:41:37.000000000 +0100
@@ -595,6 +595,10 @@
         output->output = wl_output;
         wl_list_insert(&wayland->outputs, &output->link);
         wl_output_add_listener(wl_output, &output_listener, output);
+    } else if (strcmp(interface, "wp_fractional_scale_manager_v1") == 0) {
+        wayland->wfs_mgr = wl_registry_bind(registry, id, 
&wp_fractional_scale_manager_v1_interface, 1);
+    } else if (strcmp(interface, "wp_viewporter") == 0) {
+        wayland->viewporter = wl_registry_bind(registry, id, 
&wp_viewporter_interface, 1);
     }
 }
 
@@ -660,6 +664,14 @@
     if (!wayland->input.keyboard || !(wayland->formats & (1 << 
WL_SHM_FORMAT_ARGB8888)))
         return false;
 
+    if (wayland->wfs_mgr && wayland->viewporter) {
+        // This feature does not work with some compositors rn so mut be 
enabled with env var
+        const char *env = getenv("BEMENU_WL_FRACTIONAL_SCALING");
+        if (env && (!strcmp(env, "1") || !strcmp(env, "true"))) {
+            wayland->fractional_scaling = true;
+        }
+    }
+
     set_repeat_info(&wayland->input, 40, 400);
     return true;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bemenu-0.6.17/lib/renderers/wayland/viewporter.xml 
new/bemenu-0.6.18/lib/renderers/wayland/viewporter.xml
--- old/bemenu-0.6.17/lib/renderers/wayland/viewporter.xml      1970-01-01 
01:00:00.000000000 +0100
+++ new/bemenu-0.6.18/lib/renderers/wayland/viewporter.xml      2024-02-02 
10:41:37.000000000 +0100
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="viewporter">
+
+  <copyright>
+    Copyright © 2013-2016 Collabora, Ltd.
+
+    Permission is hereby granted, free of charge, to any person obtaining a
+    copy of this software and associated documentation files (the "Software"),
+    to deal in the Software without restriction, including without limitation
+    the rights to use, copy, modify, merge, publish, distribute, sublicense,
+    and/or sell copies of the Software, and to permit persons to whom the
+    Software is furnished to do so, subject to the following conditions:
+
+    The above copyright notice and this permission notice (including the next
+    paragraph) shall be included in all copies or substantial portions of the
+    Software.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+    DEALINGS IN THE SOFTWARE.
+  </copyright>
+
+  <interface name="wp_viewporter" version="1">
+    <description summary="surface cropping and scaling">
+      The global interface exposing surface cropping and scaling
+      capabilities is used to instantiate an interface extension for a
+      wl_surface object. This extended interface will then allow
+      cropping and scaling the surface contents, effectively
+      disconnecting the direct relationship between the buffer and the
+      surface size.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="unbind from the cropping and scaling interface">
+       Informs the server that the client will not be using this
+       protocol object anymore. This does not affect any other objects,
+       wp_viewport objects included.
+      </description>
+    </request>
+
+    <enum name="error">
+      <entry name="viewport_exists" value="0"
+             summary="the surface already has a viewport object associated"/>
+    </enum>
+
+    <request name="get_viewport">
+      <description summary="extend surface interface for crop and scale">
+       Instantiate an interface extension for the given wl_surface to
+       crop and scale its content. If the given wl_surface already has
+       a wp_viewport object associated, the viewport_exists
+       protocol error is raised.
+      </description>
+      <arg name="id" type="new_id" interface="wp_viewport"
+           summary="the new viewport interface id"/>
+      <arg name="surface" type="object" interface="wl_surface"
+           summary="the surface"/>
+    </request>
+  </interface>
+
+  <interface name="wp_viewport" version="1">
+    <description summary="crop and scale interface to a wl_surface">
+      An additional interface to a wl_surface object, which allows the
+      client to specify the cropping and scaling of the surface
+      contents.
+
+      This interface works with two concepts: the source rectangle (src_x,
+      src_y, src_width, src_height), and the destination size (dst_width,
+      dst_height). The contents of the source rectangle are scaled to the
+      destination size, and content outside the source rectangle is ignored.
+      This state is double-buffered, and is applied on the next
+      wl_surface.commit.
+
+      The two parts of crop and scale state are independent: the source
+      rectangle, and the destination size. Initially both are unset, that
+      is, no scaling is applied. The whole of the current wl_buffer is
+      used as the source, and the surface size is as defined in
+      wl_surface.attach.
+
+      If the destination size is set, it causes the surface size to become
+      dst_width, dst_height. The source (rectangle) is scaled to exactly
+      this size. This overrides whatever the attached wl_buffer size is,
+      unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
+      has no content and therefore no size. Otherwise, the size is always
+      at least 1x1 in surface local coordinates.
+
+      If the source rectangle is set, it defines what area of the wl_buffer is
+      taken as the source. If the source rectangle is set and the destination
+      size is not set, then src_width and src_height must be integers, and the
+      surface size becomes the source rectangle size. This results in cropping
+      without scaling. If src_width or src_height are not integers and
+      destination size is not set, the bad_size protocol error is raised when
+      the surface state is applied.
+
+      The coordinate transformations from buffer pixel coordinates up to
+      the surface-local coordinates happen in the following order:
+        1. buffer_transform (wl_surface.set_buffer_transform)
+        2. buffer_scale (wl_surface.set_buffer_scale)
+        3. crop and scale (wp_viewport.set*)
+      This means, that the source rectangle coordinates of crop and scale
+      are given in the coordinates after the buffer transform and scale,
+      i.e. in the coordinates that would be the surface-local coordinates
+      if the crop and scale was not applied.
+
+      If src_x or src_y are negative, the bad_value protocol error is raised.
+      Otherwise, if the source rectangle is partially or completely outside of
+      the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
+      when the surface state is applied. A NULL wl_buffer does not raise the
+      out_of_buffer error.
+
+      If the wl_surface associated with the wp_viewport is destroyed,
+      all wp_viewport requests except 'destroy' raise the protocol error
+      no_surface.
+
+      If the wp_viewport object is destroyed, the crop and scale
+      state is removed from the wl_surface. The change will be applied
+      on the next wl_surface.commit.
+    </description>
+
+    <request name="destroy" type="destructor">
+      <description summary="remove scaling and cropping from the surface">
+       The associated wl_surface's crop and scale state is removed.
+       The change is applied on the next wl_surface.commit.
+      </description>
+    </request>
+
+    <enum name="error">
+      <entry name="bad_value" value="0"
+            summary="negative or zero values in width or height"/>
+      <entry name="bad_size" value="1"
+            summary="destination size is not integer"/>
+      <entry name="out_of_buffer" value="2"
+            summary="source rectangle extends outside of the content area"/>
+      <entry name="no_surface" value="3"
+            summary="the wl_surface was destroyed"/>
+    </enum>
+
+    <request name="set_source">
+      <description summary="set the source rectangle for cropping">
+       Set the source rectangle of the associated wl_surface. See
+       wp_viewport for the description, and relation to the wl_buffer
+       size.
+
+       If all of x, y, width and height are -1.0, the source rectangle is
+       unset instead. Any other set of values where width or height are zero
+       or negative, or x or y are negative, raise the bad_value protocol
+       error.
+
+       The crop and scale state is double-buffered state, and will be
+       applied on the next wl_surface.commit.
+      </description>
+      <arg name="x" type="fixed" summary="source rectangle x"/>
+      <arg name="y" type="fixed" summary="source rectangle y"/>
+      <arg name="width" type="fixed" summary="source rectangle width"/>
+      <arg name="height" type="fixed" summary="source rectangle height"/>
+    </request>
+
+    <request name="set_destination">
+      <description summary="set the surface size for scaling">
+       Set the destination size of the associated wl_surface. See
+       wp_viewport for the description, and relation to the wl_buffer
+       size.
+
+       If width is -1 and height is -1, the destination size is unset
+       instead. Any other pair of values for width and height that
+       contains zero or negative values raises the bad_value protocol
+       error.
+
+       The crop and scale state is double-buffered state, and will be
+       applied on the next wl_surface.commit.
+      </description>
+      <arg name="width" type="int" summary="surface width"/>
+      <arg name="height" type="int" summary="surface height"/>
+    </request>
+  </interface>
+
+</protocol>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bemenu-0.6.17/lib/renderers/wayland/wayland.c 
new/bemenu-0.6.18/lib/renderers/wayland/wayland.c
--- old/bemenu-0.6.17/lib/renderers/wayland/wayland.c   2024-01-27 
15:53:56.000000000 +0100
+++ new/bemenu-0.6.18/lib/renderers/wayland/wayland.c   2024-02-02 
10:41:37.000000000 +0100
@@ -506,16 +506,14 @@
         };
     }
 
-    const char *scale = getenv("BEMENU_SCALE");
-    if (scale) {
-        max_scale = fmax(strtof(scale, NULL), 1.0f);
-    }
-
     if (min_max_height != window->max_height) {
         window->max_height = min_max_height;
     }
 
-    if (max_scale != window->scale) {
+    const char *env_scale = getenv("BEMENU_SCALE");
+    if (env_scale) {
+        window->scale = 1;
+    } else if (max_scale != window->scale) {
         window->scale = max_scale;
     }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bemenu-0.6.17/lib/renderers/wayland/wayland.h 
new/bemenu-0.6.18/lib/renderers/wayland/wayland.h
--- old/bemenu-0.6.17/lib/renderers/wayland/wayland.h   2024-01-27 
15:53:56.000000000 +0100
+++ new/bemenu-0.6.18/lib/renderers/wayland/wayland.h   2024-02-02 
10:41:37.000000000 +0100
@@ -8,6 +8,8 @@
 #include <linux/input-event-codes.h>
 
 #include "wlr-layer-shell-unstable-v1.h"
+#include "fractional-scale-v1.h"
+#include "viewporter.h"
 #include "renderers/cairo_renderer.h"
 
 struct bm_menu;
@@ -119,12 +121,13 @@
     struct wl_surface *surface;
     struct wl_callback *frame_cb;
     struct zwlr_layer_surface_v1 *layer_surface;
+    struct wp_viewport *viewport_surface;
     struct wl_shm *shm;
     struct buffer buffers[2];
     uint32_t width, height, max_height;
     uint32_t hmargin_size;
     float width_factor;
-    int32_t scale;
+    double scale;
     uint32_t displayed;
     struct wl_list link;
     enum bm_align align;
@@ -167,6 +170,9 @@
     struct input input;
     struct wl_list windows;
     uint32_t formats;
+    struct wp_fractional_scale_manager_v1 *wfs_mgr;
+    struct wp_viewporter *viewporter;
+    bool fractional_scaling;
 };
 
 void bm_wl_repeat(struct wayland *wayland);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bemenu-0.6.17/lib/renderers/wayland/window.c 
new/bemenu-0.6.18/lib/renderers/wayland/window.c
--- old/bemenu-0.6.17/lib/renderers/wayland/window.c    2024-01-27 
15:53:56.000000000 +0100
+++ new/bemenu-0.6.18/lib/renderers/wayland/window.c    2024-02-02 
10:41:37.000000000 +0100
@@ -6,6 +6,7 @@
 #include <fcntl.h>
 #include <stdlib.h>
 #include <sys/mman.h>
+#include <math.h>
 
 static int
 set_cloexec_or_close(int fd)
@@ -107,7 +108,7 @@
 }
 
 static bool
-create_buffer(struct wl_shm *shm, struct buffer *buffer, int32_t width, 
int32_t height, uint32_t format, int32_t scale)
+create_buffer(struct wl_shm *shm, struct buffer *buffer, int32_t width, 
int32_t height, uint32_t format, double scale)
 {
     int fd = -1;
     struct wl_shm_pool *pool = NULL;
@@ -146,7 +147,12 @@
     if (!(surf = cairo_image_surface_create_for_data(data, 
CAIRO_FORMAT_ARGB32, width, height, stride)))
         goto fail;
 
-    buffer->cairo.scale = scale;
+    const char *env_scale = getenv("BEMENU_SCALE");
+    if (env_scale) {
+        buffer->cairo.scale = fmax(strtof(env_scale, NULL), 1.0f);
+    } else {
+        buffer->cairo.scale = scale;
+    }
 
     if (!bm_cairo_create_for_surface(&buffer->cairo, surf)) {
         cairo_surface_destroy(surf);
@@ -183,14 +189,12 @@
     if (!buffer)
         return NULL;
 
-    if (window->width * window->scale != buffer->width || window->height * 
window->scale != buffer->height)
+    if ((uint32_t) ceil(window->width * window->scale) != buffer->width || 
(uint32_t) ceil(window->height * window->scale) != buffer->height)
         destroy_buffer(buffer);
 
-    if (!buffer->buffer && !create_buffer(window->shm, buffer, window->width * 
window->scale, window->height * window->scale, WL_SHM_FORMAT_ARGB8888, 
window->scale))
+    if (!buffer->buffer && !create_buffer(window->shm, buffer, 
ceil(window->width * window->scale), ceil(window->height * window->scale), 
WL_SHM_FORMAT_ARGB8888, window->scale))
         return NULL;
 
-    wl_surface_set_buffer_scale(window->surface, window->scale);
-
     return buffer;
 }
 
@@ -239,6 +243,7 @@
 void
 bm_wl_window_render(struct window *window, struct wl_display *display, struct 
bm_menu *menu)
 {
+    (void)display;
     assert(window && menu);
     struct buffer *buffer;
     for (int tries = 0; tries < 2; ++tries) {
@@ -254,16 +259,24 @@
         window->notify.render(&buffer->cairo, buffer->width, 
window->max_height, menu, &result);
         window->displayed = result.displayed;
 
-        if (window->height == result.height / window->scale)
+        if (window->height == (uint32_t) ceil(result.height / window->scale))
             break;
 
-        window->height = result.height / window->scale;
+        window->height = ceil(result.height / window->scale);
         zwlr_layer_surface_v1_set_size(window->layer_surface, window->width, 
window->height);
-        wl_surface_commit(window->surface);
-        wl_display_roundtrip(display);
         destroy_buffer(buffer);
     }
 
+    assert(ceil(window->width * window->scale) == buffer->width);
+    assert(ceil(window->height * window->scale) == buffer->height);
+
+    if (window->wayland->fractional_scaling) {
+        assert(window->viewport_surface);
+        wp_viewport_set_destination(window->viewport_surface, window->width, 
window->height);
+    } else {
+        wl_surface_set_buffer_scale(window->surface, window->scale);
+    }
+
     wl_surface_damage_buffer(window->surface, 0, 0, buffer->width, 
buffer->height);
     wl_surface_attach(window->surface, buffer->buffer, 0, 0);
     wl_surface_commit(window->surface);
@@ -318,6 +331,21 @@
     return width;
 }
 
+static void
+fractional_scale_preferred_scale(
+    void *data, struct wp_fractional_scale_v1 *wp_fractional_scale_v1,
+    uint32_t scale)
+{
+    (void)wp_fractional_scale_v1;
+    struct window *window = data;
+
+    window->scale = (double)scale / 120;
+}
+
+static const struct wp_fractional_scale_v1_listener fractional_scale_listener 
= {
+    .preferred_scale = fractional_scale_preferred_scale,
+};
+
 static const struct zwlr_layer_surface_v1_listener layer_surface_listener = {
     .configure = layer_surface_configure,
     .closed = layer_surface_closed,
@@ -388,6 +416,17 @@
 {
     assert(window);
 
+    struct wayland *wayland = window->wayland;
+
+    if (wayland->fractional_scaling) {
+        assert(wayland->wfs_mgr && wayland->viewporter);
+
+        struct wp_fractional_scale_v1 *wfs_surf = 
wp_fractional_scale_manager_v1_get_fractional_scale(wayland->wfs_mgr, surface);
+        wp_fractional_scale_v1_add_listener(
+            wfs_surf, &fractional_scale_listener, window);
+        window->viewport_surface = 
wp_viewporter_get_viewport(wayland->viewporter, surface);
+    }
+
     enum zwlr_layer_shell_v1_layer layer = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY;
     if (layer_shell && (window->layer_surface = 
zwlr_layer_shell_v1_get_layer_surface(layer_shell, surface, output, layer, 
"menu"))) {
         zwlr_layer_surface_v1_add_listener(window->layer_surface, 
&layer_surface_listener, window);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bemenu-0.6.17/lib/renderers/x11/x11.c 
new/bemenu-0.6.18/lib/renderers/x11/x11.c
--- old/bemenu-0.6.17/lib/renderers/x11/x11.c   2024-01-27 15:53:56.000000000 
+0100
+++ new/bemenu-0.6.18/lib/renderers/x11/x11.c   2024-02-02 10:41:37.000000000 
+0100
@@ -277,7 +277,7 @@
 static bool
 constructor(struct bm_menu *menu)
 {
-    if (getenv("WAYLAND_DISPLAY") || getenv("WAYLAND_SOCKET"))
+    if (!getenv("BEMENU_BACKEND") && (getenv("WAYLAND_DISPLAY") || 
getenv("WAYLAND_SOCKET")))
         return false;
 
     struct x11 *x11;

Reply via email to