move Windows version check to smtc.go conditionally compiled for Windows
This commit is contained in:
@@ -43,6 +43,10 @@ type SMTC struct {
|
|||||||
var smtcInstance *SMTC
|
var smtcInstance *SMTC
|
||||||
|
|
||||||
func InitSMTCForWindow(hwnd uintptr) (*SMTC, error) {
|
func InitSMTCForWindow(hwnd uintptr) (*SMTC, error) {
|
||||||
|
if maj, _, _ := windows.RtlGetNtVersionNumbers(); maj < 10 {
|
||||||
|
return nil, errors.New("SMTC is not supported on Windows versions < 10")
|
||||||
|
}
|
||||||
|
|
||||||
dll, err := windows.LoadDLL("smtc.dll")
|
dll, err := windows.LoadDLL("smtc.dll")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/sys/windows"
|
|
||||||
|
|
||||||
"github.com/dweymouth/supersonic/backend"
|
"github.com/dweymouth/supersonic/backend"
|
||||||
"github.com/dweymouth/supersonic/res"
|
"github.com/dweymouth/supersonic/res"
|
||||||
"github.com/dweymouth/supersonic/ui"
|
"github.com/dweymouth/supersonic/ui"
|
||||||
@@ -93,11 +91,8 @@ func main() {
|
|||||||
mainWindow.Window.(driver.NativeWindow).RunNative(func(ctx any) {
|
mainWindow.Window.(driver.NativeWindow).RunNative(func(ctx any) {
|
||||||
// intialize Windows SMTC
|
// intialize Windows SMTC
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
if maj, _, _ := windows.RtlGetNtVersionNumbers(); maj >= 10 {
|
hwnd := ctx.(driver.WindowsWindowContext).HWND
|
||||||
// SMTC is only available from Windows 10 (10.0.10240) onward
|
myApp.SetupWindowsSMTC(hwnd)
|
||||||
hwnd := ctx.(driver.WindowsWindowContext).HWND
|
|
||||||
myApp.SetupWindowsSMTC(hwnd)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// slightly hacky workaround for https://github.com/fyne-io/fyne/issues/4964
|
// slightly hacky workaround for https://github.com/fyne-io/fyne/issues/4964
|
||||||
|
|||||||
Reference in New Issue
Block a user