Skip to contentSkip to conversation

quick gtk2.c update

Qemu-devel Christian Bourque 3 participants 4 messages Jun 27, 2005 – Jun 28, 2005 4 messages not in the archive Kbuild

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 4 lines · Christian Bourque

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...

I had huge rejects in Makefile.target, configure and vl.h. I merged them by hand and used the latest gtk2.c and xid_fs.c files I could find on the list.. It works great here on linux anyway. Good job Jim!

Regards,
Brad

Signature · 3 lines
"Human beings, who are almost unique in having the ability
to learn from the experience of others, are also remarkable
for their apparent disinclination to do so." -- Douglas Adams
#2 lore raw
In reply to Christian Bourque
Quoted 9 lines · Christian Bourque

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.

Signature · 2 lines
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.
vl.c +16 -0
diff -u qemu.orig/vl.c qemu/vl.c
@@ -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);
Makefile.target +11 -1
diff -u qemu.orig/Makefile.target qemu/Makefile.target
@@ -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 $@ $<
configure +77 -1

117 lines not on this page · raw message

vl.h +3 -0
diff -u qemu.orig/vl.h qemu/vl.h
@@ -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);
 

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 5 lines · Christian Bourque

Excellent!

What are your plans regarding QEMU in long term? Do you still want to integrate a built-in GUI?

Quoted 9 lines

I'm asking because I'm the author of JQEMU and I was wondering if I should continue improving the product... I would like to do something similar to the HWND patch but for X11 to fully integrate QEMU inside JQEMU, but I don't know anything about C/X11 programming...

Regards

Christian

According to Fabrice, the main reason for using GTK for the graphics rendering is to allow the creation of a GUI using GTK. That is the only good thing GTK has going for it. (In fact, getting GTK to do the stuff that the SDL layer does on its own was a real pain. The layer is mostly GDK, and even the "low level drawing toolkit" didn't have enough support for what qemu needs.)

I have never designed a GUI before (other than toy ones for my own use) and I have no plans to write my own GUI (because I wouldn't do a very good job). If someone else has a GUI that they want to integrate with this, or if someone out there wants to write one on top of my GTK patch, that person will have my full support as well as any help I can provide.

Signature · 2 lines
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.