-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Manipulate mouse cursor with a minimal image
This commit makes mouse cursor manipulation configurable, allowing it to be turned off completely for the SDL backend and to be featured in the upcoming Linux framebuffer backend with a minimal mouse image rendered. Currently, only one minimalist dot is provided, but the default cursor image should be improved later.
- Loading branch information
Showing
6 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Twin - A Tiny Window System | ||
* Copyright (c) 2024 National Cheng Kung University, Taiwan | ||
* All rights reserved. | ||
*/ | ||
|
||
/* Manipulating cursor images */ | ||
|
||
#include <stddef.h> | ||
#include <twin.h> | ||
|
||
/* FIXME: Improve the default cursor instead of using a minimalist dot. */ | ||
static uint32_t _twin_cursor_default[] = { | ||
0x00000000, 0x88ffffff, 0x88ffffff, 0x00000000, 0x88ffffff, 0xff000000, | ||
0xff000000, 0x88ffffff, 0x88ffffff, 0xff000000, 0xff000000, 0x88ffffff, | ||
0x00000000, 0x88ffffff, 0x88ffffff, 0x00000000, | ||
}; | ||
|
||
twin_pixmap_t *twin_make_cursor(int *hx, int *hy) | ||
{ | ||
twin_pointer_t data = {.argb32 = _twin_cursor_default}; | ||
twin_pixmap_t *cur = twin_pixmap_create_const(TWIN_ARGB32, 4, 4, 16, data); | ||
if (!cur) | ||
return NULL; | ||
*hx = *hy = 4; | ||
return cur; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters