From 5cecd4aea33abd6e81132cc08330dd21d8ce2ee6 Mon Sep 17 00:00:00 2001 From: Virt <41426325+VirtCode@users.noreply.github.com> Date: Wed, 3 Jul 2024 14:29:33 +0200 Subject: [PATCH] fix: reintroduce surface updating close #8 --- README.md | 8 +++++++- src/cursor.cpp | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d88d911..ff59843 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ A shape rule usually consists of three parts: ``` shaperule = shape-name, mode (optional), property: value, property: value, ... ``` -- `shape-name`: This is the name of the shape, this rule will apply to. Should be one of [those specified in the protocol](https://wayland.app/protocols/cursor-shape-v1#wp_cursor_shape_device_v1:enum:shape). You can use the special shape `clientside` to apply your rule to **ALL** client side cursors. +- `shape-name`: This is the name of the shape, this rule will apply to. Should be one of [those specified in the protocol](https://wayland.app/protocols/cursor-shape-v1#wp_cursor_shape_device_v1:enum:shape). You can use the special shape `clientside` to apply your rule to **ALL** client side cursors. Also note that the compositor will set the shape to `left_ptr` if you are on the wallpaper. - `mode` (optional): Can override the mode used by this shape, see `mode` in the config. This argument is optional and can be left out. - `property: value`: At the end of the rule follow zero or more property-value pairs. These are config values that will be overridden if this rule is active. Only config values from the sections `rotate`, `tilt`, `stretch` as seen above can be used. @@ -239,5 +239,11 @@ If you want to debug hardware cursors, this plugin also has an additional config Also make sure you disable the plugin on your host session, otherwise your cursor will be rotated twice. +With some distributions of hyprland (notably the hyprland packages on Arch), your system headers are not complete? In this case the build will fail with something like `wayland.hpp: No such file or directory`. In these cases you have to resort back to using `hyprpm`'s headers. To do so, make sure to update hyprpm (`hyprpm update`), and set the following env in your shell before using the makefile: + +```sh +export PKG_CONFIG_PATH="$HOME/.local/share/hyprpm/headersRoot/share/pkgconfig" +``` + ## license This plugin is licensed under the MIT License. Have a look at the `LICENSE.md` file for more information. diff --git a/src/cursor.cpp b/src/cursor.cpp index 7818f31..3cce358 100644 --- a/src/cursor.cpp +++ b/src/cursor.cpp @@ -16,6 +16,7 @@ #include #include "hyprland/cursor.hpp" +#include #include #include @@ -65,6 +66,9 @@ void CDynamicCursors::renderSoftware(CPointerManager* pointers, SP pMo auto zoom = resultShown.scale; if ((!state->hardwareFailed && state->softwareLocks == 0)) { + if (pointers->currentCursorImage.surface) + pointers->currentCursorImage.surface->resource()->frame(now); + return; } @@ -94,6 +98,9 @@ void CDynamicCursors::renderSoftware(CPointerManager* pointers, SP pMo // now pass the hotspot to rotate around renderCursorTextureInternalWithDamage(texture, &box, &damage, 1.F, pointers->currentCursorImage.hotspot * state->monitor->scale * zoom, zoom > 1 && **PNEAREST, resultShown.stretch.angle, resultShown.stretch.magnitude); + + if (pointers->currentCursorImage.surface) + pointers->currentCursorImage.surface->resource()->frame(now); } /* @@ -262,10 +269,12 @@ void CDynamicCursors::onCursorMoved(CPointerManager* pointers) { } void CDynamicCursors::setShape(const std::string& shape) { + Debug::log(WARN, "[dynamic-cursors] setting shape {}", shape); g_pShapeRuleHandler->activate(shape); } void CDynamicCursors::unsetShape() { + Debug::log(WARN, "[dynamic-cursors] setting shape to clientside"); g_pShapeRuleHandler->activate("clientside"); }