Skip to content

Commit

Permalink
#2: ignore windows that are no windows (for the wm?!?)
Browse files Browse the repository at this point in the history
  • Loading branch information
atennert committed Feb 20, 2021
1 parent 45552ab commit 2056f56
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* fix window toggling (forward)
* fix linking for systems with /usr/lib64
* add window toggling backwards
* fixed issue where frames have no content

21.1
* fix memory leak
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ class WindowHandler(
override fun addWindow(windowId: Window, isSetup: Boolean) {
system.grabServer()
val windowAttributes = nativeHeap.alloc<XWindowAttributes>()
system.getWindowAttributes(windowId, windowAttributes.ptr)
if (system.getWindowAttributes(windowId, windowAttributes.ptr) == X_FALSE) {
system.ungrabServer()
// not a window or something ...
return
}

if (windowAttributes.override_redirect != X_FALSE ||
(isSetup && windowAttributes.map_state != IsViewable)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ open class SystemFacadeMock : SystemApi {
val windowBorderWidth = 2
override fun getWindowAttributes(window: Window, attributes: CPointer<XWindowAttributes>): Int {
attributes.pointed.border_width = windowBorderWidth
return 0
return 1
}

override fun changeWindowAttributes(window: Window, mask: ULong, attributes: CPointer<XSetWindowAttributes>): Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class WindowHandlerTest {
val systemApi = object : SystemFacadeMock() {
override fun getWindowAttributes(window: Window, attributes: CPointer<XWindowAttributes>): Int {
attributes.pointed.map_state = IsViewable
return 0
return 1
}
}
val windowId: Window = systemApi.getNewWindowId()
Expand Down Expand Up @@ -146,7 +146,7 @@ class WindowHandlerTest {
val systemApi = object : SystemFacadeMock() {
override fun getWindowAttributes(window: Window, attributes: CPointer<XWindowAttributes>): Int {
attributes.pointed.map_state = IsUnmapped
return 0
return 1
}
}
testForNoActionDuringSetup(systemApi)
Expand All @@ -157,7 +157,7 @@ class WindowHandlerTest {
val systemApi = object : SystemFacadeMock() {
override fun getWindowAttributes(window: Window, attributes: CPointer<XWindowAttributes>): Int {
attributes.pointed.override_redirect = X_TRUE
return 0
return 1
}
}
testForNoActionDuringSetup(systemApi)
Expand Down Expand Up @@ -203,7 +203,7 @@ class WindowHandlerTest {
val systemApi = object : SystemFacadeMock() {
override fun getWindowAttributes(window: Window, attributes: CPointer<XWindowAttributes>): Int {
attributes.pointed.override_redirect = X_TRUE
return 0
return 1
}
}
val windowId: Window = systemApi.getNewWindowId()
Expand Down

0 comments on commit 2056f56

Please sign in to comment.