~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to ui/cocoa.m

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#ifndef MAC_OS_X_VERSION_10_5
36
36
#define MAC_OS_X_VERSION_10_5 1050
37
37
#endif
 
38
#ifndef MAC_OS_X_VERSION_10_6
 
39
#define MAC_OS_X_VERSION_10_6 1060
 
40
#endif
38
41
 
39
42
 
40
43
//#define DEBUG
771
774
        NSOpenPanel *op = [[NSOpenPanel alloc] init];
772
775
        [op setPrompt:@"Boot image"];
773
776
        [op setMessage:@"Select the disk image you want to boot.\n\nHit the \"Cancel\" button to quit"];
774
 
        [op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",@"dmg",@"qcow",@"cow",@"cloop",@"vmdk",nil]
 
777
        NSArray *filetypes = [NSArray arrayWithObjects:@"img", @"iso", @"dmg",
 
778
                                 @"qcow", @"cow", @"cloop", @"vmdk", nil];
 
779
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
 
780
        [op setAllowedFileTypes:filetypes];
 
781
        [op beginSheetModalForWindow:normalWindow
 
782
            completionHandler:^(NSInteger returnCode)
 
783
            { [self openPanelDidEnd:op
 
784
                  returnCode:returnCode contextInfo:NULL ]; } ];
 
785
#else
 
786
        // Compatibility code for pre-10.6, using deprecated method
 
787
        [op beginSheetForDirectory:nil file:nil types:filetypes
775
788
              modalForWindow:normalWindow modalDelegate:self
776
789
              didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
 
790
#endif
777
791
    } else {
778
792
        // or launch QEMU, with the global args
779
793
        [self startEmulationWithArgc:gArgc argv:(char **)gArgv];
810
824
        exit(0);
811
825
    } else if(returnCode == NSOKButton) {
812
826
        const char *bin = "qemu";
813
 
        char *img = (char*)[ [ sheet filename ] cStringUsingEncoding:NSASCIIStringEncoding];
 
827
        char *img = (char*)[ [ [ sheet URL ] path ] cStringUsingEncoding:NSASCIIStringEncoding];
814
828
 
815
829
        char **argv = (char**)malloc( sizeof(char*)*3 );
816
830
 
851
865
 
852
866
 
853
867
 
854
 
// Dock Connection
855
 
typedef struct CPSProcessSerNum
856
 
{
857
 
        UInt32                lo;
858
 
        UInt32                hi;
859
 
} CPSProcessSerNum;
860
 
 
861
 
OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
862
 
OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
863
 
OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
864
 
 
865
868
int main (int argc, const char * argv[]) {
866
869
 
867
870
    gArgc = argc;
868
871
    gArgv = (char **)argv;
869
 
    CPSProcessSerNum PSN;
870
872
    int i;
871
873
 
872
874
    /* In case we don't need to display a window, let's not do that */
890
892
    }
891
893
 
892
894
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
 
895
 
 
896
    // Pull this console process up to being a fully-fledged graphical
 
897
    // app with a menubar and Dock icon
 
898
    ProcessSerialNumber psn = { 0, kCurrentProcess };
 
899
    TransformProcessType(&psn, kProcessTransformToForegroundApplication);
 
900
 
893
901
    [NSApplication sharedApplication];
894
902
 
895
 
    if (!CPSGetCurrentProcess(&PSN))
896
 
        if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
897
 
            if (!CPSSetFrontProcess(&PSN))
898
 
                [NSApplication sharedApplication];
899
 
 
900
903
    // Add menus
901
904
    NSMenu      *menu;
902
905
    NSMenuItem  *menuItem;
960
963
static void cocoa_update(DisplayChangeListener *dcl,
961
964
                         int x, int y, int w, int h)
962
965
{
 
966
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
 
967
 
963
968
    COCOA_DEBUG("qemu_cocoa: cocoa_update\n");
964
969
 
965
970
    NSRect rect;
973
978
            h * [cocoaView cdy]);
974
979
    }
975
980
    [cocoaView setNeedsDisplayInRect:rect];
 
981
 
 
982
    [pool release];
976
983
}
977
984
 
978
985
static void cocoa_switch(DisplayChangeListener *dcl,
979
986
                         DisplaySurface *surface)
980
987
{
981
 
    COCOA_DEBUG("qemu_cocoa: cocoa_resize\n");
 
988
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
982
989
 
 
990
    COCOA_DEBUG("qemu_cocoa: cocoa_switch\n");
983
991
    [cocoaView switchSurface:surface];
 
992
    [pool release];
984
993
}
985
994
 
986
995
static void cocoa_refresh(DisplayChangeListener *dcl)
987
996
{
 
997
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
 
998
 
988
999
    COCOA_DEBUG("qemu_cocoa: cocoa_refresh\n");
989
1000
 
990
1001
    if (kbd_mouse_is_absolute()) {
1007
1018
        }
1008
1019
    } while(event != nil);
1009
1020
    graphic_hw_update(NULL);
 
1021
    [pool release];
1010
1022
}
1011
1023
 
1012
1024
static void cocoa_cleanup(void)