io/pointer: added the grab cursor

Signed-off-by: pierre <pierre.curto@gmail.com>
This commit is contained in:
pierre
2021-02-07 20:48:30 +01:00
committed by Elias Naur
parent 6682f75db9
commit a581acf3fd
7 changed files with 22 additions and 7 deletions
+2
View File
@@ -198,6 +198,8 @@ func windowSetCursor(from, to pointer.CursorName) pointer.CursorName {
curID = 5
case pointer.CursorRowResize:
curID = 6
case pointer.CursorGrab:
curID = 7
case pointer.CursorNone:
runOnMain(func() {
C.gio_hideCursor()
+3
View File
@@ -119,6 +119,9 @@ void gio_setCursor(NSUInteger curID) {
case 6:
[NSCursor.resizeUpDownCursor set];
break;
case 7:
[NSCursor.openHandCursor set];
break;
default:
[NSCursor.arrowCursor set];
break;
+2
View File
@@ -930,6 +930,8 @@ func (w *window) SetCursor(name pointer.CursorName) {
name = "top_side"
case pointer.CursorColResize:
name = "left_side"
case pointer.CursorGrab:
name = "hand1"
}
cname := C.CString(string(name))
defer C.free(unsafe.Pointer(cname))
+2
View File
@@ -606,6 +606,8 @@ func loadCursor(name pointer.CursorName) (syscall.Handle, error) {
curID = windows.IDC_SIZEWE
case pointer.CursorRowResize:
curID = windows.IDC_SIZENS
case pointer.CursorGrab:
curID = windows.IDC_SIZEALL
case pointer.CursorNone:
return 0, nil
}
+4 -1
View File
@@ -118,10 +118,13 @@ func (w *x11Window) WriteClipboard(s string) {
}
func (w *x11Window) SetCursor(name pointer.CursorName) {
if name == pointer.CursorNone {
switch name {
case 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)
+7 -6
View File
@@ -65,12 +65,13 @@ const (
HTCLIENT = 1
IDC_ARROW = 32512
IDC_IBEAM = 32513
IDC_HAND = 32649
IDC_CROSS = 32515
IDC_SIZENS = 32645
IDC_SIZEWE = 32644
IDC_ARROW = 32512
IDC_IBEAM = 32513
IDC_HAND = 32649
IDC_CROSS = 32515
IDC_SIZENS = 32645
IDC_SIZEWE = 32644
IDC_SIZEALL = 32646
INFINITE = 0xFFFFFFFF
+2
View File
@@ -103,6 +103,8 @@ const (
CursorColResize CursorName = "col-resize"
// CursorRowResize is the cursor for horizontal resize.
CursorRowResize CursorName = "row-resize"
// CursorGrab is the cursor for moving object in any direction.
CursorGrab CursorName = "grab"
// CursorNone hides the cursor. To show it again, use any other cursor.
CursorNone CursorName = "none"
)