Skip to content

Commit

Permalink
fix: set cursor on root window
Browse files Browse the repository at this point in the history
  • Loading branch information
atennert committed Jul 22, 2021
1 parent 3a4ae55 commit b59c1f6
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* update kotlin version to 1.5.10
* adjust ordering of monitors by y and x values
* include alternative actions window-move-next and window-move-previous
* set cursor on root window

21.2
* fix window toggling (forward)
Expand Down
1 change: 1 addition & 0 deletions src/nativeInterop/cinterop/xlib.def
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ headers = X11/Xlib.h \
X11/xpm.h \
X11/extensions/Xrandr.h \
X11/XF86keysym.h \
X11/cursorfont.h \
pango/pango.h \
pango/pangoxft.h \
libxml/parser.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ fun startup(system: SystemApi, logger: Logger): RuntimeResources? {

system.setErrorHandler(staticCFunction { _, err -> staticLogger?.logError("::runWindowManager::error code: ${err?.pointed?.error_code}"); 0 })

system.defineCursor(screen.root, system.createFontCursor(XC_left_ptr))

rootWindowPropertyHandler
.closeWith(RootWindowPropertyHandler::unsetWindowProperties)
.setSupportWindowProperties()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,14 @@ class SystemFacade : SystemApi {
return XUngrabButton(display, button, modifiers, window)
}

override fun createFontCursor(fontValue: Int): Cursor {
return XCreateFontCursor(display, fontValue.convert())
}

override fun defineCursor(window: Window, cursor: Cursor): Int {
return XDefineCursor(display, window, cursor)
}

override fun allowEvents(eventMode: Int, time: Time) {
XAllowEvents(display, eventMode, time)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ interface InputApi {

fun ungrabButton(button: UInt, modifiers: UInt, window: Window): Int

fun createFontCursor(fontValue: Int): Cursor

fun defineCursor(window: Window, cursor: Cursor): Int

fun getModifierMapping(): CPointer<XModifierKeymap>?

fun getDisplayKeyCodeMinMaxCounts(): Pair<Int, Int>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,14 @@ open class SystemFacadeMock : SystemApi {
return 0
}

override fun createFontCursor(fontValue: Int): Cursor {
return 0.convert()
}

override fun defineCursor(window: Window, cursor: Cursor): Int {
return 1
}

override fun allowEvents(eventMode: Int, time: Time) {
functionCalls.add(FunctionCall("allowEvents", eventMode, time))
}
Expand Down

0 comments on commit b59c1f6

Please sign in to comment.