Skip to content

add pointer cursor #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions uspace/lib/display/include/types/display/cursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion uspace/lib/ui/include/types/ui/cursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions uspace/lib/ui/src/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 28 additions & 0 deletions uspace/srv/hid/display/cursimg.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,30 @@ static uint8_t ibeam_img[] = {
0, 1, 1, 1, 1, 0, 1, 1, 1, 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