qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [Patch] Experimental Cocoa Video Driver
@ 2005-02-27  0:04 Pierre d'Herbemont
  2005-03-02  0:03 ` David Still
  0 siblings, 1 reply; 27+ messages in thread
From: Pierre d'Herbemont @ 2005-02-27  0:04 UTC (permalink / raw)
  To: qemu mailing list; +Cc: QemuX

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

Hi!

Here is a early draft of a cocoa video driver for qemu, strongly based 
on libsdl. I don't know if I'll have time to finish it, so I am sending 
it to the qemu-devel.

I think it might be interesting for QemuX (or other Mac OS X frontend): 
the patch shows that the GUI can be run within Qemu process, that means 
that you can use qemu functions, think vm_stop or vm_start, directly 
from the GUI. Moreover it means also only one icon in the dock and one 
menu bar for Qemu,

To enable the cocoa driver, just use the --enable-cocoa option in 
configure. The driver is still not completed as it should, no full 
screen mode, no mouse event, and partial keyboard event, but that 
shouldn't be to difficult to add though.

Pierre.



[-- Attachment #2: cocoa_drv.diff.txt --]
[-- Type: text/plain, Size: 20737 bytes --]

? .DS_Store
? .gdb_history
? cocoa.m
? linux-test
Index: Makefile.target
===================================================================
RCS file: /cvsroot/qemu/qemu/Makefile.target,v
retrieving revision 1.58
diff -u -r1.58 Makefile.target
--- Makefile.target	22 Feb 2005 19:27:14 -0000	1.58
+++ Makefile.target	27 Feb 2005 00:00:35 -0000
@@ -346,6 +346,10 @@
 ifdef CONFIG_SDL
 VL_OBJS+=sdl.o
 endif
+ifdef CONFIG_COCOA
+VL_OBJS+=cocoa.o
+COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa
+endif
 ifdef CONFIG_SLIRP
 DEFINES+=-I$(SRC_PATH)/slirp
 SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \
@@ -373,7 +377,10 @@
 endif
 
 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
-	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VL_LIBS)
+	$(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(COCOA_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 $@ $<
Index: configure
===================================================================
RCS file: /cvsroot/qemu/qemu/configure,v
retrieving revision 1.56
diff -u -r1.56 configure
--- configure	19 Feb 2005 17:24:28 -0000	1.56
+++ configure	27 Feb 2005 00:00:35 -0000
@@ -83,6 +83,7 @@
 linux="no"
 kqemu="no"
 kernel_path=""
+cocoa="no"
 
 # OS specific
 targetos=`uname -s`
@@ -178,6 +179,8 @@
   ;; 
   --kernel-path=*) kernel_path=${opt#--kernel-path=}
   ;; 
+  --enable-cocoa) cocoa="yes" ; sdl="no"
+  ;; 
   esac
 done
 
@@ -403,6 +406,7 @@
 echo "target list       $target_list"
 echo "gprof enabled     $gprof"
 echo "static build      $static"
+echo "Cocoa support     $cocoa"
 echo "SDL support       $sdl"
 echo "SDL static link   $sdl_static"
 echo "mingw32 support   $mingw32"
@@ -676,6 +680,11 @@
     fi
 fi
 
+if test "$cocoa" = "yes" ; then
+    echo "#define CONFIG_COCOA 1" >> $config_h
+    echo "CONFIG_COCOA=yes" >> $config_mak
+fi
+
 done # for target in $targets
 
 # build tree in object directory if source path is different from current one
Index: vl.c
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.c,v
retrieving revision 1.120
diff -u -r1.120 vl.c
--- vl.c	10 Feb 2005 22:00:06 -0000	1.120
+++ vl.c	27 Feb 2005 00:00:38 -0000
@@ -72,6 +72,13 @@
 #endif
 #endif /* CONFIG_SDL */
 
+#ifdef CONFIG_COCOA
+#ifdef main
+# undef main
+#endif
+#define main qemu_main
+#endif /* CONFIG_COCOA */
+
 #include "disas.h"
 
 #include "exec-all.h"
@@ -3550,8 +3557,10 @@
     if (nographic) {
         dumb_display_init(ds);
     } else {
-#ifdef CONFIG_SDL
+#if defined(CONFIG_SDL)
         sdl_display_init(ds, full_screen);
+#elif defined(CONFIG_COCOA)
+        cocoa_display_init(ds, full_screen);
 #else
         dumb_display_init(ds);
 #endif
--- /dev/null	Sun Feb 27 01:00:49 2005
+++ cocoa.m	Sun Feb 27 00:44:35 2005
@@ -0,0 +1,607 @@
+/*
+ * QEMU Cocoa display driver
+ * 
+ * Copyright (c) 2005 Pierre d'Herbemont
+ *                    many code/inspiration from SDL 1.2 code (LGPL)
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+/*
+    Todo :    x  miniaturize window 
+              x  center the window
+              -  save window position
+              -  handle keyboard event
+              -  handle mouse event
+              -  non 32 bpp support
+              -  full screen
+              -  mouse focus
+              x  simple graphical prompt to demo
+              -  better graphical prompt
+*/
+#include "vl.h"
+#import <Cocoa/Cocoa.h>
+
+NSWindow *window = NULL;
+NSQuickDrawView *qd_view = NULL;
+
+
+int gArgc;
+char **gArgv;
+DisplayState current_ds;
+
+/* main defined in qemu/vl.c */
+int qemu_main(int argc, char **argv);
+
+/* To deal with miniaturization */
+@interface QemuWindow : NSWindow
+{ }
+@end
+
+
+/*
+ ------------------------------------------------------
+    Qemu Video Driver
+ ------------------------------------------------------
+*/
+
+/*
+ ------------------------------------------------------
+    cocoa_update
+ ------------------------------------------------------
+*/
+static void cocoa_update(DisplayState *ds, int x, int y, int w, int h)
+{
+    //printf("updating x=%d y=%d w=%d h=%d\n", x, y, w, h);
+
+    /* Use QDFlushPortBuffer() to flush content to display */
+    RgnHandle dirty = NewRgn ();
+    RgnHandle temp  = NewRgn ();
+
+    SetEmptyRgn (dirty);
+
+    /* Build the region of dirty rectangles */
+    MacSetRectRgn (temp, x, y,
+                        x + w, y + h);
+    MacUnionRgn (dirty, temp, dirty);
+                
+    /* Flush the dirty region */
+    QDFlushPortBuffer ( [ qd_view  qdPort ], dirty );
+    DisposeRgn (dirty);
+    DisposeRgn (temp);
+}
+
+/*
+ ------------------------------------------------------
+    cocoa_resize
+ ------------------------------------------------------
+*/
+static void cocoa_resize(DisplayState *ds, int w, int h)
+{
+    const int device_bpp = 32;
+    static void *screen_pixels;
+    static int  screen_pitch;
+    NSRect contentRect;
+    
+    //printf("resizing to %d %d\n", w, h);
+    
+    contentRect = NSMakeRect (0, 0, w, h);
+    if(window)
+    {
+        [window close];
+        [window release];
+    }
+    window = [ [ QemuWindow alloc ] initWithContentRect:contentRect
+                                  styleMask:NSTitledWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask
+                                  backing:NSBackingStoreBuffered defer:NO];
+    if(!window)
+    {
+        fprintf(stderr, "(cocoa) can't create window\n");
+        exit(1);
+    }
+    
+    if(qd_view)
+        [qd_view release];
+    
+    qd_view = [ [ NSQuickDrawView alloc ] initWithFrame:contentRect ];
+    
+    if(!qd_view)
+    {
+         fprintf(stderr, "(cocoa) can't create qd_view\n");
+        exit(1);
+    }
+    
+    [ window setAcceptsMouseMovedEvents:YES ];
+    [ window setTitle:@"Qemu" ];
+    [ window setReleasedWhenClosed:NO ];
+    
+    /* Set screen to black */
+    [ window setBackgroundColor: [NSColor blackColor] ];
+    
+    /* set window position */
+    [ window center ];
+    
+    [ qd_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable ];
+    [ [ window contentView ] addSubview:qd_view ];
+    [ qd_view release ];
+    [ window makeKeyAndOrderFront:nil ];
+    
+    /* Careful here, the window seems to have to be onscreen to do that */
+    LockPortBits ( [ qd_view qdPort ] );
+    screen_pixels = GetPixBaseAddr ( GetPortPixMap ( [ qd_view qdPort ] ) );
+    screen_pitch  = GetPixRowBytes ( GetPortPixMap ( [ qd_view qdPort ] ) );
+    UnlockPortBits ( [ qd_view qdPort ] );
+    { 
+            int vOffset = [ window frame ].size.height - 
+                [ qd_view frame ].size.height - [ qd_view frame ].origin.y;
+            
+            int hOffset = [ qd_view frame ].origin.x;
+                    
+            screen_pixels += (vOffset * screen_pitch) + hOffset * (device_bpp/8);
+    }
+    ds->data = screen_pixels;
+    ds->linesize = screen_pitch;
+    ds->depth = device_bpp;
+    ds->width = w;
+    ds->height = h;
+    
+    current_ds = *ds;
+}
+
+/*
+ ------------------------------------------------------
+    keymap conversion
+ ------------------------------------------------------
+*/
+
+static int keymap[] =
+{
+    30, //'a' 0x0
+    31,  //'s'
+    32,  //'d'
+    33,  //'f'
+    35,  //'h'
+    34,  //'g'
+    44,  //'z'
+    45,  //'x'
+    46,  //'c'
+    47,  //'v'
+    0,   // 0  0x0a
+    48,  //'b'
+    16,  //'q'
+    17,  //'w'
+    18,  //'e'
+    19,  //'r' 
+    21,  //'y' 0x10
+    20,  //'t'
+    2,  //'1'
+    3,  //'2'
+    4,  //'3'
+    5,  //'4'
+    7,  //'6'
+    6,  //'5'
+    0,  //'='
+    10,  //'9'
+    8,  //'7' 0x1A
+    0,  //'-' 
+    9,  //'8' 
+    11,  //'0' 
+    27,  //']' 
+    24,  //'o' 
+    22,  //'u' 0x20
+    26,  //'['
+    23,  //'i'
+    25,  //'p'
+    28,  //'\n'
+    38,  //'l'
+    36,  //'j'
+    40,  //'"'
+    37,  //'k'
+    39,  //';'
+    15,  //'\t' 0x30
+    0,  //' '
+    0,  //'`'
+    14,  //'<backspace>'
+    0,  //'' 0x34
+    0,  //'<esc>'
+    0,  //'<esc>'
+    /* Not completed to finish see http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/video/quartz/SDL_QuartzKeys.h?rev=1.6&content-type=text/x-cvsweb-markup */
+};
+
+static int cocoa_keycode_to_qemu(int keycode)
+{
+    if(sizeof(keymap) <= keycode)
+    {
+        printf("(cocoa) warning unknow keycode 0x%x\n", keycode);
+        return 0;
+    }
+    return keymap[keycode];
+}
+
+/*
+ ------------------------------------------------------
+    cocoa_refresh
+ ------------------------------------------------------
+*/
+static void cocoa_refresh(DisplayState *ds)
+{
+    //printf("cocoa_refresh \n");
+    NSDate *distantPast;
+    NSEvent *event;
+    NSAutoreleasePool *pool;
+    int grab = 1;
+    
+    pool = [ [ NSAutoreleasePool alloc ] init ];
+    distantPast = [ NSDate distantPast ];
+    
+    if (is_active_console(vga_console)) 
+        vga_update_display();
+    do {
+        event = [ NSApp nextEventMatchingMask:NSAnyEventMask untilDate:distantPast
+                        inMode: NSDefaultRunLoopMode dequeue:YES ];
+        if (event != nil) {
+            switch ([event type]) {
+                case NSKeyDown:
+                    if(grab)
+                    {
+                        int keycode = cocoa_keycode_to_qemu([event keyCode]);
+                        
+                        if (keycode & 0x80)
+                            kbd_put_keycode(0xe0);
+                        kbd_put_keycode(keycode & 0x7f);
+                    }
+                    break;
+                case NSKeyUp:
+                    if(grab)
+                    {
+                        int keycode = cocoa_keycode_to_qemu([event keyCode]);
+
+                        if (keycode & 0x80)
+                            kbd_put_keycode(0xe0);
+                        kbd_put_keycode(keycode | 0x80);
+                    }
+                    break;
+                case NSScrollWheel:
+                
+                case NSLeftMouseDown:
+                case NSLeftMouseUp:
+                
+                case NSOtherMouseDown:
+                case NSRightMouseDown:
+                
+                case NSOtherMouseUp:
+                case NSRightMouseUp:
+                
+                case NSMouseMoved:
+                case NSOtherMouseDragged:
+                case NSRightMouseDragged:
+                case NSLeftMouseDragged:
+                
+                default: [NSApp sendEvent:event];
+            }
+        }
+    } while(event != nil);
+}
+
+/*
+ ------------------------------------------------------
+    cocoa_cleanup
+ ------------------------------------------------------
+*/
+
+static void cocoa_cleanup(void) 
+{
+
+}
+
+/*
+ ------------------------------------------------------
+    cocoa_display_init
+ ------------------------------------------------------
+*/
+
+void cocoa_display_init(DisplayState *ds, int full_screen)
+{
+    ds->dpy_update = cocoa_update;
+    ds->dpy_resize = cocoa_resize;
+    ds->dpy_refresh = cocoa_refresh;
+    
+    cocoa_resize(ds, 640, 400);
+    
+    atexit(cocoa_cleanup);
+}
+
+/*
+ ------------------------------------------------------
+    Interface with Cocoa
+ ------------------------------------------------------
+*/
+
+
+/*
+ ------------------------------------------------------
+    QemuWindow
+    Some trick from SDL to use miniwindow
+ ------------------------------------------------------
+*/
+static void QZ_SetPortAlphaOpaque ()
+{    
+    /* Assume 32 bit if( bpp == 32 )*/
+    if ( 1 ) {
+    
+        uint32_t    *pixels = (uint32_t*) current_ds.data;
+        uint32_t    rowPixels = current_ds.linesize / 4;
+        uint32_t    i, j;
+        
+        for (i = 0; i < current_ds.height; i++)
+            for (j = 0; j < current_ds.width; j++) {
+        
+                pixels[ (i * rowPixels) + j ] |= 0xFF000000;
+            }
+    }
+}
+
+@implementation QemuWindow
+- (void)miniaturize:(id)sender
+{
+        
+    /* make the alpha channel opaque so anim won't have holes in it */
+    QZ_SetPortAlphaOpaque ();
+    
+    [ super miniaturize:sender ];
+    
+}
+- (void)display
+{    
+    /* 
+        This method fires just before the window deminaturizes from the Dock.
+        
+        We'll save the current visible surface, let the window manager redraw any
+        UI elements, and restore the SDL surface. This way, no expose event 
+        is required, and the deminiaturize works perfectly.
+    */
+    
+    /* make sure pixels are fully opaque */
+    QZ_SetPortAlphaOpaque ();
+    
+    /* save current visible SDL surface */
+    [ self cacheImageInRect:[ qd_view frame ] ];
+    
+    /* let the window manager redraw controls, border, etc */
+    [ super display ];
+    
+    /* restore visible SDL surface */
+    [ self restoreCachedImage ];
+}
+
+@end
+
+
+/*
+ ------------------------------------------------------
+    QemuCocoaGUIController
+    NSApp's delegate - indeed main object
+ ------------------------------------------------------
+*/
+
+@interface QemuCocoaGUIController : NSObject
+{
+}
+- (void)applicationDidFinishLaunching: (NSNotification *) note;
+- (void)applicationWillTerminate:(NSNotification *)aNotification;
+
+- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
+
+- (void)startEmulationWithArgc:(int)argc argv:(char**)argv;
+@end
+
+@implementation QemuCocoaGUIController
+/* Called when the internal event loop has just started running */
+- (void)applicationDidFinishLaunching: (NSNotification *) note
+{
+    
+    /* Do whatever we want here : set up a pc list... */
+    {
+        NSOpenPanel *op = [[NSOpenPanel alloc] init];
+        
+        cocoa_resize(&current_ds, 640, 400);
+        
+        [op setPrompt:@"Boot image"];
+        
+        [op setMessage:@"Select the disk image you want to boot.\n\nHit the \"Cancel\" button to quit"];
+        
+        [op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",nil]
+              modalForWindow:window modalDelegate:self
+              didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
+    }
+    
+    /* or Launch Qemu, with the global args */
+    //[self startEmulationWithArgc:gArgc argv:gArgv];
+}
+
+- (void)applicationWillTerminate:(NSNotification *)aNotification
+{
+    printf("Application will terminate\n");
+    qemu_system_shutdown_request();
+    /* In order to avoid a crash */
+    exit(0);
+}
+
+- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
+{
+    if(returnCode == NSCancelButton)
+    {
+        exit(0);
+    }
+    
+    if(returnCode == NSOKButton)
+    {
+        char *bin = "qemu";
+        char *img = (char*)[ [ sheet filename ] cString];
+        
+        char **argv = (char**)malloc( sizeof(char*)*3 );
+        
+        asprintf(&argv[0], "%s", bin);
+        asprintf(&argv[1], "-hda");
+        asprintf(&argv[2], "%s", img);
+        
+        printf("Using argc %d argv %s -hda %s\n", 3, bin, img);
+        
+        [self startEmulationWithArgc:3 argv:(char**)argv];
+    }
+}
+
+- (void)startEmulationWithArgc:(int)argc argv:(char**)argv
+{
+    int status;
+    /* Launch Qemu */
+    printf("starting qemu...\n");
+    status = qemu_main (argc, argv);
+    exit(status);
+}
+@end
+
+/*
+ ------------------------------------------------------
+    Application Creation
+ ------------------------------------------------------
+*/
+
+/* Dock Connection */
+typedef struct CPSProcessSerNum
+{
+        UInt32                lo;
+        UInt32                hi;
+} CPSProcessSerNum;
+
+extern OSErr    CPSGetCurrentProcess( CPSProcessSerNum *psn);
+extern OSErr    CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
+extern OSErr    CPSSetFrontProcess( CPSProcessSerNum *psn);
+
+/* Menu Creation */
+static void setApplicationMenu(void)
+{
+    /* warning: this code is very odd */
+    NSMenu *appleMenu;
+    NSMenuItem *menuItem;
+    NSString *title;
+    NSString *appName;
+    
+    appName = @"Qemu";
+    appleMenu = [[NSMenu alloc] initWithTitle:@""];
+    
+    /* Add menu items */
+    title = [@"About " stringByAppendingString:appName];
+    [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
+
+    [appleMenu addItem:[NSMenuItem separatorItem]];
+
+    title = [@"Hide " stringByAppendingString:appName];
+    [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
+
+    menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
+    [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
+
+    [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
+
+    [appleMenu addItem:[NSMenuItem separatorItem]];
+
+    title = [@"Quit " stringByAppendingString:appName];
+    [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
+
+    
+    /* Put menu into the menubar */
+    menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
+    [menuItem setSubmenu:appleMenu];
+    [[NSApp mainMenu] addItem:menuItem];
+
+    /* Tell the application object that this is now the application menu */
+    [NSApp setAppleMenu:appleMenu];
+
+    /* Finally give up our references to the objects */
+    [appleMenu release];
+    [menuItem release];
+}
+
+/* Create a window menu */
+static void setupWindowMenu(void)
+{
+    NSMenu      *windowMenu;
+    NSMenuItem  *windowMenuItem;
+    NSMenuItem  *menuItem;
+
+    windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
+    
+    /* "Minimize" item */
+    menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
+    [windowMenu addItem:menuItem];
+    [menuItem release];
+    
+    /* Put menu into the menubar */
+    windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
+    [windowMenuItem setSubmenu:windowMenu];
+    [[NSApp mainMenu] addItem:windowMenuItem];
+    
+    /* Tell the application object that this is now the window menu */
+    [NSApp setWindowsMenu:windowMenu];
+
+    /* Finally give up our references to the objects */
+    [windowMenu release];
+    [windowMenuItem release];
+ 
+}
+
+static void CustomApplicationMain (argc, argv)
+{
+    NSAutoreleasePool   *pool = [[NSAutoreleasePool alloc] init];
+    QemuCocoaGUIController *gui_controller;
+    CPSProcessSerNum PSN;
+    
+    [NSApplication sharedApplication];
+    
+    if (!CPSGetCurrentProcess(&PSN))
+        if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
+            if (!CPSSetFrontProcess(&PSN))
+                [NSApplication sharedApplication];
+                
+    /* Set up the menubar */
+    [NSApp setMainMenu:[[NSMenu alloc] init]];
+    setApplicationMenu();
+    setupWindowMenu();
+
+    /* Create SDLMain and make it the app delegate */
+    gui_controller = [[QemuCocoaGUIController alloc] init];
+    [NSApp setDelegate:gui_controller];
+    
+    /* Start the main event loop */
+    [NSApp run];
+    
+    [gui_controller release];
+    [pool release];
+}
+
+/* Real main of qemu-cocoa */
+int main(int argc, char **argv)
+{
+    gArgc = argc;
+    gArgv = argv;
+    
+    CustomApplicationMain (argc, argv);
+    
+    return 0;
+}

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [Patch] Experimental Cocoa Video Driver
  2005-02-27  0:04 Pierre d'Herbemont
@ 2005-03-02  0:03 ` David Still
  2005-03-02 19:48   ` Pierre d'Herbemont
  0 siblings, 1 reply; 27+ messages in thread
From: David Still @ 2005-03-02  0:03 UTC (permalink / raw)
  To: qemu-devel

I'm having trouble compiling QEMU with the cocoa video driver on my  
iBook.  I'm running OS X 10.3.8 on a 700MHz iBook G3 w/ 640Mb or RAM  
and XTools 1.5.  After running "./configure --prefix=/sw  
--enable-cocoa", compilation runs smoothly until here:

gcc -Wall -O2 -g -fno-strict-aliasing -D__powerpc__ -I.  
-I/Users/stealthdave/Source/qemu/qemu/target-ppc  
-I/Users/stealthdave/Source/qemu/qemu -D_GNU_SOURCE  
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE  
-I/Users/stealthdave/Source/qemu/qemu/slirp -c -o cocoa.o  
/Users/stealthdave/Source/qemu/qemu/cocoa.m
In file included from  
/System/Library/Frameworks/CoreServices.framework/Frameworks/ 
CarbonCore.framework/Headers/DriverServices.h:32,
                  from  
/System/Library/Frameworks/CoreServices.framework/Frameworks/ 
CarbonCore.framework/Headers/CarbonCore.h:129,
                  from  
/System/Library/Frameworks/CoreServices.framework/Headers/ 
CoreServices.h:21,
                  from  
/System/Library/Frameworks/ApplicationServices.framework/Headers/ 
ApplicationServices.h:20,
                  from  
/System/Library/Frameworks/Foundation.framework/Headers/ 
NSAppleEventDescriptor.h:8,
                  from  
/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h: 
85,
                  from  
/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,
                  from /Users/stealthdave/Source/qemu/qemu/cocoa.m:38:
/System/Library/Frameworks/CoreServices.framework/Frameworks/ 
CarbonCore.framework/Headers/MachineExceptions.h:45: error: parse error  
before numeric constant
/System/Library/Frameworks/CoreServices.framework/Frameworks/ 
CarbonCore.framework/Headers/MachineExceptions.h:46: error: parse error  
before numeric constant
/System/Library/Frameworks/CoreServices.framework/Frameworks/ 
CarbonCore.framework/Headers/MachineExceptions.h:49: error: parse error  
before numeric constant
/System/Library/Frameworks/CoreServices.framework/Frameworks/ 
CarbonCore.framework/Headers/MachineExceptions.h:51: error: parse error  
before numeric constant
/System/Library/Frameworks/CoreServices.framework/Frameworks/ 
CarbonCore.framework/Headers/MachineExceptions.h:53: error: parse error  
before numeric constant
/System/Library/Frameworks/CoreServices.framework/Frameworks/ 
CarbonCore.framework/Headers/MachineExceptions.h:54: error: parse error  
before numeric constant
/System/Library/Frameworks/CoreServices.framework/Frameworks/ 
CarbonCore.framework/Headers/MachineExceptions.h:56: error: parse error  
before '}' token
make[1]: *** [cocoa.o] Error 1
make: *** [all] Error 1

Am I missing a library or something?

- Dave

On Feb 26, 2005, at 4:04 PM, Pierre d'Herbemont wrote:

> Hi!
>
> Here is a early draft of a cocoa video driver for qemu, strongly based  
> on libsdl. I don't know if I'll have time to finish it, so I am  
> sending it to the qemu-devel.
>
> I think it might be interesting for QemuX (or other Mac OS X  
> frontend): the patch shows that the GUI can be run within Qemu  
> process, that means that you can use qemu functions, think vm_stop or  
> vm_start, directly from the GUI. Moreover it means also only one icon  
> in the dock and one menu bar for Qemu,
>
> To enable the cocoa driver, just use the --enable-cocoa option in  
> configure. The driver is still not completed as it should, no full  
> screen mode, no mouse event, and partial keyboard event, but that  
> shouldn't be to difficult to add though.
>
> Pierre.
>
>
> <cocoa_drv.diff.txt>_______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [Patch] Experimental Cocoa Video Driver
  2005-03-02  0:03 ` David Still
@ 2005-03-02 19:48   ` Pierre d'Herbemont
  0 siblings, 0 replies; 27+ messages in thread
From: Pierre d'Herbemont @ 2005-03-02 19:48 UTC (permalink / raw)
  To: qemu-devel

David,

I checked out qemu's cvs from scratch, and compilation went fine....  
for i386-softmmu. So try ./configure --prefix=/sw --enable-cocoa  
--target-list=i386-softmmu.

I'll try to send a quick fix for that.

Pierre.


On 2 mars 05, at 01:03, David Still wrote:

> I'm having trouble compiling QEMU with the cocoa video driver on my  
> iBook.  I'm running OS X 10.3.8 on a 700MHz iBook G3 w/ 640Mb or RAM  
> and XTools 1.5.  After running "./configure --prefix=/sw  
> --enable-cocoa", compilation runs smoothly until here:
>
> gcc -Wall -O2 -g -fno-strict-aliasing -D__powerpc__ -I.  
> -I/Users/stealthdave/Source/qemu/qemu/target-ppc  
> -I/Users/stealthdave/Source/qemu/qemu -D_GNU_SOURCE  
> -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE  
> -I/Users/stealthdave/Source/qemu/qemu/slirp -c -o cocoa.o  
> /Users/stealthdave/Source/qemu/qemu/cocoa.m
> In file included from  
> /System/Library/Frameworks/CoreServices.framework/Frameworks/ 
> CarbonCore.framework/Headers/DriverServices.h:32,
>                  from  
> /System/Library/Frameworks/CoreServices.framework/Frameworks/ 
> CarbonCore.framework/Headers/CarbonCore.h:129,
>                  from  
> /System/Library/Frameworks/CoreServices.framework/Headers/ 
> CoreServices.h:21,
>                  from  
> /System/Library/Frameworks/ApplicationServices.framework/Headers/ 
> ApplicationServices.h:20,
>                  from  
> /System/Library/Frameworks/Foundation.framework/Headers/ 
> NSAppleEventDescriptor.h:8,
>                  from  
> /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h: 
> 85,
>                  from  
> /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,
>                  from /Users/stealthdave/Source/qemu/qemu/cocoa.m:38:
> /System/Library/Frameworks/CoreServices.framework/Frameworks/ 
> CarbonCore.framework/Headers/MachineExceptions.h:45: error: parse  
> error before numeric constant
> /System/Library/Frameworks/CoreServices.framework/Frameworks/ 
> CarbonCore.framework/Headers/MachineExceptions.h:46: error: parse  
> error before numeric constant
> /System/Library/Frameworks/CoreServices.framework/Frameworks/ 
> CarbonCore.framework/Headers/MachineExceptions.h:49: error: parse  
> error before numeric constant
> /System/Library/Frameworks/CoreServices.framework/Frameworks/ 
> CarbonCore.framework/Headers/MachineExceptions.h:51: error: parse  
> error before numeric constant
> /System/Library/Frameworks/CoreServices.framework/Frameworks/ 
> CarbonCore.framework/Headers/MachineExceptions.h:53: error: parse  
> error before numeric constant
> /System/Library/Frameworks/CoreServices.framework/Frameworks/ 
> CarbonCore.framework/Headers/MachineExceptions.h:54: error: parse  
> error before numeric constant
> /System/Library/Frameworks/CoreServices.framework/Frameworks/ 
> CarbonCore.framework/Headers/MachineExceptions.h:56: error: parse  
> error before '}' token
> make[1]: *** [cocoa.o] Error 1
> make: *** [all] Error 1
>
> Am I missing a library or something?
>
> - Dave
>
> On Feb 26, 2005, at 4:04 PM, Pierre d'Herbemont wrote:
>
>> Hi!
>>
>> Here is a early draft of a cocoa video driver for qemu, strongly  
>> based on libsdl. I don't know if I'll have time to finish it, so I am  
>> sending it to the qemu-devel.
>>
>> I think it might be interesting for QemuX (or other Mac OS X  
>> frontend): the patch shows that the GUI can be run within Qemu  
>> process, that means that you can use qemu functions, think vm_stop or  
>> vm_start, directly from the GUI. Moreover it means also only one icon  
>> in the dock and one menu bar for Qemu,
>>
>> To enable the cocoa driver, just use the --enable-cocoa option in  
>> configure. The driver is still not completed as it should, no full  
>> screen mode, no mouse event, and partial keyboard event, but that  
>> shouldn't be to difficult to add though.
>>
>> Pierre.
>>
>>
>> <cocoa_drv.diff.txt>_______________________________________________
>> Qemu-devel mailing list
>> Qemu-devel@nongnu.org
>> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re:   [Qemu-devel] [Patch] Experimental Cocoa Video Driver
  2005-04-06  2:23 Re: [Qemu-devel] Re: Windows 2000 SP4 (was Re: APM bug) Ben Taylor
@ 2005-04-06  4:25 ` Mike Kronenberg
  2005-04-06  4:29   ` Mike Kronenberg
  2005-04-08 17:36   ` Pierre d'Herbemont
  0 siblings, 2 replies; 27+ messages in thread
From: Mike Kronenberg @ 2005-04-06  4:25 UTC (permalink / raw)
  To: qemu-devel

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

Hello

I added most of the key from SDL_QuartzKeys.h to the keymap conversion 
in cocoa.m. (us_en)

Because Modifiers and Mouse still don't work, I did some tests with 
keycode in freedos-beta9rc5.

Have fun

Mike

[-- Attachment #2: cocoa.m.diff --]
[-- Type: text/plain, Size: 5414 bytes --]

176,224c176,298
<     30, //'a' 0x0
<     31,  //'s'
<     32,  //'d'
<     33,  //'f'
<     35,  //'h'
<     34,  //'g'
<     44,  //'z'
<     45,  //'x'
<     46,  //'c'
<     47,  //'v'
<     0,   // 0  0x0a
<     48,  //'b'
<     16,  //'q'
<     17,  //'w'
<     18,  //'e'
<     19,  //'r' 
<     21,  //'y' 0x10
<     20,  //'t'
<     2,  //'1'
<     3,  //'2'
<     4,  //'3'
<     5,  //'4'
<     7,  //'6'
<     6,  //'5'
<     0,  //'='
<     10,  //'9'
<     8,  //'7' 0x1A
<     0,  //'-' 
<     9,  //'8' 
<     11,  //'0' 
<     27,  //']' 
<     24,  //'o' 
<     22,  //'u' 0x20
<     26,  //'['
<     23,  //'i'
<     25,  //'p'
<     28,  //'\n'
<     38,  //'l'
<     36,  //'j'
<     40,  //'"'
<     37,  //'k'
<     39,  //';'
<     15,  //'\t' 0x30
<     0,  //' '
<     0,  //'`'
<     14,  //'<backspace>'
<     0,  //'' 0x34
<     0,  //'<esc>'
<     0,  //'<esc>'
---
>     30,	//	0x00	#define QZ_a	0x1e
>     31,	//	0x01	#define QZ_s	0x1f
>     32,	//	0x02	#define QZ_d	0x20
>     33,	//	0x03	#define QZ_f	0x21
>     35,	//	0x04	#define QZ_h	0x23
>     34,	//	0x05	#define QZ_g	0x22
>     44,	//	0x06	#define QZ_z	0x2c
>     45,	//	0x07	#define QZ_x	0x2d
>     46,	//	0x08	#define QZ_c	0x2e
>     47,	//	0x09	#define QZ_v	0x2f
>     0,	//	0x0A	Undefined	
>     48,	//	0x0B	#define QZ_b	0x30
>     16,	//	0x0C	#define QZ_q	0x10
>     17,	//	0x0D	#define QZ_w	0x11
>     18,	//	0x0E	#define QZ_e	0x12
>     19,	//	0x0F	#define QZ_r	0x13
>     21,	//	0x10	#define QZ_y	0x15
>     20,	//	0x11	#define QZ_t	0x14
>     2,	//	0x12	#define QZ_1	0x2
>     3,	//	0x13	#define QZ_2	0x3
>     4,	//	0x14	#define QZ_3	0x4
>     5,	//	0x15	#define QZ_4	0x5
>     7,	//	0x16	#define QZ_6	0x7
>     6,	//	0x17	#define QZ_5	0x6
>     13,	//	0x18	#define QZ_EQUALS	0xd
>     10,	//	0x19	#define QZ_9	0xa
>     8,	//	0x1A	#define QZ_7	0x8
>     12,	//	0x1B	#define QZ_MINUS	0xc
>     9,	//	0x1C	#define QZ_8	0x9
>     11,	//	0x1D	#define QZ_0	0xb
>     27,	//	0x1E	#define QZ_RIGHTBRACKET	0x1b
>     24,	//	0x1F	#define QZ_o	0x18
>     22,	//	0x20	#define QZ_u	0x16
>     26,	//	0x21	#define QZ_LEFTBRACKET	0x1a
>     23,	//	0x22	#define QZ_i	0x17
>     25,	//	0x23	#define QZ_p	0x19
>     28,	//	0x24	#define QZ_RETURN	0x1c
>     38,	//	0x25	#define QZ_l	0x26
>     36,	//	0x26	#define QZ_j	0x24
>     40,	//	0x27	#define QZ_QUOTE	0x28
>     37,	//	0x28	#define QZ_k	0x25
>     39,	//	0x29	#define QZ_SEMICOLON	0x27
>     43,	//	0x2A	#define QZ_BACKSLASH	0x2b
>     51,	//	0x2B	#define QZ_COMMA	0x33
>     53,	//	0x2C	#define QZ_SLASH	0x35
>     49,	//	0x2D	#define QZ_n	0x31
>     50,	//	0x2E	#define QZ_m	0x32
>     52,	//	0x2F	#define QZ_PERIOD	0x34
>     15,	//	0x30	#define QZ_TAB	0xf
>     57,	//	0x31	#define QZ_SPACE	0x39
>     41,	//	0x32	#define QZ_BACKQUOTE	0x29
>     14,	//	0x33	#define QZ_BACKSPACE	0xe
>     0,	//	0x34	Undefined	
>     1,	//	0x35	#define QZ_ESCAPE	0x1
>     0,	//	0x36	#define QZ_RMETA	
>     0,	//	0x37	#define QZ_LMETA	
>     26,	//	0x38	#define QZ_LSHIFT	0x2a
>     58,	//	0x39	#define QZ_CAPSLOCK	0x3a
>     56,	//	0x3A	#define QZ_LALT	0x38
>     29,	//	0x3B	#define QZ_LCTRL	0x1d
>     54,	//	0x3C	#define QZ_RSHIFT	0x36
>     168,	//	0x3D	#define QZ_RALT	0xb8
>     157,	//	0x3E	#define QZ_RCTRL	0x9d
>     0,	//	0x3F	Undefined	
>     0,	//	0x40	Undefined	
>     0,	//	0x41	Undefined	
>     0,	//	0x42	Undefined	
>     55,	//	0x43	#define QZ_KP_MULTIPLY	0x37
>     78,	//	0x45	#define QZ_KP_PLUS	0x4e
>     69,	//	0x47	#define QZ_NUMLOCK	0x45
>     0,	//	0x48	Undefined	
>     0,	//	0x49	Undefined	
>     0,	//	0x4A	Undefined	
>     21,	//	0x4B	#define QZ_KP_DIVIDE	0xb5
>     152,	//	0x4C	#define QZ_KP_ENTER	0x9c
>     74,	//	0x4E	#define QZ_KP_MINUS	0x4a
>     0,	//	0x4F	Undefined	
>     0,	//	0x50	Undefined	
>     0,	//	0x51	#define QZ_KP_EQUALS	
>     82,	//	0x52	#define QZ_KP0	0x52
>     79,	//	0x53	#define QZ_KP1	0x4f
>     80,	//	0x54	#define QZ_KP2	0x50
>     81,	//	0x55	#define QZ_KP3	0x51
>     76,	//	0x56	#define QZ_KP4	0x4b
>     77,	//	0x57	#define QZ_KP5	0x4c
>     78,	//	0x58	#define QZ_KP6	0x4d
>     71,	//	0x59	#define QZ_KP7	0x47
>     0,	//	0x5A	Undefined	
>     72,	//	0x5B	#define QZ_KP8	0x48
>     73,	//	0x5C	#define QZ_KP9	0x49
>     0,	//	0x5D	Undefined	
>     0,	//	0x5E	Undefined	
>     0,	//	0x5F	Undefined	
>     63,	//	0x60	#define QZ_F5	0x3f
>     64,	//	0x61	#define QZ_F6	0x40
>     65,	//	0x62	#define QZ_F7	0x41
>     61,	//	0x63	#define QZ_F3	0x3d
>     66,	//	0x64	#define QZ_F8	0x42
>     67,	//	0x65	#define QZ_F9	0x43
>     0,	//	0x66	Undefined	
>     87,	//	0x67	#define QZ_F11	0x57
>     0,	//	0x68	Undefined	
>     23,	//	0x69	#define QZ_PRINT	0xb7
>     0,	//	0x6A	Undefined	
>     70,	//	0x6B	#define QZ_SCROLLOCK	0x46
>     68,	//	0x6D	#define QZ_F10	0x44
>     0,	//	0x6E	Undefined	
>     88,	//	0x6F	#define QZ_F12	0x58
>     0,	//	0x70	Undefined	
>     110,	//	0x71	#define QZ_PAUSE	0x0
>     210,	//	0x72	#define QZ_INSERT	0xd2
>     199,	//	0x73	#define QZ_HOME	0xc7
>     201,	//	0x74	#define QZ_PAGEUP	0xc9
>     211,	//	0x75	#define QZ_DELETE	0xd3
>     62,	//	0x76	#define QZ_F4	0x3e
>     223,	//	0x77	#define QZ_END	0xcf
>     60,	//	0x78	#define QZ_F2	0x3c
>     209,	//	0x79	#define QZ_PAGEDOWN	0xd1
>     59,	//	0x7A	#define QZ_F1	0x3b
>     219,	//	0x7B	#define QZ_LEFT	0xcb
>     221,	//	0x7C	#define QZ_RIGHT	0xcd
>     208,	//	0x7D	#define QZ_DOWN	0xd0
>     200,	//	0x7E	#define QZ_UP	0xc8	

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [Patch] Experimental Cocoa Video Driver
  2005-04-06  4:25 ` [Qemu-devel] [Patch] Experimental Cocoa Video Driver Mike Kronenberg
@ 2005-04-06  4:29   ` Mike Kronenberg
  2005-04-08 17:36   ` Pierre d'Herbemont
  1 sibling, 0 replies; 27+ messages in thread
From: Mike Kronenberg @ 2005-04-06  4:29 UTC (permalink / raw)
  To: qemu-devel

oops, wrong thread.

Mike

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re:   [Qemu-devel] [Patch] Experimental Cocoa Video Driver
  2005-04-06  4:25 ` [Qemu-devel] [Patch] Experimental Cocoa Video Driver Mike Kronenberg
  2005-04-06  4:29   ` Mike Kronenberg
@ 2005-04-08 17:36   ` Pierre d'Herbemont
  1 sibling, 0 replies; 27+ messages in thread
From: Pierre d'Herbemont @ 2005-04-08 17:36 UTC (permalink / raw)
  To: qemu-devel, Mike Kronenberg

Selon Mike Kronenberg <mike.kronenberg@kberg.ch>:

> Hello
>
> I added most of the key from SDL_QuartzKeys.h to the keymap conversion
> in cocoa.m. (us_en)

Nice ;)

You may want to resend this patch to the list with the mention [Patch] and a new
subject, so that Fabrice can handle it if he doesn't monitor this thread...

Pierre.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Qemu-devel] [PATCH] Experimental Cocoa Video Driver
@ 2005-04-10  2:21 Mike Kronenberg
  2005-04-10  9:53 ` René Korthaus
  2005-04-10 18:18 ` [Qemu-devel] [PATCH] Experimental Cocoa Video Driver Mike Kronenberg
  0 siblings, 2 replies; 27+ messages in thread
From: Mike Kronenberg @ 2005-04-10  2:21 UTC (permalink / raw)
  To: Qemu-devel

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

Provides improved Mousesupport and grab/ungrab
- to grab: click into qemu window
- to ungrab: ctrl+alt or switch window (incl. alt-tab)

Tested: (on Win95b)
- leftclick, leftdrag, leftdoubleclick
- rightclick, rightdrag

Not tested:
- scrollwheel

Known Bug:
- can't grab when switching from other app by clicking qemu-window 
(first grabs, then ungrabs)
-> workaround: alt-tab to qemu, then click on qemu-window

have fun
Mike

[-- Attachment #2: cocoa.m_20050410.diff --]
[-- Type: text/plain, Size: 9416 bytes --]

Index: cocoa.m
===================================================================
RCS file: /cvsroot/qemu/qemu/cocoa.m,v
retrieving revision 1.4
diff -u -r1.4 cocoa.m
--- cocoa.m	7 Apr 2005 20:36:50 -0000	1.4
+++ cocoa.m	10 Apr 2005 01:01:29 -0000
@@ -27,7 +27,7 @@
               x  center the window
               -  save window position
               -  handle keyboard event
-              -  handle mouse event
+              /  handle mouse event
               -  non 32 bpp support
               -  full screen
               -  mouse focus
@@ -47,6 +47,8 @@
 char **gArgv;
 DisplayState current_ds;
 
+bool grab = false;
+
 /* main defined in qemu/vl.c */
 int qemu_main(int argc, char **argv);
 
@@ -173,55 +175,129 @@
 
 static int keymap[] =
 {
-    30, //'a' 0x0
-    31,  //'s'
-    32,  //'d'
-    33,  //'f'
-    35,  //'h'
-    34,  //'g'
-    44,  //'z'
-    45,  //'x'
-    46,  //'c'
-    47,  //'v'
-    0,   // 0  0x0a
-    48,  //'b'
-    16,  //'q'
-    17,  //'w'
-    18,  //'e'
-    19,  //'r' 
-    21,  //'y' 0x10
-    20,  //'t'
-    2,  //'1'
-    3,  //'2'
-    4,  //'3'
-    5,  //'4'
-    7,  //'6'
-    6,  //'5'
-    0,  //'='
-    10,  //'9'
-    8,  //'7' 0x1A
-    0,  //'-' 
-    9,  //'8' 
-    11,  //'0' 
-    27,  //']' 
-    24,  //'o' 
-    22,  //'u' 0x20
-    26,  //'['
-    23,  //'i'
-    25,  //'p'
-    28,  //'\n'
-    38,  //'l'
-    36,  //'j'
-    40,  //'"'
-    37,  //'k'
-    39,  //';'
-    15,  //'\t' 0x30
-    0,  //' '
-    0,  //'`'
-    14,  //'<backspace>'
-    0,  //'' 0x34
-    0,  //'<esc>'
-    0,  //'<esc>'
+    30,	//	0x00	#define QZ_a	0x1e
+    31,	//	0x01	#define QZ_s	0x1f
+    32,	//	0x02	#define QZ_d	0x20
+    33,	//	0x03	#define QZ_f	0x21
+    35,	//	0x04	#define QZ_h	0x23
+    34,	//	0x05	#define QZ_g	0x22
+    44,	//	0x06	#define QZ_z	0x2c
+    45,	//	0x07	#define QZ_x	0x2d
+    46,	//	0x08	#define QZ_c	0x2e
+    47,	//	0x09	#define QZ_v	0x2f
+    0,	//	0x0A	Undefined	
+    48,	//	0x0B	#define QZ_b	0x30
+    16,	//	0x0C	#define QZ_q	0x10
+    17,	//	0x0D	#define QZ_w	0x11
+    18,	//	0x0E	#define QZ_e	0x12
+    19,	//	0x0F	#define QZ_r	0x13
+    21,	//	0x10	#define QZ_y	0x15
+    20,	//	0x11	#define QZ_t	0x14
+    2,	//	0x12	#define QZ_1	0x2
+    3,	//	0x13	#define QZ_2	0x3
+    4,	//	0x14	#define QZ_3	0x4
+    5,	//	0x15	#define QZ_4	0x5
+    7,	//	0x16	#define QZ_6	0x7
+    6,	//	0x17	#define QZ_5	0x6
+    13,	//	0x18	#define QZ_EQUALS	0xd
+    10,	//	0x19	#define QZ_9	0xa
+    8,	//	0x1A	#define QZ_7	0x8
+    12,	//	0x1B	#define QZ_MINUS	0xc
+    9,	//	0x1C	#define QZ_8	0x9
+    11,	//	0x1D	#define QZ_0	0xb
+    27,	//	0x1E	#define QZ_RIGHTBRACKET	0x1b
+    24,	//	0x1F	#define QZ_o	0x18
+    22,	//	0x20	#define QZ_u	0x16
+    26,	//	0x21	#define QZ_LEFTBRACKET	0x1a
+    23,	//	0x22	#define QZ_i	0x17
+    25,	//	0x23	#define QZ_p	0x19
+    28,	//	0x24	#define QZ_RETURN	0x1c
+    38,	//	0x25	#define QZ_l	0x26
+    36,	//	0x26	#define QZ_j	0x24
+    40,	//	0x27	#define QZ_QUOTE	0x28
+    37,	//	0x28	#define QZ_k	0x25
+    39,	//	0x29	#define QZ_SEMICOLON	0x27
+    43,	//	0x2A	#define QZ_BACKSLASH	0x2b
+    51,	//	0x2B	#define QZ_COMMA	0x33
+    53,	//	0x2C	#define QZ_SLASH	0x35
+    49,	//	0x2D	#define QZ_n	0x31
+    50,	//	0x2E	#define QZ_m	0x32
+    52,	//	0x2F	#define QZ_PERIOD	0x34
+    15,	//	0x30	#define QZ_TAB	0xf
+    57,	//	0x31	#define QZ_SPACE	0x39
+    41,	//	0x32	#define QZ_BACKQUOTE	0x29
+    14,	//	0x33	#define QZ_BACKSPACE	0xe
+    0,	//	0x34	Undefined	
+    1,	//	0x35	#define QZ_ESCAPE	0x1
+    0,	//	0x36	#define QZ_RMETA	
+    0,	//	0x37	#define QZ_LMETA	
+    26,	//	0x38	#define QZ_LSHIFT	0x2a
+    58,	//	0x39	#define QZ_CAPSLOCK	0x3a
+    56,	//	0x3A	#define QZ_LALT	0x38
+    29,	//	0x3B	#define QZ_LCTRL	0x1d
+    54,	//	0x3C	#define QZ_RSHIFT	0x36
+    168,	//	0x3D	#define QZ_RALT	0xb8
+    157,	//	0x3E	#define QZ_RCTRL	0x9d
+    0,	//	0x3F	Undefined	
+    0,	//	0x40	Undefined	
+    0,	//	0x41	Undefined	
+    0,	//	0x42	Undefined	
+    55,	//	0x43	#define QZ_KP_MULTIPLY	0x37
+    78,	//	0x45	#define QZ_KP_PLUS	0x4e
+    69,	//	0x47	#define QZ_NUMLOCK	0x45
+    0,	//	0x48	Undefined	
+    0,	//	0x49	Undefined	
+    0,	//	0x4A	Undefined	
+    21,	//	0x4B	#define QZ_KP_DIVIDE	0xb5
+    152,	//	0x4C	#define QZ_KP_ENTER	0x9c
+    74,	//	0x4E	#define QZ_KP_MINUS	0x4a
+    0,	//	0x4F	Undefined	
+    0,	//	0x50	Undefined	
+    0,	//	0x51	#define QZ_KP_EQUALS	
+    82,	//	0x52	#define QZ_KP0	0x52
+    79,	//	0x53	#define QZ_KP1	0x4f
+    80,	//	0x54	#define QZ_KP2	0x50
+    81,	//	0x55	#define QZ_KP3	0x51
+    76,	//	0x56	#define QZ_KP4	0x4b
+    77,	//	0x57	#define QZ_KP5	0x4c
+    78,	//	0x58	#define QZ_KP6	0x4d
+    71,	//	0x59	#define QZ_KP7	0x47
+    0,	//	0x5A	Undefined	
+    72,	//	0x5B	#define QZ_KP8	0x48
+    73,	//	0x5C	#define QZ_KP9	0x49
+    0,	//	0x5D	Undefined	
+    0,	//	0x5E	Undefined	
+    0,	//	0x5F	Undefined	
+    63,	//	0x60	#define QZ_F5	0x3f
+    64,	//	0x61	#define QZ_F6	0x40
+    65,	//	0x62	#define QZ_F7	0x41
+    61,	//	0x63	#define QZ_F3	0x3d
+    66,	//	0x64	#define QZ_F8	0x42
+    67,	//	0x65	#define QZ_F9	0x43
+    0,	//	0x66	Undefined	
+    87,	//	0x67	#define QZ_F11	0x57
+    0,	//	0x68	Undefined	
+    23,	//	0x69	#define QZ_PRINT	0xb7
+    0,	//	0x6A	Undefined	
+    70,	//	0x6B	#define QZ_SCROLLOCK	0x46
+    68,	//	0x6D	#define QZ_F10	0x44
+    0,	//	0x6E	Undefined	
+    88,	//	0x6F	#define QZ_F12	0x58
+    0,	//	0x70	Undefined	
+    110,	//	0x71	#define QZ_PAUSE	0x0
+    210,	//	0x72	#define QZ_INSERT	0xd2
+    199,	//	0x73	#define QZ_HOME	0xc7
+    201,	//	0x74	#define QZ_PAGEUP	0xc9
+    211,	//	0x75	#define QZ_DELETE	0xd3
+    62,	//	0x76	#define QZ_F4	0x3e
+    223,	//	0x77	#define QZ_END	0xcf
+    60,	//	0x78	#define QZ_F2	0x3c
+    209,	//	0x79	#define QZ_PAGEDOWN	0xd1
+    59,	//	0x7A	#define QZ_F1	0x3b
+    219,	//	0x7B	#define QZ_LEFT	0xcb
+    221,	//	0x7C	#define QZ_RIGHT	0xcd
+    208,	//	0x7D	#define QZ_DOWN	0xd0
+    200,	//	0x7E	#define QZ_UP	0xc8	
     /* Not completed to finish see http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/video/quartz/SDL_QuartzKeys.h?rev=1.6&content-type=text/x-cvsweb-markup */
 };
 
@@ -246,23 +322,33 @@
     NSDate *distantPast;
     NSEvent *event;
     NSAutoreleasePool *pool;
-    int grab = 1;
     
     pool = [ [ NSAutoreleasePool alloc ] init ];
     distantPast = [ NSDate distantPast ];
     
+    /* release grab when switching windows or pressing ctrl+alt */
+    if ( 
+    		(![window isKeyWindow]) ||
+    		(([[NSApp currentEvent] modifierFlags] & NSControlKeyMask) && ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask))
+    ) {
+		grab = false;
+		[ window setTitle:@"Qemu" ];
+   		[NSCursor unhide];
+		CGAssociateMouseAndMouseCursorPosition ( TRUE );
+    }
+    
     if (is_active_console(vga_console)) 
         vga_update_display();
     do {
         event = [ NSApp nextEventMatchingMask:NSAnyEventMask untilDate:distantPast
                         inMode: NSDefaultRunLoopMode dequeue:YES ];
         if (event != nil) {
+
             switch ([event type]) {
                 case NSKeyDown:
                     if(grab)
                     {
                         int keycode = cocoa_keycode_to_qemu([event keyCode]);
-                        
                         if (keycode & 0x80)
                             kbd_put_keycode(0xe0);
                         kbd_put_keycode(keycode & 0x7f);
@@ -279,21 +365,73 @@
                     }
                     break;
                 case NSScrollWheel:
-                
+					if(grab)
+					{
+						int dz = [event deltaZ];
+						kbd_mouse_event(0, 0, dz, 0);
+					}
+					break;
                 case NSLeftMouseDown:
+					if(grab)
+					{
+						int buttons = 0;
+						buttons |= MOUSE_EVENT_LBUTTON;
+						kbd_mouse_event(0, 0, 0, buttons);
+					} else {
+						grab = true;
+						[ window setTitle:@"Qemu - Press ctrl + alt to ungrab" ];
+		       		    [NSCursor hide];
+		    				CGAssociateMouseAndMouseCursorPosition ( FALSE );
+					}
+					break;
                 case NSLeftMouseUp:
-                
+					if(grab)
+					{
+						kbd_mouse_event(0, 0, 0, 0);
+					}
+					break;
                 case NSOtherMouseDown:
                 case NSRightMouseDown:
-                
+					if(grab)
+					{
+						int buttons = 0;
+						buttons |= MOUSE_EVENT_RBUTTON;
+						kbd_mouse_event(0, 0, 0, buttons);
+					}
+					break;
                 case NSOtherMouseUp:
                 case NSRightMouseUp:
+					if(grab)
+					{
+						kbd_mouse_event(0, 0, 0, 0);
+					}
+					break;
                 
                 case NSMouseMoved:
+					if(grab)
+					{
+						int dx, dy, dz, buttons;
+						dx = [event deltaX];
+						dy = [event deltaY];
+						dz = 0;
+						buttons = 0;
+						kbd_mouse_event(dx, dy, dz, buttons);
+					}
+					break;
                 case NSOtherMouseDragged:
                 case NSRightMouseDragged:
                 case NSLeftMouseDragged:
-                
+					if(grab)
+					{
+						int dx, dy, dz, buttons;
+						dx = [event deltaX];
+						dy = [event deltaY];
+						dz = 0;
+						buttons = 0;
+						buttons |= MOUSE_EVENT_LBUTTON;
+						kbd_mouse_event(dx, dy, dz, buttons);
+					}
+					break;
                 default: [NSApp sendEvent:event];
             }
         }
@@ -325,6 +463,7 @@
     
     cocoa_resize(ds, 640, 400);
     
+    
     atexit(cocoa_cleanup);
 }
 

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [PATCH] Experimental Cocoa Video Driver
  2005-04-10  2:21 [Qemu-devel] [PATCH] Experimental Cocoa Video Driver Mike Kronenberg
@ 2005-04-10  9:53 ` René Korthaus
  2005-04-10 11:09   ` Mike Kronenberg
  2005-04-10 18:18 ` [Qemu-devel] [PATCH] Experimental Cocoa Video Driver Mike Kronenberg
  1 sibling, 1 reply; 27+ messages in thread
From: René Korthaus @ 2005-04-10  9:53 UTC (permalink / raw)
  To: qemu-devel

Am 10.04.2005 um 04:21 schrieb Mike Kronenberg:

> Provides improved Mousesupport and grab/ungrab
> - to grab: click into qemu window
> - to ungrab: ctrl+alt or switch window (incl. alt-tab)

What about a simple var for choosing mouse grabbing or not, like

// grabbing enabled: 1, grabbing disabled: 0
int mouseGrabbing = 1;



Greetings, cordney*



>
> Tested: (on Win95b)
> - leftclick, leftdrag, leftdoubleclick
> - rightclick, rightdrag
>
> Not tested:
> - scrollwheel
>
> Known Bug:
> - can't grab when switching from other app by clicking qemu-window  
> (first grabs, then ungrabs)
> -> workaround: alt-tab to qemu, then click on qemu-window
>
> have fun
> Mike
> Index: cocoa.m
> ===================================================================
> RCS file: /cvsroot/qemu/qemu/cocoa.m,v
> retrieving revision 1.4
> diff -u -r1.4 cocoa.m
> --- cocoa.m	7 Apr 2005 20:36:50 -0000	1.4
> +++ cocoa.m	10 Apr 2005 01:01:29 -0000
> @@ -27,7 +27,7 @@
>                x  center the window
>                -  save window position
>                -  handle keyboard event
> -              -  handle mouse event
> +              /  handle mouse event
>                -  non 32 bpp support
>                -  full screen
>                -  mouse focus
> @@ -47,6 +47,8 @@
>  char **gArgv;
>  DisplayState current_ds;
>
> +bool grab = false;
> +
>  /* main defined in qemu/vl.c */
>  int qemu_main(int argc, char **argv);
>
> @@ -173,55 +175,129 @@
>
>  static int keymap[] =
>  {
> -    30, //'a' 0x0
> -    31,  //'s'
> -    32,  //'d'
> -    33,  //'f'
> -    35,  //'h'
> -    34,  //'g'
> -    44,  //'z'
> -    45,  //'x'
> -    46,  //'c'
> -    47,  //'v'
> -    0,   // 0  0x0a
> -    48,  //'b'
> -    16,  //'q'
> -    17,  //'w'
> -    18,  //'e'
> -    19,  //'r'
> -    21,  //'y' 0x10
> -    20,  //'t'
> -    2,  //'1'
> -    3,  //'2'
> -    4,  //'3'
> -    5,  //'4'
> -    7,  //'6'
> -    6,  //'5'
> -    0,  //'='
> -    10,  //'9'
> -    8,  //'7' 0x1A
> -    0,  //'-'
> -    9,  //'8'
> -    11,  //'0'
> -    27,  //']'
> -    24,  //'o'
> -    22,  //'u' 0x20
> -    26,  //'['
> -    23,  //'i'
> -    25,  //'p'
> -    28,  //'\n'
> -    38,  //'l'
> -    36,  //'j'
> -    40,  //'"'
> -    37,  //'k'
> -    39,  //';'
> -    15,  //'\t' 0x30
> -    0,  //' '
> -    0,  //'`'
> -    14,  //'<backspace>'
> -    0,  //'' 0x34
> -    0,  //'<esc>'
> -    0,  //'<esc>'
> +    30,	//	0x00	#define QZ_a	0x1e
> +    31,	//	0x01	#define QZ_s	0x1f
> +    32,	//	0x02	#define QZ_d	0x20
> +    33,	//	0x03	#define QZ_f	0x21
> +    35,	//	0x04	#define QZ_h	0x23
> +    34,	//	0x05	#define QZ_g	0x22
> +    44,	//	0x06	#define QZ_z	0x2c
> +    45,	//	0x07	#define QZ_x	0x2d
> +    46,	//	0x08	#define QZ_c	0x2e
> +    47,	//	0x09	#define QZ_v	0x2f
> +    0,	//	0x0A	Undefined	
> +    48,	//	0x0B	#define QZ_b	0x30
> +    16,	//	0x0C	#define QZ_q	0x10
> +    17,	//	0x0D	#define QZ_w	0x11
> +    18,	//	0x0E	#define QZ_e	0x12
> +    19,	//	0x0F	#define QZ_r	0x13
> +    21,	//	0x10	#define QZ_y	0x15
> +    20,	//	0x11	#define QZ_t	0x14
> +    2,	//	0x12	#define QZ_1	0x2
> +    3,	//	0x13	#define QZ_2	0x3
> +    4,	//	0x14	#define QZ_3	0x4
> +    5,	//	0x15	#define QZ_4	0x5
> +    7,	//	0x16	#define QZ_6	0x7
> +    6,	//	0x17	#define QZ_5	0x6
> +    13,	//	0x18	#define QZ_EQUALS	0xd
> +    10,	//	0x19	#define QZ_9	0xa
> +    8,	//	0x1A	#define QZ_7	0x8
> +    12,	//	0x1B	#define QZ_MINUS	0xc
> +    9,	//	0x1C	#define QZ_8	0x9
> +    11,	//	0x1D	#define QZ_0	0xb
> +    27,	//	0x1E	#define QZ_RIGHTBRACKET	0x1b
> +    24,	//	0x1F	#define QZ_o	0x18
> +    22,	//	0x20	#define QZ_u	0x16
> +    26,	//	0x21	#define QZ_LEFTBRACKET	0x1a
> +    23,	//	0x22	#define QZ_i	0x17
> +    25,	//	0x23	#define QZ_p	0x19
> +    28,	//	0x24	#define QZ_RETURN	0x1c
> +    38,	//	0x25	#define QZ_l	0x26
> +    36,	//	0x26	#define QZ_j	0x24
> +    40,	//	0x27	#define QZ_QUOTE	0x28
> +    37,	//	0x28	#define QZ_k	0x25
> +    39,	//	0x29	#define QZ_SEMICOLON	0x27
> +    43,	//	0x2A	#define QZ_BACKSLASH	0x2b
> +    51,	//	0x2B	#define QZ_COMMA	0x33
> +    53,	//	0x2C	#define QZ_SLASH	0x35
> +    49,	//	0x2D	#define QZ_n	0x31
> +    50,	//	0x2E	#define QZ_m	0x32
> +    52,	//	0x2F	#define QZ_PERIOD	0x34
> +    15,	//	0x30	#define QZ_TAB	0xf
> +    57,	//	0x31	#define QZ_SPACE	0x39
> +    41,	//	0x32	#define QZ_BACKQUOTE	0x29
> +    14,	//	0x33	#define QZ_BACKSPACE	0xe
> +    0,	//	0x34	Undefined	
> +    1,	//	0x35	#define QZ_ESCAPE	0x1
> +    0,	//	0x36	#define QZ_RMETA	
> +    0,	//	0x37	#define QZ_LMETA	
> +    26,	//	0x38	#define QZ_LSHIFT	0x2a
> +    58,	//	0x39	#define QZ_CAPSLOCK	0x3a
> +    56,	//	0x3A	#define QZ_LALT	0x38
> +    29,	//	0x3B	#define QZ_LCTRL	0x1d
> +    54,	//	0x3C	#define QZ_RSHIFT	0x36
> +    168,	//	0x3D	#define QZ_RALT	0xb8
> +    157,	//	0x3E	#define QZ_RCTRL	0x9d
> +    0,	//	0x3F	Undefined	
> +    0,	//	0x40	Undefined	
> +    0,	//	0x41	Undefined	
> +    0,	//	0x42	Undefined	
> +    55,	//	0x43	#define QZ_KP_MULTIPLY	0x37
> +    78,	//	0x45	#define QZ_KP_PLUS	0x4e
> +    69,	//	0x47	#define QZ_NUMLOCK	0x45
> +    0,	//	0x48	Undefined	
> +    0,	//	0x49	Undefined	
> +    0,	//	0x4A	Undefined	
> +    21,	//	0x4B	#define QZ_KP_DIVIDE	0xb5
> +    152,	//	0x4C	#define QZ_KP_ENTER	0x9c
> +    74,	//	0x4E	#define QZ_KP_MINUS	0x4a
> +    0,	//	0x4F	Undefined	
> +    0,	//	0x50	Undefined	
> +    0,	//	0x51	#define QZ_KP_EQUALS	
> +    82,	//	0x52	#define QZ_KP0	0x52
> +    79,	//	0x53	#define QZ_KP1	0x4f
> +    80,	//	0x54	#define QZ_KP2	0x50
> +    81,	//	0x55	#define QZ_KP3	0x51
> +    76,	//	0x56	#define QZ_KP4	0x4b
> +    77,	//	0x57	#define QZ_KP5	0x4c
> +    78,	//	0x58	#define QZ_KP6	0x4d
> +    71,	//	0x59	#define QZ_KP7	0x47
> +    0,	//	0x5A	Undefined	
> +    72,	//	0x5B	#define QZ_KP8	0x48
> +    73,	//	0x5C	#define QZ_KP9	0x49
> +    0,	//	0x5D	Undefined	
> +    0,	//	0x5E	Undefined	
> +    0,	//	0x5F	Undefined	
> +    63,	//	0x60	#define QZ_F5	0x3f
> +    64,	//	0x61	#define QZ_F6	0x40
> +    65,	//	0x62	#define QZ_F7	0x41
> +    61,	//	0x63	#define QZ_F3	0x3d
> +    66,	//	0x64	#define QZ_F8	0x42
> +    67,	//	0x65	#define QZ_F9	0x43
> +    0,	//	0x66	Undefined	
> +    87,	//	0x67	#define QZ_F11	0x57
> +    0,	//	0x68	Undefined	
> +    23,	//	0x69	#define QZ_PRINT	0xb7
> +    0,	//	0x6A	Undefined	
> +    70,	//	0x6B	#define QZ_SCROLLOCK	0x46
> +    68,	//	0x6D	#define QZ_F10	0x44
> +    0,	//	0x6E	Undefined	
> +    88,	//	0x6F	#define QZ_F12	0x58
> +    0,	//	0x70	Undefined	
> +    110,	//	0x71	#define QZ_PAUSE	0x0
> +    210,	//	0x72	#define QZ_INSERT	0xd2
> +    199,	//	0x73	#define QZ_HOME	0xc7
> +    201,	//	0x74	#define QZ_PAGEUP	0xc9
> +    211,	//	0x75	#define QZ_DELETE	0xd3
> +    62,	//	0x76	#define QZ_F4	0x3e
> +    223,	//	0x77	#define QZ_END	0xcf
> +    60,	//	0x78	#define QZ_F2	0x3c
> +    209,	//	0x79	#define QZ_PAGEDOWN	0xd1
> +    59,	//	0x7A	#define QZ_F1	0x3b
> +    219,	//	0x7B	#define QZ_LEFT	0xcb
> +    221,	//	0x7C	#define QZ_RIGHT	0xcd
> +    208,	//	0x7D	#define QZ_DOWN	0xd0
> +    200,	//	0x7E	#define QZ_UP	0xc8	
>      /* Not completed to finish see  
> http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/video/quartz/ 
> SDL_QuartzKeys.h?rev=1.6&content-type=text/x-cvsweb-markup */
>  };
>
> @@ -246,23 +322,33 @@
>      NSDate *distantPast;
>      NSEvent *event;
>      NSAutoreleasePool *pool;
> -    int grab = 1;
>
>      pool = [ [ NSAutoreleasePool alloc ] init ];
>      distantPast = [ NSDate distantPast ];
>
> +    /* release grab when switching windows or pressing ctrl+alt */
> +    if (
> +    		(![window isKeyWindow]) ||
> +    		(([[NSApp currentEvent] modifierFlags] & NSControlKeyMask) &&  
> ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask))
> +    ) {
> +		grab = false;
> +		[ window setTitle:@"Qemu" ];
> +   		[NSCursor unhide];
> +		CGAssociateMouseAndMouseCursorPosition ( TRUE );
> +    }
> +
>      if (is_active_console(vga_console))
>          vga_update_display();
>      do {
>          event = [ NSApp nextEventMatchingMask:NSAnyEventMask  
> untilDate:distantPast
>                          inMode: NSDefaultRunLoopMode dequeue:YES ];
>          if (event != nil) {
> +
>              switch ([event type]) {
>                  case NSKeyDown:
>                      if(grab)
>                      {
>                          int keycode = cocoa_keycode_to_qemu([event  
> keyCode]);
> -
>                          if (keycode & 0x80)
>                              kbd_put_keycode(0xe0);
>                          kbd_put_keycode(keycode & 0x7f);
> @@ -279,21 +365,73 @@
>                      }
>                      break;
>                  case NSScrollWheel:
> -
> +					if(grab)
> +					{
> +						int dz = [event deltaZ];
> +						kbd_mouse_event(0, 0, dz, 0);
> +					}
> +					break;
>                  case NSLeftMouseDown:
> +					if(grab)
> +					{
> +						int buttons = 0;
> +						buttons |= MOUSE_EVENT_LBUTTON;
> +						kbd_mouse_event(0, 0, 0, buttons);
> +					} else {
> +						grab = true;
> +						[ window setTitle:@"Qemu - Press ctrl + alt to ungrab" ];
> +		       		    [NSCursor hide];
> +		    				CGAssociateMouseAndMouseCursorPosition ( FALSE );
> +					}
> +					break;
>                  case NSLeftMouseUp:
> -
> +					if(grab)
> +					{
> +						kbd_mouse_event(0, 0, 0, 0);
> +					}
> +					break;
>                  case NSOtherMouseDown:
>                  case NSRightMouseDown:
> -
> +					if(grab)
> +					{
> +						int buttons = 0;
> +						buttons |= MOUSE_EVENT_RBUTTON;
> +						kbd_mouse_event(0, 0, 0, buttons);
> +					}
> +					break;
>                  case NSOtherMouseUp:
>                  case NSRightMouseUp:
> +					if(grab)
> +					{
> +						kbd_mouse_event(0, 0, 0, 0);
> +					}
> +					break;
>
>                  case NSMouseMoved:
> +					if(grab)
> +					{
> +						int dx, dy, dz, buttons;
> +						dx = [event deltaX];
> +						dy = [event deltaY];
> +						dz = 0;
> +						buttons = 0;
> +						kbd_mouse_event(dx, dy, dz, buttons);
> +					}
> +					break;
>                  case NSOtherMouseDragged:
>                  case NSRightMouseDragged:
>                  case NSLeftMouseDragged:
> -
> +					if(grab)
> +					{
> +						int dx, dy, dz, buttons;
> +						dx = [event deltaX];
> +						dy = [event deltaY];
> +						dz = 0;
> +						buttons = 0;
> +						buttons |= MOUSE_EVENT_LBUTTON;
> +						kbd_mouse_event(dx, dy, dz, buttons);
> +					}
> +					break;
>                  default: [NSApp sendEvent:event];
>              }
>          }
> @@ -325,6 +463,7 @@
>
>      cocoa_resize(ds, 640, 400);
>
> +
>      atexit(cocoa_cleanup);
>  }
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [PATCH] Experimental Cocoa Video Driver
  2005-04-10  9:53 ` René Korthaus
@ 2005-04-10 11:09   ` Mike Kronenberg
  2005-04-10 12:05     ` René Korthaus
  0 siblings, 1 reply; 27+ messages in thread
From: Mike Kronenberg @ 2005-04-10 11:09 UTC (permalink / raw)
  To: qemu-devel

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

some minor changes:
- ing grab instead of bool :) (or did you mean the naming of the var?)
- rightdrag works now
- leftclick+command emulates rightclick (also for rightdrag)
- disabled ungrab when windows-switching -> clicking qemu-window will 
now activate window and grab

Known Bug:
- if you return to qemu by alt-tab and the mouse is outside the 
qemu-window, clicks are passed to window under hidden cursor

Workaround:
- ungrab with ctrl+alt, click into qemu-window

Mike

PS.
René Korthaus wrote:

> What about a simple var for choosing mouse grabbing or not, like
>
> // grabbing enabled: 1, grabbing disabled: 0
> int mouseGrabbing = 1; 

Tanks. I hope I got you right.

[-- Attachment #2: cocoa.m_20050410_2.diff --]
[-- Type: text/plain, Size: 10011 bytes --]

Index: cocoa.m
===================================================================
RCS file: /cvsroot/qemu/qemu/cocoa.m,v
retrieving revision 1.4
diff -u -r1.4 cocoa.m
--- cocoa.m	7 Apr 2005 20:36:50 -0000	1.4
+++ cocoa.m	10 Apr 2005 10:54:59 -0000
@@ -27,7 +27,7 @@
               x  center the window
               -  save window position
               -  handle keyboard event
-              -  handle mouse event
+              /  handle mouse event
               -  non 32 bpp support
               -  full screen
               -  mouse focus
@@ -47,6 +47,8 @@
 char **gArgv;
 DisplayState current_ds;
 
+int grab = 0;
+
 /* main defined in qemu/vl.c */
 int qemu_main(int argc, char **argv);
 
@@ -173,55 +175,129 @@
 
 static int keymap[] =
 {
-    30, //'a' 0x0
-    31,  //'s'
-    32,  //'d'
-    33,  //'f'
-    35,  //'h'
-    34,  //'g'
-    44,  //'z'
-    45,  //'x'
-    46,  //'c'
-    47,  //'v'
-    0,   // 0  0x0a
-    48,  //'b'
-    16,  //'q'
-    17,  //'w'
-    18,  //'e'
-    19,  //'r' 
-    21,  //'y' 0x10
-    20,  //'t'
-    2,  //'1'
-    3,  //'2'
-    4,  //'3'
-    5,  //'4'
-    7,  //'6'
-    6,  //'5'
-    0,  //'='
-    10,  //'9'
-    8,  //'7' 0x1A
-    0,  //'-' 
-    9,  //'8' 
-    11,  //'0' 
-    27,  //']' 
-    24,  //'o' 
-    22,  //'u' 0x20
-    26,  //'['
-    23,  //'i'
-    25,  //'p'
-    28,  //'\n'
-    38,  //'l'
-    36,  //'j'
-    40,  //'"'
-    37,  //'k'
-    39,  //';'
-    15,  //'\t' 0x30
-    0,  //' '
-    0,  //'`'
-    14,  //'<backspace>'
-    0,  //'' 0x34
-    0,  //'<esc>'
-    0,  //'<esc>'
+    30,	//	0x00	#define QZ_a	0x1e
+    31,	//	0x01	#define QZ_s	0x1f
+    32,	//	0x02	#define QZ_d	0x20
+    33,	//	0x03	#define QZ_f	0x21
+    35,	//	0x04	#define QZ_h	0x23
+    34,	//	0x05	#define QZ_g	0x22
+    44,	//	0x06	#define QZ_z	0x2c
+    45,	//	0x07	#define QZ_x	0x2d
+    46,	//	0x08	#define QZ_c	0x2e
+    47,	//	0x09	#define QZ_v	0x2f
+    0,	//	0x0A	Undefined	
+    48,	//	0x0B	#define QZ_b	0x30
+    16,	//	0x0C	#define QZ_q	0x10
+    17,	//	0x0D	#define QZ_w	0x11
+    18,	//	0x0E	#define QZ_e	0x12
+    19,	//	0x0F	#define QZ_r	0x13
+    21,	//	0x10	#define QZ_y	0x15
+    20,	//	0x11	#define QZ_t	0x14
+    2,	//	0x12	#define QZ_1	0x2
+    3,	//	0x13	#define QZ_2	0x3
+    4,	//	0x14	#define QZ_3	0x4
+    5,	//	0x15	#define QZ_4	0x5
+    7,	//	0x16	#define QZ_6	0x7
+    6,	//	0x17	#define QZ_5	0x6
+    13,	//	0x18	#define QZ_EQUALS	0xd
+    10,	//	0x19	#define QZ_9	0xa
+    8,	//	0x1A	#define QZ_7	0x8
+    12,	//	0x1B	#define QZ_MINUS	0xc
+    9,	//	0x1C	#define QZ_8	0x9
+    11,	//	0x1D	#define QZ_0	0xb
+    27,	//	0x1E	#define QZ_RIGHTBRACKET	0x1b
+    24,	//	0x1F	#define QZ_o	0x18
+    22,	//	0x20	#define QZ_u	0x16
+    26,	//	0x21	#define QZ_LEFTBRACKET	0x1a
+    23,	//	0x22	#define QZ_i	0x17
+    25,	//	0x23	#define QZ_p	0x19
+    28,	//	0x24	#define QZ_RETURN	0x1c
+    38,	//	0x25	#define QZ_l	0x26
+    36,	//	0x26	#define QZ_j	0x24
+    40,	//	0x27	#define QZ_QUOTE	0x28
+    37,	//	0x28	#define QZ_k	0x25
+    39,	//	0x29	#define QZ_SEMICOLON	0x27
+    43,	//	0x2A	#define QZ_BACKSLASH	0x2b
+    51,	//	0x2B	#define QZ_COMMA	0x33
+    53,	//	0x2C	#define QZ_SLASH	0x35
+    49,	//	0x2D	#define QZ_n	0x31
+    50,	//	0x2E	#define QZ_m	0x32
+    52,	//	0x2F	#define QZ_PERIOD	0x34
+    15,	//	0x30	#define QZ_TAB	0xf
+    57,	//	0x31	#define QZ_SPACE	0x39
+    41,	//	0x32	#define QZ_BACKQUOTE	0x29
+    14,	//	0x33	#define QZ_BACKSPACE	0xe
+    0,	//	0x34	Undefined	
+    1,	//	0x35	#define QZ_ESCAPE	0x1
+    0,	//	0x36	#define QZ_RMETA	
+    0,	//	0x37	#define QZ_LMETA	
+    26,	//	0x38	#define QZ_LSHIFT	0x2a
+    58,	//	0x39	#define QZ_CAPSLOCK	0x3a
+    56,	//	0x3A	#define QZ_LALT	0x38
+    29,	//	0x3B	#define QZ_LCTRL	0x1d
+    54,	//	0x3C	#define QZ_RSHIFT	0x36
+    168,	//	0x3D	#define QZ_RALT	0xb8
+    157,	//	0x3E	#define QZ_RCTRL	0x9d
+    0,	//	0x3F	Undefined	
+    0,	//	0x40	Undefined	
+    0,	//	0x41	Undefined	
+    0,	//	0x42	Undefined	
+    55,	//	0x43	#define QZ_KP_MULTIPLY	0x37
+    78,	//	0x45	#define QZ_KP_PLUS	0x4e
+    69,	//	0x47	#define QZ_NUMLOCK	0x45
+    0,	//	0x48	Undefined	
+    0,	//	0x49	Undefined	
+    0,	//	0x4A	Undefined	
+    21,	//	0x4B	#define QZ_KP_DIVIDE	0xb5
+    152,	//	0x4C	#define QZ_KP_ENTER	0x9c
+    74,	//	0x4E	#define QZ_KP_MINUS	0x4a
+    0,	//	0x4F	Undefined	
+    0,	//	0x50	Undefined	
+    0,	//	0x51	#define QZ_KP_EQUALS	
+    82,	//	0x52	#define QZ_KP0	0x52
+    79,	//	0x53	#define QZ_KP1	0x4f
+    80,	//	0x54	#define QZ_KP2	0x50
+    81,	//	0x55	#define QZ_KP3	0x51
+    76,	//	0x56	#define QZ_KP4	0x4b
+    77,	//	0x57	#define QZ_KP5	0x4c
+    78,	//	0x58	#define QZ_KP6	0x4d
+    71,	//	0x59	#define QZ_KP7	0x47
+    0,	//	0x5A	Undefined	
+    72,	//	0x5B	#define QZ_KP8	0x48
+    73,	//	0x5C	#define QZ_KP9	0x49
+    0,	//	0x5D	Undefined	
+    0,	//	0x5E	Undefined	
+    0,	//	0x5F	Undefined	
+    63,	//	0x60	#define QZ_F5	0x3f
+    64,	//	0x61	#define QZ_F6	0x40
+    65,	//	0x62	#define QZ_F7	0x41
+    61,	//	0x63	#define QZ_F3	0x3d
+    66,	//	0x64	#define QZ_F8	0x42
+    67,	//	0x65	#define QZ_F9	0x43
+    0,	//	0x66	Undefined	
+    87,	//	0x67	#define QZ_F11	0x57
+    0,	//	0x68	Undefined	
+    23,	//	0x69	#define QZ_PRINT	0xb7
+    0,	//	0x6A	Undefined	
+    70,	//	0x6B	#define QZ_SCROLLOCK	0x46
+    68,	//	0x6D	#define QZ_F10	0x44
+    0,	//	0x6E	Undefined	
+    88,	//	0x6F	#define QZ_F12	0x58
+    0,	//	0x70	Undefined	
+    110,	//	0x71	#define QZ_PAUSE	0x0
+    210,	//	0x72	#define QZ_INSERT	0xd2
+    199,	//	0x73	#define QZ_HOME	0xc7
+    201,	//	0x74	#define QZ_PAGEUP	0xc9
+    211,	//	0x75	#define QZ_DELETE	0xd3
+    62,	//	0x76	#define QZ_F4	0x3e
+    223,	//	0x77	#define QZ_END	0xcf
+    60,	//	0x78	#define QZ_F2	0x3c
+    209,	//	0x79	#define QZ_PAGEDOWN	0xd1
+    59,	//	0x7A	#define QZ_F1	0x3b
+    219,	//	0x7B	#define QZ_LEFT	0xcb
+    221,	//	0x7C	#define QZ_RIGHT	0xcd
+    208,	//	0x7D	#define QZ_DOWN	0xd0
+    200,	//	0x7E	#define QZ_UP	0xc8	
     /* Not completed to finish see http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/video/quartz/SDL_QuartzKeys.h?rev=1.6&content-type=text/x-cvsweb-markup */
 };
 
@@ -246,23 +322,33 @@
     NSDate *distantPast;
     NSEvent *event;
     NSAutoreleasePool *pool;
-    int grab = 1;
     
     pool = [ [ NSAutoreleasePool alloc ] init ];
     distantPast = [ NSDate distantPast ];
     
+    /* release grab when switching windows or pressing ctrl+alt */
+    if (
+		//(![ NSApp isActive ]) ||
+    		(([ [ NSApp currentEvent ] modifierFlags ] & NSControlKeyMask) && ([ [ NSApp currentEvent ] modifierFlags ] & NSAlternateKeyMask))
+    ) {
+		grab = 0;
+		[ window setTitle:@"Qemu" ];
+   		[ NSCursor unhide ];
+		CGAssociateMouseAndMouseCursorPosition ( TRUE );
+    }
+    
     if (is_active_console(vga_console)) 
         vga_update_display();
     do {
         event = [ NSApp nextEventMatchingMask:NSAnyEventMask untilDate:distantPast
                         inMode: NSDefaultRunLoopMode dequeue:YES ];
         if (event != nil) {
+
             switch ([event type]) {
                 case NSKeyDown:
                     if(grab)
                     {
                         int keycode = cocoa_keycode_to_qemu([event keyCode]);
-                        
                         if (keycode & 0x80)
                             kbd_put_keycode(0xe0);
                         kbd_put_keycode(keycode & 0x7f);
@@ -279,21 +365,91 @@
                     }
                     break;
                 case NSScrollWheel:
-                
+					if(grab)
+					{
+						int dz = [event deltaZ];
+						kbd_mouse_event(0, 0, dz, 0);
+					}
+					break;
                 case NSLeftMouseDown:
+					if(grab)
+					{
+						int buttons = 0;
+						if ([ [ NSApp currentEvent ] modifierFlags ] & NSCommandKeyMask) { //leftclick+command simulates rightclick
+							buttons |= MOUSE_EVENT_RBUTTON;
+						} else {
+							buttons |= MOUSE_EVENT_LBUTTON;
+						}
+						kbd_mouse_event(0, 0, 0, buttons);
+					} else {
+						grab = 1;
+						[ window setTitle:@"Qemu - Press ctrl + alt to ungrab" ];
+		       		    [ NSCursor hide ];
+		    				CGAssociateMouseAndMouseCursorPosition ( FALSE );
+					}
+					break;
                 case NSLeftMouseUp:
-                
+					if(grab)
+					{
+						kbd_mouse_event(0, 0, 0, 0);
+					}
+					break;
                 case NSOtherMouseDown:
                 case NSRightMouseDown:
-                
+					if(grab)
+					{
+						int buttons = 0;
+						buttons |= MOUSE_EVENT_RBUTTON;
+						kbd_mouse_event(0, 0, 0, buttons);
+					}
+					break;
                 case NSOtherMouseUp:
                 case NSRightMouseUp:
+					if(grab)
+					{
+						kbd_mouse_event(0, 0, 0, 0);
+					}
+					break;
                 
                 case NSMouseMoved:
+					if(grab)
+					{
+						int dx, dy, dz, buttons;
+						dx = [event deltaX];
+						dy = [event deltaY];
+						dz = 0;
+						buttons = 0;
+						kbd_mouse_event(dx, dy, dz, buttons);
+					}
+					break;
                 case NSOtherMouseDragged:
                 case NSRightMouseDragged:
+					if(grab)
+					{
+						int dx, dy, dz, buttons;
+						dx = [event deltaX];
+						dy = [event deltaY];
+						dz = 0;
+						buttons = 0;
+						buttons |= MOUSE_EVENT_RBUTTON;
+						kbd_mouse_event(dx, dy, dz, buttons);
+					}
                 case NSLeftMouseDragged:
-                
+					if(grab)
+					{
+						int dx, dy, dz, buttons;
+						dx = [event deltaX];
+						dy = [event deltaY];
+						dz = 0;
+						buttons = 0;
+						if ([ [ NSApp currentEvent ] modifierFlags ] & NSCommandKeyMask) { //leftclick+command simulates rightclick
+							buttons |= MOUSE_EVENT_RBUTTON;
+						} else {
+							buttons |= MOUSE_EVENT_LBUTTON;
+						}
+						kbd_mouse_event(dx, dy, dz, buttons);
+					}
+					break;
                 default: [NSApp sendEvent:event];
             }
         }
@@ -325,6 +481,7 @@
     
     cocoa_resize(ds, 640, 400);
     
+    
     atexit(cocoa_cleanup);
 }
 

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [PATCH] Experimental Cocoa Video Driver
  2005-04-10 11:09   ` Mike Kronenberg
@ 2005-04-10 12:05     ` René Korthaus
  2005-04-10 13:07       ` Mike Kronenberg
  0 siblings, 1 reply; 27+ messages in thread
From: René Korthaus @ 2005-04-10 12:05 UTC (permalink / raw)
  To: qemu-devel



I meant a simple switch to set whether you want mouse grabbing or not,  
cause if you want to do this in qemu+sdl, you have to patch many files.  
I personally don't like this whole mouse grabbing thing.

Am 10.04.2005 um 13:09 schrieb Mike Kronenberg:
> some minor changes:
> - ing grab instead of bool :) (or did you mean the naming of the var?)
> - rightdrag works now
> - leftclick+command emulates rightclick (also for rightdrag)
> - disabled ungrab when windows-switching -> clicking qemu-window will  
> now activate window and grab
>
> Known Bug:
> - if you return to qemu by alt-tab and the mouse is outside the  
> qemu-window, clicks are passed to window under hidden cursor
>
> Workaround:
> - ungrab with ctrl+alt, click into qemu-window
>
> Mike
>
> PS.
> René Korthaus wrote:
>
>> What about a simple var for choosing mouse grabbing or not, like
>>
>> // grabbing enabled: 1, grabbing disabled: 0
>> int mouseGrabbing = 1;
>
> Tanks. I hope I got you right.
> Index: cocoa.m
> ===================================================================
> RCS file: /cvsroot/qemu/qemu/cocoa.m,v
> retrieving revision 1.4
> diff -u -r1.4 cocoa.m
> --- cocoa.m	7 Apr 2005 20:36:50 -0000	1.4
> +++ cocoa.m	10 Apr 2005 10:54:59 -0000
> @@ -27,7 +27,7 @@
>                x  center the window
>                -  save window position
>                -  handle keyboard event
> -              -  handle mouse event
> +              /  handle mouse event
>                -  non 32 bpp support
>                -  full screen
>                -  mouse focus
> @@ -47,6 +47,8 @@
>  char **gArgv;
>  DisplayState current_ds;
>
> +int grab = 0;
> +
>  /* main defined in qemu/vl.c */
>  int qemu_main(int argc, char **argv);
>
> @@ -173,55 +175,129 @@
>
>  static int keymap[] =
>  {
> -    30, //'a' 0x0
> -    31,  //'s'
> -    32,  //'d'
> -    33,  //'f'
> -    35,  //'h'
> -    34,  //'g'
> -    44,  //'z'
> -    45,  //'x'
> -    46,  //'c'
> -    47,  //'v'
> -    0,   // 0  0x0a
> -    48,  //'b'
> -    16,  //'q'
> -    17,  //'w'
> -    18,  //'e'
> -    19,  //'r'
> -    21,  //'y' 0x10
> -    20,  //'t'
> -    2,  //'1'
> -    3,  //'2'
> -    4,  //'3'
> -    5,  //'4'
> -    7,  //'6'
> -    6,  //'5'
> -    0,  //'='
> -    10,  //'9'
> -    8,  //'7' 0x1A
> -    0,  //'-'
> -    9,  //'8'
> -    11,  //'0'
> -    27,  //']'
> -    24,  //'o'
> -    22,  //'u' 0x20
> -    26,  //'['
> -    23,  //'i'
> -    25,  //'p'
> -    28,  //'\n'
> -    38,  //'l'
> -    36,  //'j'
> -    40,  //'"'
> -    37,  //'k'
> -    39,  //';'
> -    15,  //'\t' 0x30
> -    0,  //' '
> -    0,  //'`'
> -    14,  //'<backspace>'
> -    0,  //'' 0x34
> -    0,  //'<esc>'
> -    0,  //'<esc>'
> +    30,	//	0x00	#define QZ_a	0x1e
> +    31,	//	0x01	#define QZ_s	0x1f
> +    32,	//	0x02	#define QZ_d	0x20
> +    33,	//	0x03	#define QZ_f	0x21
> +    35,	//	0x04	#define QZ_h	0x23
> +    34,	//	0x05	#define QZ_g	0x22
> +    44,	//	0x06	#define QZ_z	0x2c
> +    45,	//	0x07	#define QZ_x	0x2d
> +    46,	//	0x08	#define QZ_c	0x2e
> +    47,	//	0x09	#define QZ_v	0x2f
> +    0,	//	0x0A	Undefined	
> +    48,	//	0x0B	#define QZ_b	0x30
> +    16,	//	0x0C	#define QZ_q	0x10
> +    17,	//	0x0D	#define QZ_w	0x11
> +    18,	//	0x0E	#define QZ_e	0x12
> +    19,	//	0x0F	#define QZ_r	0x13
> +    21,	//	0x10	#define QZ_y	0x15
> +    20,	//	0x11	#define QZ_t	0x14
> +    2,	//	0x12	#define QZ_1	0x2
> +    3,	//	0x13	#define QZ_2	0x3
> +    4,	//	0x14	#define QZ_3	0x4
> +    5,	//	0x15	#define QZ_4	0x5
> +    7,	//	0x16	#define QZ_6	0x7
> +    6,	//	0x17	#define QZ_5	0x6
> +    13,	//	0x18	#define QZ_EQUALS	0xd
> +    10,	//	0x19	#define QZ_9	0xa
> +    8,	//	0x1A	#define QZ_7	0x8
> +    12,	//	0x1B	#define QZ_MINUS	0xc
> +    9,	//	0x1C	#define QZ_8	0x9
> +    11,	//	0x1D	#define QZ_0	0xb
> +    27,	//	0x1E	#define QZ_RIGHTBRACKET	0x1b
> +    24,	//	0x1F	#define QZ_o	0x18
> +    22,	//	0x20	#define QZ_u	0x16
> +    26,	//	0x21	#define QZ_LEFTBRACKET	0x1a
> +    23,	//	0x22	#define QZ_i	0x17
> +    25,	//	0x23	#define QZ_p	0x19
> +    28,	//	0x24	#define QZ_RETURN	0x1c
> +    38,	//	0x25	#define QZ_l	0x26
> +    36,	//	0x26	#define QZ_j	0x24
> +    40,	//	0x27	#define QZ_QUOTE	0x28
> +    37,	//	0x28	#define QZ_k	0x25
> +    39,	//	0x29	#define QZ_SEMICOLON	0x27
> +    43,	//	0x2A	#define QZ_BACKSLASH	0x2b
> +    51,	//	0x2B	#define QZ_COMMA	0x33
> +    53,	//	0x2C	#define QZ_SLASH	0x35
> +    49,	//	0x2D	#define QZ_n	0x31
> +    50,	//	0x2E	#define QZ_m	0x32
> +    52,	//	0x2F	#define QZ_PERIOD	0x34
> +    15,	//	0x30	#define QZ_TAB	0xf
> +    57,	//	0x31	#define QZ_SPACE	0x39
> +    41,	//	0x32	#define QZ_BACKQUOTE	0x29
> +    14,	//	0x33	#define QZ_BACKSPACE	0xe
> +    0,	//	0x34	Undefined	
> +    1,	//	0x35	#define QZ_ESCAPE	0x1
> +    0,	//	0x36	#define QZ_RMETA	
> +    0,	//	0x37	#define QZ_LMETA	
> +    26,	//	0x38	#define QZ_LSHIFT	0x2a
> +    58,	//	0x39	#define QZ_CAPSLOCK	0x3a
> +    56,	//	0x3A	#define QZ_LALT	0x38
> +    29,	//	0x3B	#define QZ_LCTRL	0x1d
> +    54,	//	0x3C	#define QZ_RSHIFT	0x36
> +    168,	//	0x3D	#define QZ_RALT	0xb8
> +    157,	//	0x3E	#define QZ_RCTRL	0x9d
> +    0,	//	0x3F	Undefined	
> +    0,	//	0x40	Undefined	
> +    0,	//	0x41	Undefined	
> +    0,	//	0x42	Undefined	
> +    55,	//	0x43	#define QZ_KP_MULTIPLY	0x37
> +    78,	//	0x45	#define QZ_KP_PLUS	0x4e
> +    69,	//	0x47	#define QZ_NUMLOCK	0x45
> +    0,	//	0x48	Undefined	
> +    0,	//	0x49	Undefined	
> +    0,	//	0x4A	Undefined	
> +    21,	//	0x4B	#define QZ_KP_DIVIDE	0xb5
> +    152,	//	0x4C	#define QZ_KP_ENTER	0x9c
> +    74,	//	0x4E	#define QZ_KP_MINUS	0x4a
> +    0,	//	0x4F	Undefined	
> +    0,	//	0x50	Undefined	
> +    0,	//	0x51	#define QZ_KP_EQUALS	
> +    82,	//	0x52	#define QZ_KP0	0x52
> +    79,	//	0x53	#define QZ_KP1	0x4f
> +    80,	//	0x54	#define QZ_KP2	0x50
> +    81,	//	0x55	#define QZ_KP3	0x51
> +    76,	//	0x56	#define QZ_KP4	0x4b
> +    77,	//	0x57	#define QZ_KP5	0x4c
> +    78,	//	0x58	#define QZ_KP6	0x4d
> +    71,	//	0x59	#define QZ_KP7	0x47
> +    0,	//	0x5A	Undefined	
> +    72,	//	0x5B	#define QZ_KP8	0x48
> +    73,	//	0x5C	#define QZ_KP9	0x49
> +    0,	//	0x5D	Undefined	
> +    0,	//	0x5E	Undefined	
> +    0,	//	0x5F	Undefined	
> +    63,	//	0x60	#define QZ_F5	0x3f
> +    64,	//	0x61	#define QZ_F6	0x40
> +    65,	//	0x62	#define QZ_F7	0x41
> +    61,	//	0x63	#define QZ_F3	0x3d
> +    66,	//	0x64	#define QZ_F8	0x42
> +    67,	//	0x65	#define QZ_F9	0x43
> +    0,	//	0x66	Undefined	
> +    87,	//	0x67	#define QZ_F11	0x57
> +    0,	//	0x68	Undefined	
> +    23,	//	0x69	#define QZ_PRINT	0xb7
> +    0,	//	0x6A	Undefined	
> +    70,	//	0x6B	#define QZ_SCROLLOCK	0x46
> +    68,	//	0x6D	#define QZ_F10	0x44
> +    0,	//	0x6E	Undefined	
> +    88,	//	0x6F	#define QZ_F12	0x58
> +    0,	//	0x70	Undefined	
> +    110,	//	0x71	#define QZ_PAUSE	0x0
> +    210,	//	0x72	#define QZ_INSERT	0xd2
> +    199,	//	0x73	#define QZ_HOME	0xc7
> +    201,	//	0x74	#define QZ_PAGEUP	0xc9
> +    211,	//	0x75	#define QZ_DELETE	0xd3
> +    62,	//	0x76	#define QZ_F4	0x3e
> +    223,	//	0x77	#define QZ_END	0xcf
> +    60,	//	0x78	#define QZ_F2	0x3c
> +    209,	//	0x79	#define QZ_PAGEDOWN	0xd1
> +    59,	//	0x7A	#define QZ_F1	0x3b
> +    219,	//	0x7B	#define QZ_LEFT	0xcb
> +    221,	//	0x7C	#define QZ_RIGHT	0xcd
> +    208,	//	0x7D	#define QZ_DOWN	0xd0
> +    200,	//	0x7E	#define QZ_UP	0xc8	
>      /* Not completed to finish see  
> http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/video/quartz/ 
> SDL_QuartzKeys.h?rev=1.6&content-type=text/x-cvsweb-markup */
>  };
>
> @@ -246,23 +322,33 @@
>      NSDate *distantPast;
>      NSEvent *event;
>      NSAutoreleasePool *pool;
> -    int grab = 1;
>
>      pool = [ [ NSAutoreleasePool alloc ] init ];
>      distantPast = [ NSDate distantPast ];
>
> +    /* release grab when switching windows or pressing ctrl+alt */
> +    if (
> +		//(![ NSApp isActive ]) ||
> +    		(([ [ NSApp currentEvent ] modifierFlags ] & NSControlKeyMask)  
> && ([ [ NSApp currentEvent ] modifierFlags ] & NSAlternateKeyMask))
> +    ) {
> +		grab = 0;
> +		[ window setTitle:@"Qemu" ];
> +   		[ NSCursor unhide ];
> +		CGAssociateMouseAndMouseCursorPosition ( TRUE );
> +    }
> +
>      if (is_active_console(vga_console))
>          vga_update_display();
>      do {
>          event = [ NSApp nextEventMatchingMask:NSAnyEventMask  
> untilDate:distantPast
>                          inMode: NSDefaultRunLoopMode dequeue:YES ];
>          if (event != nil) {
> +
>              switch ([event type]) {
>                  case NSKeyDown:
>                      if(grab)
>                      {
>                          int keycode = cocoa_keycode_to_qemu([event  
> keyCode]);
> -
>                          if (keycode & 0x80)
>                              kbd_put_keycode(0xe0);
>                          kbd_put_keycode(keycode & 0x7f);
> @@ -279,21 +365,91 @@
>                      }
>                      break;
>                  case NSScrollWheel:
> -
> +					if(grab)
> +					{
> +						int dz = [event deltaZ];
> +						kbd_mouse_event(0, 0, dz, 0);
> +					}
> +					break;
>                  case NSLeftMouseDown:
> +					if(grab)
> +					{
> +						int buttons = 0;
> +						if ([ [ NSApp currentEvent ] modifierFlags ] &  
> NSCommandKeyMask) { //leftclick+command simulates rightclick
> +							buttons |= MOUSE_EVENT_RBUTTON;
> +						} else {
> +							buttons |= MOUSE_EVENT_LBUTTON;
> +						}
> +						kbd_mouse_event(0, 0, 0, buttons);
> +					} else {
> +						grab = 1;
> +						[ window setTitle:@"Qemu - Press ctrl + alt to ungrab" ];
> +		       		    [ NSCursor hide ];
> +		    				CGAssociateMouseAndMouseCursorPosition ( FALSE );
> +					}
> +					break;
>                  case NSLeftMouseUp:
> -
> +					if(grab)
> +					{
> +						kbd_mouse_event(0, 0, 0, 0);
> +					}
> +					break;
>                  case NSOtherMouseDown:
>                  case NSRightMouseDown:
> -
> +					if(grab)
> +					{
> +						int buttons = 0;
> +						buttons |= MOUSE_EVENT_RBUTTON;
> +						kbd_mouse_event(0, 0, 0, buttons);
> +					}
> +					break;
>                  case NSOtherMouseUp:
>                  case NSRightMouseUp:
> +					if(grab)
> +					{
> +						kbd_mouse_event(0, 0, 0, 0);
> +					}
> +					break;
>
>                  case NSMouseMoved:
> +					if(grab)
> +					{
> +						int dx, dy, dz, buttons;
> +						dx = [event deltaX];
> +						dy = [event deltaY];
> +						dz = 0;
> +						buttons = 0;
> +						kbd_mouse_event(dx, dy, dz, buttons);
> +					}
> +					break;
>                  case NSOtherMouseDragged:
>                  case NSRightMouseDragged:
> +					if(grab)
> +					{
> +						int dx, dy, dz, buttons;
> +						dx = [event deltaX];
> +						dy = [event deltaY];
> +						dz = 0;
> +						buttons = 0;
> +						buttons |= MOUSE_EVENT_RBUTTON;
> +						kbd_mouse_event(dx, dy, dz, buttons);
> +					}
>                  case NSLeftMouseDragged:
> -
> +					if(grab)
> +					{
> +						int dx, dy, dz, buttons;
> +						dx = [event deltaX];
> +						dy = [event deltaY];
> +						dz = 0;
> +						buttons = 0;
> +						if ([ [ NSApp currentEvent ] modifierFlags ] &  
> NSCommandKeyMask) { //leftclick+command simulates rightclick
> +							buttons |= MOUSE_EVENT_RBUTTON;
> +						} else {
> +							buttons |= MOUSE_EVENT_LBUTTON;
> +						}
> +						kbd_mouse_event(dx, dy, dz, buttons);
> +					}
> +					break;
>                  default: [NSApp sendEvent:event];
>              }
>          }
> @@ -325,6 +481,7 @@
>
>      cocoa_resize(ds, 640, 400);
>
> +
>      atexit(cocoa_cleanup);
>  }
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [PATCH] Experimental Cocoa Video Driver
  2005-04-10 12:05     ` René Korthaus
@ 2005-04-10 13:07       ` Mike Kronenberg
  2005-04-10 16:15         ` [Qemu-devel] Cocoa Video Driver & mouse grabbing (was: [PATCH] Experimental Cocoa Video Driver) René Korthaus
  0 siblings, 1 reply; 27+ messages in thread
From: Mike Kronenberg @ 2005-04-10 13:07 UTC (permalink / raw)
  To: qemu-devel

René Korthaus wrote:

> I meant a simple switch to set whether you want mouse grabbing or 
> not,  cause if you want to do this in qemu+sdl, you have to patch many 
> files.  I personally don't like this whole mouse grabbing thing.

The cocoa-Aproach does not use SDL at all, it is an alternative to SDL. 
Mouse and Key Grabbing is handled completly by cocoa.m. The 
cocoa-Aproach is meant to add a userfriendly GUI to qemu under OS X.

In order to be able to use elements outside qemu (like for examples a 
toolbar with a button to switch cdrom-images) you must have a way to 
ungrab on the fly. I use the same ctrl+alt as in SDL.

Never the less, one could make an Menu- / Prefferencepanel entry for 
enabling/disabling mousegrab for Console-Style Guest-OSes

Mike

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Qemu-devel] Cocoa Video Driver & mouse grabbing (was: [PATCH] Experimental Cocoa Video Driver)
  2005-04-10 13:07       ` Mike Kronenberg
@ 2005-04-10 16:15         ` René Korthaus
  2005-04-10 16:50           ` [Qemu-devel] Cocoa Video Driver & mouse grabbing Mike Kronenberg
  0 siblings, 1 reply; 27+ messages in thread
From: René Korthaus @ 2005-04-10 16:15 UTC (permalink / raw)
  To: qemu-devel

Am 10.04.2005 um 15:07 schrieb Mike Kronenberg:

> René Korthaus wrote:
>
>> I meant a simple switch to set whether you want mouse grabbing or 
>> not,  cause if you want to do this in qemu+sdl, you have to patch 
>> many files.  I personally don't like this whole mouse grabbing thing.
>
> The cocoa-Aproach does not use SDL at all, it is an alternative to 
> SDL. Mouse and Key Grabbing is handled completly by cocoa.m. The 
> cocoa-Aproach is meant to add a userfriendly GUI to qemu under OS X.

I know.

>
> In order to be able to use elements outside qemu (like for examples a 
> toolbar with a button to switch cdrom-images) you must have a way to 
> ungrab on the fly. I use the same ctrl+alt as in SDL.

Why do you have to use grabbing anyway? Its as simple as when the mouse 
moves over the Qemu window, the cursor in the guest os moves, isn't it? 
VPC doesn't need grabbing, too, right? I think no grabbing is more 
user-friendly.

>
> Never the less, one could make an Menu- / Prefferencepanel entry for 
> enabling/disabling mousegrab for Console-Style Guest-OSes

Then, that would require a command-line argument like -nograb for 
disabling mouse grabbing for the current session, which would be the 
approach I would favour personally and also for the users of a GUI, 
cause it would only mean to be a checkbox in the preferences.

We could probably start a poll about that... :)
BTW: I renamed the subject to meet the discussion point.

>
> Mike
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing
  2005-04-10 16:15         ` [Qemu-devel] Cocoa Video Driver & mouse grabbing (was: [PATCH] Experimental Cocoa Video Driver) René Korthaus
@ 2005-04-10 16:50           ` Mike Kronenberg
  2005-04-10 17:20             ` Herbert Poetzl
  0 siblings, 1 reply; 27+ messages in thread
From: Mike Kronenberg @ 2005-04-10 16:50 UTC (permalink / raw)
  To: qemu-devel

René Korthaus wrote:

> I know.

I knew - I'm following the list for quite some time :)  - It was rather 
retorical to see whether I was worng, since I still have to crawl a lot 
of code.

>> In order to be able to use elements outside qemu (like for examples a 
>> toolbar with a button to switch cdrom-images) you must have a way to 
>> ungrab on the fly. I use the same ctrl+alt as in SDL.
>
>
> Why do you have to use grabbing anyway? Its as simple as when the 
> mouse moves over the Qemu window, the cursor in the guest os moves, 
> isn't it? VPC doesn't need grabbing, too, right? I think no grabbing 
> is more user-friendly.

That is exactly the point. To achive that, both system would have to use 
the same cursor speed/acceleration. One way is to disable acceleration 
in the guest-OS.
Further, the guest-OS would have to know, where I enter the window - as 
far as i know, the guest-OS only reads the mouse-delta. One way would be 
to "calibrate" the guest-OS cursor.
Possibility: Send a (-10000,-10000) mouse-delta to qemu - guessing that 
the cursor is now at (0/0) in the guest, then compute the mouse-delta to 
the window-entrypoint.

Writing this, I realise I have to try that. Thanks for the input :)
(Still under the assumption the guest has cursor-acceleration turned of)

>> Never the less, one could make an Menu- / Prefferencepanel entry for 
>> enabling/disabling mousegrab for Console-Style Guest-OSes
>
>
> Then, that would require a command-line argument like -nograb for 
> disabling mouse grabbing for the current session, which would be the 
> approach I would favour personally and also for the users of a GUI, 
> cause it would only mean to be a checkbox in the preferences.

Well, I think the "Vanilla OS X user" does not care about command-line 
options :) . If the SDL part would have a similar option, it would be ok 
to use that, but as long as only the "small" cocoa world would need it, 
i would stay with a checkbox in the preferences - which could be handled 
by cocoa.m without cmdline option.

> We could probably start a poll about that... :)
> BTW: I renamed the subject to meet the discussion point.

No doubt :)

I rl I write programs for education - target users are children 7-14 and 
teachers - the keyword is: keep it REAL simple. I think both ways are 
needed, the commandline way for us, the guiway for them :)

Mike

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing
  2005-04-10 16:50           ` [Qemu-devel] Cocoa Video Driver & mouse grabbing Mike Kronenberg
@ 2005-04-10 17:20             ` Herbert Poetzl
  2005-04-10 19:55               ` Jim C. Brown
  2005-04-12  7:07               ` Antwort: Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing [Hugo Boss: Virus checked] Michael Hoeller
  0 siblings, 2 replies; 27+ messages in thread
From: Herbert Poetzl @ 2005-04-10 17:20 UTC (permalink / raw)
  To: Mike Kronenberg; +Cc: qemu-devel

On Sun, Apr 10, 2005 at 06:50:16PM +0200, Mike Kronenberg wrote:
> René Korthaus wrote:
> 
> >I know.
> 
> I knew - I'm following the list for quite some time :)  - It was rather 
> retorical to see whether I was worng, since I still have to crawl a lot 
> of code.
> 
> >>In order to be able to use elements outside qemu (like for examples a 
> >>toolbar with a button to switch cdrom-images) you must have a way to 
> >>ungrab on the fly. I use the same ctrl+alt as in SDL.
> >
> >
> >Why do you have to use grabbing anyway? Its as simple as when the 
> >mouse moves over the Qemu window, the cursor in the guest os moves, 
> >isn't it? VPC doesn't need grabbing, too, right? I think no grabbing 
> >is more user-friendly.
> 
> That is exactly the point. To achive that, both system would have to use 
> the same cursor speed/acceleration. One way is to disable acceleration 
> in the guest-OS.
> Further, the guest-OS would have to know, where I enter the window - as 
> far as i know, the guest-OS only reads the mouse-delta. One way would be 
> to "calibrate" the guest-OS cursor.
> Possibility: Send a (-10000,-10000) mouse-delta to qemu - guessing that 
> the cursor is now at (0/0) in the guest, then compute the mouse-delta to 
> the window-entrypoint.
> 
> Writing this, I realise I have to try that. Thanks for the input :)
> (Still under the assumption the guest has cursor-acceleration turned of)

hmm, probably not such a good idea, just think of the many
systems where you have hot-spot corners to activate your
favorite wossname ...

btw, what is the problem with emulating a touchscreen like
interface for the guest? it would be sufficient to set the
coordinate field to the window size and every host point
could be translated 1:1 to the guest .. no magic, no special
accelleration, just simple coordinates ...

probably I'm missing something utterly important here, because
it cannot be that simple, can it?

> >>Never the less, one could make an Menu- / Prefferencepanel entry for 
> >>enabling/disabling mousegrab for Console-Style Guest-OSes
> >
> >Then, that would require a command-line argument like -nograb for 
> >disabling mouse grabbing for the current session, which would be the 
> >approach I would favour personally and also for the users of a GUI, 
> >cause it would only mean to be a checkbox in the preferences.
> 
> Well, I think the "Vanilla OS X user" does not care about command-line 
> options :) . If the SDL part would have a similar option, it would be ok 
> to use that, but as long as only the "small" cocoa world would need it, 
> i would stay with a checkbox in the preferences - which could be handled 
> by cocoa.m without cmdline option.
> 
> >We could probably start a poll about that... :)
> >BTW: I renamed the subject to meet the discussion point.
> 
> No doubt :)
> 
> I rl I write programs for education - target users are children 7-14 and 
> teachers - the keyword is: keep it REAL simple. I think both ways are 
> needed, the commandline way for us, the guiway for them :)

btw, if you need somebody to talk about OS X stuff,
feel free to contact me, I started with NeXSTEP some
long time ago ... (still wincing ;)

best,
Herbert

> Mike
> 
> 
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [PATCH] Experimental Cocoa Video Driver
  2005-04-10  2:21 [Qemu-devel] [PATCH] Experimental Cocoa Video Driver Mike Kronenberg
  2005-04-10  9:53 ` René Korthaus
@ 2005-04-10 18:18 ` Mike Kronenberg
  2005-04-11  2:11   ` Mike Kronenberg
  1 sibling, 1 reply; 27+ messages in thread
From: Mike Kronenberg @ 2005-04-10 18:18 UTC (permalink / raw)
  To: qemu-devel

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

And another little update - i know im posting way to fast :)


Mike Kronenberg wrote:

> Provides improved Mousesupport and grab/ungrab
> - to grab: click into qemu window
> - to ungrab: ctrl+alt or switch window (incl. alt-tab)
>
> Tested: (on Win95b)
> - leftclick, leftdrag, leftdoubleclick
> - rightclick, rightdrag
>
> Not tested:
> - scrollwheel
>
> Known Bug:
> - can't grab when switching from other app by clicking qemu-window 
> (first grabs, then ungrabs)
> -> workaround: alt-tab to qemu, then click on qemu-window

This patch removes this Bug
- ungrabs automatically, when qemu-window looses activ-status.

Mike

[-- Attachment #2: cocoa.m_20050410_3.tiff --]
[-- Type: image/tiff, Size: 10393 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing
  2005-04-10 17:20             ` Herbert Poetzl
@ 2005-04-10 19:55               ` Jim C. Brown
  2005-04-10 20:26                 ` John R. Hogerhuis
  2005-04-12  7:07               ` Antwort: Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing [Hugo Boss: Virus checked] Michael Hoeller
  1 sibling, 1 reply; 27+ messages in thread
From: Jim C. Brown @ 2005-04-10 19:55 UTC (permalink / raw)
  To: qemu-devel

On Sun, Apr 10, 2005 at 07:20:38PM +0200, Herbert Poetzl wrote:
> btw, what is the problem with emulating a touchscreen like
> interface for the guest? it would be sufficient to set the
> coordinate field to the window size and every host point
> could be translated 1:1 to the guest .. no magic, no special
> accelleration, just simple coordinates ...
> 
> probably I'm missing something utterly important here, because
> it cannot be that simple, can it?
> 

Once the absolute coordinates pass through from the touchpad, acceleration can
still be applied. The effect of this is that the translation is no longer
1:1 ... emulating a touchpad doesn't really help unless acceleration is turned
off in touchpad mode for the guest.

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing
  2005-04-10 19:55               ` Jim C. Brown
@ 2005-04-10 20:26                 ` John R. Hogerhuis
  2005-04-10 20:39                   ` Thomas Steffen
  2005-04-11  1:20                   ` Herbert Poetzl
  0 siblings, 2 replies; 27+ messages in thread
From: John R. Hogerhuis @ 2005-04-10 20:26 UTC (permalink / raw)
  To: qemu-devel

On Sun, 2005-04-10 at 15:55 -0400, Jim C. Brown wrote:
> On Sun, Apr 10, 2005 at 07:20:38PM +0200, Herbert Poetzl wrote:
> > btw, what is the problem with emulating a touchscreen like
> > interface for the guest? it would be sufficient to set the
> > coordinate field to the window size and every host point
> > could be translated 1:1 to the guest .. no magic, no special
> > accelleration, just simple coordinates ...
> > 
> > probably I'm missing something utterly important here, because
> > it cannot be that simple, can it?
> > 
> 
> Once the absolute coordinates pass through from the touchpad, acceleration can
> still be applied. The effect of this is that the translation is no longer
> 1:1 ... emulating a touchpad doesn't really help unless acceleration is turned
> off in touchpad mode for the guest.
> 

Oops, he said touchscreen not touchpad.

A high res touchscreen emulation sounds like a promising solution. Won't
work with all OSes, but it should work with newer ones anyway. Clever
idea.

-- John.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing
  2005-04-10 20:26                 ` John R. Hogerhuis
@ 2005-04-10 20:39                   ` Thomas Steffen
  2005-04-10 21:04                     ` Mike Kronenberg
  2005-04-11  1:20                   ` Herbert Poetzl
  1 sibling, 1 reply; 27+ messages in thread
From: Thomas Steffen @ 2005-04-10 20:39 UTC (permalink / raw)
  To: qemu-devel

On Apr 10, 2005 10:26 PM, John R. Hogerhuis <jhoger@pobox.com> wrote:

> A high res touchscreen emulation sounds like a promising solution. Won't
> work with all OSes, but it should work with newer ones anyway. Clever
> idea.

Sounds like a good idea. But is there a standard that is supported out
of the box by most OSes? Last time I used a touch screen I had to
install the driver for the serial protocol myself, even on Linux and
on XP. But of course that could be specific to this manufacturer.

Thomas

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing
  2005-04-10 20:39                   ` Thomas Steffen
@ 2005-04-10 21:04                     ` Mike Kronenberg
  0 siblings, 0 replies; 27+ messages in thread
From: Mike Kronenberg @ 2005-04-10 21:04 UTC (permalink / raw)
  To: Thomas Steffen, qemu-devel

Thomas Steffen wrote:

>Sounds like a good idea. But is there a standard that is supported out
>of the box by most OSes? Last time I used a touch screen I had to
>install the driver for the serial protocol myself, even on Linux and
>on XP. But of course that could be specific to this manufacturer.
>
>  
>
Maybe we should take a glimpse at the Tablet PC standarts from MS...
If memory serves me right, most of the Tablets use a wacom system.
I have a TC1000 (not wacom), and there is linux support.

Mike

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing
  2005-04-10 20:26                 ` John R. Hogerhuis
  2005-04-10 20:39                   ` Thomas Steffen
@ 2005-04-11  1:20                   ` Herbert Poetzl
  1 sibling, 0 replies; 27+ messages in thread
From: Herbert Poetzl @ 2005-04-11  1:20 UTC (permalink / raw)
  To: jhoger, qemu-devel

On Sun, Apr 10, 2005 at 01:26:11PM -0700, John R. Hogerhuis wrote:
> On Sun, 2005-04-10 at 15:55 -0400, Jim C. Brown wrote:
> > On Sun, Apr 10, 2005 at 07:20:38PM +0200, Herbert Poetzl wrote:
> > > btw, what is the problem with emulating a touchscreen like
> > > interface for the guest? it would be sufficient to set the
> > > coordinate field to the window size and every host point
> > > could be translated 1:1 to the guest .. no magic, no special
> > > accelleration, just simple coordinates ...
> > > 
> > > probably I'm missing something utterly important here, because
> > > it cannot be that simple, can it?
> > > 
> > 
> > Once the absolute coordinates pass through from the touchpad, acceleration can
> > still be applied. The effect of this is that the translation is no longer
> > 1:1 ... emulating a touchpad doesn't really help unless acceleration is turned
> > off in touchpad mode for the guest.
> > 
> 
> Oops, he said touchscreen not touchpad.
> 
> A high res touchscreen emulation sounds like a promising solution. Won't
> work with all OSes, but it should work with newer ones anyway. Clever
> idea.

thanks!

http://www.elotouch.com/support/linux.asp
http://www.elotouch.com/support/dnld.asp

http://www.3M.com/3MTouchSystems/downloads/legacy.jhtml#Linux

http://www.wacom.com/productsupport/linux.cfm

just some links ...

best,
Herbert

> -- John.
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] [PATCH] Experimental Cocoa Video Driver
  2005-04-10 18:18 ` [Qemu-devel] [PATCH] Experimental Cocoa Video Driver Mike Kronenberg
@ 2005-04-11  2:11   ` Mike Kronenberg
  0 siblings, 0 replies; 27+ messages in thread
From: Mike Kronenberg @ 2005-04-11  2:11 UTC (permalink / raw)
  To: qemu-devel

I put up a Build with this patch at

http://www.kberg.ch/cocoaqemu/

Just give a try! :)

Mike

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Antwort: Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing [Hugo Boss: Virus checked]
  2005-04-10 17:20             ` Herbert Poetzl
  2005-04-10 19:55               ` Jim C. Brown
@ 2005-04-12  7:07               ` Michael Hoeller
  2005-04-12  8:48                 ` Mike Kronenberg
  2005-04-12 14:49                 ` [Qemu-devel] QEMU accelerator Question Michael Hoeller
  1 sibling, 2 replies; 27+ messages in thread
From: Michael Hoeller @ 2005-04-12  7:07 UTC (permalink / raw)
  To: qemu-devel

Hello,

i have downloaded the latest version of qemu from the cvs - how can I get
the fitting version of the QEMU
accelerator for the cvs version? I tried to install WinXP with qemu but
the installation is __very__ slow.

Initially I wanted to install Win98 SE but when ever I boot form the disk
with CD support I have the problem
that the installation fails do the not enough ext.memory... So I tried
with Win98 this works since here the
installation CD is bootable. But I don't want this version. Any idear
about the ext.memory problem?

And last I have a understanding problem. Every time i want to install with
qemu -m 256 -localtime -user-net
-hda /data3/win98.img -cdrom /dev/cdrom -k de -boot d I get them message :
Could not get an DNS Addess.
This goes away when I start a connection to the internet. Question is:
what is this good for and when can
I close the connection again? Or do I need to have it up all time I am
installing??

Thanks lot
Michael


This e-mail (and/or attachments) is confidential and may be privileged. Use or disclosure of it by anyone other than a designated addressee is unauthorized.
If you are not an intended recipient, please delete this e-mail from the computer on which you received it. We thank you for notifying us immediately.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: Antwort: Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing [Hugo Boss: Virus checked]
  2005-04-12  7:07               ` Antwort: Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing [Hugo Boss: Virus checked] Michael Hoeller
@ 2005-04-12  8:48                 ` Mike Kronenberg
  2005-04-12 14:49                 ` [Qemu-devel] QEMU accelerator Question Michael Hoeller
  1 sibling, 0 replies; 27+ messages in thread
From: Mike Kronenberg @ 2005-04-12  8:48 UTC (permalink / raw)
  To: qemu-devel

Michael Hoeller wrote:

>Hello,
>
>i have downloaded the latest version of qemu from the cvs - how can I get 
>the fitting version of the QEMU 
>accelerator for the cvs version? I tried to install WinXP with qemu but 
>the installation is __very__ slow.
>  
>
there are 2 accelerators:
http://fabrice.bellard.free.fr/qemu/download.html (kqemu - the original 
one, closed source)
http://www.dad-answers.com/qemu/ (qvm86 - open souce)

>Initially I wanted to install Win98 SE but when ever I boot form the disk 
>with CD support I have the problem 
>that the installation fails do the not enough ext.memory... So I tried 
>with Win98 this works since here the 
>installation CD is bootable. But I don't want this version. Any idear 
>about the ext.memory problem?
>  
>
is this the original win98SE Boot floppy? Else you have to edit 
autoexec.bat/config.sys to adjust emm386 to provide enough ext.memory

>And last I have a understanding problem. Every time i want to install with 
>qemu -m 256 -localtime -user-net 
>-hda /data3/win98.img -cdrom /dev/cdrom -k de -boot d I get them message : 
>Could not get an DNS Addess. 
>This goes away when I start a connection to the internet. Question is: 
>what is this good for and when can 
>I close the connection again? Or do I need to have it up all time I am 
>installing??
>  
>
qemu emulates a DHCP/DNS/SMB Server, but it need a running network 
connection to do so. if you have no connection up, ad the switch 
-dummy-net and you should have no problem.

http://fabrice.bellard.free.fr/qemu/qemu-doc.html

Greetings

Mike

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] QEMU accelerator Question
  2005-04-13  5:36                     ` Michael Hoeller
@ 2005-04-12 10:13                       ` Mark Williamson
  0 siblings, 0 replies; 27+ messages in thread
From: Mark Williamson @ 2005-04-12 10:13 UTC (permalink / raw)
  To: Michael Hoeller; +Cc: qemu-devel

If you untar the accelerator package into the the QEmu directory it overwrites 
a few files to modify the build process.  Simply rebuilding will then also 
build and install the accelerator.  Try it and let us know if you have any 
problems...

Let go your fear, use the source Luke ;-)

Cheers,
Mark

On Wednesday 13 April 2005 06:36, Michael Hoeller wrote:
> Hello Mark,
>
> Mark wrote:
> >First, go here: http://fabrice.bellard.free.fr/qemu/qemu-accel.html and
>
> read
>
> >the blurb about the accelerator.
> >
> >Then download this
>
> http://fabrice.bellard.free.fr/qemu/kqemu-0.6.2-1.tar.gz
>
> >(it's linked from the Downloads page) and untar it in the Qemu CVS
>
> directory.
>
> >Then do ./configure && make in the QEmu CVS directory.  The do make
>
> install as
>
> >root.
> >
> >This will build & install QEmu and the accelerator module.
>
> I have read the documentation more than twice but I still don't know how
> to compile
> the kqemu. I have compiled qemu 0.6.2 successfully on SuSE 9.2 and it
> works.
>
> How do I install the kqemu the readme in kqemu tell to copy the code in
> the qemu
> dir but then I over write the qemu Makefile.
>
> Only doing a make in kqemu fials do to unset variable like the
> KERNLE_SOUCRE (might
> recall the false name - I have the code not on this machine :-( but it was
> KERNEL_.... )
>
> or to I only need to do an install? I have a 2.6 Kernel
>
> Thanks a lot
> Michael
>
>
>
>
> This e-mail (and/or attachments) is confidential and may be privileged. Use
> or disclosure of it by anyone other than a designated addressee is
> unauthorized. If you are not an intended recipient, please delete this
> e-mail from the computer on which you received it. We thank you for
> notifying us immediately.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] QEMU accelerator Question
  2005-04-12 14:49                 ` [Qemu-devel] QEMU accelerator Question Michael Hoeller
@ 2005-04-12 14:24                   ` Mark Williamson
  2005-04-13  5:36                     ` Michael Hoeller
  0 siblings, 1 reply; 27+ messages in thread
From: Mark Williamson @ 2005-04-12 14:24 UTC (permalink / raw)
  To: qemu-devel

First, go here: http://fabrice.bellard.free.fr/qemu/qemu-accel.html and read 
the blurb about the accelerator.

Then download this http://fabrice.bellard.free.fr/qemu/kqemu-0.6.2-1.tar.gz 
(it's linked from the Downloads page) and untar it in the Qemu CVS directory.

Then do ./configure && make in the QEmu CVS directory.  The do make install as 
root.

This will build & install QEmu and the accelerator module.

Cheers,
Mark

On Tuesday 12 April 2005 15:49, Michael Hoeller wrote:
> Hello,
>
>
> first sorry I posted this with a false subject before ...
>
> i have downloaded the latest version of qemu from the cvs - how can I get
> the fitting version of the QEMU accelerator for the cvs version? I tried
> to install WinXP with qemu but the installation is __very__ slow.
>
> Initially I wanted to install Win98 SE but when ever I boot form the disk
> with CD support I have the problem
> that the installation fails do the not enough ext.memory... So I tried
> with Win98 this works since here the
> installation CD is bootable. But I don't want this version. Any idear
> about the ext.memory problem?
>
> And last I have a understanding problem. Every time i want to install with
>
> qemu -m 256 -localtime -user-net
> -hda /data3/win98.img -cdrom /dev/cdrom -k de -boot d I get them message :
>
> Could not get an DNS Addess.
> This goes away when I start a connection to the internet. Question is:
> what is this good for and when can
> I close the connection again? Or do I need to have it up all time I am
> installing??
>
> Thanks lot
> Michael
>
>
> This e-mail (and/or attachments) is confidential and may be privileged. Use
> or disclosure of it by anyone other than a designated addressee is
> unauthorized. If you are not an intended recipient, please delete this
> e-mail from the computer on which you received it. We thank you for
> notifying us immediately.
>
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Qemu-devel] QEMU accelerator Question
  2005-04-12  7:07               ` Antwort: Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing [Hugo Boss: Virus checked] Michael Hoeller
  2005-04-12  8:48                 ` Mike Kronenberg
@ 2005-04-12 14:49                 ` Michael Hoeller
  2005-04-12 14:24                   ` Mark Williamson
  1 sibling, 1 reply; 27+ messages in thread
From: Michael Hoeller @ 2005-04-12 14:49 UTC (permalink / raw)
  To: qemu-devel

Hello,


first sorry I posted this with a false subject before ...

i have downloaded the latest version of qemu from the cvs - how can I get
the fitting version of the QEMU accelerator for the cvs version? I tried
to install WinXP with qemu but the installation is __very__ slow.

Initially I wanted to install Win98 SE but when ever I boot form the disk
with CD support I have the problem
that the installation fails do the not enough ext.memory... So I tried
with Win98 this works since here the
installation CD is bootable. But I don't want this version. Any idear
about the ext.memory problem?

And last I have a understanding problem. Every time i want to install with

qemu -m 256 -localtime -user-net
-hda /data3/win98.img -cdrom /dev/cdrom -k de -boot d I get them message :

Could not get an DNS Addess.
This goes away when I start a connection to the internet. Question is:
what is this good for and when can
I close the connection again? Or do I need to have it up all time I am
installing??

Thanks lot
Michael


This e-mail (and/or attachments) is confidential and may be privileged. Use or disclosure of it by anyone other than a designated addressee is unauthorized.
If you are not an intended recipient, please delete this e-mail from the computer on which you received it. We thank you for notifying us immediately.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Qemu-devel] QEMU accelerator Question
  2005-04-12 14:24                   ` Mark Williamson
@ 2005-04-13  5:36                     ` Michael Hoeller
  2005-04-12 10:13                       ` Mark Williamson
  0 siblings, 1 reply; 27+ messages in thread
From: Michael Hoeller @ 2005-04-13  5:36 UTC (permalink / raw)
  To: qemu-devel

Hello Mark,


Mark wrote:
>First, go here: http://fabrice.bellard.free.fr/qemu/qemu-accel.html and
read
>the blurb about the accelerator.
>
>Then download this
http://fabrice.bellard.free.fr/qemu/kqemu-0.6.2-1.tar.gz
>(it's linked from the Downloads page) and untar it in the Qemu CVS
directory.
>
>Then do ./configure && make in the QEmu CVS directory.  The do make
install as
>root.
>
>This will build & install QEmu and the accelerator module.

I have read the documentation more than twice but I still don't know how
to compile
the kqemu. I have compiled qemu 0.6.2 successfully on SuSE 9.2 and it
works.

How do I install the kqemu the readme in kqemu tell to copy the code in
the qemu
dir but then I over write the qemu Makefile.

Only doing a make in kqemu fials do to unset variable like the
KERNLE_SOUCRE (might
recall the false name - I have the code not on this machine :-( but it was
KERNEL_.... )

or to I only need to do an install? I have a 2.6 Kernel

Thanks a lot
Michael




This e-mail (and/or attachments) is confidential and may be privileged. Use or disclosure of it by anyone other than a designated addressee is unauthorized.
If you are not an intended recipient, please delete this e-mail from the computer on which you received it. We thank you for notifying us immediately.

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2005-04-13 10:19 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-10  2:21 [Qemu-devel] [PATCH] Experimental Cocoa Video Driver Mike Kronenberg
2005-04-10  9:53 ` René Korthaus
2005-04-10 11:09   ` Mike Kronenberg
2005-04-10 12:05     ` René Korthaus
2005-04-10 13:07       ` Mike Kronenberg
2005-04-10 16:15         ` [Qemu-devel] Cocoa Video Driver & mouse grabbing (was: [PATCH] Experimental Cocoa Video Driver) René Korthaus
2005-04-10 16:50           ` [Qemu-devel] Cocoa Video Driver & mouse grabbing Mike Kronenberg
2005-04-10 17:20             ` Herbert Poetzl
2005-04-10 19:55               ` Jim C. Brown
2005-04-10 20:26                 ` John R. Hogerhuis
2005-04-10 20:39                   ` Thomas Steffen
2005-04-10 21:04                     ` Mike Kronenberg
2005-04-11  1:20                   ` Herbert Poetzl
2005-04-12  7:07               ` Antwort: Re: [Qemu-devel] Cocoa Video Driver & mouse grabbing [Hugo Boss: Virus checked] Michael Hoeller
2005-04-12  8:48                 ` Mike Kronenberg
2005-04-12 14:49                 ` [Qemu-devel] QEMU accelerator Question Michael Hoeller
2005-04-12 14:24                   ` Mark Williamson
2005-04-13  5:36                     ` Michael Hoeller
2005-04-12 10:13                       ` Mark Williamson
2005-04-10 18:18 ` [Qemu-devel] [PATCH] Experimental Cocoa Video Driver Mike Kronenberg
2005-04-11  2:11   ` Mike Kronenberg
  -- strict thread matches above, loose matches on Subject: below --
2005-04-06  2:23 Re: [Qemu-devel] Re: Windows 2000 SP4 (was Re: APM bug) Ben Taylor
2005-04-06  4:25 ` [Qemu-devel] [Patch] Experimental Cocoa Video Driver Mike Kronenberg
2005-04-06  4:29   ` Mike Kronenberg
2005-04-08 17:36   ` Pierre d'Herbemont
2005-02-27  0:04 Pierre d'Herbemont
2005-03-02  0:03 ` David Still
2005-03-02 19:48   ` Pierre d'Herbemont

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