[gcompris/gcomprixogoo] Added the command line option --nocursor (-C). As its name implies, GCompris won't show any visible
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris/gcomprixogoo] Added the command line option --nocursor (-C). As its name implies, GCompris won't show any visible
- Date: Sun, 17 Oct 2010 13:14:39 +0000 (UTC)
commit 4c0658217ad1e2b3cbbeedab4ae2eaaeb9b3d850
Author: Bruno Coudoin <bruno coudoin free fr>
Date: Sun Oct 17 13:16:18 2010 +0200
Added the command line option --nocursor (-C). As its name implies,
GCompris won't show any visible cursor. This is very useful to touch
screen users.
src/gcompris/gcompris.c | 40 +++++++++++++++++++++++++++++++++++++---
src/gcompris/properties.h | 1 +
2 files changed, 38 insertions(+), 3 deletions(-)
---
diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c
index 5d46fd6..6b28c13 100644
--- a/src/gcompris/gcompris.c
+++ b/src/gcompris/gcompris.c
@@ -118,6 +118,7 @@ static gint popt_window = FALSE;
static gint popt_sound = FALSE;
static gint popt_mute = FALSE;
static gint popt_cursor = FALSE;
+static gint popt_nocursor = FALSE;
static gint popt_version = FALSE;
static gint popt_difficulty_filter = FALSE;
static gint popt_debug = FALSE;
@@ -165,7 +166,10 @@ static GOptionEntry options[] = {
N_("run GCompris without sound."), NULL},
{"cursor", 'c', 0, G_OPTION_ARG_NONE, &popt_cursor,
- N_("run GCompris with the default gnome cursor."), NULL},
+ N_("run GCompris with the default system cursor."), NULL},
+
+ {"nocursor", 'C', 0, G_OPTION_ARG_NONE, &popt_nocursor,
+ N_("run GCompris without cursor (touch screen mode)."), NULL},
{"difficulty", 'd', 0, G_OPTION_ARG_INT, &popt_difficulty_filter,
N_("display only activities with this difficulty level."), NULL},
@@ -458,10 +462,31 @@ guint gc_cursor_get()
return gc_cursor_current;
}
+/* Set the cursor to be invisible
+ * (Useful for touch screens)
+ */
+void gc_cursor_hide()
+{
+ char in_cursor[] = {0x0};
+ GdkCursor *cursor;
+ GdkBitmap *bp;
+ GdkColor color = {0, 0, 0, 0};
+
+ bp = gdk_bitmap_create_from_data(NULL , in_cursor , 1, 1);
+ cursor = gdk_cursor_new_from_pixmap(bp , bp ,
+ &color , &color ,
+ 1 , 1);
+ gdk_window_set_cursor(window->window , cursor);
+ gdk_cursor_unref(cursor);
+}
+
void gc_cursor_set(guint gdk_cursor_type)
{
GdkCursor *cursor = NULL;
+ if (properties->nocursor)
+ return;
+
// Little hack to force gcompris to use the default cursor
if(gdk_cursor_type==GCOMPRIS_DEFAULT_CURSOR)
gdk_cursor_type=properties->defaultcursor;
@@ -807,7 +832,10 @@ static void setup_window ()
GTK_SIGNAL_FUNC (map_cb), NULL);
// Set the cursor
- gc_cursor_set(GCOMPRIS_DEFAULT_CURSOR);
+ if (properties->nocursor)
+ gc_cursor_hide();
+ else
+ gc_cursor_set(GCOMPRIS_DEFAULT_CURSOR);
canvas = goo_canvas_new();
@@ -1574,10 +1602,16 @@ main (int argc, char *argv[])
if (popt_cursor)
{
- g_message("Default gnome cursor enabled");
+ g_message("Default system cursor enabled");
properties->defaultcursor = GDK_LEFT_PTR;
}
+ if (popt_nocursor)
+ {
+ g_message("No cursors");
+ properties->nocursor = TRUE;
+ }
+
if (popt_experimental)
{
g_message("Experimental boards allowed");
diff --git a/src/gcompris/properties.h b/src/gcompris/properties.h
index b4d1d54..5682a21 100644
--- a/src/gcompris/properties.h
+++ b/src/gcompris/properties.h
@@ -32,6 +32,7 @@ typedef struct {
gint fx;
gint fullscreen;
gint defaultcursor;
+ gint nocursor;
gint timer;
gint filter_style;
gint difficulty_filter;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]