rpms/gcompris/devel gcompris-7.4-xf86vidmode.patch, NONE, 1.1 gcompris.spec, 1.3, 1.4

Hans de Goede (jwrdegoede) fedora-extras-commits at redhat.com
Sat May 6 22:42:38 UTC 2006


Author: jwrdegoede

Update of /cvs/extras/rpms/gcompris/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv8056

Modified Files:
	gcompris.spec 
Added Files:
	gcompris-7.4-xf86vidmode.patch 
Log Message:
* Sat May  6 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 7.4-7
- Use XF86VidMode instead of Xrandr extension for resolution switching,
  hopefully fixing bug 190918.


gcompris-7.4-xf86vidmode.patch:

--- NEW FILE gcompris-7.4-xf86vidmode.patch ---
--- gcompris-7.4/configure.xf86vm	2006-04-12 01:13:49.000000000 +0200
+++ gcompris-7.4/configure	2006-05-07 00:25:10.000000000 +0200
@@ -1094,7 +1094,7 @@
   --disable-sdltest       Do not try to compile and run a test SDL program
   --disable-glibtest      do not try to compile and run a test GLIB program
   --disable-rpath         do not hardcode runtime library paths
-  --disable-xrandr        Turn off xrandr
+  --disable-xf86vidmode   Turn off xf86vidmode
   --enable-debug          Turn on debugging messages
   --disable-sqlite        Turn off sqlite (will disable profile)
   --enable-py-build-only  Skip python modules tests. (Useful if you just need
@@ -23630,7 +23630,7 @@
 /usr/openwin/share/include'
 
 if test "$ac_x_includes" = no; then
-  # Guess where to find include files, by looking for Intrinsic.h.
+  # Guess where to find include files, by looking for Xlib.h.
   # First, try using that file with no special directory specified.
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -23638,7 +23638,7 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <X11/Intrinsic.h>
+#include <X11/Xlib.h>
 _ACEOF
 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -23665,7 +23665,7 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
   for ac_dir in $ac_x_header_dirs; do
-  if test -r "$ac_dir/X11/Intrinsic.h"; then
+  if test -r "$ac_dir/X11/Xlib.h"; then
     ac_x_includes=$ac_dir
     break
   fi
@@ -23686,11 +23686,11 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <X11/Intrinsic.h>
+#include <X11/Xlib.h>
 int
 main ()
 {
-XtMalloc (0)
+XrmInitialize ()
   ;
   return 0;
 }
@@ -23769,23 +23769,23 @@
 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
 fi
 
-# Check whether --enable-xrandr or --disable-xrandr was given.
-if test "${enable_xrandr+set}" = set; then
-  enableval="$enable_xrandr"
-  USE_XRANDR="$enableval"
+# Check whether --enable-xf86vidmode or --disable-xf86vidmode was given.
+if test "${enable_xf86vidmode+set}" = set; then
+  enableval="$enable_xf86vidmode"
+  USE_XF86VM="$enableval"
 else
-  USE_XRANDR="yes"
+  USE_XF86VM="yes"
 fi;
-found_randr=no
-if test "x$USE_XRANDR" == "xyes" ; then
-  RANDR_LIBS=
-  echo "$as_me:$LINENO: checking for XRRSetScreenConfigAndRate in -lXrandr" >&5
-echo $ECHO_N "checking for XRRSetScreenConfigAndRate in -lXrandr... $ECHO_C" >&6
-if test "${ac_cv_lib_Xrandr_XRRSetScreenConfigAndRate+set}" = set; then
+found_xf86vidmode=no
+if test "x$USE_XF86VM" == "xyes" ; then
+  XF86VM_LIBS=
+  echo "$as_me:$LINENO: checking for XF86VidModeQueryExtension in -lXxf86vm" >&5
+echo $ECHO_N "checking for XF86VidModeQueryExtension in -lXxf86vm... $ECHO_C" >&6
+if test "${ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXrandr -L$x_libraries $ALL_X_LIBS  $LIBS"
+LIBS="-lXxf86vm -L$x_libraries $ALL_X_LIBS  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -23799,11 +23799,11 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char XRRSetScreenConfigAndRate ();
+char XF86VidModeQueryExtension ();
 int
 main ()
 {
-XRRSetScreenConfigAndRate ();
+XF86VidModeQueryExtension ();
   ;
   return 0;
 }
@@ -23830,23 +23830,23 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_Xrandr_XRRSetScreenConfigAndRate=yes
+  ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_Xrandr_XRRSetScreenConfigAndRate=no
+ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xrandr_XRRSetScreenConfigAndRate" >&5
-echo "${ECHO_T}$ac_cv_lib_Xrandr_XRRSetScreenConfigAndRate" >&6
-if test $ac_cv_lib_Xrandr_XRRSetScreenConfigAndRate = yes; then
-  echo "$as_me:$LINENO: checking for X11/extensions/Xrandr.h" >&5
-echo $ECHO_N "checking for X11/extensions/Xrandr.h... $ECHO_C" >&6
-if test "${ac_cv_header_X11_extensions_Xrandr_h+set}" = set; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension" >&5
+echo "${ECHO_T}$ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension" >&6
+if test $ac_cv_lib_Xxf86vm_XF86VidModeQueryExtension = yes; then
+  echo "$as_me:$LINENO: checking for X11/extensions/xf86vmode.h" >&5
+echo $ECHO_N "checking for X11/extensions/xf86vmode.h... $ECHO_C" >&6
+if test "${ac_cv_header_X11_extensions_xf86vmode_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -23857,7 +23857,7 @@
 /* end confdefs.h.  */
 #include <X11/Xlib.h>
 
-#include <X11/extensions/Xrandr.h>
+#include <X11/extensions/xf86vmode.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -23881,38 +23881,38 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_header_X11_extensions_Xrandr_h=yes
+  ac_cv_header_X11_extensions_xf86vmode_h=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_X11_extensions_Xrandr_h=no
+ac_cv_header_X11_extensions_xf86vmode_h=no
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_Xrandr_h" >&5
-echo "${ECHO_T}$ac_cv_header_X11_extensions_Xrandr_h" >&6
-if test $ac_cv_header_X11_extensions_Xrandr_h = yes; then
-  RANDR_LIBS="-L$x_libraries -lXrandr" found_randr=yes
+echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_xf86vmode_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_extensions_xf86vmode_h" >&6
+if test $ac_cv_header_X11_extensions_xf86vmode_h = yes; then
+  XF86VM_LIBS="-L$x_libraries -lXxf86vm" found_xf86vidmode=yes
 fi
 
 
 fi
 
 
-  if test "x$found_randr" = "xno"; then
-     { echo "$as_me:$LINENO: \"Suitable Xrandr extension library not found - you need at least X 4.3. Will not use xrandr for fullscreen.\"" >&5
-echo "$as_me: \"Suitable Xrandr extension library not found - you need at least X 4.3. Will not use xrandr for fullscreen.\"" >&6;}
+  if test "x$found_xf86vidmode" = "xno"; then
+     { echo "$as_me:$LINENO: \"Suitable XF86VidMode extension library not found - Will not use xf86vidmode for fullscreen.\"" >&5
+echo "$as_me: \"Suitable XF86VidMode extension library not found - Will not use xf86vidmode for fullscreen.\"" >&6;}
   else
 
 cat >>confdefs.h <<_ACEOF
-#define XRANDR 1
+#define XF86_VIDMODE 1
 _ACEOF
 
   fi
 fi
 
-LDFLAGS="${LDFLAGS} ${RANDR_LIBS}"
+LDFLAGS="${LDFLAGS} ${XF86VM_LIBS}"
 
 ALL_LINGUAS="am ar az bg ca cs da de el en_CA en_GB es et eu fi fr ga gu he hi hr hu it ka lt mk ml ms nb ne nl nn pa pl pt pt_BR ro ru rw sk sl sq sr sr at Latn sv tr vi wa zh_CN zh_TW"
 
@@ -28651,7 +28651,7 @@
 echo "SDL LIBS                                 = found"
 fi
 
-echo "XRANDR option  (--enable-xrandr)         = $found_randr"
+echo "XF86VM option  (--enable-xf86vidmode)    = $found_xf86vidmode"
 
 echo "SQLITE database (--enable-sqlite)        = $with_sqlite (profiles depend on this)"
 
--- gcompris-7.4/config.h.in.xf86vm	2006-04-12 01:16:12.000000000 +0200
+++ gcompris-7.4/config.h.in	2006-05-07 00:25:10.000000000 +0200
@@ -141,5 +141,5 @@
 /* Version number of package */
 #undef VERSION
 
-/* XRANDR Available */
-#undef XRANDR
+/* XF86VidMode Available */
+#undef XF86_VIDMODE
--- gcompris-7.4/src/boards/py-gcompris-properties.c.xf86vm	2006-05-07 00:25:10.000000000 +0200
+++ gcompris-7.4/src/boards/py-gcompris-properties.c	2006-05-07 00:25:10.000000000 +0200
@@ -72,8 +72,8 @@
 	return Py_False;
       }
     }
-    if(strcmp(name,"noxrandr")==0){
-      if(self->cdata->noxrandr){
+    if(strcmp(name,"noxf86vm")==0){
+      if(self->cdata->noxf86vm){
 	Py_INCREF(Py_True);
 	return Py_True;
       } else {
--- gcompris-7.4/src/gcompris/gcompris.c.xf86vm	2006-03-02 00:47:10.000000000 +0100
+++ gcompris-7.4/src/gcompris/gcompris.c	2006-05-07 00:29:58.000000000 +0200
@@ -33,12 +33,13 @@
 
 #include "cursor.h"
 
-/* For XRANDR Support */
-#ifdef XRANDR
+/* For XF86_VIDMODE Support */
+#ifdef XF86_VIDMODE
 #include <gdk/gdkx.h>
 #include <X11/Xlib.h>
-#include <X11/extensions/Xrandr.h>
-#include <X11/extensions/Xrender.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/xf86dga.h>
+#include <X11/extensions/xf86vmode.h>   
 #endif
 
 #if defined _WIN32 || defined __WIN32__
@@ -104,7 +105,7 @@
 static int popt_aalias		   = FALSE;
 static int popt_difficulty_filter  = FALSE;
 static int popt_debug		   = FALSE;
-static int popt_noxrandr	   = FALSE;
+static int popt_noxf86vm	   = FALSE;
 static char *popt_root_menu        = NULL;
 static char *popt_local_activity   = NULL;
 static int popt_administration	   = FALSE;
@@ -139,8 +140,8 @@
    N_("Print the version of " PACKAGE), NULL},
   {"antialiased", '\0', POPT_ARG_NONE, &popt_aalias, 0,
    N_("Use the antialiased canvas (slower)."), NULL},
-  {"noxrandr", 'x', POPT_ARG_NONE, &popt_noxrandr, 0,
-   N_("Disable XRANDR (No screen resolution change)."), NULL},
+  {"noxf86vm", 'x', POPT_ARG_NONE, &popt_noxf86vm, 0,
+   N_("Disable XF86VidMode (No screen resolution change)."), NULL},
   {"root-menu", 'l', POPT_ARG_STRING, &popt_root_menu, 0,
    N_("Run gcompris with local menu (e.g -l /reading will let you play only activities in the reading directory, -l /boards/connect4 only the connect4 activity)"), NULL},
   {"local-activity", 'L', POPT_ARG_STRING, &popt_local_activity, 0,
@@ -184,29 +185,19 @@
 };
 
 /* XRandr Stuff */
-#ifdef XRANDR
-typedef struct 
+#ifdef XF86_VIDMODE
+static struct 
 {
-  gboolean                xr_lock_updates;
+  int vidmode_available;
+  XF86VidModeModeInfo orig_mode;
+  int orig_viewport_x;
+  int orig_viewport_y;
+  int width;
+  int height;
+} XF86VidModeData = { 0, { 0 }, 0, 0 };
 
-  XRRScreenConfiguration *xr_screen_conf;
-
-  XRRScreenSize          *xr_sizes;
-  int                     xr_nsize;
-  SizeID	          xr_current_size;
-
-  Rotation                xr_rotations;
-  Rotation                xr_current_rotation;
-
-} XRANDRData; 
-
-static SizeID		 xr_previous_size;
-static gboolean		 xr_previous_size_set = FALSE;
-static XRANDRData	*xrandr = NULL;
-
-static void xrandr_init ( XRANDRData *xrandr );
-static void xrandr_get_config ( XRANDRData *xrandr );
-static void xrandr_set_config( XRANDRData  *xrandr );
+static void xf86_vidmode_init( void );
+static void xf86_vidmode_set_fullscreen( int state );
 #endif
 
 /****************************************************************************/
@@ -441,8 +432,8 @@
   gint screen_height, screen_width;
   GtkWidget *vbox;
 
-#ifdef XRANDR
-  xrandr = g_new0 (XRANDRData, 1);
+#ifdef XF86_VIDMODE
+  xf86_vidmode_init();
 #endif
 
   gcompris_set_fullscreen(properties->fullscreen);
@@ -450,10 +441,10 @@
   screen_height = gdk_screen_height();
   screen_width  = gdk_screen_width();
 
-#ifdef XRANDR
-  if(properties->fullscreen && !properties->noxrandr) {
-    screen_height = xrandr->xr_sizes[xrandr->xr_current_size].height;
-    screen_width  = xrandr->xr_sizes[xrandr->xr_current_size].width;
+#ifdef XF86_VIDMODE
+  if(properties->fullscreen && !properties->noxf86vm) {
+    screen_width  = XF86VidModeData.width;
+    screen_height = XF86VidModeData.height;
   }
 #endif
 
@@ -811,39 +802,18 @@
  */
 void gcompris_set_fullscreen(gboolean state)
 {
-
-  if(state)
-    {
-#ifdef XRANDR
-      gint i;
-      /* Search the 800x600 Resolution */
-      if(properties->fullscreen && !properties->noxrandr) {
-	
-	g_warning("XRANDR Is compiled in. Searching a good resolution");
-
-	/* Check if XRANDR is available */
-	if (!properties->noxrandr) {
-	  xrandr_get_config ( xrandr );
-	  xr_previous_size = (SizeID)xrandr->xr_current_size;
-	  for (i = 0; i < xrandr->xr_nsize; i++) {
-	    if(xrandr->xr_sizes[i].width == BOARDWIDTH &&
-	       xrandr->xr_sizes[i].height == BOARDHEIGHT+BARHEIGHT) 
-	      {
-		xrandr->xr_current_size = (SizeID)i;
-		xr_previous_size_set = TRUE;
-		break;
-	      }
-	  }
-	}
-
-	/* Set the Fullscreen now */
-	if(xr_previous_size_set) 
-	  {
-	    if(is_mapped)
-	      xrandr_set_config( xrandr );
-	  }
-      }
+  properties->fullscreen = state;
+  /* We need to grab the pointer before doing the vidmode switch otherwise the
+     setviewport may be "canceled" by the pointer being outside the viewport */
+  if(properties->fullscreen)
+    gdk_pointer_grab(window->window, TRUE, 0, window->window, NULL,
+      GDK_CURRENT_TIME);
+     
+#ifdef XF86_VIDMODE
+  xf86_vidmode_set_fullscreen(properties->fullscreen);
 #endif
+  if(properties->fullscreen)
+    {
       gdk_window_set_decorations (window->window, 0);
       gdk_window_set_functions (window->window, 0);
       gtk_widget_set_uposition (window, 0, 0);
@@ -851,20 +821,7 @@
     }
   else
     { 
-#ifdef XRANDR
-      /* Set back the original screen size */
-      if(xr_previous_size_set && !properties->noxrandr)
-	{
-	  /* Need to refresh our config or xrandr api will reject us */
-	  if(xrandr)
-	    {
-	      xrandr_get_config ( xrandr );
-	      xrandr->xr_current_size = (SizeID)xr_previous_size;
-	      xrandr_set_config( xrandr );
-	    }
-	}
-      xr_previous_size_set = FALSE;
-#endif
+      gdk_pointer_ungrab(GDK_CURRENT_TIME);
       /* The hide must be done at least for KDE */
       gtk_widget_hide (window);
       gdk_window_set_decorations (window->window, GDK_DECOR_ALL);
@@ -1044,68 +1001,136 @@
     g_printerr ("%s: %s\n\n", "gcompris", message);
 }
 
-#ifdef XRANDR
+#ifdef XF86_VIDMODE
 /*
- * XRANDR STUFF
- * ------------
+ * XF86VidMode STUFF
+ * -----------------
  */
 static void
-xrandr_init ( XRANDRData *data )
+xf86_vidmode_init ( void )
 {
-  if(data==NULL)
+  int i,j;
+  XF86VidModeModeLine *l = (XF86VidModeModeLine *)((char *)
+    &XF86VidModeData.orig_mode + sizeof XF86VidModeData.orig_mode.dotclock);
+  
+  if (properties->noxf86vm)
     return;
-
-  data->xr_screen_conf = XRRGetScreenInfo (GDK_DISPLAY(), GDK_ROOT_WINDOW());
-
-  if (data->xr_screen_conf == NULL)
+  
+  if (!XF86VidModeQueryVersion(GDK_DISPLAY(), &i, &j))
+    properties->noxf86vm = TRUE;
+  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))
+    properties->noxf86vm = TRUE;
+  else if (!XF86VidModeGetViewPort(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
+            gdk_screen_get_default()), &XF86VidModeData.orig_viewport_x,
+            &XF86VidModeData.orig_viewport_x))
+    properties->noxf86vm = TRUE;
+  
+  if (properties->noxf86vm)
+      g_warning("XF86VidMode not available");
+  else
     {
-      g_warning("XRANDR not available");
-      properties->noxrandr = TRUE;
+      XF86VidModeData.width  = XF86VidModeData.orig_mode.hdisplay;
+      XF86VidModeData.height = XF86VidModeData.orig_mode.vdisplay;
+      g_warning("XF86VidMode support enabled");
     }
-  else
-      g_warning("XRANDR support enabled");
- }
-
-static void
-xrandr_get_config ( XRANDRData *data )
-{
-  if(data==NULL)
-    return;
-
-  xrandr_init (data);
-
-  data->xr_current_size = XRRConfigCurrentConfiguration (data->xr_screen_conf, 
-							 &data->xr_current_rotation);
-
-  data->xr_sizes = XRRConfigSizes(data->xr_screen_conf, &data->xr_nsize);
-  
-  data->xr_rotations = XRRConfigRotations(data->xr_screen_conf,
-					  &data->xr_current_rotation);
 }
 
+
 static void
-xrandr_set_config( XRANDRData  *data )
+xf86_vidmode_set_fullscreen ( int state )
 {
-  Status  status = RRSetConfigFailed;
+  int i;
+  XF86VidModeModeLine mode;
 
-  if(data==NULL)
+  if (properties->noxf86vm)
     return;
 
-  if (data->xr_lock_updates) return;
-  
-  status = XRRSetScreenConfig (GDK_DISPLAY(), 
-			       data->xr_screen_conf, 
-			       GDK_ROOT_WINDOW(), 
-			       data->xr_current_size, 
-			       data->xr_current_rotation, 
-			       CurrentTime);
-
-  if(status) {
-    g_error("ERROR: Failed to set back the original resolution XRRSetScreenConfig returned status = %d\n",
-	    (int)status);
-  }
-  return;
-
+  if (state)
+    {
+      XF86VidModeModeInfo **modes;
+      int mode_count;
+      
+      if (!XF86VidModeGetModeLine(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
+            gdk_screen_get_default()), &i, &mode))
+        {
+          g_warning("XF86VidMode couldnot get current mode, not switching resolution");
+          properties->fullscreen = FALSE;
+          return;
+        }
+        
+      /* Do we need to switch? */
+      if ((mode.hdisplay == BOARDWIDTH) &&
+          (mode.vdisplay == BOARDHEIGHT+BARHEIGHT))
+        {
+          if (!XF86VidModeSetViewPort(GDK_DISPLAY(),
+                GDK_SCREEN_XNUMBER(gdk_screen_get_default()), 0, 0))
+            g_warning("XF86VidMode couldnot change viewport");
+          return;
+        }
+
+      if (!XF86VidModeGetAllModeLines(GDK_DISPLAY(), GDK_SCREEN_XNUMBER(
+            gdk_screen_get_default()), &mode_count, &modes))
+        {
+          g_warning("XF86VidMode couldnot get modes not switching resolution");
+          properties->fullscreen = FALSE;
+          return;
+        }
+
+      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;
+                  if (!XF86VidModeSetViewPort(GDK_DISPLAY(),
+                        GDK_SCREEN_XNUMBER(gdk_screen_get_default()), 0, 0))
+                    g_warning("XF86VidMode couldnot change viewport");
+                }
+              else
+                {
+                  g_warning("XF86VidMode couldnot switch resolution");
+                  properties->fullscreen = FALSE;
+                }
+              break;
+            }
+        }
+      if (i == mode_count)
+        {
+          g_warning("XF86VidMode couldnot find a suitable resolution");
+          properties->fullscreen = FALSE;
+        }
+      XFree(modes);
+    }
+  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 (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");
+    }
 }
 #endif
 
@@ -1185,9 +1210,9 @@
       properties->fullscreen = TRUE;
     }
 
-  if (popt_noxrandr)
+  if (popt_noxf86vm)
     {
-      properties->noxrandr = TRUE;
+      properties->noxf86vm = TRUE;
     }
 
   if (popt_window)
--- gcompris-7.4/src/gcompris/properties.c.xf86vm	2006-05-07 00:25:10.000000000 +0200
+++ gcompris-7.4/src/gcompris/properties.c	2006-05-07 00:25:10.000000000 +0200
@@ -160,7 +160,7 @@
   tmp->fx		 = 1;
   tmp->screensize	 = 1;
   tmp->fullscreen	 = 1;
-  tmp->noxrandr		 = FALSE;
+  tmp->noxf86vm		 = FALSE;
   tmp->timer		 = 1;
   tmp->skin		 = "babytoy";
   tmp->key		 = "default";
@@ -244,8 +244,8 @@
 	} else if(!strcmp(value.v_identifier, "fullscreen")) {
 	  if(!scan_get_int(scanner, &tmp->fullscreen))
 	    g_warning("Config file parsing error on token %s", token);
-	} else if(!strcmp(value.v_identifier, "noxrandr")) {
-	  if(!scan_get_int(scanner, &tmp->noxrandr))
+	} else if(!strcmp(value.v_identifier, "noxf86vm")) {
+	  if(!scan_get_int(scanner, &tmp->noxf86vm))
 	    g_warning("Config file parsing error on token %s", token);
 	} else if(!strcmp(value.v_identifier, "timer")) {
 	  if(!scan_get_int(scanner, &tmp->timer))
--- gcompris-7.4/src/gcompris/properties.h.xf86vm	2006-05-07 00:25:10.000000000 +0200
+++ gcompris-7.4/src/gcompris/properties.h	2006-05-07 00:25:10.000000000 +0200
@@ -28,7 +28,7 @@
   gint		music;
   gint		fx;
   gint		fullscreen;
-  gint		noxrandr;
+  gint		noxf86vm;
   gint		screensize;
   gint		defaultcursor;
   gint		timer;
--- gcompris-7.4/configure.in.xf86vm	2006-04-12 01:06:34.000000000 +0200
+++ gcompris-7.4/configure.in	2006-05-07 00:25:10.000000000 +0200
@@ -81,30 +81,30 @@
 
 AM_ICONV
 
-dnl XRANDR Allow us to set the screen resolution dynamically
+dnl XF86VidMode allows us to set the screen resolution dynamically
 AC_PATH_X
-AC_ARG_ENABLE(xrandr,
+AC_ARG_ENABLE(xf86vidmode,
           AC_HELP_STRING(
-          [--disable-xrandr],
-          [Turn off xrandr]),
-          USE_XRANDR="$enableval", USE_XRANDR="yes")
-found_randr=no
-if test "x$USE_XRANDR" == "xyes" ; then
-  RANDR_LIBS=
-  AC_CHECK_LIB(Xrandr, XRRSetScreenConfigAndRate,
-             [AC_CHECK_HEADER(X11/extensions/Xrandr.h,
-                              RANDR_LIBS="-L$x_libraries -lXrandr" found_randr=yes,,
+          [--disable-xf86vidmode],
+          [Turn off xf86vidmode]),
+          USE_XF86VM="$enableval", USE_XF86VM="yes")
+found_xf86vidmode=no
+if test "x$USE_XF86VM" == "xyes" ; then
+  XF86VM_LIBS=
+  AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension,
+             [AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
+                              XF86VM_LIBS="-L$x_libraries -lXxf86vm" found_xf86vidmode=yes,,
                                 [#include <X11/Xlib.h>])],
                , -L$x_libraries $ALL_X_LIBS )
 
-  if test "x$found_randr" = "xno"; then
-     AC_MSG_NOTICE(["Suitable Xrandr extension library not found - you need at least X 4.3. Will not use xrandr for fullscreen."])
+  if test "x$found_xf86vidmode" = "xno"; then
+     AC_MSG_NOTICE(["Suitable XF86VidMode extension library not found - Will not use xf86vidmode for fullscreen."])
   else
-     AC_DEFINE_UNQUOTED(XRANDR, 1, [XRANDR Available])
+     AC_DEFINE_UNQUOTED(XF86_VIDMODE, 1, [XF86VidMode Available])
   fi
 fi
 
-LDFLAGS="${LDFLAGS} ${RANDR_LIBS}"
+LDFLAGS="${LDFLAGS} ${XF86VM_LIBS}"
 
 dnl Add the languages which your application supports here.
 ALL_LINGUAS="am ar az bg ca cs da de el en_CA en_GB es et eu fi fr ga gu he hi hr hu it ka lt mk ml ms nb ne nl nn pa pl pt pt_BR ro ru rw sk sl sq sr sr at Latn sv tr vi wa zh_CN zh_TW"
@@ -680,7 +680,7 @@
 echo "SDL LIBS                                 = found"
 fi
 
-echo "XRANDR option  (--enable-xrandr)         = $found_randr"
+echo "XF86VM option  (--enable-xf86vidmode)    = $found_xf86vidmode"
 
 echo "SQLITE database (--enable-sqlite)        = $with_sqlite (profiles depend on this)"
 


Index: gcompris.spec
===================================================================
RCS file: /cvs/extras/rpms/gcompris/devel/gcompris.spec,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- gcompris.spec	5 May 2006 18:08:47 -0000	1.3
+++ gcompris.spec	6 May 2006 22:42:38 -0000	1.4
@@ -1,6 +1,6 @@
 Name:           gcompris
 Version:        7.4
-Release:        6%{?dist}
+Release:        7%{?dist}
 Summary:        Educational suite for kids 2-10 years old
 Group:          Amusements/Games
 License:        GPL
@@ -12,6 +12,7 @@
 Patch2:         gcompris-nl.patch
 Patch3:         gcompris-electric.patch
 Patch4:         gcompris-click_on_letter.patch
+Patch5:         gcompris-7.4-xf86vidmode.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 libXrandr-devel
@@ -220,6 +221,7 @@
 %patch2 -p1
 %patch3 -p1 -z .electric
 %patch4 -p1 -z .click_on_letter
+%patch5 -p1 -z .xf86vm
 iconv -f ISO-8859-1 -t UTF8 docs/C/gcompris.info > tmp
 mv tmp docs/C/gcompris.info
 # fix gnome.canvas deprecation warnings
@@ -476,6 +478,10 @@
 
 
 %changelog
+* Sat May  6 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 7.4-7
+- Use XF86VidMode instead of Xrandr extension for resolution switching,
+  hopefully fixing bug 190918.
+
 * Fri May  5 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 7.4-6
 - Add missing python module Requires.
 




More information about the fedora-extras-commits mailing list