summaryrefslogtreecommitdiff
path: root/window.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-06 14:46:32 -0600
committerJeff Carr <[email protected]>2025-02-06 14:46:32 -0600
commit93e87a05c7220f1a8dd7ac2e8dc43b123f6e0f71 (patch)
treedfac2d257144a33fc3ebc39a03b38d295703c0cb /window.go
parentbc15e6c87955d9ba837fe125ca2c53737afaf014 (diff)
dragging a windows keeps it put
Diffstat (limited to 'window.go')
-rw-r--r--window.go21
1 files changed, 16 insertions, 5 deletions
diff --git a/window.go b/window.go
index 313c153..621bae1 100644
--- a/window.go
+++ b/window.go
@@ -83,13 +83,24 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
// re-draws the buttons for each of the windows
func redoWindows(nextW int, nextH int) {
- for _, win := range findWindows() {
- win.dumpWidget(fmt.Sprintf("redoWindowsS (%d,%d)", nextW, nextH))
- win.redrawWindow(nextW, nextH)
- win.dumpWidget(fmt.Sprintf("redoWindowsE (%d,%d)", nextW, nextH))
+ for _, tk := range findWindows() {
+ tk.dumpWidget(fmt.Sprintf("redoWindowsS (%d,%d)", nextW, nextH))
+ if tk.window.wasDragged {
+ // don't move windows around the user has dragged to a certain location
+ tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0)
+ } else {
+ w, _ := me.baseGui.Size()
+ if nextW > w-20 {
+ nextW = 0
+ nextH += 4
+ }
+ // probably a new window?
+ tk.redrawWindow(nextW, nextH)
+ }
+ tk.dumpWidget(fmt.Sprintf("redoWindowsE (%d,%d)", nextW, nextH))
// increment the width for the next window
- nextW += win.gocuiSize.Width() + 10
+ nextW += tk.gocuiSize.Width() + 10
// nextH += 10
}
}