Compare commits
2 Commits
v0.1.3-tes
...
v0.1.3-tes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b059c91388 | ||
|
|
289337f016 |
@@ -9,6 +9,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -139,6 +140,7 @@ var hwndNoZOrder uintptr = 0x0004
|
|||||||
var hwndNoSize uintptr = 0x0001
|
var hwndNoSize uintptr = 0x0001
|
||||||
var hwndNoActivate uintptr = 0x0010
|
var hwndNoActivate uintptr = 0x0010
|
||||||
var hwndShowWindow uintptr = 0x0040
|
var hwndShowWindow uintptr = 0x0040
|
||||||
|
var swMinimize uintptr = 6
|
||||||
var swRestore uintptr = 9
|
var swRestore uintptr = 9
|
||||||
var swHideControl uintptr = 0
|
var swHideControl uintptr = 0
|
||||||
var swShowControl uintptr = 5
|
var swShowControl uintptr = 5
|
||||||
@@ -328,6 +330,9 @@ func guiLog(text string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runNativeGUI(initialTab string) error {
|
func runNativeGUI(initialTab string) error {
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
user32 := syscall.NewLazyDLL("user32.dll")
|
user32 := syscall.NewLazyDLL("user32.dll")
|
||||||
kernel32 := syscall.NewLazyDLL("kernel32.dll")
|
kernel32 := syscall.NewLazyDLL("kernel32.dll")
|
||||||
gdi32 := syscall.NewLazyDLL("gdi32.dll")
|
gdi32 := syscall.NewLazyDLL("gdi32.dll")
|
||||||
@@ -790,8 +795,25 @@ func runNativeGUI(initialTab string) error {
|
|||||||
width = rc.Right
|
width = rc.Right
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if x >= width-42 && x <= width-22 && y >= 12 && y <= 32 {
|
switch {
|
||||||
guiLog("close button ignored to keep GUI visible")
|
case pointInHeaderDot(x, y, width-92, 22):
|
||||||
|
guiLog("window control minimize")
|
||||||
|
if showWindowProc != nil {
|
||||||
|
showWindowProc.Call(hwnd, swMinimize)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
case pointInHeaderDot(x, y, width-62, 22):
|
||||||
|
guiLog("window control topmost toggle")
|
||||||
|
app.topMost = !app.topMost
|
||||||
|
saveGUISettings(&app)
|
||||||
|
applyTopMost(hwnd, &app)
|
||||||
|
if invalidateRectProc != nil {
|
||||||
|
invalidateRectProc.Call(hwnd, 0, 1)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
case pointInHeaderDot(x, y, width-32, 22):
|
||||||
|
guiLog("window control close")
|
||||||
|
postQuitMessage.Call(0)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
releaseCapture.Call()
|
releaseCapture.Call()
|
||||||
@@ -894,7 +916,8 @@ func runNativeGUI(initialTab string) error {
|
|||||||
postQuitMessage.Call(0)
|
postQuitMessage.Call(0)
|
||||||
return 0
|
return 0
|
||||||
case wmCloseGUI:
|
case wmCloseGUI:
|
||||||
guiLog("wmClose ignored to keep GUI visible")
|
guiLog("wmClose received")
|
||||||
|
postQuitMessage.Call(0)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
ret, _, _ := defWindowProc.Call(hwnd, uintptr(message), wParam, lParam)
|
ret, _, _ := defWindowProc.Call(hwnd, uintptr(message), wParam, lParam)
|
||||||
@@ -990,6 +1013,10 @@ func refreshGUI(setWindowText *syscall.LazyProc, app *guiApp, reloadData bool) {
|
|||||||
if app == nil {
|
if app == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if app.activeTab == "history" && !reloadData {
|
||||||
|
syncPaneVisibility(app)
|
||||||
|
return
|
||||||
|
}
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
defer func() {
|
defer func() {
|
||||||
if d := time.Since(start); d > 100*time.Millisecond {
|
if d := time.Since(start); d > 100*time.Millisecond {
|
||||||
@@ -1724,6 +1751,10 @@ func paintMainWindow(hwnd uintptr, app *guiApp) uintptr {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func pointInHeaderDot(x, y, cx, cy int32) bool {
|
||||||
|
return x >= cx-11 && x <= cx+11 && y >= cy-11 && y <= cy+11
|
||||||
|
}
|
||||||
|
|
||||||
func paintFooter(hdc uintptr, rc winRect, app *guiApp) {
|
func paintFooter(hdc uintptr, rc winRect, app *guiApp) {
|
||||||
if app == nil {
|
if app == nil {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user