Comments (8)
But even with the code shown below added, the example still registers each and every workspace change correctly while at the same time cortile frequently fails to do so. The root cause must be something else ...
...just a guess in the dark, please comment those 4 lines and report back: https://github.com/leukipp/cortile/blob/main/input/mousebinding.go#L50-L53
That's it! After commenting those lines I cannot reproduce the issue anymore.
from cortile.
Thanks for your efforts and detailed description, nailing the problem down:
I noticed that occasionally some events are never received by cortile at all, for example the _NET_CURRENT_DESKTOP property change from the root window when changing the workspace.
At first I thought it was about my picom config and all the stuff going on (fade animation, blur) that choked the X connection and event queue somehow but then I noticed it doesn't happen when changing the workspace via external means (wmctrl or the workspace switcher of the LXQt panel) instead of Openbox's keybindings.
This could be an upstream issue, that can only be fixed in the xgb or xgbutil library which cortile relies on.
Trying to reproduce this bug on an environment will cost me some time, so I would kindly ask you to run the minimal example
below to confirm that this is caused by xgb dependencies.
minimal example
main.go
Please build via go build main.go
and run the binary.
package main
import (
"fmt"
"github.com/BurntSushi/xgb/xproto"
"github.com/BurntSushi/xgbutil"
"github.com/BurntSushi/xgbutil/ewmh"
"github.com/BurntSushi/xgbutil/xevent"
"github.com/BurntSushi/xgbutil/xprop"
"github.com/BurntSushi/xgbutil/xwindow"
)
func main() {
X, err := xgbutil.NewConn()
if err != nil {
fmt.Println("Connection to X server failed")
return
}
root := xwindow.New(X, X.RootWin())
root.Listen(xproto.EventMaskSubstructureNotify | xproto.EventMaskPropertyChange)
fmt.Println("Listen")
xevent.PropertyNotifyFun(StateUpdate).Connect(X, root.Id)
xevent.Main(X)
}
func StateUpdate(X *xgbutil.XUtil, e xevent.PropertyNotifyEvent) {
aname, err := xprop.AtomName(X, e.Atom)
fmt.Println(aname)
if err != nil {
fmt.Println("Error retrieving atom name")
return
}
if IsInList(aname, []string{"_NET_CURRENT_DESKTOP"}) {
fmt.Println("--------- _NET_CURRENT_DESKTOP --------->", CurrentDesktopGet(X))
}
}
func IsInList(item string, items []string) bool {
for i := 0; i < len(items); i++ {
if items[i] == item {
return true
}
}
return false
}
func CurrentDesktopGet(X *xgbutil.XUtil) uint {
currentDesk, err := ewmh.CurrentDesktopGet(X)
if err != nil {
fmt.Println("Error retrieving current desktop")
}
return currentDesk
}
While trying to identify the problem I added more log output to cortile at places where X events are initially received and processed.
The minimal example should include the cortile implementations (root.go) you mentioned, where the issue original arises.
Please let me know, if the --------- _NET_CURRENT_DESKTOP --------->
output still reports the wrong (previous) workspace. It may be some race condition where _NET_CURRENT_DESKTOP
fires, but ewmh.CurrentDesktopGet(X)
still reports the old state.
from cortile.
Thanks for creating the minimal example! I tried it and running it at the same time as cortile, I cannot reproduce the issue in the minimal example whereas it keeps happening in cortile.
As a next step I added the code below to the example to include event listener callbacks for all clients/windows mimicking what cortile does. I thought that maybe having a lot of listeners to different X clients in a single program might be the reason for the issues.
But even with the code shown below added, the example still registers each and every workspace change correctly while at the same time cortile frequently fails to do so. The root cause must be something else ...
code patch for attaching client handlers in the minimal example
@@ -25,9 +25,42 @@ func main() {
fmt.Println("Listen")
xevent.PropertyNotifyFun(StateUpdate).Connect(X, root.Id)
+ windows, err := ewmh.ClientListStackingGet(X)
+ if err != nil {
+ fmt.Println("Error retrieving client list: ", err)
+ }
+ for _, win := range windows {
+ fmt.Println("attaching window handlers")
+ attachClientHandlers(X, xwindow.New(X, win))
+ }
xevent.Main(X)
}
+func attachClientHandlers(X *xgbutil.XUtil, c *xwindow.Window) {
+ c.Listen(xproto.EventMaskStructureNotify | xproto.EventMaskPropertyChange | xproto.EventMaskFocusChange)
+
+ // Attach structure events
+ xevent.ConfigureNotifyFun(func(x *xgbutil.XUtil, ev xevent.ConfigureNotifyEvent) {
+ fmt.Println("Client structure event")
+ }).Connect(X, c.Id)
+
+ // Attach property events
+ xevent.PropertyNotifyFun(func(x *xgbutil.XUtil, ev xevent.PropertyNotifyEvent) {
+ aname, _ := xprop.AtomName(X, ev.Atom)
+ fmt.Println("Client property event ", aname)
+ }).Connect(X, c.Id)
+
+ // Attach focus in events
+ xevent.FocusInFun(func(x *xgbutil.XUtil, ev xevent.FocusInEvent) {
+ fmt.Println("Client focus in event")
+ }).Connect(X, c.Id)
+
+ // Attach focus out events
+ xevent.FocusOutFun(func(x *xgbutil.XUtil, ev xevent.FocusOutEvent) {
+ fmt.Println("Client focus out event")
+ }).Connect(X, c.Id)
+}
+
func StateUpdate(X *xgbutil.XUtil, e xevent.PropertyNotifyEvent) {
aname, err := xprop.AtomName(X, e.Atom)
from cortile.
But even with the code shown below added, the example still registers each and every workspace change correctly while at the same time cortile frequently fails to do so. The root cause must be something else ...
...just a guess in the dark, please comment those 4 lines and report back:
https://github.com/leukipp/cortile/blob/main/input/mousebinding.go#L50-L53
from cortile.
Please also try the version from the xgb-jezek branch, where github.com/BurntSushi/xgb*
is replaced with the github.com/jezek/xgb*
fork, which provides those features:
I've forked the XGB repository from BurntSushi's github to apply some
patches which caused panics and memory leaks upon close and tests were added,
to test multiple server close scenarios.
Much of the code has been rewritten in an effort to support thread safety and multiple extensions.
It is thread safe and gets immediate improvement from parallelism when
GOMAXPROCS > 1. (See the benchmarks in xproto/xproto_test.go for evidence.)
from cortile.
Please also try the version from the xgb-jezek branch [...]
No difference to the main branch's behavior in terms of the issue observed.
from cortile.
Thanks for your feedback! A proper fix will be included in the next cortile release.
from cortile.
The fix is included in v2.5.0.
from cortile.
Related Issues (20)
- using restore in toggle instead of disable/enable(only)
- How i can make disable+fullscreen mode? HOT 1
- cortile release v2.3.2 crashes on start with GLIBC not found HOT 3
- [question] socket communication commands to enable/disable cortile HOT 6
- Remember tiling state and layout proportions
- The unit files have no installation config (WantedBy=, RequiredBy=, Also=, Alias= settings in the [Install] section, and DefaultInstance= for template units). This means they are not meant to be enabled using systemctl. HOT 1
- requested feature (switcher mode) show tiling for all open windows HOT 5
- how to enable it on second monitor? HOT 3
- Automatically open applications on specific workspaces HOT 1
- How to disable mod_* keys? HOT 2
- Extended external communication via D-BUS HOT 1
- Option to disable window decorations only in fullscreen layout HOT 4
- How to change the key binding from Ctrl + Shift to Super Key? HOT 6
- i3 support HOT 1
- Feature Suggestions: Workspace specific + Toggle Fill HOT 1
- Crash - integer divide by zero HOT 10
- 3 columns HOT 1
- New fullscreen and maximized layouts [breaking change]
- Window dimenions are misread when using Reaper
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cortile.