[Player-cvs] common/gtk hxbin.cpp, 1.3.4.1, 1.3.4.2 hxplayer.cpp, 1.21.2.1, 1.21.2.2 hxstatisticsobserver.cpp, 1.2, 1.2.6.1

[Player-cvs] common/gtk hxbin.cpp, 1.3.4.1, 1.3.4.2 hxplayer.cpp, 1.21.2.1, 1.21.2.2 hxstatisticsobserver.cpp, 1.2, 1.2.6.1

rggammon at helixcommunity.org rggammon at helixcommunity.org
Wed Jul 7 11:52:37 PDT 2004


Update of /cvsroot/player/common/gtk
In directory cvs-new:/tmp/cvs-serv24705/common/gtk

Modified Files:
      Tag: bingo-beta
	hxbin.cpp hxplayer.cpp hxstatisticsobserver.cpp 
Log Message:
Merging back CR'd bug fixes to bingo-beta


Index: hxstatisticsobserver.cpp
===================================================================
RCS file: /cvsroot/player/common/gtk/hxstatisticsobserver.cpp,v
retrieving revision 1.2
retrieving revision 1.2.6.1
diff -u -d -r1.2 -r1.2.6.1
--- hxstatisticsobserver.cpp	29 Apr 2004 20:08:12 -0000	1.2
+++ hxstatisticsobserver.cpp	7 Jul 2004 18:52:35 -0000	1.2.6.1
@@ -58,14 +58,15 @@
 
 static void
 make_gvalue(GValue*              value,
-            int                  value_type,
-            const unsigned char* buf)
+            int                  valueType,
+            const unsigned char* szBuf)
 {
     gsize in;
     gsize out;
     gchar *utf8_val;
+    const gchar* buf = (const gchar*)szBuf;    
     
-    switch(value_type)
+    switch(valueType)
     {
         case kValueType32BitSignedInt:
             g_value_init(value, G_TYPE_INT);
@@ -73,9 +74,9 @@
             break;
             
         case kValueTypeString:
-            in = strlen((char*)buf) + 1;
+            in = strlen(buf) + 1;
             out = 0;
-            utf8_val = g_convert((char*)value, in - 1, "UTF-8", "ISO-8859-1", &in, &out, NULL);
+            utf8_val = g_convert(buf, in - 1, "UTF-8", "ISO-8859-1", &in, &out, NULL);
             g_assert(utf8_val);
             
             g_value_init(value, G_TYPE_STRING);

Index: hxplayer.cpp
===================================================================
RCS file: /cvsroot/player/common/gtk/hxplayer.cpp,v
retrieving revision 1.21.2.1
retrieving revision 1.21.2.2
diff -u -d -r1.21.2.1 -r1.21.2.2
--- hxplayer.cpp	29 Jun 2004 22:09:49 -0000	1.21.2.1
+++ hxplayer.cpp	7 Jul 2004 18:52:35 -0000	1.21.2.2
@@ -117,6 +117,10 @@
 static GList* g_players_list = NULL;
 static Display* g_dpy = NULL;
 
+/* extension info */
+static gboolean g_xshm_present = FALSE;
+static gint     g_xshm_event_base = -1;
+
 /* GObject, GtkObject methods */
 static void     hx_player_class_init            (HXPlayerClass*  klass);
 static void     hx_player_init                  (HXPlayer*       hxplayer,
@@ -1037,9 +1041,24 @@
         if(g_engine_ref_count == 0)
         {
 #ifdef G_OS_UNIX
+            // Create a display for the player
+            if(!g_dpy)
+            {
+                g_dpy = XOpenDisplay(NULL);
+            }
+
+            // Query for extensions for event handling purposes within
+            // the pump callback.
+            gint ignore;
+            g_xshm_present = XQueryExtension(g_dpy,
+                                             "MIT-SHM",
+                                             &ignore,
+                                             &g_xshm_event_base,
+                                             &ignore);
+            
             g_pump_timer_id = gtk_timeout_add(SLEEP_TIME,
                                               hx_player_pump,
-                                              (gpointer)player);
+                                              NULL);
 #endif
         }
         
@@ -2039,23 +2058,11 @@
     widget->style = gtk_style_attach(widget->style, widget->window);
 
     gdk_window_set_user_data(widget->window, player);
-       
-    // Create a player
-    if(!g_dpy)
-    {
-        g_dpy = XOpenDisplay(NULL);
-    }
-        
+
+    g_assert(g_dpy != NULL);    
     player->window->display = g_dpy;
     player->window->window = (void*)GDK_DRAWABLE_XID(widget->window);
 
-    // Query for extensions for event handling purposes
-    gint ignore;
-    player->xshm_present = XQueryExtension((Display*)player->window->display,
-                                           "MIT-SHM",
-                                           &ignore,
-                                           &player->xshm_event_base,
-                                           &ignore);
 #elif defined(G_OS_WIN32)
     player->window->window = (void*)GDK_WINDOW_HWND(widget->window);
 #else
@@ -2319,19 +2326,13 @@
 }
 
 static gboolean
-hx_player_pump(gpointer user_data)
+hx_player_pump(gpointer /* unused */)
 {
-    HXPlayer* player = HX_PLAYER(user_data);
-    g_return_val_if_fail(player, TRUE);
-
     ClientEngineProcessXEvent(NULL);    
 
     /* Process any events in the display queue */
-    Display* dpy;
-
-    dpy = (Display*)player->window->display;
-
-    if(dpy)
+    
+    if(g_dpy)
     {
         XEvent xevent;
         HXxEvent pnevent;
@@ -2348,9 +2349,9 @@
            get back are ShmCompletion messages. Why is this?           
         */
         
-        while(XPending(dpy))
+        while(XPending(g_dpy))
         {
-            XNextEvent(dpy, &xevent);
+            XNextEvent(g_dpy, &xevent);
             
             // package native event in HXxEvent and send to dispatcher
             pnevent.event = xevent.type;
@@ -2368,8 +2369,8 @@
                "base event" number. */
                     
             /* Check the extensions */
-            if(player->xshm_present &&
-               (ShmCompletion + player->xshm_event_base) == xevent.type)
+            if(g_xshm_present &&
+               (ShmCompletion + g_xshm_event_base) == xevent.type)
             {
                 /* Ignore xshm completion */
             }

Index: hxbin.cpp
===================================================================
RCS file: /cvsroot/player/common/gtk/hxbin.cpp,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -u -d -r1.3.4.1 -r1.3.4.2
--- hxbin.cpp	29 Jun 2004 22:09:49 -0000	1.3.4.1
+++ hxbin.cpp	7 Jul 2004 18:52:35 -0000	1.3.4.2
@@ -117,7 +117,7 @@
 
     hxbin->maintain_aspect_ratio = TRUE;
     hxbin->stretch_to_fit = FALSE;
-    hxbin->player_visual_state_changed_handler = -1;
+    hxbin->player_ideal_size_changed_handler = -1;
 }
 
 GtkWidget*
@@ -199,16 +199,16 @@
     {
         GtkAllocation alloc_player;
         gint player_width, player_height;
-        
-        if(hx_player_has_visual_content(HX_PLAYER(player)))
+        gint ideal_width, ideal_height;
+
+        /* Calculate the player's aspect ratio from its ideal size */
+        hx_player_get_ideal_size(HX_PLAYER(player),
+                                 &ideal_width, &ideal_height);        
+
+        if(ideal_width > 0 && ideal_height > 0)
         {
-            gint ideal_width, ideal_height;
             gdouble player_aspect_ratio, bin_aspect_ratio;
 
-            /* Calculate the player's aspect ratio from its ideal size */
-            hx_player_get_ideal_size(HX_PLAYER(player),
-                                     &ideal_width, &ideal_height);        
-
             player_aspect_ratio = (gdouble) ideal_width / (gdouble) ideal_height;
             bin_aspect_ratio = (gdouble) alloc_bin->width / (gdouble) alloc_bin->height;
             
@@ -280,12 +280,18 @@
 }
 
 static void
-hx_bin_player_visual_state_changed(GtkWidget* widget,
-                                   gboolean   /* is_visibile */,
-                                   GtkWidget* hxbin)
+hx_bin_player_ideal_size_changed(GtkWidget* widget,
+                                 gint /* width */,
+                                 gint /* height */,
+                                 GtkWidget* hxbin)
 {
-    /* Reallocate when switching from logo to vido and visa versa */
-    hx_bin_size_allocate(hxbin, &hxbin->allocation);
+    g_return_if_fail(hxbin != NULL);
+    
+    if(GTK_WIDGET_REALIZED(hxbin))
+    {
+        /* Reallocate when switching from logo to vido and visa versa */
+        hx_bin_size_allocate(hxbin, &hxbin->allocation);
+    }
 }
 
 static void
@@ -299,11 +305,11 @@
 
     hxbin = HX_BIN (container);
         
-    g_return_if_fail(hxbin->player_visual_state_changed_handler < 0);
+    g_return_if_fail(hxbin->player_ideal_size_changed_handler < 0);
 
-    hxbin->player_visual_state_changed_handler =
-        g_signal_connect(G_OBJECT(widget), "visual_state_changed",
-                         G_CALLBACK(hx_bin_player_visual_state_changed), hxbin);
+    hxbin->player_ideal_size_changed_handler =
+        g_signal_connect(G_OBJECT(widget), "ideal_size_changed",
+                         G_CALLBACK(hx_bin_player_ideal_size_changed), hxbin);
 
     GTK_CONTAINER_CLASS(g_parent_class)->add(container, widget);
 }
@@ -318,17 +324,17 @@
     g_return_if_fail(HX_IS_BIN(container));
 
     hxbin = HX_BIN (container);
-    g_return_if_fail(hxbin->player_visual_state_changed_handler >= 0);
+    g_return_if_fail(hxbin->player_ideal_size_changed_handler >= 0);
 
     player = gtk_bin_get_child(GTK_BIN(container));
 
     if(widget == player)
     {
         g_signal_handler_disconnect(G_OBJECT(player),
-                                    hxbin->player_visual_state_changed_handler);
+                                    hxbin->player_ideal_size_changed_handler);
     }
     
-    hxbin->player_visual_state_changed_handler = -1;
+    hxbin->player_ideal_size_changed_handler = -1;
 
     GTK_CONTAINER_CLASS(g_parent_class)->remove(container, widget);
 }




More information about the Player-cvs mailing list
 

Site Map   |   Terms of Use   |   Privacy Policy   |   Contact Us

Copyright © 1995-2007 RealNetworks, Inc. All rights reserved. RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.