@@ -3,6 +3,7 @@ package internal
33import (
44 "os/exec"
55 "sync"
6+ "time"
67
78 "github.com/BurntSushi/xgb"
89 "github.com/BurntSushi/xgb/xproto"
@@ -179,16 +180,14 @@ type outputInfo struct {
179180
180181// RegistryHandler handles Wayland registry events
181182type RegistryHandler struct {
182- wl.OutputGeometryHandler
183- wl.OutputModeHandler
184-
185183 registry * wl.Registry
186184 compositor * wl.Compositor
187185 lockManager * ext.SessionLockManager
188186 seat * wl.Seat
189187 shm * wl.Shm
190188 outputs map [uint32 ]* wl.Output
191189 outputGeometries map [* wl.Output ]outputInfo
190+ locker * WaylandLocker
192191}
193192
194193// Media file extension maps
@@ -209,29 +208,57 @@ type handlerFunc func(wl.OutputGeometryEvent)
209208// outputModeHandlerFunc is a function type for handling output mode events
210209type outputModeHandlerFunc func (ev wl.OutputModeEvent )
211210
211+ // WaylandLocker represents a Wayland-based screen locker
212212type WaylandLocker struct {
213+ // Wayland connection and display
213214 display * wl.Display
214215 registry * wl.Registry
215216 registryHandler * RegistryHandler
216217 compositor * wl.Compositor
217- lockManager * ext.SessionLockManager
218- lock * ext.SessionLock
219- keyboard * wl.Keyboard
220- seat * wl.Seat
221218 shm * wl.Shm
222- securePassword * SecurePassword
223- surfaces map [* wl.Output ]struct {
219+ seat * wl.Seat
220+ keyboard * wl.Keyboard
221+ pointer * wl.Pointer
222+ output * wl.Output
223+ lock * ext.SessionLock
224+ lockSurface * wl.Surface
225+ lockManager * ext.SessionLockManager
226+
227+ // Session lock surfaces
228+ surfaces map [* wl.Output ]struct {
224229 wlSurface * wl.Surface
225230 lockSurface * ext.SessionLockSurface
226231 }
227- redrawCh chan int
228- outputs map [uint32 ]* wl.Output
229- mediaPlayer * MediaPlayer
232+ outputs map [uint32 ]* wl.Output
233+
234+ // State
235+ mu sync.Mutex
230236 done chan struct {}
231- config Configuration
232- helper * LockHelper
233- lockActive bool
237+ redrawCh chan int
238+ securePassword * SecurePassword
234239 countdownActive bool
235- lockoutManager * LockoutManager // Use the shared lockout manager
236- mu sync.Mutex
240+ countdownTimer * time.Timer
241+ lockActive bool
242+ mediaPlayer * MediaPlayer
243+ lockoutManager * LockoutManager
244+
245+ // Keymap data
246+ keymapData []byte
247+ keymapFormat uint32
248+ keymapSize uint32
249+ xkbContext uintptr
250+ xkbState uintptr
251+ xkbKeymap uintptr
252+
253+ // Configuration
254+ config Configuration
255+ helper * LockHelper
256+ }
257+
258+ // updatePasswordDisplay updates the password display
259+ func (l * WaylandLocker ) updatePasswordDisplay () {
260+ select {
261+ case l .redrawCh <- l .securePassword .Length ():
262+ default :
263+ }
237264}
0 commit comments