graphics glitch fix & fixed wine registry issue
This commit is contained in:
@@ -173,6 +173,7 @@ func createWineRegistryComponents() {
|
||||
enableOptionAsAltButton = widget.NewButton("Enable", func() {
|
||||
enableOptionAsAltButton.Disable()
|
||||
disableOptionAsAltButton.Disable()
|
||||
remapOperationInProgress = true
|
||||
|
||||
// Show loading state in status label
|
||||
fyne.Do(func() {
|
||||
@@ -182,6 +183,10 @@ func createWineRegistryComponents() {
|
||||
|
||||
// Run in goroutine to avoid blocking UI
|
||||
go func() {
|
||||
defer func() {
|
||||
remapOperationInProgress = false
|
||||
}()
|
||||
|
||||
if err := utils.SetOptionAsAltEnabled(true); err != nil {
|
||||
debug.Printf("Failed to enable Option-as-Alt mapping: %v", err)
|
||||
// Update UI on main thread
|
||||
@@ -210,6 +215,7 @@ func createWineRegistryComponents() {
|
||||
disableOptionAsAltButton = widget.NewButton("Disable", func() {
|
||||
enableOptionAsAltButton.Disable()
|
||||
disableOptionAsAltButton.Disable()
|
||||
remapOperationInProgress = true
|
||||
|
||||
// Show loading state in status label
|
||||
fyne.Do(func() {
|
||||
@@ -219,6 +225,10 @@ func createWineRegistryComponents() {
|
||||
|
||||
// Run in goroutine to avoid blocking UI
|
||||
go func() {
|
||||
defer func() {
|
||||
remapOperationInProgress = false
|
||||
}()
|
||||
|
||||
if err := utils.SetOptionAsAltEnabled(false); err != nil {
|
||||
debug.Printf("Failed to disable Option-as-Alt mapping: %v", err)
|
||||
// Update UI on main thread
|
||||
@@ -298,33 +308,31 @@ func startPulsingEffect() {
|
||||
dots := ""
|
||||
|
||||
for pulsingActive {
|
||||
select {
|
||||
case <-pulsingTicker.C:
|
||||
if pulsingActive {
|
||||
// Cycle through different dot patterns for visual effect
|
||||
switch len(dots) {
|
||||
case 0:
|
||||
dots = "."
|
||||
case 1:
|
||||
dots = ".."
|
||||
case 2:
|
||||
dots = "..."
|
||||
default:
|
||||
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)
|
||||
}
|
||||
}
|
||||
})
|
||||
<-pulsingTicker.C
|
||||
if pulsingActive {
|
||||
// Cycle through different dot patterns for visual effect
|
||||
switch len(dots) {
|
||||
case 0:
|
||||
dots = "."
|
||||
case 1:
|
||||
dots = ".."
|
||||
case 2:
|
||||
dots = "..."
|
||||
default:
|
||||
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)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
@@ -66,8 +66,55 @@ func showOptionsPopup() {
|
||||
|
||||
// Set the close button action to hide the popup
|
||||
closeButton.OnTapped = func() {
|
||||
popup.Hide()
|
||||
if remapOperationInProgress {
|
||||
// Show warning popup instead of closing
|
||||
showRemapWarningPopup()
|
||||
} else {
|
||||
popup.Hide()
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
|
@@ -45,6 +45,7 @@ var (
|
||||
|
||||
// State variables
|
||||
currentWineRegistryEnabled bool
|
||||
remapOperationInProgress bool
|
||||
|
||||
// Pulsing effect variables (pulsingActive is in status.go)
|
||||
pulsingTicker *time.Ticker
|
||||
|
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
wineRegistrySection = "[Software\\Wine\\Mac Driver]"
|
||||
wineRegistrySection = "[Software\\\\Wine\\\\Mac Driver]"
|
||||
leftOptionKey = "\"LeftOptionIsAlt\"=\"Y\""
|
||||
rightOptionKey = "\"RightOptionIsAlt\"=\"Y\""
|
||||
wineLoaderPath = "/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/CrossOver-Hosted Application/wineloader2"
|
||||
|
Reference in New Issue
Block a user