[gcompris/gcomprixogoo] Workaround for the fullscreen mode on macosx. now set a huge max ratio hint when fullscreen is set.
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris/gcomprixogoo] Workaround for the fullscreen mode on macosx. now set a huge max ratio hint when fullscreen is set.
- Date: Wed, 7 Apr 2010 15:26:45 +0000 (UTC)
commit 48ad142aa507b2bffab2a2864cdf9b44452dadb1
Author: Bruno Coudoin <bruno coudoin free fr>
Date: Wed Apr 7 17:25:28 2010 +0200
Workaround for the fullscreen mode on macosx. now set a huge max ratio hint when fullscreen is set.
src/gcompris/config.c | 3 +-
src/gcompris/gcompris.c | 57 +++++++++++++++++++++++++++++++++-------------
2 files changed, 42 insertions(+), 18 deletions(-)
---
diff --git a/src/gcompris/config.c b/src/gcompris/config.c
index 6082e4c..afc1528 100644
--- a/src/gcompris/config.c
+++ b/src/gcompris/config.c
@@ -735,8 +735,6 @@ item_event_ok(GooCanvasItem *item,
else if(!strcmp((char *)data, "music"))
{
properties->music = (properties->music ? 0 : 1);
- if (properties->music)
- gc_sound_init();
g_object_set (item,
"svg-id", (properties->music ? pixmap_checked : pixmap_unchecked),
NULL);
@@ -746,6 +744,7 @@ item_event_ok(GooCanvasItem *item,
}
else
{
+ gc_sound_init();
gc_sound_bg_reopen();
}
gc_item_focus_init(item, NULL);
diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c
index e510671..b3cc14d 100644
--- a/src/gcompris/gcompris.c
+++ b/src/gcompris/gcompris.c
@@ -97,6 +97,7 @@ static GtkWidget *widget_activation_entry;
static GcomprisProperties *properties = NULL;
static gboolean is_mapped = FALSE;
static gboolean fullscreen;
+static gboolean mute;
static guint gc_cursor_current;
/****************************************************************************/
@@ -347,6 +348,16 @@ board_widget_key_press_callback (GtkWidget *widget,
gc_fullscreen_set(TRUE);
return TRUE;
}
+ else if(event->state & GDK_CONTROL_MASK && ((event->keyval == GDK_m)
+ || (event->keyval == GDK_M))) {
+ /* Toggle Mute */
+ if (mute)
+ gc_sound_bg_resume();
+ else
+ gc_sound_bg_pause();
+ mute = ! mute;
+ return TRUE;
+ }
switch (event->keyval)
{
@@ -778,22 +789,6 @@ static void setup_window ()
gtk_window_set_title(GTK_WINDOW (window), "GCompris");
- GdkGeometry hints;
- hints.base_width = 615;
- hints.base_height = 400;
- hints.min_width = hints.base_width;
- hints.min_height = hints.base_height;
- hints.width_inc = 1;
- hints.height_inc = 1;
- hints.min_aspect = (float)BOARDWIDTH/BOARDHEIGHT;
- hints.max_aspect = (float)BOARDWIDTH/BOARDHEIGHT;
- gint geom_mask = GDK_HINT_RESIZE_INC |
- GDK_HINT_MIN_SIZE |
- GDK_HINT_BASE_SIZE;
- if (!popt_sugar_look)
- geom_mask |= GDK_HINT_ASPECT;
- gtk_window_set_geometry_hints (GTK_WINDOW (window), NULL, &hints, geom_mask);
-
/*
* Set the main window
* -------------------
@@ -1030,6 +1025,29 @@ void gc_board_end()
}
}
+void _set_geometry_hints(gboolean state)
+{
+ GdkGeometry hints;
+ hints.base_width = 615;
+ hints.base_height = 400;
+ hints.min_width = hints.base_width;
+ hints.min_height = hints.base_height;
+ hints.width_inc = 1;
+ hints.height_inc = 1;
+ hints.min_aspect = (float)BOARDWIDTH/BOARDHEIGHT;
+ if (state)
+ /* Warning: this is a workaround for GTK-OSX */
+ hints.max_aspect = (float)10; /* Fullscreen case */
+ else
+ hints.max_aspect = (float)BOARDWIDTH/BOARDHEIGHT;
+ gint geom_mask = GDK_HINT_RESIZE_INC |
+ GDK_HINT_MIN_SIZE |
+ GDK_HINT_BASE_SIZE;
+ if (!popt_sugar_look)
+ geom_mask |= GDK_HINT_ASPECT;
+ gtk_window_set_geometry_hints (GTK_WINDOW (window), NULL, &hints, geom_mask);
+}
+
/** \brief toggle full screen mode
*
*
@@ -1042,6 +1060,7 @@ void gc_fullscreen_set(gboolean state)
static gint window_h = BOARDHEIGHT;
fullscreen = state;
+ _set_geometry_hints(state);
if(state)
{
gtk_window_get_position ( (GtkWindow*)( window ), &window_x, &window_y );
@@ -1877,6 +1896,12 @@ main (int argc, char *argv[])
gtk_widget_show_all (window);
+
+ if(properties->music || properties->fx)
+ mute = FALSE;
+ else
+ mute = TRUE;
+
/* If a specific activity is selected, skeep the intro music */
if(!popt_root_menu)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]