Compare commits

..

No commits in common. "5657f85c83a00600c4a534bd5f6ff1d79c5dd20e" and "07bcd119d745f4925e32f8b39b8e09d8c38f8e64" have entirely different histories.

4 changed files with 22 additions and 25 deletions

2
go.mod
View File

@ -3,7 +3,7 @@ module git.tebibyte.media/tomo/backend
go 1.20 go 1.20
require ( require (
git.tebibyte.media/tomo/tomo v0.36.0 git.tebibyte.media/tomo/tomo v0.35.0
git.tebibyte.media/tomo/typeset v0.7.1 git.tebibyte.media/tomo/typeset v0.7.1
git.tebibyte.media/tomo/xgbkb v1.0.1 git.tebibyte.media/tomo/xgbkb v1.0.1
github.com/jezek/xgb v1.1.1 github.com/jezek/xgb v1.1.1

4
go.sum
View File

@ -1,6 +1,6 @@
git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q= git.tebibyte.media/sashakoshka/xgbkb v1.0.0/go.mod h1:pNcE6TRO93vHd6q42SdwLSTTj25L0Yzggz7yLe0JV6Q=
git.tebibyte.media/tomo/tomo v0.36.0 h1:V9vyPYb4kpUceBhcDF/XyLDACzE5lY8kYEGHAkIsqs0= git.tebibyte.media/tomo/tomo v0.35.0 h1:1XvcUcWg1rBZXov3KfuX6VfiuBQ2mcJHIslHMLn07no=
git.tebibyte.media/tomo/tomo v0.36.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps= git.tebibyte.media/tomo/tomo v0.35.0/go.mod h1:C9EzepS9wjkTJjnZaPBh22YvVPyA4hbBAJVU20Rdmps=
git.tebibyte.media/tomo/typeset v0.7.1 h1:aZrsHwCG5ZB4f5CruRFsxLv5ezJUCFUFsQJJso2sXQ8= git.tebibyte.media/tomo/typeset v0.7.1 h1:aZrsHwCG5ZB4f5CruRFsxLv5ezJUCFUFsQJJso2sXQ8=
git.tebibyte.media/tomo/typeset v0.7.1/go.mod h1:PwDpSdBF3l/EzoIsa2ME7QffVVajnTHZN6l3MHEGe1g= git.tebibyte.media/tomo/typeset v0.7.1/go.mod h1:PwDpSdBF3l/EzoIsa2ME7QffVVajnTHZN6l3MHEGe1g=
git.tebibyte.media/tomo/xgbkb v1.0.1 h1:b3HDUopjdQp1MZrb5Vpil4bOtk3NnNXtfQW27Blw2kE= git.tebibyte.media/tomo/xgbkb v1.0.1 h1:b3HDUopjdQp1MZrb5Vpil4bOtk3NnNXtfQW27Blw2kE=

View File

@ -13,7 +13,7 @@ type scrollSum struct {
} }
// TODO: this needs to be configurable, we need a config api // TODO: this needs to be configurable, we need a config api
const scrollDistance = 32 const scrollDistance = 16
func (sum *scrollSum) add (button xproto.Button, window *window, state uint16) { func (sum *scrollSum) add (button xproto.Button, window *window, state uint16) {
if xgbkb.StateToModifiers(state).Shift { if xgbkb.StateToModifiers(state).Shift {

View File

@ -18,6 +18,7 @@ import "github.com/jezek/xgbutil/keybind"
import "github.com/jezek/xgbutil/mousebind" import "github.com/jezek/xgbutil/mousebind"
import "github.com/jezek/xgbutil/xgraphics" import "github.com/jezek/xgbutil/xgraphics"
type mainWindow struct { *window }
type window struct { type window struct {
backend *Backend backend *Backend
hierarchy *system.Hierarchy hierarchy *system.Hierarchy
@ -27,7 +28,6 @@ type window struct {
title string title string
leader *window
modalParent *window modalParent *window
hasModal bool hasModal bool
shy bool shy bool
@ -63,24 +63,28 @@ func (this *windowLink) NotifyMinimumSizeChange () {
func (this *Backend) NewWindow ( func (this *Backend) NewWindow (
bounds image.Rectangle, bounds image.Rectangle,
) ( ) (
output tomo.Window, output tomo.MainWindow,
err error, err error,
) { ) {
this.assert() this.assert()
return this.newWindow(bounds, false) window, err := this.newWindow(bounds, false)
output = mainWindow { window: window }
return output, err
} }
func (this *Backend) NewPlainWindow ( func (this *Backend) NewPlainWindow (
bounds image.Rectangle, bounds image.Rectangle,
) ( ) (
output tomo.Window, output tomo.MainWindow,
err error, err error,
) { ) {
this.assert() this.assert()
window, err := this.newWindow(bounds, false) window, err := this.newWindow(bounds, false)
window.setType("dock") window.setType("dock")
return window, err output = mainWindow { window: window }
return output, err
} }
func (this *Backend) newWindow ( func (this *Backend) newWindow (
@ -96,7 +100,6 @@ func (this *Backend) newWindow (
window := &window { backend: this } window := &window { backend: this }
link := &windowLink { window: window } link := &windowLink { window: window }
window.hierarchy = this.system.NewHierarchy(link) window.hierarchy = this.system.NewHierarchy(link)
window.leader = window
window.xWindow, err = xwindow.Generate(this.x) window.xWindow, err = xwindow.Generate(this.x)
if err != nil { return } if err != nil { return }
@ -175,11 +178,10 @@ func (this *window) SetTitle (title string) {
icccm.WmIconNameSet (this.backend.x, this.xWindow.Id, title) icccm.WmIconNameSet (this.backend.x, this.xWindow.Id, title)
} }
func (this *window) SetIcon (sizes ...canvas.Texture) { func (this *window) SetIcon (sizes ...image.Image) {
wmIcons := []ewmh.WmIcon { } wmIcons := []ewmh.WmIcon { }
for _, icon := range sizes { for _, icon := range sizes {
// TODO we use textures now. make this better
width := icon.Bounds().Max.X width := icon.Bounds().Max.X
height := icon.Bounds().Max.Y height := icon.Bounds().Max.Y
wmIcon := ewmh.WmIcon { wmIcon := ewmh.WmIcon {
@ -245,23 +247,18 @@ func (this *window) NewModal (bounds image.Rectangle) (tomo.Window, error) {
return modal, err return modal, err
} }
func (this *window) NewChild (bounds image.Rectangle) (tomo.Window, error) { func (this mainWindow) NewChild (bounds image.Rectangle) (tomo.Window, error) {
leader := this.leader
child, err := this.backend.newWindow ( child, err := this.backend.newWindow (
bounds.Add(this.metrics.bounds.Min), false) bounds.Add(this.metrics.bounds.Min), false)
child.leader = leader
if err != nil { return nil, err } if err != nil { return nil, err }
child.setClientLeader(this.window)
child.setClientLeader(leader) this.setClientLeader(this.window)
leader.setClientLeader(leader)
icccm.WmTransientForSet ( icccm.WmTransientForSet (
this.backend.x, this.backend.x,
child.xWindow.Id, this.xWindow.Id,
leader.xWindow.Id) this.xWindow.Id)
child.setType("UTILITY") this.setType("UTILITY")
// child.inheritProperties(leader.window) // this.inheritProperties(this.window)
return this, err return this, err
} }