* core: eglReleaseThread when we have no outputs
This fixes monitor on/off on the somewhat broken nvidia 580 drivers
and potentially other nvidia drivers as well.
* lockSurface: discard frameCallback when eglSwapBuffers fails
* egl: log more errors
* fix: handle EGL surface creation failure gracefully instead of aborting
When GPU VRAM is exhausted, eglCreatePlatformWindowSurfaceEXT and
wl_egl_window_create can return null. Previously this triggered
RASSERT -> std::abort(), crashing hyprlock and leaving the session
in a broken lock state.
Replace RASSERT with error logging and early return, setting
readyForFrame = false so the next configure event retries the
allocation. This allows hyprlock to survive transient GPU memory
pressure rather than crashing.
Fixes: https://github.com/hyprwm/hyprlock/issues/986
* lock-surface: improve error handling for lock surface configure
---------
Co-authored-by: Nilesh <nilesh@cloudgeni.us>
* pam: fix username race by using getpwuid_r instead of getpwuid
getpwuid() returns a pointer into a static buffer shared across all
threads. Any getpw*/getpwent call from another thread — including
those made internally by PAM modules during authentication — will
overwrite it before pam_start() reads pw_name, causing hyprlock to
authenticate as a random system user (root, bin, systemd-network)
or fail with 'user unknown'.
Replace with getpwuid_r(), which writes into a caller-supplied buffer,
and copy pw_name into a std::string before calling pam_start().
* pam: get username once
Instead of retrieving the username via getpwuid_r as in a69f526c95,
get the username once when initializing CPam and save it in a string.
This should be sufficent for making sure there are no problems with the
static buffer returned by getpwuid and is simpler.
* misc: clang-format
---------
Co-authored-by: mcgi5sr2 <mcgi5sr2@gmail.com>
Properly lock AWP<IWidget> weak pointers before calling onAssetUpdate()
to prevent use-after-free when widgets are destroyed during shutdown or
output removal. Guard timer callback against null g_asyncResourceManager.
Fix destruction order to join threads before resetting globals.
* core: use Hyprgraphics::CAsyncResourceGatherer
* core: move screencopy frame generation to the new resource manager
* core: introduce a dedicated onAssetUpdate callback
* check for unloaded before finished and some cleanup
* also allow for dynamic label resource deduplication
use a simple counter instead of a timestamp to allow the same
widget on a different monitor to reuse a text cmd resource.
I didn't do this before, because I was worried about two labels that use
the same command with different reload times. I mitigated that by just
incrementing the revision by the time interval. This should be sufficent
to avoid clashes.
* don't render within onAssetUpdate to avoid duplicate renders
another much improvement for multi monitor setups.
allows updating within the same frame for most labels.
* remove nvidia workaround :)
I tested and it seems like the resource manager revision makes
the nvidia workaround obsolete.
* widget: add click handling and point containment methods to IWidget interface
* core: add onClick method to handle mouse click events
- renderer: move getOrCreateWidgetsFor method declaration to public section
* core: update mouse event handling to track mouse location and button clicks
* widget: add onclick command handling and point containment to CLabel
- config: add onclick special config value to label
* assets: add label configuration for keyboard layout switching
* config: add onclick configuration for label widgets
- add CLICKABLE macro for onclick configuration
- replace direct onclick assignment with CLICKABLE macro
* core: fix cursor shape initialization and pointer handling
- ensure pointer is available before setting cursor shape
- initialize cursor shape device if not already done
* core: add hover handling and cursor shape updates
- implement onHover method to manage widget hover states
- update cursor shape based on hover status
- ensure all outputs are redrawn after state changes
* widgets: add hover state management and bounding box calculations
- add setHover and isHovered methods to manage hover state
- implement containsPoint method for hit testing
- override getBoundingBox in CLabel for accurate positioning
- add onHover method in CLabel to change cursor shape
* core: add hover handling in pointer motion
- invoke onHover method with current mouse location
* widgets: add hover handling and bounding box for password input field
- add getBoundingBox method to calculate the widget's bounding box
- implement onHover method to update cursor shape on hover
* widgets: update hover behavior for label widget
- modify cursor shape setting to only apply when onclickCommand is not empty
* core: optimize hover handling and rendering for lock surfaces
- Improve hover state tracking for widgets
- reduce unnecessary redraw calls by tracking hover changes
- remove redundant renderAllOutputs() call
* widgets: add onclick and hover to shape and image
* core: trigger hover and onclick only for the currently focused surface
* core: handle fractionalScale in onclick and hover
* core: don't trigger onclick or hover when hide_cursor is set
* misc: remove braces
* core: run onclick commands asnychronously
---------
Co-authored-by: Memoraike <memoraike@gmail.com>