[MPlayer-dev-eng] GTK2

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Aug 14 10:52:48 CEST 2005


Hi,
On Sun, Aug 14, 2005 at 10:34:17AM +0200, Reimar D?ffinger wrote:
> On Sun, Aug 14, 2005 at 04:37:17AM +0300, Onur Kucuk wrote:
> >  Here is a patch to make MPlayer gui GTK2. Besides benefits of GTK2
> > (Unicode) it should provide more stability while using the arts
> > audio output with gui.
> 
> I ran across that patch a few days ago but didn't get to cleaning it up.
> So now you can do that :-)
> Comments on the patch:
> First of all you have a lot of whitespace changes, which makes the patch
> very hard to read - especially which part of configure you changed and
> which ones are unchanged is very difficult to see.

And they were the reason why nobody noticed the missing = sign in the
configure part...
I attached a cleaned-up version. Though the configure part and the while
loop might still be worth a closer look.

Greetings,
Reimar Döffinger
-------------- next part --------------
diff -bur MPlayer-cvs/Gui/mplayer/gtk/about.c MPlayer-gtk2/Gui/mplayer/gtk/about.c
--- MPlayer-cvs/Gui/mplayer/gtk/about.c	2005-01-22 01:41:07.000000000 +0100
+++ MPlayer-gtk2/Gui/mplayer/gtk/about.c	2005-08-14 10:45:10.000000000 +0200
@@ -28,6 +28,11 @@
   GtkWidget     * AboutText;
   GtkWidget     * Ok;
 
+#ifdef HAVE_GTK2_GUI
+  GtkTextBuffer * AboutTextBuffer;
+  GtkTextIter   iter;
+#endif //HAVE_GTK2_GUI
+
   GtkStyle      * pixmapstyle;
   GdkPixmap     * pixmapwid;
   GdkBitmap     * mask;
@@ -67,11 +72,21 @@
   gtk_box_pack_start( GTK_BOX( vbox ),scrolledwindow1,TRUE,TRUE,0 );
   gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
 
+#ifdef HAVE_GTK2_GUI
+  AboutText = gtk_text_view_new();
+  AboutTextBuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (AboutText));
+  gtk_text_buffer_get_iter_at_offset (AboutTextBuffer, &iter, 0);  
+#else  
   AboutText=gtk_text_new( NULL,NULL );
+#endif
   gtk_widget_set_name( AboutText,"AboutText" );
   gtk_widget_show( AboutText );
   gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),AboutText );
+#ifdef HAVE_GTK2_GUI  
+  gtk_text_buffer_insert (AboutTextBuffer, &iter,   
+#else  
   gtk_text_insert( GTK_TEXT( AboutText ),NULL,NULL,NULL,
+#endif
   	"\n" 
 	MSGTR_ABOUT_UHU 
 	"             (http://www.uhulinux.hu/)\n" 
diff -bur MPlayer-cvs/Gui/mplayer/widgets.c MPlayer-gtk2/Gui/mplayer/widgets.c
--- MPlayer-cvs/Gui/mplayer/widgets.c	2005-01-22 01:41:08.000000000 +0100
+++ MPlayer-gtk2/Gui/mplayer/widgets.c	2005-08-14 10:39:36.000000000 +0200
@@ -217,7 +217,15 @@
 	  gtk_widget_destroy( PopUpMenu );
 	 }
         PopUpMenu=create_PopUpMenu();
+#ifdef HAVE_GTK2_GUI
+        // Ugly hack, but we don't wanna loose events
+        while( !GTK_WIDGET_VISIBLE( PopUpMenu ) ) {
+           gtk_menu_popup( GTK_MENU( PopUpMenu ),NULL,NULL,NULL,NULL,0,gtk_get_current_event_time( ) );
+           gtk_main_iteration( );
+        }
+#else
         gtk_menu_popup( GTK_MENU( PopUpMenu ),NULL,NULL,NULL,NULL,0,0 );
+#endif //HAVE_GTK2_GUI
         break;
    case evHidePopUpMenu:
         if ( PopUpMenu ) 
diff -bur MPlayer-cvs/configure MPlayer-gtk2/configure
--- MPlayer-cvs/configure	2005-08-12 10:48:31.000000000 +0200
+++ MPlayer-gtk2/configure	2005-08-14 10:45:56.000000000 +0200
@@ -155,6 +155,7 @@
 Optional features:
   --disable-mencoder     disable mencoder (a/v encoder) compilation [enable]
   --enable-gui           enable gmplayer compilation (GTK 1.2 GUI) [disable]
+  --enable-gtk2          enable gtk2 port of the gui [disable]
   --enable-largefiles    enable support for files > 2 GBytes [disable]
   --enable-linux-devfs   set default devices to devfs ones [disable]
   --enable-termcap       use termcap database for key codes [autodetect]
@@ -1440,6 +1441,7 @@
 _lirc=auto
 _lircc=auto
 _gui=no
+_gtk2=no
 _termcap=auto
 _termios=auto
 _3dfx=no
@@ -1692,6 +1694,8 @@
   --disable-lircc)	_lircc=no	;;
   --enable-gui)		_gui=yes	;;
   --disable-gui)	_gui=no		;;
+  --enable-gtk2)	_gtk2=yes	;;
+  --disable-gtk2)	_gtk2=no	;;
   --enable-termcap)	_termcap=yes	;;
   --disable-termcap)	_termcap=no	;;
   --enable-termios)	_termios=yes    ;;
@@ -6641,6 +6645,30 @@
   fi
   echores "$_xshape"
 
+#Check for new GTK (2.x.x)
+if test "$_gtk2" = yes ; then
+
+  #Check for GTK:
+  echocheck "GTK+ version"
+
+  _gtk=`pkg-config gtk+-2.0 --modversion 2>&1`
+  _inc_gtk=`pkg-config gtk+-2.0 --cflags 2>&1`
+  _ld_gtk=`pkg-config gtk+-2.0 --libs 2>&1`
+  echores "$_gtk"
+
+  # Check for GLIB
+  echocheck "glib version"
+  _glib=`pkg-config glib-2.0 --modversion 2>&1`
+  _inc_glib=`pkg-config glib-2.0 --cflags 2>&1`
+  _ld_glib=`pkg-config glib-2.0 --libs 2>&1`
+  echores "$_glib"
+
+  _def_gui='#define HAVE_NEW_GUI 1'
+  _def_gtk2_gui='#define HAVE_GTK2_GUI 1'
+  _ld_gui='$(GTKLIB) $(GLIBLIB)'
+       
+# Check for "old GTK (1.2.x)
+else
 
   # Check for GTK:
   echocheck "GTK version"
@@ -6675,7 +6703,9 @@
   echores "$_glib (using $_glibconfig)"
 
   _def_gui='#define HAVE_NEW_GUI 1'
+  _def_gtk2_gui='#undef HAVE_GTK2_GUI'
   _ld_gui='$(GTKLIB) $(GLIBLIB)'
+fi
 
   echo "Creating Gui/config.mak"
   cat > Gui/config.mak << EOF
@@ -6690,6 +6720,7 @@
 
 else
   _def_gui='#undef HAVE_NEW_GUI'
+  _def_gtk2_gui='#undef HAVE_GTK2_GUI'
 fi
 # --------------- GUI specific tests end -------------------
 
@@ -7456,6 +7487,7 @@
 
 /* gui support, please do not edit this option */
 $_def_gui
+$_def_gtk2_gui
 
 /* Audio output drivers */
 $_def_ossaudio


More information about the MPlayer-dev-eng mailing list