From 5a0e0cd49b978cfc54f6776de9cc1e6e0436a776 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Sun, 13 Nov 2022 15:39:33 -0500 Subject: [PATCH] Set minimum window dimensions --- backends/x/x.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/backends/x/x.go b/backends/x/x.go index 2eec2b4..3f70a4b 100644 --- a/backends/x/x.go +++ b/backends/x/x.go @@ -14,6 +14,7 @@ import "golang.org/x/image/font/basicfont" import "github.com/jezek/xgbutil" import "github.com/jezek/xgb/xproto" import "github.com/jezek/xgbutil/ewmh" +import "github.com/jezek/xgbutil/icccm" import "github.com/jezek/xgbutil/xevent" import "github.com/jezek/xgbutil/xwindow" import "github.com/jezek/xgbutil/xgraphics" @@ -404,6 +405,22 @@ func factory (application *stone.Application) (output stone.Backend, err error) ) backend.SetTitle(application.Title()) backend.SetIcon(application.Icon()) + if err != nil { return } + + // set minimum dimensions + minWidth := + backend.metrics.cellWidth + backend.metrics.padding * 2 + minHeight := + backend.metrics.cellHeight + backend.metrics.padding * 2 + err = icccm.WmNormalHintsSet ( + backend.connection, + backend.window.Id, + &icccm.NormalHints { + Flags: icccm.SizeHintPMinSize, + MinWidth: uint(minWidth), + MinHeight: uint(minHeight), + }) + if err != nil { return } // create a canvas backend.reallocateCanvas()