graphics glitch fix & fixed wine registry issue

This commit is contained in:
aomizu
2025-06-09 11:40:20 +09:00
parent d260eb05f3
commit 03c7b2190c
8 changed files with 87 additions and 31 deletions

View File

@@ -2,5 +2,5 @@
Icon = "Icon.png" Icon = "Icon.png"
Name = "TurtleSilicon" Name = "TurtleSilicon"
ID = "com.tairasu.turtlesilicon" ID = "com.tairasu.turtlesilicon"
Version = "1.2.0" Version = "1.2.1"
Build = 33 Build = 37

View File

@@ -15,7 +15,7 @@ import (
"fyne.io/fyne/v2/widget" "fyne.io/fyne/v2/widget"
) )
const appVersion = "1.2.0" const appVersion = "1.2.1"
func main() { func main() {
TSApp := app.NewWithID("com.tairasu.turtlesilicon") TSApp := app.NewWithID("com.tairasu.turtlesilicon")

View File

@@ -173,6 +173,7 @@ func createWineRegistryComponents() {
enableOptionAsAltButton = widget.NewButton("Enable", func() { enableOptionAsAltButton = widget.NewButton("Enable", func() {
enableOptionAsAltButton.Disable() enableOptionAsAltButton.Disable()
disableOptionAsAltButton.Disable() disableOptionAsAltButton.Disable()
remapOperationInProgress = true
// Show loading state in status label // Show loading state in status label
fyne.Do(func() { fyne.Do(func() {
@@ -182,6 +183,10 @@ func createWineRegistryComponents() {
// Run in goroutine to avoid blocking UI // Run in goroutine to avoid blocking UI
go func() { go func() {
defer func() {
remapOperationInProgress = false
}()
if err := utils.SetOptionAsAltEnabled(true); err != nil { if err := utils.SetOptionAsAltEnabled(true); err != nil {
debug.Printf("Failed to enable Option-as-Alt mapping: %v", err) debug.Printf("Failed to enable Option-as-Alt mapping: %v", err)
// Update UI on main thread // Update UI on main thread
@@ -210,6 +215,7 @@ func createWineRegistryComponents() {
disableOptionAsAltButton = widget.NewButton("Disable", func() { disableOptionAsAltButton = widget.NewButton("Disable", func() {
enableOptionAsAltButton.Disable() enableOptionAsAltButton.Disable()
disableOptionAsAltButton.Disable() disableOptionAsAltButton.Disable()
remapOperationInProgress = true
// Show loading state in status label // Show loading state in status label
fyne.Do(func() { fyne.Do(func() {
@@ -219,6 +225,10 @@ func createWineRegistryComponents() {
// Run in goroutine to avoid blocking UI // Run in goroutine to avoid blocking UI
go func() { go func() {
defer func() {
remapOperationInProgress = false
}()
if err := utils.SetOptionAsAltEnabled(false); err != nil { if err := utils.SetOptionAsAltEnabled(false); err != nil {
debug.Printf("Failed to disable Option-as-Alt mapping: %v", err) debug.Printf("Failed to disable Option-as-Alt mapping: %v", err)
// Update UI on main thread // Update UI on main thread
@@ -298,33 +308,31 @@ func startPulsingEffect() {
dots := "" dots := ""
for pulsingActive { for pulsingActive {
select { <-pulsingTicker.C
case <-pulsingTicker.C: if pulsingActive {
if pulsingActive { // Cycle through different dot patterns for visual effect
// Cycle through different dot patterns for visual effect switch len(dots) {
switch len(dots) { case 0:
case 0: dots = "."
dots = "." case 1:
case 1: dots = ".."
dots = ".." case 2:
case 2: dots = "..."
dots = "..." default:
default: dots = ""
dots = ""
}
// Update the label with pulsing dots
fyne.Do(func() {
if pulsingActive && optionAsAltStatusLabel != nil {
// Use the dots directly in the status text
if strings.Contains(optionAsAltStatusLabel.String(), "Enabling") {
optionAsAltStatusLabel.ParseMarkdown("**Remap Option key as Alt key:** Enabling" + dots)
} else if strings.Contains(optionAsAltStatusLabel.String(), "Disabling") {
optionAsAltStatusLabel.ParseMarkdown("**Remap Option key as Alt key:** Disabling" + dots)
}
}
})
} }
// Update the label with pulsing dots
fyne.Do(func() {
if pulsingActive && optionAsAltStatusLabel != nil {
// Use the dots directly in the status text
if strings.Contains(optionAsAltStatusLabel.String(), "Enabling") {
optionAsAltStatusLabel.ParseMarkdown("**Remap Option key as Alt key:** Enabling" + dots)
} else if strings.Contains(optionAsAltStatusLabel.String(), "Disabling") {
optionAsAltStatusLabel.ParseMarkdown("**Remap Option key as Alt key:** Disabling" + dots)
}
}
})
} }
} }
}() }()

View File

@@ -66,8 +66,55 @@ func showOptionsPopup() {
// Set the close button action to hide the popup // Set the close button action to hide the popup
closeButton.OnTapped = func() { closeButton.OnTapped = func() {
popup.Hide() if remapOperationInProgress {
// Show warning popup instead of closing
showRemapWarningPopup()
} else {
popup.Hide()
}
} }
popup.Show() popup.Show()
} }
// showRemapWarningPopup shows a warning popup when user tries to close options during remap operation
func showRemapWarningPopup() {
if currentWindow == nil {
return
}
// Create warning content
warningTitle := widget.NewRichTextFromMarkdown("# ⚠️ Please Wait")
warningMessage := widget.NewRichTextFromMarkdown("**Remap operation is in progress.**\n\nThe wine registry is being modified. This will take a moment.\n\nPlease wait for the operation to complete before closing the options.")
// Create OK button
okButton := widget.NewButton("OK", func() {
// This will be set when the popup is created
})
okButton.Importance = widget.HighImportance
// Create warning content container
warningContent := container.NewVBox(
container.NewCenter(warningTitle),
widget.NewSeparator(),
warningMessage,
widget.NewSeparator(),
container.NewCenter(okButton),
)
// Calculate smaller popup size
windowSize := currentWindow.Content().Size()
popupWidth := windowSize.Width * 2 / 3
popupHeight := windowSize.Height / 2
// Create the warning popup
warningPopup := widget.NewModalPopUp(container.NewPadded(warningContent), currentWindow.Canvas())
warningPopup.Resize(fyne.NewSize(popupWidth, popupHeight))
// Set the OK button action to hide the warning popup
okButton.OnTapped = func() {
warningPopup.Hide()
}
warningPopup.Show()
}

View File

@@ -45,6 +45,7 @@ var (
// State variables // State variables
currentWineRegistryEnabled bool currentWineRegistryEnabled bool
remapOperationInProgress bool
// Pulsing effect variables (pulsingActive is in status.go) // Pulsing effect variables (pulsingActive is in status.go)
pulsingTicker *time.Ticker pulsingTicker *time.Ticker

View File

@@ -10,7 +10,7 @@ import (
) )
const ( const (
wineRegistrySection = "[Software\\Wine\\Mac Driver]" wineRegistrySection = "[Software\\\\Wine\\\\Mac Driver]"
leftOptionKey = "\"LeftOptionIsAlt\"=\"Y\"" leftOptionKey = "\"LeftOptionIsAlt\"=\"Y\""
rightOptionKey = "\"RightOptionIsAlt\"=\"Y\"" rightOptionKey = "\"RightOptionIsAlt\"=\"Y\""
wineLoaderPath = "/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/CrossOver-Hosted Application/wineloader2" wineLoaderPath = "/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/CrossOver-Hosted Application/wineloader2"

BIN
turtlesilicon Executable file

Binary file not shown.

Binary file not shown.