Commit graph

73 commits

Author SHA1 Message Date
Maximilian Seidler
318c00d6d0
core: stabilize label updates and revision locking in the asyncResourceGatherer (#384)
* core: handle rerendering when frameCallback is pending

* core: log when skipping label updates

* asyncResourceGatherer: remove busy and use loopMutex

Makes getAssetById fail less often and thus labels get more stable
updates

* asyncResourceGatherer: revision locking

`assetsMutex` was not needed, since `apply` only gets called from the
main thread and resources are also only aquired via the main thread.

`preloadTargets`, previously kinda guarded by the `busy` flag are now
locked as suggested in #367 (but via a copy of `peloadTargets`).

`apply` now returns a boolean so that the locking of preloadTargets in
combination with checking `preloadTargets.empty()` is a bit nicer.

* asyncResourceGatherer: remove explicit template arg for unique lock
2024-06-26 20:31:15 +02:00
Vaxry
c5b8ad03d0
core: move to hyprutils for utils (#362)
* core: move to hyprutils for utils

* Nix: add hyprutils dep

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-06-08 23:49:49 +02:00
André Silva
768cd3ea52
core: handle null timers in destructors (#350) 2024-05-26 18:46:53 +02:00
Tom Englund
58c93d8de8
core: fix a few reported leaks by asan (#349)
* widgets: add missing virtual destructor

destructor is missing and as a consequence all sub classes gets wrongly
destructed reported as "new-delete-type-mismatch" by asan.

* gatherer: free memory allocated by pango

with pango_parse_markup its up to the caller of the function to free the
pointer to the text returned stored in this buf.

* core: add destructor and free devices

add a destructor and free both drmDevice and gbmDevice, leaks reported
by asan.

* core: free xkb allocated state and keymap

free xkb state and keymap on destruction to prevent leak on exit and
less asan spam.

* locksurface: destroy the surface frame on done

the callback was never being destroyed and is leaking on each
frameCallback creation, call wl_callback_destroy in onCallback() and
free the memory. reported with asan.
2024-05-25 20:05:37 +02:00
8658386f21 image: fix build with libc++
fixes #289
2024-04-22 10:12:42 +01:00
bvr-yr
04267a5f83
label: add text_align option for multi-line text (#278) 2024-04-13 14:38:06 +01:00
Maximilian Seidler
883fbdfe01
auth: implement a full pam conversation (#205)
* auth: implement a full pam conversation

* input-field: fixup failedAttempts and color change

Credits to @bvr-yr

* pam: set default module to hyprland

* input-field: backup previous asset

* auth: restart auth in onPasswordCheckTimer

* auth: immediately switch to waiting when input was submitted

* auth: remove redundant waitingForPamAuth

* auth: add inputRequested and reschedule submitInput

* auth: clear password buffer and handle submitInput before input is requested

* Revert "input-field: backup previous asset"

This reverts commit 89702945be6af4aa43f54688ad34a4ccba994a3e.

Without the backup we avoid rendering the prompt placeholder for one frame when the failText is not available.
Looks better this way.

* auth: fallback to su if pam_module not in /etc/pam.d

rare occasion where a path check even works on nix

* auth: rename inputSubmitted and resubmit callback

* auth: detach failText from the conversation

* fix rebase mistake

* auth: make sure prompt and failText are not reset when restarting auth

needed for labels

* auth: force update timers when the prompt changes

* auth: remove unused stuff
2024-04-10 22:41:31 +01:00
bvr-yr
eb1123fa2e
widgets: add Shape + minor image improve (#266)
* widgets: add Shape

* image: minor improvment

* glClear on FB alloc

* add Nix HM

* always create FB if not xray
2024-04-10 17:24:17 +01:00
Maximilian Seidler
1bfe32e7fa
input-field: also fade in when checkWaiting is true (#265) 2024-04-09 11:14:25 +01:00
bvr-yr
bbbb960e42
image: add reload options (#247)
* image: add reload options

* check for actual file changes

* use modtime

* check only same paths

* add Nix HM
2024-04-07 18:09:25 +01:00
Mike Rivnak
ad41b31135
core: Add user description variable (#248) 2024-03-31 02:06:11 +01:00
bvr-yr
84c6282d6a
widgets: add rotate option to label and image (#234)
* widgets: add `rotate` option to label and image

* use framebuffer for image
2024-03-29 19:01:11 +00:00
bvr-yr
f77e17e4d2
label: add $LAYOUT variable (#211)
* label: add `$LAYOUT` variable

* add exclamation mark as wildcard to hide layout
2024-03-21 15:19:12 +00:00
kcirick
54da0cae0f
auth: Use getpwuid(getuid()) instead of getlogin() (#204)
* Making changes

* Replacing struct with auto keyword

* Removing the extra semicolon

* ran clang-format
2024-03-19 15:50:23 +00:00
Maximilian Seidler
b50acfaf94
input-field: only render the current output on fade out callback (#206) 2024-03-19 02:49:12 +00:00
bvr-yr
1bf6ffdbe2
input-field: new color features (#201)
* input-field: new color features

* add nix HM

* add workaround for faillasset not being shown on empty imput

* comment

* change cfg option name

* remove TODO

* small fix

* one more edge check

* dedup changeColor function

* simplify more
2024-03-19 02:46:52 +00:00
bvr-yr
23224d40e4
input-field: various fixes (#198)
* input-field: some fixes

* simplify; correctly check passlen(utf8) in draw return

* correctly erase utf-8 on backspace

* render on up events too

* omglul

me dumb

* revert fade speed change
2024-03-17 00:32:43 +00:00
bvr-yr
3e38762e84
widgets: add Image (#191) 2024-03-16 16:44:44 +02:00
Maximilian Seidler
e040c56ad2
core: fix libc++ compatibility (#195)
* core: add missing header

libc++ compatibility #193

* input-field: fix wrong clock type
2024-03-15 14:43:29 +00:00
Abhinav Anil
56e7bc1e51
input-field: fix missing fail_text when placeholder_text is empty (#192)
* input-field: fix missing fail text when placeholder is empty

* comments
2024-03-15 14:26:02 +00:00
Abhinav Anil
1c92c6109c
renderer: add fade out animation and property to disable (#188)
* renderer, Nix/HM module: add fade out animation and prop

* fix: fade duration and disable on non hyprland session

* fix: revert needsFrame condition, update duration to 500ms

* fix: make shadows obey widget opacity
2024-03-14 13:23:41 +00:00
bvr-yr
988d5b3957
label: add $FAIL and $ATTEMPTS (#186)
* label: add `$ATTEMPTS` variable

* labels: also add `$FAIL`

* SHOUT
2024-03-13 21:25:06 +00:00
bvr-yr
f3a41161ec
input-field: add capslock and numlock options (#182)
* input-field: add capslock and numlock options

* fixups

* Nix/HM module: add {caps,num}lock options

---------

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2024-03-13 01:10:42 +00:00
bvr-yr
6027f12d3b
input-field: fix alignment on multi-monitors (#175)
* input-field: fix alignment on multi-monitors

* clang-format

* remove redundant
2024-03-11 18:14:12 +00:00
bvr-yr
6c9d6f05a0
input-field: check_color + some fixes (#172) 2024-03-11 15:17:14 +00:00
bvr-yr
066e0ae88f
core: force update labels on SIGUSR2 (#169)
* core: force update labels on `SIGUSR2`

* allow 0ms and force
2024-03-10 21:38:01 +00:00
Maximilian Seidler
766d470308
input-field: display utf-8 codepoint length (#164) 2024-03-10 14:33:01 +00:00
Maximilian Seidler
8086d896e6
background: handle missing assets (#158)
* background: fix background not rendering when resource gatherer is busy

* asyncResourceGatherer: check cairo_surface_status

* background: clear resource id when texture is invalid
2024-03-09 16:45:44 +00:00
bvr-yr
149b6737c2
input-field: fail display improvments (#154)
* input-field: fail display improvments

* update Home Manager

* add `$ATTEMPTS` variable, change defaults

* nix wording

* log failed attempts
2024-03-09 16:44:58 +00:00
Maximilian Seidler
b4a1c8ccbb
label: Fix label updates (#152)
* label: render output via stringPort instead of surface

* label: retry onAssetCallback

Calling `render` might not update the asset when the surfaces frameCallback is already set.

* Revert "label: fix rendering with multiple timers that fire at the same time (#147)"

This reverts commit e9a57f0dae.
2024-03-08 22:48:59 +00:00
Maximilian Seidler
e9a57f0dae
label: fix rendering with multiple timers that fire at the same time (#147) 2024-03-07 21:32:32 +00:00
Maximilian Seidler
1d39a530a4
label: higher precision resource id's (#148) 2024-03-07 21:31:58 +00:00
Maximilian Seidler
3d6162e06e
input-field: Add fade out timeout #3 (#142)
* input-field: add fade out timeout

* input-field: let dots reset themselfs

Now the dots kind of fade into the placeholder text on a failure.

* Nix/HM module: add input-field:fade_timeout option
2024-03-06 21:12:49 +00:00
81ec54c0e8 shadow: fix build 2024-03-05 20:31:31 +00:00
9b54840e12 shadows: disable by default 2024-03-05 20:28:29 +00:00
a4dc596cb8 renderer: add shadowable props 2024-03-05 20:27:28 +00:00
bvr-yr
d1f542a75f
input-field: add dots rounding option (#130)
* refactor: move dot props to struct, rename to camelCase

* input-field: add dots rounding option

* render: minor fix for odd input-field width

* add dots_rounding option to Home Manager
2024-03-04 17:59:36 +00:00
matteo4375
49ef1d306c
input-field: Add rounding option (#127)
* input-field: add rounding option

* add rounding option to nix home manager module
2024-03-04 01:54:27 +00:00
p4rfait
19d7844f04
hidden-input-field: add seed for random colors in hidden input field outline (#125) 2024-03-03 22:55:27 +00:00
ada7ce8e56 renderer: various fixes to transformations and backgrounds
fixes #111
2024-03-03 02:19:31 +00:00
Maximilian Seidler
ac757cf7ab
input-field: show autentication failReason without additional input (#98)
This makes it so that
1. The renderer is triggered when the onPasswordCheckTimer callback is fired. Previously you had to give an
   additional input for the renderer to be triggered and the fail reason to show.
2. The updateDots function now sets dots.currentAmout to 0, when a failID is present.
   That leads to the draw function to return false and the failReason to be displayed until another input happens.
2024-02-29 14:34:27 +00:00
582e8c86b4 label: use a callback from asyncGatherer to render 2024-02-26 18:25:52 +00:00
bvr-yr
a7cffd0f77
render: remove alpha check for input-field (#90) 2024-02-26 17:37:19 +00:00
bvr-yr
94ac7fef1a
input-field: dots improvements (#84)
* input-field: dots improvements

* fix stuff
2024-02-26 00:33:19 +00:00
Maurice Kraus
0ad65916b8
renderer: restrict maximum dot amount w.r.t to input width (#56) 2024-02-24 14:14:10 +00:00
Jan Beich
8969351cba
core: Add libc++ compatibility (#73)
src/renderer/AsyncResourceGatherer.cpp:98:22: error: no viable overloaded '+='
   98 |             progress += 1.0 / (preloads + 1.0);
      |             ~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~
src/renderer/widgets/IWidget.cpp:41:44: error: no member named 'current_zone' in namespace 'std::chrono'
   41 |     const auto current_zone = std::chrono::current_zone();
      |                               ~~~~~~~~~~~~~^
2024-02-23 21:29:08 +00:00
4c68780143 format: sanitize username for null
ref #64
2024-02-23 13:04:13 +00:00
Jan Beich
f85287a523
core: Unbreak build on FreeBSD (#71)
* Add OpenPAM support (used by BSDs except OpenBSD)

--   Package 'pam', required by 'virtual:world', not found
CMake Error at /usr/local/share/cmake/Modules/FindPkgConfig.cmake:619 (message):
  The following required packages were not found:

   - pam

src/core/Password.cpp:6:10: fatal error: 'security/pam_misc.h' file not found
    6 | #include <security/pam_misc.h>
      |          ^~~~~~~~~~~~~~~~~~~~~

* Add missing headers

src/renderer/widgets/IWidget.cpp: In member function 'virtual IWidget::SFormatResult IWidget::formatString(std::string)':
src/renderer/widgets/IWidget.cpp:51:41: error: 'getlogin' was not declared in this scope
   51 |     replaceAll(in, "$USER", std::string{getlogin()});
      |                                         ^~~~~~~~
src/renderer/widgets/IWidget.cpp:51:51: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(<brace-enclosed initializer list>)'
   51 |     replaceAll(in, "$USER", std::string{getlogin()});
      |                                                   ^
src/renderer/DMAFrame.cpp: In member function 'bool CDMAFrame::onBufferDone()':
src/renderer/DMAFrame.cpp:181:17: error: 'close' was not declared in this scope; did you mean 'pclose'?
  181 |                 close(fd[plane_tmp]);
      |                 ^~~~~
      |                 pclose
src/renderer/DMAFrame.cpp:196:13: error: 'close' was not declared in this scope; did you mean 'pclose'?
  196 |             close(fd[plane]);
      |             ^~~~~
      |             pclose
src/core/Password.cpp: In lambda function:
src/core/Password.cpp:44:31: error: 'strdup' was not declared in this scope
   44 |         reply->resp         = strdup(pass.c_str());
      |                               ^~~~~~
src/core/hyprlock.cpp: In member function 'void CHyprlock::spawnAsync(const std::string&)':
src/core/hyprlock.cpp:768:9: error: 'sigemptyset' was not declared in this scope
  768 |         sigemptyset(&set);
      |         ^~~~~~~~~~~
src/core/hyprlock.cpp:769:21: error: 'SIG_SETMASK' was not declared in this scope
  769 |         sigprocmask(SIG_SETMASK, &set, NULL);
      |                     ^~~~~~~~~~~
src/core/hyprlock.cpp:769:9: error: 'sigprocmask' was not declared in this scope
  769 |         sigprocmask(SIG_SETMASK, &set, NULL);
      |         ^~~~~~~~~~~
2024-02-23 12:54:14 +00:00
7ca13a801b renderer: fix misc blur shenanigans
fixes #58
2024-02-22 00:31:33 +00:00
1b57d52179 background: add blurring 2024-02-21 22:21:16 +00:00