| File was renamed from VoiceSnapGo/internal/overlay/overlay_windows.go |
| | |
| | | pt wPoint |
| | | } |
| | | type wWndClassEx struct { |
| | | cbSize uint32 |
| | | style uint32 |
| | | wndProc uintptr |
| | | clsExtra int32 |
| | | wndExtra int32 |
| | | hInstance uintptr |
| | | hIcon uintptr |
| | | hCursor uintptr |
| | | hbrBg uintptr |
| | | menuName *uint16 |
| | | className *uint16 |
| | | hIconSm uintptr |
| | | cbSize uint32 |
| | | style uint32 |
| | | wndProc uintptr |
| | | clsExtra int32 |
| | | wndExtra int32 |
| | | hInstance uintptr |
| | | hIcon uintptr |
| | | hCursor uintptr |
| | | hbrBg uintptr |
| | | menuName *uint16 |
| | | className *uint16 |
| | | hIconSm uintptr |
| | | } |
| | | type gdipSI struct { |
| | | ver uint32 |
| | |
| | | func (o *winOverlay) SetVolume(vol float64) { trySendF(o.volCh, vol) } |
| | | func (o *winOverlay) SetPosition(x, y int) { trySendP(o.posCh, [2]int{x, y}) } |
| | | func (o *winOverlay) GetPosition() (int, int) { return o.posX, o.posY } |
| | | func (o *winOverlay) Size() (int, int) { return capW, capH } |
| | | func (o *winOverlay) OnDragged(fn func(x, y int)) { o.dragCb = fn } |
| | | func (o *winOverlay) Close() { close(o.closeCh); <-o.done } |
| | | |
| | | func trySend(ch chan bool, v bool) { select { case ch <- v: default: } } |
| | | func trySendS(ch chan statusCmd, v statusCmd) { select { case ch <- v: default: } } |
| | | func trySendF(ch chan float64, v float64) { select { case ch <- v: default: } } |
| | | func trySendP(ch chan [2]int, v [2]int) { select { case ch <- v: default: } } |
| | | func trySend(ch chan bool, v bool) { |
| | | select { |
| | | case ch <- v: |
| | | default: |
| | | } |
| | | } |
| | | func trySendS(ch chan statusCmd, v statusCmd) { |
| | | select { |
| | | case ch <- v: |
| | | default: |
| | | } |
| | | } |
| | | func trySendF(ch chan float64, v float64) { |
| | | select { |
| | | case ch <- v: |
| | | default: |
| | | } |
| | | } |
| | | func trySendP(ch chan [2]int, v [2]int) { |
| | | select { |
| | | case ch <- v: |
| | | default: |
| | | } |
| | | } |
| | | |
| | | // ---- Main render thread ---- |
| | | |
| | |
| | | |
| | | // Register window class |
| | | hInst, _, _ := kGetModuleHandle.Call(0) |
| | | cls, _ := syscall.UTF16PtrFromString("VoiceSnapOverlay") |
| | | cls, _ := syscall.UTF16PtrFromString("PrivateVoiceInputOverlay") |
| | | wc := wWndClassEx{ |
| | | cbSize: uint32(unsafe.Sizeof(wWndClassEx{})), |
| | | wndProc: syscall.NewCallback(overlayWndProc), |