fix: reintroduce surface updating

close #8
This commit is contained in:
Virt 2024-07-03 14:29:33 +02:00
commit 5cecd4aea3
2 changed files with 16 additions and 1 deletions

View file

@ -197,7 +197,7 @@ A shape rule usually consists of three parts:
``` ```
shaperule = shape-name, mode (optional), property: value, property: value, ... 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. - `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. - `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. 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 ## license
This plugin is licensed under the MIT License. Have a look at the `LICENSE.md` file for more information. This plugin is licensed under the MIT License. Have a look at the `LICENSE.md` file for more information.

View file

@ -16,6 +16,7 @@
#include <hyprland/src/config/ConfigValue.hpp> #include <hyprland/src/config/ConfigValue.hpp>
#include "hyprland/cursor.hpp" #include "hyprland/cursor.hpp"
#include <hyprland/src/protocols/core/Compositor.hpp>
#include <hyprland/wlr/interfaces/wlr_output.h> #include <hyprland/wlr/interfaces/wlr_output.h>
#include <hyprland/wlr/render/interface.h> #include <hyprland/wlr/render/interface.h>
@ -65,6 +66,9 @@ void CDynamicCursors::renderSoftware(CPointerManager* pointers, SP<CMonitor> pMo
auto zoom = resultShown.scale; auto zoom = resultShown.scale;
if ((!state->hardwareFailed && state->softwareLocks == 0)) { if ((!state->hardwareFailed && state->softwareLocks == 0)) {
if (pointers->currentCursorImage.surface)
pointers->currentCursorImage.surface->resource()->frame(now);
return; return;
} }
@ -94,6 +98,9 @@ void CDynamicCursors::renderSoftware(CPointerManager* pointers, SP<CMonitor> pMo
// now pass the hotspot to rotate around // 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); 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) { void CDynamicCursors::setShape(const std::string& shape) {
Debug::log(WARN, "[dynamic-cursors] setting shape {}", shape);
g_pShapeRuleHandler->activate(shape); g_pShapeRuleHandler->activate(shape);
} }
void CDynamicCursors::unsetShape() { void CDynamicCursors::unsetShape() {
Debug::log(WARN, "[dynamic-cursors] setting shape to clientside");
g_pShapeRuleHandler->activate("clientside"); g_pShapeRuleHandler->activate("clientside");
} }