rpms/gcompris/FC-5 gcompris-7.4-xf86vidmode2.patch, NONE, 1.1 gcompris-7.4-xf86vidmode3.patch, NONE, 1.1 gcompris.spec, 1.7, 1.8
Hans de Goede (jwrdegoede)
fedora-extras-commits at redhat.com
Mon Jul 3 20:36:47 UTC 2006
Author: jwrdegoede
Update of /cvs/extras/rpms/gcompris/FC-5
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv27056
Modified Files:
gcompris.spec
Added Files:
gcompris-7.4-xf86vidmode2.patch
gcompris-7.4-xf86vidmode3.patch
Log Message:
* Mon Jul 3 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 7.4-12
- Restore the original resolution and ungrab the mouse on focus out, redo
on focus in. This allows alt-tab-ing away when in fullscreen mode. And
more importantly makes gnome-screensaver happy when trying to run while
gcompris is running in fullscreen mode (BZ 197276).
gcompris-7.4-xf86vidmode2.patch:
--- NEW FILE gcompris-7.4-xf86vidmode2.patch ---
diff -ur gcompris-7.4.orig/src/gcompris/gcompris.c gcompris-7.4/src/gcompris/gcompris.c
--- gcompris-7.4.orig/src/gcompris/gcompris.c 2006-06-04 15:33:39.000000000 +0200
+++ gcompris-7.4/src/gcompris/gcompris.c 2006-06-05 22:04:19.000000000 +0200
@@ -187,16 +187,16 @@
#ifdef XF86_VIDMODE
static struct
{
- int vidmode_available;
+ XF86VidModeModeInfo fs_mode;
XF86VidModeModeInfo orig_mode;
int orig_viewport_x;
int orig_viewport_y;
- int width;
- int height;
-} XF86VidModeData = { 0, { 0 }, 0, 0 };
+} XF86VidModeData = { { 0 }, { 0 }, 0, 0 };
static void xf86_vidmode_init( void );
static void xf86_vidmode_set_fullscreen( int state );
+static gint xf86_window_configured(GtkWindow *window,
+ GdkEventConfigure *event, gpointer param);
#endif
/****************************************************************************/
@@ -430,19 +430,17 @@
#ifdef XF86_VIDMODE
xf86_vidmode_init();
-#endif
-
- gcompris_set_fullscreen(properties->fullscreen);
- screen_height = gdk_screen_height();
- screen_width = gdk_screen_width();
-
-#ifdef XF86_VIDMODE
if(properties->fullscreen && !properties->noxf86vm) {
- screen_width = XF86VidModeData.width;
- screen_height = XF86VidModeData.height;
+ screen_height = XF86VidModeData.fs_mode.vdisplay;
+ screen_width = XF86VidModeData.fs_mode.hdisplay;
}
+ else
#endif
+ {
+ screen_height = gdk_screen_height();
+ screen_width = gdk_screen_width();
+ }
yratio=screen_height/(float)(BOARDHEIGHT+BARHEIGHT);
xratio=screen_width/(float)BOARDWIDTH;
@@ -654,6 +652,14 @@
gtk_signal_connect (GTK_OBJECT (window), "map_event",
GTK_SIGNAL_FUNC (map_cb), NULL);
+#ifdef XF86_VIDMODE
+ /* The Xf86VidMode code needs to accuratly now the window position,
+ this is the only way to get it. */
+ gtk_widget_add_events(GTK_WIDGET(window), GDK_STRUCTURE_MASK);
+ gtk_signal_connect (GTK_OBJECT (window), "configure_event",
+ GTK_SIGNAL_FUNC (xf86_window_configured), 0);
+#endif
+
/* For non anti alias canvas */
gtk_widget_push_visual (gdk_rgb_get_visual ());
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
@@ -814,9 +820,11 @@
else
{
/* The hide must be done at least for KDE */
- gtk_widget_hide (window);
+ if (is_mapped)
+ gtk_widget_hide (window);
gdk_window_set_decorations (window->window, GDK_DECOR_ALL);
- gtk_widget_show (window);
+ if (is_mapped)
+ gtk_widget_show (window);
gdk_window_set_functions (window->window, GDK_FUNC_ALL);
gtk_widget_set_uposition (window, 0, 0);
gtk_window_unfullscreen (GTK_WINDOW(window));
@@ -895,8 +903,8 @@
{
if(is_mapped == FALSE)
{
- is_mapped = TRUE;
gcompris_set_fullscreen(properties->fullscreen);
+ is_mapped = TRUE;
}
g_warning("gcompris window is now mapped");
}
@@ -1036,7 +1044,8 @@
static void
xf86_vidmode_init ( void )
{
- int i,j;
+ int i,j, mode_count;
+ XF86VidModeModeInfo **modes;
XF86VidModeModeLine *l = (XF86VidModeModeLine *)((char *)
&XF86VidModeData.orig_mode + sizeof XF86VidModeData.orig_mode.dotclock);
@@ -1048,104 +1057,55 @@
else if (!XF86VidModeQueryExtension(GDK_DISPLAY(), &i, &j))
properties->noxf86vm = TRUE;
else if (!XF86VidModeGetModeLine(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
- gdk_screen_get_default()), &XF86VidModeData.orig_mode.dotclock, l))
+ gdk_screen_get_default()), (int*)&XF86VidModeData.orig_mode.dotclock, l))
properties->noxf86vm = TRUE;
else if (!XF86VidModeGetViewPort(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
gdk_screen_get_default()), &XF86VidModeData.orig_viewport_x,
&XF86VidModeData.orig_viewport_y))
properties->noxf86vm = TRUE;
+ else if (!XF86VidModeGetAllModeLines(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
+ gdk_screen_get_default()), &mode_count, &modes))
+ properties->noxf86vm = TRUE;
+ else {
+ for (i = 0; i < mode_count; i++)
+ {
+ if ((modes[i]->hdisplay == BOARDWIDTH) &&
+ (modes[i]->vdisplay == BOARDHEIGHT+BARHEIGHT))
+ {
+ XF86VidModeData.fs_mode = *modes[i];
+ break;
+ }
+ }
+ if (i == mode_count)
+ properties->noxf86vm = TRUE;
+ XFree(modes);
+ }
if (properties->noxf86vm)
- g_warning("XF86VidMode not available");
+ g_warning("XF86VidMode (or 800x600 resolution) not available");
else
- {
- XF86VidModeData.width = XF86VidModeData.orig_mode.hdisplay;
- XF86VidModeData.height = XF86VidModeData.orig_mode.vdisplay;
g_warning("XF86VidMode support enabled");
- }
}
static void
xf86_vidmode_set_fullscreen ( int state )
{
- int i;
- XF86VidModeModeLine mode;
-
if (properties->noxf86vm)
return;
if (state)
{
- XF86VidModeModeInfo **modes;
- int mode_count;
- gint x,y;
-
- if (!XF86VidModeGetModeLine(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
- gdk_screen_get_default()), &i, &mode))
- {
- /* If we can't get the currentmode force setting of a new mode. */
- mode.hdisplay = 0;
- }
-
- /* Do we need to switch? */
- if ((mode.hdisplay != BOARDWIDTH) ||
- (mode.vdisplay != BOARDHEIGHT+BARHEIGHT))
- {
- if (!XF86VidModeGetAllModeLines(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
- gdk_screen_get_default()), &mode_count, &modes))
- mode_count = 0;
-
- for (i = 0; i < mode_count; i++)
- {
- if ((modes[i]->hdisplay == BOARDWIDTH) &&
- (modes[i]->vdisplay == BOARDHEIGHT+BARHEIGHT))
- {
- if (XF86VidModeSwitchToMode(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
- gdk_screen_get_default()), modes[i]))
- {
- XF86VidModeData.width = modes[i]->hdisplay;
- XF86VidModeData.height = modes[i]->vdisplay;
- }
- else
- g_warning("XF86VidMode couldnot switch resolution");
- break;
- }
- }
- if (i == mode_count)
- g_warning("XF86VidMode couldnot find a suitable resolution");
- if (mode_count)
- XFree(modes);
- }
- /* We need to grab the pointer before setting the viewport otherwise
- setviewport may get "canceled" by the pointer being outside the
- current viewport. */
- if (gdk_pointer_grab(window->window, TRUE, 0, window->window, NULL,
- GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS)
- g_warning("Pointer grab failed");
-
- gdk_window_get_position(window->window, &x, &y);
- if (!XF86VidModeSetViewPort(GDK_DISPLAY(),
- GDK_SCREEN_XNUMBER(gdk_screen_get_default()), x, y))
- g_warning("XF86VidMode couldnot change viewport");
+ if (!XF86VidModeSwitchToMode(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
+ gdk_screen_get_default()), &XF86VidModeData.fs_mode))
+ g_warning("XF86VidMode couldnot switch resolution");
}
else
{
- if (!XF86VidModeGetModeLine(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
- gdk_screen_get_default()), &i, &mode) ||
- (mode.hdisplay != XF86VidModeData.orig_mode.hdisplay) ||
- (mode.vdisplay != XF86VidModeData.orig_mode.vdisplay))
- {
- if (XF86VidModeSwitchToMode(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
- gdk_screen_get_default()), &XF86VidModeData.orig_mode))
- {
- XF86VidModeData.width = XF86VidModeData.orig_mode.hdisplay;
- XF86VidModeData.height = XF86VidModeData.orig_mode.vdisplay;
- }
- else
- g_warning("XF86VidMode couldnot restore original resolution");
+ if (!XF86VidModeSwitchToMode(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
+ gdk_screen_get_default()), &XF86VidModeData.orig_mode))
+ g_warning("XF86VidMode couldnot 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(
@@ -1154,6 +1114,31 @@
g_warning("XF86VidMode couldnot restore original viewport");
}
}
+
+/* We need to accuratly now the window position, this is the only way to get
+ it. We also use this as _the_ place to grab the pointer, because gtk seems
+ 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. */
+static gint xf86_window_configured(GtkWindow *window,
+ GdkEventConfigure *event, gpointer param)
+{
+ if(properties->fullscreen && !properties->noxf86vm) {
+ if (gdk_pointer_grab(event->window, TRUE, 0, event->window, NULL,
+ GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS)
+ g_warning("Pointer grab failed");
+ if (!XF86VidModeSetViewPort(GDK_DISPLAY(),
+ GDK_SCREEN_XNUMBER(gdk_screen_get_default()), event->x, event->y))
+ g_warning("XF86VidMode couldnot change viewport");
+ }
+ /* Act as if we aren't there / aren't hooked up */
+ return FALSE;
+}
+
#endif
/*****************************************
--- gcompris-7.4/src/gcompris/config.c.xf86vm 2006-01-09 23:59:33.000000000 +0100
+++ gcompris-7.4/src/gcompris/config.c 2006-06-04 09:01:14.000000000 +0200
@@ -716,11 +722,11 @@
{
properties->fullscreen = (properties->fullscreen ? 0 : 1);
-#ifdef XRANDR
+#ifdef XF86_VIDMODE
/* Changing screen without xrandr is more complex, it requires to remove the
black border we created manually.
*/
- if(!properties->noxrandr)
+ if(!properties->noxf86vm)
gcompris_set_fullscreen(properties->fullscreen);
#endif
/* Warning changing the image needs to update pixbuf_ref for the focus usage */
gcompris-7.4-xf86vidmode3.patch:
--- NEW FILE gcompris-7.4-xf86vidmode3.patch ---
--- gcompris-7.4/src/gcompris/gcompris.c.test 2006-07-02 21:43:43.000000000 +0200
+++ gcompris-7.4/src/gcompris/gcompris.c 2006-07-03 22:14:51.000000000 +0200
@@ -73,7 +73,6 @@
//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);
static gint board_widget_key_press_callback (GtkWidget *widget,
GdkEventKey *event,
gpointer client_data);
@@ -81,7 +80,6 @@
GcomprisProperties *properties = NULL;
static gboolean antialiased = FALSE;
-static gboolean is_mapped = FALSE;
/****************************************************************************/
/* Some constants. */
@@ -191,12 +189,17 @@
XF86VidModeModeInfo orig_mode;
int orig_viewport_x;
int orig_viewport_y;
-} XF86VidModeData = { { 0 }, { 0 }, 0, 0 };
+ int window_x;
+ int window_y;
+ gboolean fullscreen_active;
+} XF86VidModeData = { { 0 }, { 0 }, 0, 0, 0, 0, FALSE };
static void xf86_vidmode_init( void );
static void xf86_vidmode_set_fullscreen( int state );
static gint xf86_window_configured(GtkWindow *window,
GdkEventConfigure *event, gpointer param);
+static gint xf86_focus_changed(GtkWindow *window,
+ GdkEventFocus *event, gpointer param);
#endif
/****************************************************************************/
@@ -649,15 +652,18 @@
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (quit_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (window), "map_event",
- GTK_SIGNAL_FUNC (map_cb), NULL);
-
#ifdef XF86_VIDMODE
/* The Xf86VidMode code needs to accuratly now the window position,
- this is the only way to get it. */
- gtk_widget_add_events(GTK_WIDGET(window), GDK_STRUCTURE_MASK);
+ 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",
GTK_SIGNAL_FUNC (xf86_window_configured), 0);
+ 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_FUNC (xf86_focus_changed), 0);
#endif
/* For non anti alias canvas */
@@ -820,11 +826,9 @@
else
{
/* The hide must be done at least for KDE */
- if (is_mapped)
- gtk_widget_hide (window);
+ gtk_widget_hide (window);
gdk_window_set_decorations (window->window, GDK_DECOR_ALL);
- if (is_mapped)
- gtk_widget_show (window);
+ gtk_widget_show (window);
gdk_window_set_functions (window->window, GDK_FUNC_ALL);
gtk_widget_set_uposition (window, 0, 0);
gtk_window_unfullscreen (GTK_WINDOW(window));
@@ -846,7 +850,7 @@
#ifdef XF86_VIDMODE
/* When fullscreen override mouse grab with our own which
confines the cursor to our fullscreen window */
- if (properties->fullscreen && !properties->noxf86vm)
+ if (XF86VidModeData.fullscreen_active)
if (gdk_pointer_grab(item->canvas->layout.bin_window, FALSE, event_mask,
window->window, cursor, etime+1) != GDK_GRAB_SUCCESS)
g_warning("Pointer grab failed");
@@ -861,7 +865,7 @@
#ifdef XF86_VIDMODE
/* When fullscreen restore the normal mouse grab which avoids
scrolling the virtual desktop */
- if (properties->fullscreen && !properties->noxf86vm)
+ if (XF86VidModeData.fullscreen_active)
if (gdk_pointer_grab(window->window, TRUE, 0, window->window, NULL,
etime+1) != GDK_GRAB_SUCCESS)
g_warning("Pointer grab failed");
@@ -895,20 +899,6 @@
}
-/*
- * We want GCompris to be set as fullscreen the later possible
- *
- */
-static void map_cb (GtkWidget *widget, gpointer data)
-{
- if(is_mapped == FALSE)
- {
- gcompris_set_fullscreen(properties->fullscreen);
- is_mapped = TRUE;
- }
- g_warning("gcompris window is now mapped");
-}
-
/*
* Process the cleanup of the child (no zombies)
* ---------------------------------------------
@@ -1091,32 +1081,43 @@
static void
xf86_vidmode_set_fullscreen ( int state )
{
- if (properties->noxf86vm)
+ if (properties->noxf86vm || XF86VidModeData.fullscreen_active == state)
return;
if (state)
{
if (!XF86VidModeSwitchToMode(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
gdk_screen_get_default()), &XF86VidModeData.fs_mode))
- g_warning("XF86VidMode couldnot switch resolution");
+ g_warning("XF86VidMode could not switch resolution");
+ /* Notice the pointer must be grabbed before setting the viewport
+ otherwise setviewport may get "canceled" by the pointer being outside
+ the current viewport. */
+ if (gdk_pointer_grab(window->window, TRUE, 0, window->window, NULL,
+ GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS)
+ g_warning("Pointer grab failed");
+ if (!XF86VidModeSetViewPort(GDK_DISPLAY(),
+ GDK_SCREEN_XNUMBER(gdk_screen_get_default()),
+ XF86VidModeData.window_x, XF86VidModeData.window_y))
+ g_warning("XF86VidMode could not change viewport");
}
else
{
if (!XF86VidModeSwitchToMode(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
gdk_screen_get_default()), &XF86VidModeData.orig_mode))
- g_warning("XF86VidMode couldnot restore original resolution");
+ 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(
gdk_screen_get_default()), XF86VidModeData.orig_viewport_x,
XF86VidModeData.orig_viewport_y))
- g_warning("XF86VidMode couldnot restore original viewport");
+ g_warning("XF86VidMode could not restore original viewport");
}
+ XF86VidModeData.fullscreen_active = state;
}
/* We need to accuratly now the window position, this is the only way to get
- it. We also use this as _the_ place to grab the pointer, because gtk seems
+ it. We also grab the pointer to be sure it is really grabbed. Gtk seems
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.
@@ -1127,18 +1128,30 @@
static gint xf86_window_configured(GtkWindow *window,
GdkEventConfigure *event, gpointer param)
{
- if(properties->fullscreen && !properties->noxf86vm) {
+ XF86VidModeData.window_x = event->x;
+ XF86VidModeData.window_y = event->y;
+
+ if(XF86VidModeData.fullscreen_active) {
if (gdk_pointer_grab(event->window, TRUE, 0, event->window, NULL,
GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS)
g_warning("Pointer grab failed");
if (!XF86VidModeSetViewPort(GDK_DISPLAY(),
GDK_SCREEN_XNUMBER(gdk_screen_get_default()), event->x, event->y))
- g_warning("XF86VidMode couldnot change viewport");
+ g_warning("XF86VidMode could not change viewport");
}
/* Act as if we aren't there / aren't hooked up */
return FALSE;
}
+static gint xf86_focus_changed(GtkWindow *window,
+ GdkEventFocus *event, gpointer param)
+{
+ if (properties->fullscreen)
+ xf86_vidmode_set_fullscreen(event->in);
+ /* Act as if we aren't there / aren't hooked up */
+ return FALSE;
+}
+
#endif
/*****************************************
@@ -1474,6 +1487,7 @@
setup_window ();
+ gcompris_set_fullscreen(properties->fullscreen);
gtk_widget_show_all (window);
str = gcompris_get_asset_file("gcompris misc", NULL, "audio/x-ogg", "welcome.ogg");
Index: gcompris.spec
===================================================================
RCS file: /cvs/extras/rpms/gcompris/FC-5/gcompris.spec,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- gcompris.spec 11 May 2006 14:44:54 -0000 1.7
+++ gcompris.spec 3 Jul 2006 20:36:47 -0000 1.8
@@ -1,6 +1,6 @@
Name: gcompris
Version: 7.4
-Release: 10%{?dist}
+Release: 12%{?dist}
Summary: Educational suite for kids 2-10 years old
Group: Amusements/Games
License: GPL
@@ -13,6 +13,8 @@
Patch3: gcompris-electric.patch
Patch4: gcompris-click_on_letter.patch
Patch5: gcompris-7.4-xf86vidmode.patch
+Patch6: gcompris-7.4-xf86vidmode2.patch
+Patch7: gcompris-7.4-xf86vidmode3.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Buildrequires: libgnomeui-devel sqlite-devel libassetml-devel python-devel
Buildrequires: pygtk2-devel SDL_mixer-devel libXt-devel libXxf86vm-devel
@@ -224,6 +226,8 @@
%patch3 -p1 -z .electric
%patch4 -p1 -z .click_on_letter
%patch5 -p1 -z .xf86vm
+%patch6 -p1 -z .xf86vm2
+%patch7 -p1 -z .xf86vm3
iconv -f ISO-8859-1 -t UTF8 docs/C/gcompris.info > tmp
mv tmp docs/C/gcompris.info
# fix gnome.canvas deprecation warnings
@@ -480,6 +484,15 @@
%changelog
+* Mon Jul 3 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 7.4-12
+- Restore the original resolution and ungrab the mouse on focus out, redo
+ on focus in. This allows alt-tab-ing away when in fullscreen mode. And
+ more importantly makes gnome-screensaver happy when trying to run while
+ gcompris is running in fullscreen mode (BZ 197276).
+
+* Mon Jun 5 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 7.4-11
+- Various improvments to the new fullscreen code.
+
* Thu May 11 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 7.4-10
- Add a hard Requires on gcompris-libs version-release to the base package
because upstream doesn't bump the soname version when the abi changes.
More information about the fedora-extras-commits
mailing list