ui: add Config.Sp and Config.Dp convenience methods

And rename Pixels to Val.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-05-16 19:32:47 +02:00
parent acf345a0f8
commit 00cb158247
7 changed files with 26 additions and 16 deletions
+2 -2
View File
@@ -207,8 +207,8 @@ func Main() {
}
cfg := getConfig()
opts := singleWindow.opts
w := cfg.Pixels(opts.Width)
h := cfg.Pixels(opts.Height)
w := cfg.Val(opts.Width)
h := cfg.Val(opts.Height)
title := C.CString(opts.Title)
defer C.free(unsafe.Pointer(title))
C.gio_main(view, title, C.CGFloat(w), C.CGFloat(h))
+2 -2
View File
@@ -222,8 +222,8 @@ func createNativeWindow(opts *WindowOptions) (*window, error) {
C.free(unsafe.Pointer(title))
_, _, cfg := w.config()
w.width = int(cfg.Pixels(opts.Width) + .5)
w.height = int(cfg.Pixels(opts.Height) + .5)
w.width = int(cfg.Val(opts.Width) + .5)
w.height = int(cfg.Val(opts.Height) + .5)
if conn.decor != nil {
// Request server side decorations.
w.decor = C.zxdg_decoration_manager_v1_get_toplevel_decoration(conn.decor, w.topLvl)
+2 -2
View File
@@ -217,8 +217,8 @@ func createNativeWindow(opts *WindowOptions) (*window, error) {
}
defer unregisterClass(cls, hInst)
wr := rect{
right: int32(cfg.Pixels(opts.Width) + .5),
bottom: int32(cfg.Pixels(opts.Height) + .5),
right: int32(cfg.Val(opts.Width) + .5),
bottom: int32(cfg.Val(opts.Height) + .5),
}
dwStyle := uint32(_WS_OVERLAPPEDWINDOW)
dwExStyle := uint32(_WS_EX_APPWINDOW | _WS_EX_WINDOWEDGE)