qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Jim C. Brown" <jma5@umd.edu>
To: Christian Bourque <christian.bourque@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] quick gtk2.c update
Date: Mon, 27 Jun 2005 21:04:19 -0400	[thread overview]
Message-ID: <20050628010419.GA21906@jbrown.mylinuxbox.org> (raw)
In-Reply-To: <a6ee49d305062714191d1eed3@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 577 bytes --]

On Mon, Jun 27, 2005 at 05:19:17PM -0400, Christian Bourque wrote:
> Hi Jim!
> 
> Could you send a new Makefile.diff (the old one is not working with
> the latest cvs version of QEMU), I would like to test this code too...
> 
> Thanks
> 
> Christian
> 

I just tested it myself. This patch was applied to latest CVS and it worked
perfectly. (The CVS was pure btw - freshly checked out into a new directory.)

If there are any rejects with this, please email the *.rej files to me.

-- 
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.

[-- Attachment #2: 2qemu-gtk-patch.diff --]
[-- Type: text/plain, Size: 6229 bytes --]

diff -u qemu.orig/vl.c qemu/vl.c
--- qemu.orig/vl.c	Tue May 31 14:53:22 2005
+++ qemu/vl.c	Tue May 31 14:52:55 2005
@@ -147,6 +147,7 @@
 TextConsole *vga_console;
 CharDriverState *serial_hds[MAX_SERIAL_PORTS];
 CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
+int use_gtk = 0;
 #ifdef TARGET_I386
 int win2k_install_hack = 0;
 #endif
@@ -2877,6 +2878,7 @@
     QEMU_OPTION_cirrusvga,
     QEMU_OPTION_g,
     QEMU_OPTION_std_vga,
+    QEMU_OPTION_use_gtk,
     QEMU_OPTION_monitor,
     QEMU_OPTION_serial,
     QEMU_OPTION_parallel,
@@ -2947,6 +2949,7 @@
     { "localtime", 0, QEMU_OPTION_localtime },
     { "isa", 0, QEMU_OPTION_isa },
     { "std-vga", 0, QEMU_OPTION_std_vga },
+    { "use-gtk", 0, QEMU_OPTION_use_gtk },
     { "monitor", 1, QEMU_OPTION_monitor },
     { "serial", 1, QEMU_OPTION_serial },
     { "parallel", 1, QEMU_OPTION_parallel },
@@ -3345,6 +3348,9 @@
             case QEMU_OPTION_std_vga:
                 cirrus_vga_enabled = 0;
                 break;
+            case QEMU_OPTION_use_gtk:
+                use_gtk = 1;
+                break;
             case QEMU_OPTION_g:
                 {
                     const char *p;
@@ -3599,7 +3605,17 @@
     if (nographic) {
         dumb_display_init(ds);
     } else {
+#if defined(CONFIG_GTK)
 #if defined(CONFIG_SDL)
+	/* so we can choose */
+	if (use_gtk)
+        gtk2_display_init(ds, full_screen);
+	else
+        sdl_display_init(ds, full_screen);
+#else
+        gtk2_display_init(ds, full_screen);
+#endif
+#elif defined(CONFIG_SDL)
         sdl_display_init(ds, full_screen);
 #elif defined(CONFIG_COCOA)
         cocoa_display_init(ds, full_screen);
diff -u qemu.orig/Makefile.target qemu/Makefile.target
--- qemu.orig/Makefile.target	Mon May 30 19:42:28 2005
+++ qemu/Makefile.target	Mon May 30 19:57:26 2005
@@ -357,6 +357,10 @@
 ifdef CONFIG_SDL
 VL_OBJS+=sdl.o
 endif
+ifdef CONFIG_GTK
+VL_OBJS+=gtk2.o
+VL_OBJS+=fullscreen.o
+endif
 ifdef CONFIG_COCOA
 VL_OBJS+=cocoa.o
 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa
@@ -392,13 +396,19 @@
 endif
 
 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
-	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(VL_LIBS)
+	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_LIBS) $(GTK_LIBS) $(FS_LIBS) $(VL_LIBS)
 
 cocoa.o: cocoa.m
 	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
 
 sdl.o: sdl.c keymaps.c sdl_keysym.h
 	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
+
+gtk2.o: gtk2.c keymaps.c gdk_keysym.h fullscreen.h
+	$(CC) $(CFLAGS) $(DEFINES) $(GTK_CFLAGS) -c -o $@ $<
+
+fullscreen.o: $(FSDRV) fullscreen.h
+	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
 
 sdlaudio.o: sdlaudio.c
 	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
diff -u qemu.orig/configure qemu/configure
--- qemu.orig/configure	Mon May 30 19:40:14 2005
+++ qemu/configure	Mon May 30 20:10:11 2005
@@ -15,6 +15,7 @@
 TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
 TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
 TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
+TMPF="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}-conf"
 
 # default parameters
 prefix=""
@@ -171,6 +172,10 @@
   ;;
   --disable-sdl) sdl="no"
   ;;
+  --enable-gtk) gtk="yes"
+  ;;
+  --set-fs-driver=*) fsdrv=`echo $opt | cut -d '=' -f 2`
+  ;;
   --enable-fmod) fmod="yes"
   ;;
   --fmod-lib=*) fmod_lib=${opt#--fmod-lib=}
@@ -311,6 +316,62 @@
 fi # cross compilation
 fi # -z $sdl
 
+##########################################
+# GTK probe
+
+gtk_too_old=no
+
+if test -z "$gtk" ; then
+
+gtk=no
+
+# normal GTK probe
+cat > $TMPC << EOF
+#include <stdlib.h>
+#include <gtk/gtk.h>
+int main(int argc, char **argv) { gtk_init(&argc, &argv); return EXIT_SUCCESS; }
+EOF
+
+if $cc -o $TMPE `pkg-config --cflags --libs gtk+-2.0 2> /dev/null` $TMPC 2> /dev/null ; then
+_gtkversion=`pkg-config --modversion gtk+-2.0 | sed 's/[^0-9]//g'`
+if test "$_sdlversion" -lt 240 ; then
+  gtk_too_old=yes
+else
+  gtk=yes
+
+fi
+
+fi # gtk compile test
+
+fi # -z $gtk
+
+if [ "$gtk" = "yes" ]; then
+
+if [ "$fsdrv" = "" ] ; then
+
+if [ "$bsd" = "yes" -o "$linux" = "yes" ]; then
+  fsdrv=xvid_fs.c
+else
+  fsdrv=null_fs.c
+fi
+
+fi # fsdrv test
+
+if [ "$fsdrv" = "xvid_fs.c" -o "$fsdrv" = "null_fs.c" ]; then
+  echo "fsdrv=$fsdrv" >> $TMPF
+else
+  echo "Warning: unknown gtk fullscreen driver: $fsdrv - using null driver"
+  echo 'fsdrv=null_fs.c' >> $TMPF
+  fsdrv=null_fs.c
+fi
+
+if [ "$fsdrv" = "xvid_fs.c" ]; then
+  FS_LIBS="-lX11 -lXxf86vm -lXext -L/usr/X11R6/lib"
+  echo 'FS_LIBS="-lX11 -lXxf86vm -lXext -L/usr/X11R6/lib"' >> $TMPF
+fi
+
+fi # gtk=yes test
+
 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
 cat << EOF
 
@@ -434,6 +495,8 @@
 if test "$sdl" != "no" ; then
     echo "SDL static link   $sdl_static"
 fi
+echo "GTK support       $gtk"
+echo "GTK FS driver     $fsdrv"
 echo "mingw32 support   $mingw32"
 echo "Adlib support     $adlib"
 echo -n "FMOD support      $fmod"
@@ -643,6 +706,8 @@
 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
 
+. $TMPF
+
 if test "$target_cpu" = "i386" ; then
   echo "TARGET_ARCH=i386" >> $config_mak
   echo "#define TARGET_ARCH \"i386\"" >> $config_h
@@ -720,6 +785,17 @@
     fi
 fi
 
+if test "$gtk" = "yes" ; then
+    . $TMPF
+    echo "#define CONFIG_GTK 1" >> $config_h
+    echo "CONFIG_GTK=yes" >> $config_mak
+    echo "GTK_LIBS=`pkg-config --libs gtk+-2.0`" >> $config_mak
+    echo "GTK_CFLAGS=`pkg-config --cflags gtk+-2.0`" >> $config_mak
+    echo "FSDRV=$fsdrv" >> $config_mak
+    echo "FS_LIBS=$FS_LIBS" >> $config_mak
+    echo "" >> $config_mak
+fi
+
 if test "$cocoa" = "yes" ; then
     echo "#define CONFIG_COCOA 1" >> $config_h
     echo "CONFIG_COCOA=yes" >> $config_mak
@@ -739,4 +815,4 @@
     done
 fi
 
-rm -f $TMPO $TMPC $TMPE $TMPS
+rm -f $TMPO $TMPC $TMPE $TMPS $TMPF
diff -u qemu.orig/vl.h qemu/vl.h
--- qemu.orig/vl.h	Mon May 30 19:40:14 2005
+++ qemu/vl.h	Sat May 28 16:16:18 2005
@@ -579,6 +579,9 @@
 /* sdl.c */
 void sdl_display_init(DisplayState *ds, int full_screen);
 
+/* gtk2.c */
+void gtk2_display_init(DisplayState *ds, int full_screen);
+
 /* cocoa.m */
 void cocoa_display_init(DisplayState *ds, int full_screen);
 

  parent reply	other threads:[~2005-06-28  1:08 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-27 21:19 [Qemu-devel] quick gtk2.c update Christian Bourque
2005-06-27 21:37 ` Brad Campbell
2005-06-28  1:04 ` Jim C. Brown [this message]
     [not found]   ` <a6ee49d305062720121d6fcc4e@mail.gmail.com>
     [not found]     ` <a6ee49d30506272028f772930@mail.gmail.com>
     [not found]       ` <20050628033526.GA23166@jbrown.mylinuxbox.org>
     [not found]         ` <a6ee49d3050628075662b7ec4c@mail.gmail.com>
2005-06-28 18:46           ` Jim C. Brown
  -- strict thread matches above, loose matches on Subject: below --
2005-06-19 19:09 Jim C. Brown
2005-06-19 22:25 ` Sebastien Bechet
2005-06-20  0:01   ` Jim C. Brown
2005-06-19 22:57 ` jeebs
2005-06-19 23:53   ` Jim C. Brown
     [not found]     ` <002c01c57535$60064fb0$334d21d1@organiza3bfb0e>
2005-06-20  1:59       ` Jim C. Brown
2005-06-21  2:27         ` jeebs
2005-06-21  2:39           ` Jim C. Brown
2005-06-21  2:58             ` jeebs
2005-06-21  4:28               ` Jim C. Brown
2005-06-21 10:45                 ` Jernej Simončič
2005-06-21 16:27                 ` jeebs
2005-06-21 17:20                   ` Jernej Simončič
2005-06-21 19:40                     ` jeebs
2005-06-21 20:22                       ` Jernej Simončič
2005-06-21 21:19                         ` jeebs
2005-06-21 22:24                           ` Jim C. Brown
2005-06-21 22:45                             ` jeebs
2005-06-21 23:58                               ` Jim C. Brown
2005-06-22  4:14                                 ` jeebs
2005-06-22  5:15                                   ` Damien Mascord
2005-06-22  9:31                                   ` Jernej Simončič
2005-06-22 12:31                                   ` Jim C. Brown
2005-06-22  9:16                                 ` Jernej Simončič
2005-06-22 13:17                                 ` Jim C. Brown
2005-06-22 18:36                                   ` Jim C. Brown
2005-06-22 18:53                                   ` Jim C. Brown
2005-06-22 20:59                                     ` Jim C. Brown
2005-06-23  2:26                                       ` jeebs
2005-06-24  0:32                                         ` Jim C. Brown
2005-06-26 16:13                                           ` Jim C. Brown
2005-06-27 17:11                                             ` jeebs
2005-06-27 18:15                                               ` Jim C. Brown
2005-06-22 13:22                                 ` Jim C. Brown
2005-06-22  3:53                               ` Herbert Poetzl
2005-06-22 12:41                                 ` Jim C. Brown
2005-06-21 21:52                       ` Jim C. Brown
2005-06-21 19:45                   ` Jim C. Brown
2005-06-21 10:42               ` Jernej Simončič
2005-06-21 12:36                 ` Jim C. Brown
2005-06-21 16:30                 ` jeebs
2005-06-21 17:25                   ` Jernej Simončič
2005-06-21 10:39           ` Jernej Simončič
2005-06-21 10:32         ` Jernej Simončič

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050628010419.GA21906@jbrown.mylinuxbox.org \
    --to=jma5@umd.edu \
    --cc=christian.bourque@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).