dragging and window placement is still messed up

This commit is contained in:
Jeff Carr 2025-02-06 21:25:51 -06:00
parent 0b265d2b72
commit 3d104d5b4a
3 changed files with 30 additions and 1 deletions

View File

@ -99,6 +99,15 @@ var colorButton colorT = colorT{
name: "normal button", name: "normal button",
} }
var colorButtonDense colorT = colorT{
frame: none,
fg: none,
bg: gocui.ColorGreen,
selFg: none,
selBg: gocui.ColorWhite,
name: "normal button",
}
var colorDropdown colorT = colorT{ var colorDropdown colorT = colorT{
frame: gocui.ColorYellow, frame: gocui.ColorYellow,
fg: none, fg: none,

View File

@ -141,7 +141,10 @@ func tabCycleWindows(g *gocui.Gui, v *gocui.View) error {
return nil return nil
} }
tk.makeWindowActive() tk.makeWindowActive()
tk.doWidgetClick(tk.gocuiSize.w0, tk.gocuiSize.h0) w, h := g.MousePosition()
me.downW = w
me.downH = h
tk.doWindowClick()
return nil return nil
} }

View File

@ -142,6 +142,13 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
newH = newH - startH newH = newH - startH
// tk.dumpWidget(fmt.Sprintf("PlaceGroup(%d,%d)", maxW, newH)) // tk.dumpWidget(fmt.Sprintf("PlaceGroup(%d,%d)", maxW, newH))
return maxW, newH return maxW, newH
case widget.Button:
if tk.isWindowDense() && tk.isInGrid() {
tk.frame = false
tk.color = &colorButtonDense
}
tk.gocuiSetWH(startW, startH)
return tk.gocuiSize.Width(), tk.gocuiSize.Height()
default: default:
tk.gocuiSetWH(startW, startH) tk.gocuiSetWH(startW, startH)
return tk.gocuiSize.Width(), tk.gocuiSize.Height() return tk.gocuiSize.Width(), tk.gocuiSize.Height()
@ -159,6 +166,16 @@ func (tk *guiWidget) isWindowDense() bool {
return tk.parent.isWindowDense() return tk.parent.isWindowDense()
} }
func (tk *guiWidget) isInGrid() bool {
if tk.node.WidgetType == widget.Grid {
return true
}
if tk.parent == nil {
return true
}
return tk.parent.isInGrid()
}
func (w *guiWidget) placeGrid(startW int, startH int) (int, int) { func (w *guiWidget) placeGrid(startW int, startH int) (int, int) {
// w.showWidgetPlacement("grid0:") // w.showWidgetPlacement("grid0:")
if w.node.WidgetType != widget.Grid { if w.node.WidgetType != widget.Grid {