aboutsummaryrefslogtreecommitdiff
path: root/example/d2tk_fbdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'example/d2tk_fbdev.c')
-rw-r--r--example/d2tk_fbdev.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/example/d2tk_fbdev.c b/example/d2tk_fbdev.c
index a6c9c26..d298190 100644
--- a/example/d2tk_fbdev.c
+++ b/example/d2tk_fbdev.c
@@ -33,6 +33,7 @@ typedef void (*foreach_t)(const char *path, const char *d_name);
struct _app_t {
d2tk_fbdev_t *fbdev;
+ bool show_cursor;
};
static sig_atomic_t done = false;
@@ -52,11 +53,14 @@ _expose(void *data, d2tk_coord_t w, d2tk_coord_t h)
d2tk_example_run(base, w, h);
- d2tk_coord_t x = 0;
- d2tk_coord_t y = 0;
+ if(app->show_cursor)
+ {
+ d2tk_coord_t x = 0;
+ d2tk_coord_t y = 0;
- d2tk_base_get_mouse_pos(base, &x, &y);
- d2tk_base_cursor(base, &D2TK_RECT(x, y, 24, 24));
+ d2tk_base_get_mouse_pos(base, &x, &y);
+ d2tk_base_cursor(base, &D2TK_RECT(x, y, 24, 24));
+ }
return EXIT_SUCCESS;
}
@@ -153,7 +157,7 @@ main(int argc, char **argv)
static char fb_device [PATH_MAX] = AUTO;
int c;
- while( (c = getopt(argc, argv, "f:")) != -1)
+ while( (c = getopt(argc, argv, "f:c")) != -1)
{
switch(c)
{
@@ -161,11 +165,16 @@ main(int argc, char **argv)
{
strncpy(fb_device, optarg, PATH_MAX-1);
} break;
+ case 'c':
+ {
+ app.show_cursor = true;
+ } break;
default:
{
fprintf(stderr, "Usage: %s\n"
- " -f fb_device (auto)\n\n",
+ " -f fb_device (auto)\n"
+ " -c show cursor\n\n",
argv[0]);
} return EXIT_FAILURE;
}