Commit dfe68474 authored by Bruno Coudoin's avatar Bruno Coudoin

added again gnome2-macros updated - - - fixed window name

	* Makefile.am: added again gnome2-macros
	* docs/screenshots/memory_div.jpg: updated
	* docs/screenshots/memory_div_small.jpg: -
	* docs/screenshots/submarine.jpg: -
	* docs/screenshots/submarine_small.jpg: -
	* docs/take_screenshots.sh: fixed window name
	* po/POTFILES.in:
	* src/boards/py-mod-utils.c: (py_gc_item_absolute_move),
	(py_gc_item_rotate), (py_gc_item_rotate_relative),
	(py_gc_item_rotate_with_center),
	(py_gc_item_rotate_relative_with_center): fixed, bad replace. anim work again.
	* src/gcompris/Makefile.am:
	* src/gcompris/gc_core.h:
	* src/gcompris/gc_net.c:
	* src/gcompris/gcompris.c: (board_widget_key_press_callback),
	(gc_set_background), (init_background), (gc_cursor_set),
	(setup_window), (gc_fullscreen_set), (gc_canvas_item_grab),
	(gc_terminate), (xf86_vidmode_init), (xf86_vidmode_set_fullscreen),
	(xf86_window_configured), (gc_init): added cache support
	* src/gcompris/images_selector.c: (gc_selector_images_start),
	(gc_selector_images_stop), (display_image), (display_image_set),
	(item_event_imageset_selector), (item_event_images_selector),
	(item_event_scroll), (parseImage), (parse_doc), (read_xml_file),
	(read_dataset_directory): typo, removed white space
	* src/gcompris/properties.c: (gc_prop_default_database_name_get),
	(gc_prop_new), (gc_prop_user_dirname_get):
	* src/gcompris/properties.h: added cache support
	* src/gcompris/cache.c: not functional yet cache mecanism for the web version.
parent 8ce8a89f
This diff is collapsed.
......@@ -28,6 +28,7 @@ EXTRA_DIST = \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
gnome2-macros \
README.mingw README.translators README.windows \
config.h.mingw Makefile.mingw global_win32.mak gcompris.ico gcompris-installer.nsi
......@@ -65,7 +66,7 @@ dist-core:
gzip --best $(distcore).tar
@echo Created $(distcore).tar.gz
all-local:
all-local:
ACLOCAL_AMFLAGS =
ACLOCAL_AMFLAGS =
docs/screenshots/memory_div.jpg

17.1 KB | W: | H:

docs/screenshots/memory_div.jpg

32.3 KB | W: | H:

docs/screenshots/memory_div.jpg
docs/screenshots/memory_div.jpg
docs/screenshots/memory_div.jpg
docs/screenshots/memory_div.jpg
  • 2-up
  • Swipe
  • Onion skin
docs/screenshots/memory_div_small.jpg

9.01 KB | W: | H:

docs/screenshots/memory_div_small.jpg

13.8 KB | W: | H:

docs/screenshots/memory_div_small.jpg
docs/screenshots/memory_div_small.jpg
docs/screenshots/memory_div_small.jpg
docs/screenshots/memory_div_small.jpg
  • 2-up
  • Swipe
  • Onion skin
docs/screenshots/submarine.jpg

29.1 KB | W: | H:

docs/screenshots/submarine.jpg

29.2 KB | W: | H:

docs/screenshots/submarine.jpg
docs/screenshots/submarine.jpg
docs/screenshots/submarine.jpg
docs/screenshots/submarine.jpg
  • 2-up
  • Swipe
  • Onion skin
docs/screenshots/submarine_small.jpg

14.1 KB | W: | H:

docs/screenshots/submarine_small.jpg

14 KB | W: | H:

docs/screenshots/submarine_small.jpg
docs/screenshots/submarine_small.jpg
docs/screenshots/submarine_small.jpg
docs/screenshots/submarine_small.jpg
  • 2-up
  • Swipe
  • Onion skin
......@@ -2,4 +2,4 @@
# A command example I use to create the screenshots.
# Move them in the screenshots directory with the name found
# in their .xml.in menu name field
xwd -name gcompris | convert - -quality 85 -resize 400x300 $1.jpg
xwd -name GCompris | convert - -quality 85 -resize 400x300 $1.jpg
......@@ -290,6 +290,7 @@ src/gcompris/board.c
src/gcompris/board_config.c
src/gcompris/bonus.c
src/gcompris/config.c
src/gcompris/dialog.c
src/gcompris/file_selector.c
src/gcompris/gameutil.c
src/gcompris/gcompris.c
......
......@@ -84,14 +84,14 @@ py_gc_item_focus_event(PyObject* self, PyObject* args)
/* void gc_item_absolute_move(GnomeCanvasItem *item, int x, int y); */
static PyObject*
py_gcompris_gc_item_absolute_move(PyObject* self, PyObject* args)
py_gc_item_absolute_move(PyObject* self, PyObject* args)
{
PyObject* pyitem;
GnomeCanvasItem* item;
int x, y;
/* Parse arguments */
if(!PyArg_ParseTuple(args, "Oii:gcompris_gc_item_absolute_move", &pyitem, &x, &y))
if(!PyArg_ParseTuple(args, "Oii:gc_item_absolute_move", &pyitem, &x, &y))
return NULL;
item = (GnomeCanvasItem*) pygobject_get(pyitem);
......@@ -106,14 +106,14 @@ py_gcompris_gc_item_absolute_move(PyObject* self, PyObject* args)
/* void gc_item_rotate(GnomeCanvasItem *item, double angle); */
static PyObject*
py_gcompris_gc_item_rotate(PyObject* self, PyObject* args)
py_gc_item_rotate(PyObject* self, PyObject* args)
{
PyObject* pyitem;
GnomeCanvasItem* item;
double angle;
/* Parse arguments */
if(!PyArg_ParseTuple(args, "Od:gcompris_gc_item_rotate_relative", &pyitem, &angle))
if(!PyArg_ParseTuple(args, "Od:gc_item_rotate_relative", &pyitem, &angle))
return NULL;
item = (GnomeCanvasItem*) pygobject_get(pyitem);
......@@ -128,14 +128,14 @@ py_gcompris_gc_item_rotate(PyObject* self, PyObject* args)
/* void gc_item_rotate_relative(GnomeCanvasItem *item, double angle); */
static PyObject*
py_gcompris_gc_item_rotate_relative(PyObject* self, PyObject* args)
py_gc_item_rotate_relative(PyObject* self, PyObject* args)
{
PyObject* pyitem;
GnomeCanvasItem* item;
double angle;
/* Parse arguments */
if(!PyArg_ParseTuple(args, "Od:gcompris_gc_item_rotate_relative", &pyitem, &angle))
if(!PyArg_ParseTuple(args, "Od:gc_item_rotate_relative", &pyitem, &angle))
return NULL;
item = (GnomeCanvasItem*) pygobject_get(pyitem);
......@@ -150,7 +150,7 @@ py_gcompris_gc_item_rotate_relative(PyObject* self, PyObject* args)
/* void gc_item_rotate_with_center(GnomeCanvasItem *item, double angle, int x, int y); */
static PyObject*
py_gcompris_gc_item_rotate_with_center(PyObject* self, PyObject* args)
py_gc_item_rotate_with_center(PyObject* self, PyObject* args)
{
PyObject* pyitem;
GnomeCanvasItem* item;
......@@ -158,7 +158,7 @@ py_gcompris_gc_item_rotate_with_center(PyObject* self, PyObject* args)
int x,y;
/* Parse arguments */
if(!PyArg_ParseTuple(args, "Odii:gcompris_gc_item_rotate_with_center", &pyitem, &angle, &x, &y))
if(!PyArg_ParseTuple(args, "Odii:gc_item_rotate_with_center", &pyitem, &angle, &x, &y))
return NULL;
item = (GnomeCanvasItem*) pygobject_get(pyitem);
......@@ -173,7 +173,7 @@ py_gcompris_gc_item_rotate_with_center(PyObject* self, PyObject* args)
/* void gc_item_rotate_relative_with_center(GnomeCanvasItem *item, double angle, int x, int y); */
static PyObject*
py_gcompris_gc_item_rotate_relative_with_center(PyObject* self, PyObject* args)
py_gc_item_rotate_relative_with_center(PyObject* self, PyObject* args)
{
PyObject* pyitem;
GnomeCanvasItem* item;
......@@ -181,7 +181,7 @@ py_gcompris_gc_item_rotate_relative_with_center(PyObject* self, PyObject* args)
int x,y;
/* Parse arguments */
if(!PyArg_ParseTuple(args, "Odii:gcompris_gc_item_rotate_relative_with_center", &pyitem, &angle, &x, &y))
if(!PyArg_ParseTuple(args, "Odii:gc_item_rotate_relative_with_center", &pyitem, &angle, &x, &y))
return NULL;
item = (GnomeCanvasItem*) pygobject_get(pyitem);
......@@ -346,13 +346,13 @@ static PyMethodDef PythonGcomprisUtilsModule[] = {
{ "load_pixmap", py_gc_pixmap_load, METH_VARARGS, "gc_pixmap_load" },
{ "set_image_focus", py_gc_item_focus_set, METH_VARARGS, "gc_item_focus_set" },
{ "item_event_focus", py_gc_item_focus_event, METH_VARARGS, "gc_item_focus_event" },
{ "gc_item_absolute_move", py_gcompris_gc_item_absolute_move, METH_VARARGS, "gc_item_absolute_move" },
{ "gc_item_rotate", py_gcompris_gc_item_rotate, METH_VARARGS, "gc_item_rotate" },
{ "gc_item_rotate_relative", py_gcompris_gc_item_rotate_relative, METH_VARARGS, "gc_item_rotate_relative" },
{ "gc_item_rotate__with_center", py_gcompris_gc_item_rotate_with_center, METH_VARARGS,
"gc_item_rotate_with_center" },
{ "gc_item_rotate_relative_with_center", py_gcompris_gc_item_rotate_relative_with_center, METH_VARARGS,
"gc_item_rotate_relative_with_center" },
{ "item_absolute_move", py_gc_item_absolute_move, METH_VARARGS, "gc_item_absolute_move" },
{ "item_rotate", py_gc_item_rotate, METH_VARARGS, "gc_item_rotate" },
{ "item_rotate_relative", py_gc_item_rotate_relative, METH_VARARGS, "gc_item_rotate_relative" },
{ "item_rotate__with_center", py_gc_item_rotate_with_center, METH_VARARGS,
"item_rotate_with_center" },
{ "item_rotate_relative_with_center", py_gc_item_rotate_relative_with_center, METH_VARARGS,
"item_rotate_relative_with_center" },
{ "dialog", py_gc_dialog, METH_VARARGS, "gc_dialog" },
{ "dialog_close", py_gc_dialog_close, METH_VARARGS, "gc_dialog_close" },
{ "filename_pass", py_gcompris_filename_pass, METH_VARARGS, "gcompris_filename_pass" },
......
......@@ -73,14 +73,14 @@ gcompris_LDADD = \
#
# Gcompris library
#
#
lib_LTLIBRARIES = libgcompris-1.la
libgcompris_1_la_LIBADD = \
$(GCOMPRIS_LIBS) $(sqlite_ldadd) $(XML_LIBS) $(GNET_LIBS)
libgcompris_1_la_LDFLAGS = $(no_undefined) \
-version-info $(LIBGCOMPRIS_CURRENT):$(LIBGCOMPRIS_REVISION):$(LIBGCOMPRIS_AGE)
-version-info $(LIBGCOMPRIS_CURRENT):$(LIBGCOMPRIS_REVISION):$(LIBGCOMPRIS_AGE)
libgcomprisincludedir = $(includedir)/libgcompris-1.0/libgcompris
......@@ -126,6 +126,7 @@ libgcompris_1_la_SOURCES = \
file_selector.c \
gameutil.c \
gc_net.c \
cache.c \
gcompris.c \
gcompris_alphabeta.c \
gcompris_confirm.c \
......
/* gcompris - gameutil_net.c
*
* Time-stamp: <2006/07/10 01:24:04 bruno>
*
* Copyright (C) 2006 Bruno Coudoin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "gcompris.h"
#include "gc_core.h"
#include <string.h>
/** \file Implementation of the cache functionality
*
*/
/* The max size of the cache in bytes,
* 0 = NO LIMITS
* -1 = NO CACHE
*/
static int cache_max_size = 1000;
static GHashTable *hash_cache = NULL;
/** For debug only
*/
static void
_dump_cache(gchar *key,
gchar *value,
gpointer dummy)
{
printf("cache %s = %s\n", key, value);
}
static void dump_cache(void)
{
g_hash_table_foreach(hash_cache,
(GHFunc) _dump_cache,
NULL);
}
/**
* recursively parse the cache and fill up the hash with files there
*/
void _cache_init(const gchar *basedir, const gchar *currentdir)
{
GcomprisProperties *properties = gc_prop_get();
GDir *dir;
const gchar *file;
if(!currentdir)
currentdir = basedir;
dir = g_dir_open(currentdir, 0, NULL);
printf(" _cache_init %s\n", currentdir);
while((file = g_dir_read_name(dir)))
{
gchar *fullfile = g_strconcat(currentdir, "/", file, NULL);
printf(" processing file = %s\n", fullfile);
if(g_file_test(fullfile, G_FILE_TEST_IS_DIR))
{
_cache_init(basedir, fullfile);
}
else if(g_file_test(fullfile, G_FILE_TEST_IS_REGULAR))
{
/* Strip file to get the KEY part out of it */
printf(" Adding '%s' in the cache\n", fullfile);
g_hash_table_insert(hash_cache,
g_strconcat(properties->server, "/",
fullfile + strlen(basedir) + 1,
NULL),
g_strdup(fullfile));
}
g_free(fullfile);
}
g_dir_close(dir);
}
/** Initialize the cache system
*
* \param max_size: the max size in byte of the cache
*
*/
void gc_cache_init(int max_size)
{
cache_max_size = max_size;
/* No server defined, the cache is useless */
if(!gc_prop_get()->server ||
!gc_prop_get()->cache_dir)
return;
hash_cache = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
printf("gc_cache_init\n");
/* try to create it */
printf("Creating cache dir %s\n", gc_prop_get()->cache_dir);
if(g_mkdir_with_parents(gc_prop_get()->cache_dir, 0755))
{
g_error("Failed to create the cache directory");
}
printf(" opened top directory\n");
/* Load the previous cache directory if any */
_cache_init(gc_prop_get()->cache_dir, NULL);
dump_cache();
}
/** End the cache system
*
*/
void gc_cache_end()
{
if(!hash_cache)
return;
g_hash_table_destroy (hash_cache);
hash_cache = NULL;
}
static void
_clear_cache(gchar *key,
gchar *value,
gpointer dummy)
{
printf("NOT IMPLEMENTED: Clearing chache %s:%s\n", key, value);
}
/** Clear the cache. All files in the cache are removed
*
*/
void gc_cache_clear()
{
g_hash_table_foreach(hash_cache,
(GHFunc) _clear_cache,
NULL);
}
/** Get a file from the cache based on it's URL
*
*/
gchar *gc_cache_get(gchar *url)
{
return((char *)g_hash_table_lookup(hash_cache, url));
}
/** Put and Get a file from the cache. The data in 'buffer' are saved in the
* cache under the name 'url'. A file is created and is returned.
*
* \param url: the url of the data in buffer
* \param buffer: the data for the url
* \param length: length of contents, or -1 if contents is a nul-terminated string
*
* \return a full path to the file in the cache
*/
gchar *gc_cache_insert(const gchar *url, const char *buffer, gssize length)
{
/* Save the buffer in the cache */
if(g_file_set_contents("TBD", buffer, length, NULL))
g_hash_table_replace(hash_cache, (gpointer) url, (gpointer) "TBD");
return("TBD");
}
......@@ -45,8 +45,15 @@ void gc_menu_load();
/** mimetype */
void gc_mime_type_load();
/* log */
void gc_log_start (GcomprisBoard *gcomprisBoard);
/** log */
void gc_log_start (GcomprisBoard *gcomprisBoard);
void gc_log_set_key (GcomprisBoard *gcomprisBoard, guint keyval);
/** cache */
void gc_cache_init(int max_size);
void gc_cache_end();
void gc_cache_clear();
gchar *gc_cache_get(gchar *url);
gchar *gc_cache_insert(const gchar *url, const char *buffer, gssize length);
#endif
......@@ -20,6 +20,7 @@
*/
#include "gc_net.h"
#include "gc_core.h"
#ifdef USE_GNET
#include <gnet.h>
......
......@@ -41,7 +41,7 @@
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/xf86vmode.h>
#include <X11/extensions/xf86vmode.h>
#endif
#if defined _WIN32 || defined __WIN32__
......@@ -73,7 +73,7 @@ GtkWidget *drawing_area;
GnomeCanvas *canvas;
GnomeCanvas *canvas_bar;
GnomeCanvas *canvas_bg;
//static gint pause_board_cb (GtkWidget *widget, gpointer data);
static void quit_cb (GtkWidget *widget, gpointer data);
static void map_cb (GtkWidget *widget, gpointer data);
......@@ -125,6 +125,7 @@ static int popt_no_config = FALSE;
static int popt_display_resource = FALSE;
static char *popt_server = NULL;
static int *popt_web_only = NULL;
static char *popt_cache_dir = NULL;
static struct poptOption options[] = {
{"fullscreen", 'f', POPT_ARG_NONE, &popt_fullscreen, 0,
......@@ -208,6 +209,10 @@ static struct poptOption options[] = {
{"web-only", '\0', POPT_ARG_NONE, &popt_web_only, 0,
N_("Only when --server is provided, disable check for local resource first."
" Data are always taken from the web server."), NULL},
{"cache-dir", '\0', POPT_ARG_STRING, &popt_cache_dir, 0,
N_("In server mode, where is the cache directory to avoid useless downloads."), NULL},
#ifndef WIN32 /* Not supported on windows */
POPT_AUTOHELP
#endif
......@@ -224,7 +229,7 @@ static struct poptOption options[] = {
/* Fullscreen Stuff */
#ifdef XF86_VIDMODE
static struct
static struct
{
XF86VidModeModeInfo fs_mode;
XF86VidModeModeInfo orig_mode;
......@@ -261,7 +266,7 @@ board_widget_key_press_callback (GtkWidget *widget,
gpointer client_data)
{
int kv = event->keyval;
if(event->state & GDK_CONTROL_MASK && ((event->keyval == GDK_r)
|| (event->keyval == GDK_R))) {
g_message("Refreshing the canvas\n");
......@@ -460,7 +465,7 @@ GnomeCanvasItem *gc_set_background(GnomeCanvasGroup *parent, gchar *file)
else
backgroundimg=gnome_canvas_item_new (parent,
gnome_canvas_pixbuf_get_type (),
"pixbuf", background_pixmap,
"pixbuf", background_pixmap,
"x", 0.0,
"y", 0.0,
"width", (double) BOARDWIDTH,
......@@ -516,7 +521,7 @@ static void init_background()
xratio=MIN(max, xratio);
g_message("Calculated x ratio xratio=%f\n", xratio);
/* Background area if ratio above 1 */
if(properties->fullscreen)
......@@ -527,7 +532,7 @@ static void init_background()
0, 0,
screen_width,
screen_height + 30);
gtk_widget_set_usize (GTK_WIDGET(canvas_bg), screen_width, screen_height);
/* Create a black box for the background */
......@@ -560,7 +565,7 @@ static void init_background()
{
gnome_canvas_item_new (gnome_canvas_root(canvas_bg),
gnome_canvas_widget_get_type (),
"widget", vbox,
"widget", vbox,
"x", (double) (screen_width-
BOARDWIDTH*xratio)/2,
"y", (double) (screen_height-
......@@ -616,39 +621,39 @@ void gc_cursor_set(guint gdk_cursor_type)
gdk_color_parse("red",&bg);
switch (gdk_cursor_type) {
case GCOMPRIS_BIG_RED_ARROW_CURSOR :
case GCOMPRIS_BIG_RED_ARROW_CURSOR :
bits = big_red_arrow_cursor_bits;
break;
case GCOMPRIS_BIRD_CURSOR :
bits = bird_cursor_bits;
case GCOMPRIS_BIRD_CURSOR :
bits = bird_cursor_bits;
break;
case GCOMPRIS_LINE_CURSOR :
bits = big_red_line_cursor_bits;
case GCOMPRIS_LINE_CURSOR :
bits = big_red_line_cursor_bits;
break;
case GCOMPRIS_RECT_CURSOR :
bits = big_red_rectangle_cursor_bits;
case GCOMPRIS_RECT_CURSOR :
bits = big_red_rectangle_cursor_bits;
break;
case GCOMPRIS_FILLRECT_CURSOR :
bits = big_red_filledrectangle_cursor_bits;
case GCOMPRIS_FILLRECT_CURSOR :
bits = big_red_filledrectangle_cursor_bits;
break;
case GCOMPRIS_CIRCLE_CURSOR :
bits = big_red_circle_cursor_bits;
case GCOMPRIS_CIRCLE_CURSOR :
bits = big_red_circle_cursor_bits;
break;
case GCOMPRIS_FILLCIRCLE_CURSOR :
bits = big_red_filledcircle_cursor_bits;
case GCOMPRIS_FILLCIRCLE_CURSOR :
bits = big_red_filledcircle_cursor_bits;
break;
case GCOMPRIS_FILL_CURSOR :
bits = big_red_fill_cursor_bits;
case GCOMPRIS_FILL_CURSOR :
bits = big_red_fill_cursor_bits;
break;
case GCOMPRIS_DEL_CURSOR :
bits = big_red_del_cursor_bits;
case GCOMPRIS_DEL_CURSOR :
bits = big_red_del_cursor_bits;
break;
case GCOMPRIS_SELECT_CURSOR :
bits = big_red_select_cursor_bits;
case GCOMPRIS_SELECT_CURSOR :
bits = big_red_select_cursor_bits;
break;
default : bits = big_red_arrow_cursor_bits;
}
cursor = gdk_cursor_new_from_data(bits, 40 , 40, &fg, &bg, 0, 0);
gdk_window_set_cursor(window->window, cursor);
gdk_cursor_unref(cursor);
......@@ -713,12 +718,12 @@ static void setup_window ()
this is the only way to get it, and it needs to track the focus to
enable/disable fullscreen on alt-tab */
gtk_widget_add_events(GTK_WIDGET(window),
GDK_STRUCTURE_MASK|GDK_FOCUS_CHANGE_MASK);
gtk_signal_connect (GTK_OBJECT (window), "configure_event",
GDK_STRUCTURE_MASK|GDK_FOCUS_CHANGE_MASK);
gtk_signal_connect (GTK_OBJECT (window), "configure_event",
GTK_SIGNAL_FUNC (xf86_window_configured), 0);
gtk_signal_connect (GTK_OBJECT (window), "focus_in_event",
gtk_signal_connect (GTK_OBJECT (window), "focus_in_event",
GTK_SIGNAL_FUNC (xf86_focus_changed), 0);
gtk_signal_connect (GTK_OBJECT (window), "focus_out_event",
gtk_signal_connect (GTK_OBJECT (window), "focus_out_event",
GTK_SIGNAL_FUNC (xf86_focus_changed), 0);
#endif
......@@ -772,7 +777,7 @@ static void setup_window ()
gtk_widget_show (GTK_WIDGET(canvas_bg));
init_plugins();
/* Load all the menu once */
gc_menu_load();
......@@ -800,18 +805,18 @@ static void setup_window ()
if(properties->profile && properties->profile->group_ids)
{
gboolean found = FALSE;
GList *group_id;
for (group_id = properties->profile->group_ids; group_id != NULL; group_id = group_id->next)
for (group_id = properties->profile->group_ids; group_id != NULL; group_id = group_id->next)
if (g_list_length(gc_db_users_from_group_get( *((int *) group_id->data))) > 0){
found = TRUE;
break;
}
/* No profile start normally */
if (found)
board_to_start = gc_menu_section_get("/login/login");
board_to_start = gc_menu_section_get("/login/login");
else {
board_to_start = gc_menu_section_get(properties->root_menu);
/* this will set user information to system one */
......@@ -877,7 +882,7 @@ void gc_fullscreen_set(gboolean state)
gtk_widget_set_uposition (window, 0, 0);
}
else
{
{
/* The hide must be done at least for KDE */
if (is_mapped)
gtk_widget_hide (window);
......@@ -897,20 +902,20 @@ int gc_canvas_item_grab (GnomeCanvasItem *item, unsigned int event_mask,
GdkCursor *cursor, guint32 etime)
{
int retval;
retval = gnome_canvas_item_grab(item, event_mask, cursor, etime);
if (retval != GDK_GRAB_SUCCESS)
return retval;
#ifdef XF86_VIDMODE
/* When fullscreen override mouse grab with our own which
confines the cursor to our fullscreen window */
if (XF86VidModeData.fullscreen_active)
if (gdk_pointer_grab(item->canvas->layout.bin_window, FALSE, event_mask,
window->window, cursor, etime+1) != GDK_GRAB_SUCCESS)
window->window, cursor, etime+1) != GDK_GRAB_SUCCESS)
g_warning("Pointer grab failed");
#endif
return retval;
}
......@@ -973,7 +978,7 @@ static void map_cb (GtkWidget *widget, gpointer data)
g_warning("gcompris window is now mapped");
}
/*
/*
* Process the cleanup of the child (no zombies)
* ---------------------------------------------
*/
......@@ -983,7 +988,7 @@ void gc_terminate(int signum)
g_warning("gcompris got the %d signal, starting exit procedure", signum);
gc_exit();
}
static void load_properties ()
......@@ -1162,10 +1167,10 @@ xf86_vidmode_init ( void )
XF86VidModeModeInfo **modes;
XF86VidModeModeLine *l = (XF86VidModeModeLine *)((char *)
&XF86VidModeData.orig_mode + sizeof XF86VidModeData.orig_mode.dotclock);
if (properties->noxf86vm)
return;
if (!XF86VidModeQueryVersion(GDK_DISPLAY(), &i, &j))
properties->noxf86vm = TRUE;
else if (!XF86VidModeQueryExtension(GDK_DISPLAY(), &i, &j))
......@@ -1194,7 +1199,7 @@ xf86_vidmode_init ( void )
properties->noxf86vm = TRUE;
XFree(modes);
}
if (properties->noxf86vm)
g_warning("XF86VidMode (or 800x600 resolution) not available");
else
......@@ -1207,7 +1212,7 @@ xf86_vidmode_set_fullscreen ( int state )
{
if (properties->noxf86vm || XF86VidModeData.fullscreen_active == state)
return;
printf("setfullscreen %d\n", state);
if (state)
......@@ -1231,7 +1236,7 @@ xf86_vidmode_set_fullscreen ( int state )
if (!XF86VidModeSwitchToMode(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
gdk_screen_get_default()), &XF86VidModeData.orig_mode))
g_warning("XF86VidMode could not restore original resolution");
gdk_pointer_ungrab(GDK_CURRENT_TIME);
if (XF86VidModeData.orig_viewport_x || XF86VidModeData.orig_viewport_y)
if (!XF86VidModeSetViewPort(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
......@@ -1247,7 +1252,7 @@ xf86_vidmode_set_fullscreen ( int state )
to be playing tricks with the window (destroying and recreating?) when
switching fullscreen <-> window which sometimes (race condition) causes
the pointer to not be properly grabbed.
This has the added advantage that this way we know for sure the pointer is
always grabbed before setting the viewport otherwise setviewport may get
"canceled" by the pointer being outside the current viewport. */
......@@ -1256,7 +1261,7 @@ static gint xf86_window_configured(GtkWindow *window,
{
XF86VidModeData.window_x = event->x;
XF86VidModeData.window_y = event->y;
printf("configure: %dx%d, fullscreen_active: %d\n", event->x, event->y,
(int)XF86VidModeData.fullscreen_active);
......@@ -1271,7 +1276,7 @@ static gint xf86_window_configured(GtkWindow *window,
/* Act as if we aren't there / aren't hooked up */
return FALSE;
}
static gint xf86_focus_changed(GtkWindow *window,
GdkEventFocus *event, gpointer param)
{
......@@ -1292,7 +1297,7 @@ static gint xf86_focus_changed(GtkWindow *window,
int
gc_init (int argc, char *argv[])
{
poptContext pctx;
poptContext pctx;
int popt_option;
/* First, Remove the gnome crash dialog because it locks the user when in full screen */
......@@ -1309,7 +1314,7 @@ gc_init (int argc, char *argv[])
/* To have some real random behaviour */
srand (time (NULL));
/* Default difficulty filter: non specified */
popt_difficulty_filter = -1;
......@@ -1452,7 +1457,7 @@ gc_init (int argc, char *argv[])
for(list = menulist; list != NULL; list = list->next) {
GcomprisBoard *board = list->data;
if (board){
if (strcmp(board->type,"menu")==0)
menu_todo = g_list_prepend(menu_todo, g_strdup_printf("%s/%s",board->section, board->name));
......@@ -1461,7 +1466,7 @@ gc_init (int argc, char *argv[])
}
}
}
exit(0);
}
else {
......@@ -1472,7 +1477,7 @@ gc_init (int argc, char *argv[])
}
if (popt_users_dir){
if ((!g_file_test(popt_users_dir, G_FILE_TEST_IS_DIR)) ||
if ((!g_file_test(popt_users_dir, G_FILE_TEST_IS_DIR)) ||
(access(popt_users_dir, popt_administration? R_OK : W_OK ) == -1)){
g_warning("%s does not exists or is not %s ", popt_users_dir,
popt_administration? "readable" : "writable");
......@@ -1499,7 +1504,7 @@ gc_init (int argc, char *argv[])
/* shared_dir initialised, now we can set the default */
properties->database = gc_prop_default_database_name_get ( properties->shared_dir );
g_warning( "Infos:\n Shared dir '%s'\n Users dir '%s'\n Database '%s'\n",
properties->shared_dir,
properties->shared_dir,