mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
screen change mutex, fixes "HTTP requests are not buffered - screen changing is failing".
This commit is contained in:
parent
245c3d9635
commit
4aa7da45e1
@ -1,10 +1,14 @@
|
||||
package desktop
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/desktop/xorg"
|
||||
)
|
||||
|
||||
var mu = sync.Mutex{}
|
||||
|
||||
func (manager *DesktopManagerCtx) Move(x, y int) {
|
||||
xorg.Move(x, y)
|
||||
}
|
||||
@ -42,10 +46,15 @@ func (manager *DesktopManagerCtx) GetScreenSize() *types.ScreenSize {
|
||||
}
|
||||
|
||||
func (manager *DesktopManagerCtx) ChangeScreenSize(width int, height int, rate int) error {
|
||||
mu.Lock()
|
||||
manager.emmiter.Emit("before_screen_size_change")
|
||||
err := xorg.ChangeScreenSize(width, height, rate)
|
||||
|
||||
defer func() {
|
||||
manager.emmiter.Emit("after_screen_size_change")
|
||||
return err
|
||||
mu.Unlock()
|
||||
}()
|
||||
|
||||
return xorg.ChangeScreenSize(width, height, rate)
|
||||
}
|
||||
|
||||
func (manager *DesktopManagerCtx) SetKeyboardLayout(layout string) {
|
||||
|
Loading…
Reference in New Issue
Block a user