Skip to content

Commit

Permalink
Fixed bit-twizzling error in new window-state-event
Browse files Browse the repository at this point in the history
Misunderstood use of the ChangedMask in gtk's window-state-event
  • Loading branch information
mftb0 committed Feb 17, 2024
1 parent 7131beb commit d5318a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/cbxv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

const (
NAME = "cbxv"
VERSION = "0.5.2"
VERSION = "0.5.3"
)

// Update listens for messages on the message channel and
Expand Down
10 changes: 6 additions & 4 deletions internal/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ func NewUI(m *model.Model, messenger util.Messenger) *UI {
})
u.MainWindow.Connect("window-state-event", func(w *gtk.Window, event *gdk.Event) bool {
ev := gdk.EventWindowStateNewFromEvent(event)
if ev.ChangedMask() & ev.NewWindowState() == gdk.WINDOW_STATE_FULLSCREEN {
u.SendMessage(util.Message{TypeName: "setFullscreen", Data: "true"})
} else {
u.SendMessage(util.Message{TypeName: "setFullscreen", Data: "false"})
if ev.ChangedMask() & gdk.WINDOW_STATE_FULLSCREEN != 0 {
if ev.NewWindowState() & gdk.WINDOW_STATE_FULLSCREEN != 0 {
u.SendMessage(util.Message{TypeName: "setFullscreen", Data: "true"})
} else {
u.SendMessage(util.Message{TypeName: "setFullscreen", Data: "false"})
}
}
return true
})
Expand Down

0 comments on commit d5318a6

Please sign in to comment.