mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
io/pointer: [API] make cursor name into a byte
Add most of the common cursors defined by different systems. Normalize cursor names to match CSS. This is API change: some cursor names have changed, and the underlying type is no longer a string. Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
+4
-8
@@ -296,18 +296,14 @@ func (w *x11Window) Raise() {
|
||||
}
|
||||
|
||||
func (w *x11Window) SetCursor(name pointer.CursorName) {
|
||||
switch name {
|
||||
case pointer.CursorNone:
|
||||
if name == pointer.CursorNone {
|
||||
w.cursor = name
|
||||
C.XFixesHideCursor(w.x, w.xw)
|
||||
return
|
||||
case pointer.CursorGrab:
|
||||
name = "hand1"
|
||||
}
|
||||
if w.cursor == pointer.CursorNone {
|
||||
C.XFixesShowCursor(w.x, w.xw)
|
||||
}
|
||||
cname := C.CString(string(name))
|
||||
|
||||
xcursor := xCursor[name]
|
||||
cname := C.CString(xcursor)
|
||||
defer C.free(unsafe.Pointer(cname))
|
||||
c := C.XcursorLibraryLoadCursor(w.x, cname)
|
||||
if c == 0 {
|
||||
|
||||
Reference in New Issue
Block a user