rpms/gcompris/devel gcompris-7.4-xf86vidmode2.patch, NONE, 1.1 gcompris.spec, 1.9, 1.10
Hans de Goede (jwrdegoede)
fedora-extras-commits at redhat.com
Mon Jun 5 20:33:39 UTC 2006
- Previous message (by thread): fedora-security/audit fc4,1.277,1.278 fc5,1.190,1.191
- Next message (by thread): rpms/gajim/FC-5 .cvsignore, 1.6, 1.7 gajim.spec, 1.10, 1.11 sources, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: jwrdegoede
Update of /cvs/extras/rpms/gcompris/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv18247
Modified Files:
gcompris.spec
Added Files:
gcompris-7.4-xf86vidmode2.patch
Log Message:
* Mon Jun 5 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 7.4-11
- Various improvments to the new fullscreen code.
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 */
Index: gcompris.spec
===================================================================
RCS file: /cvs/extras/rpms/gcompris/devel/gcompris.spec,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- gcompris.spec 11 May 2006 14:43:20 -0000 1.9
+++ gcompris.spec 5 Jun 2006 20:33:39 -0000 1.10
@@ -1,6 +1,6 @@
Name: gcompris
Version: 7.4
-Release: 10%{?dist}
+Release: 11%{?dist}
Summary: Educational suite for kids 2-10 years old
Group: Amusements/Games
License: GPL
@@ -13,6 +13,7 @@
Patch3: gcompris-electric.patch
Patch4: gcompris-click_on_letter.patch
Patch5: gcompris-7.4-xf86vidmode.patch
+Patch6: gcompris-7.4-xf86vidmode2.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 +225,7 @@
%patch3 -p1 -z .electric
%patch4 -p1 -z .click_on_letter
%patch5 -p1 -z .xf86vm
+%patch6 -p1 -z .xf86vm2
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 +482,9 @@
%changelog
+* 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.
- Previous message (by thread): fedora-security/audit fc4,1.277,1.278 fc5,1.190,1.191
- Next message (by thread): rpms/gajim/FC-5 .cvsignore, 1.6, 1.7 gajim.spec, 1.10, 1.11 sources, 1.6, 1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list