rpms/gcompris/devel gcompris-7.4-xf86vidmode3.patch, NONE, 1.1 gcompris.spec, 1.10, 1.11

Hans de Goede (jwrdegoede) fedora-extras-commits at redhat.com
Mon Jul 3 20:31:24 UTC 2006


Author: jwrdegoede

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

Modified Files:
	gcompris.spec 
Added Files:
	gcompris-7.4-xf86vidmode3.patch 
Log Message:
* Mon Jun  5 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-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/devel/gcompris.spec,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- gcompris.spec	5 Jun 2006 20:33:39 -0000	1.10
+++ gcompris.spec	3 Jul 2006 20:31:23 -0000	1.11
@@ -1,6 +1,6 @@
 Name:           gcompris
 Version:        7.4
-Release:        11%{?dist}
+Release:        12%{?dist}
 Summary:        Educational suite for kids 2-10 years old
 Group:          Amusements/Games
 License:        GPL
@@ -14,6 +14,7 @@
 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
@@ -226,6 +227,7 @@
 %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
@@ -482,6 +484,12 @@
 
 
 %changelog
+* Mon Jun  5 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.
 




More information about the fedora-extras-commits mailing list