From cbaf408fef7cfefd533ecd43ec15ba0fa2a37154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Volf?= Date: Fri, 2 May 2025 04:33:15 +0200 Subject: [PATCH] add pointer cursor --- .../display/include/types/display/cursor.h | 6 ++-- uspace/lib/ui/include/types/ui/cursor.h | 4 ++- uspace/lib/ui/src/window.c | 3 ++ uspace/srv/hid/display/cursimg.c | 28 +++++++++++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/uspace/lib/display/include/types/display/cursor.h b/uspace/lib/display/include/types/display/cursor.h index b4b8592171..21962a606f 100644 --- a/uspace/lib/display/include/types/display/cursor.h +++ b/uspace/lib/display/include/types/display/cursor.h @@ -48,12 +48,14 @@ typedef enum { /** Double arrow pointing up-right nad down-left */ dcurs_size_urdl, /** I-beam (suggests editable text) */ - dcurs_ibeam + dcurs_ibeam, + /** Pointer (suggests clickable object) */ + dcurs_pointer, } display_stock_cursor_t; enum { /** Number of stock cursor types */ - dcurs_limit = dcurs_ibeam + 1 + dcurs_limit = dcurs_pointer + 1 }; #endif diff --git a/uspace/lib/ui/include/types/ui/cursor.h b/uspace/lib/ui/include/types/ui/cursor.h index 4f0231f5c0..d58b17b1cb 100644 --- a/uspace/lib/ui/include/types/ui/cursor.h +++ b/uspace/lib/ui/include/types/ui/cursor.h @@ -48,7 +48,9 @@ typedef enum { /** Double arrow pointing up-right nad down-left */ ui_curs_size_urdl, /** I-beam (suggests editable text) */ - ui_curs_ibeam + ui_curs_ibeam, + /** Pointer (suggests clickable object) */ + ui_curs_pointer, } ui_stock_cursor_t; enum { diff --git a/uspace/lib/ui/src/window.c b/uspace/lib/ui/src/window.c index a285e0e70f..944832187a 100644 --- a/uspace/lib/ui/src/window.c +++ b/uspace/lib/ui/src/window.c @@ -1250,6 +1250,9 @@ display_stock_cursor_t wnd_dcursor_from_cursor(ui_stock_cursor_t cursor) case ui_curs_ibeam: dcursor = dcurs_ibeam; break; + case ui_curs_pointer: + dcursor = dcurs_pointer; + break; } return dcursor; diff --git a/uspace/srv/hid/display/cursimg.c b/uspace/srv/hid/display/cursimg.c index 9876d7db08..3dfd8fbeee 100644 --- a/uspace/srv/hid/display/cursimg.c +++ b/uspace/srv/hid/display/cursimg.c @@ -158,6 +158,30 @@ static uint8_t ibeam_img[] = { 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0 }; +static uint8_t pointer_img[] = { + 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 2, 2, 2, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, + 0, 1, 1, 0, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 1, 1, 0, + 1, 2, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, + 1, 2, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, + 1, 2, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, + 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, + 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, + 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 +}; + ds_cursimg_t ds_cursimg[dcurs_limit] = { { .rect = { 0, 0, 13, 21 }, @@ -182,6 +206,10 @@ ds_cursimg_t ds_cursimg[dcurs_limit] = { { .rect = { -5, -9, 6, 10 }, .image = ibeam_img + }, + { + .rect = { -6, 0, 13, 21 }, + .image = pointer_img } };