diff mbox

[2/5] ui/cocoa: Correct typos in comments and variable names

Message ID 1386543546-31919-3-git-send-email-peter.maydell@linaro.org
State Superseded
Headers show

Commit Message

Peter Maydell Dec. 8, 2013, 10:59 p.m. UTC
Fix various non-user-visible typos in comments and variable names.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 ui/cocoa.m | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Comments

Stefan Weil Dec. 13, 2013, 8:18 p.m. UTC | #1
Am 08.12.2013 23:59, schrieb Peter Maydell:
> Fix various non-user-visible typos in comments and variable names.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  ui/cocoa.m | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index d38cf22..f55747f 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -52,7 +52,7 @@
>  #define COCOA_MOUSE_EVENT \
>          if (isTabletEnabled) { \
>              kbd_mouse_event((int)(p.x * 0x7FFF / (screen.width - 1)), (int)((screen.height - p.y) * 0x7FFF / (screen.height - 1)), 0, buttons); \
> -        } else if (isMouseGrabed) { \
> +        } else if (isMouseGrabbed) { \
>              kbd_mouse_event((int)[event deltaX], (int)[event deltaY], 0, buttons); \
>          } else { \
>              [NSApp sendEvent:event]; \
> @@ -204,7 +204,7 @@ int keymap[] =
>      200,//  126     0x7E    0xc8    E0,48   U ARROW QZ_UP
>  /* completed according to http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/video/quartz/SDL_QuartzKeys.h?rev=1.6&content-type=text/x-cvsweb-markup */
>  
> -/* Aditional 104 Key XP-Keyboard Scancodes from http://www.computer-engineering.org/ps2keyboard/scancodes1.html */
> +/* Additional 104 Key XP-Keyboard Scancodes from http://www.computer-engineering.org/ps2keyboard/scancodes1.html */
>  /*
>      221 //          0xdd            e0,5d   APPS
>          //              E0,2A,E0,37         PRNT SCRN
> @@ -260,7 +260,7 @@ static int cocoa_keycode_to_qemu(int keycode)
>      float cx,cy,cw,ch,cdx,cdy;
>      CGDataProviderRef dataProviderRef;
>      int modifiers_state[256];
> -    BOOL isMouseGrabed;
> +    BOOL isMouseGrabbed;
>      BOOL isFullscreen;
>      BOOL isAbsoluteEnabled;
>      BOOL isTabletEnabled;
> @@ -271,7 +271,7 @@ static int cocoa_keycode_to_qemu(int keycode)
>  - (void) toggleFullScreen:(id)sender;
>  - (void) handleEvent:(NSEvent *)event;
>  - (void) setAbsoluteEnabled:(BOOL)tIsAbsoluteEnabled;
> -- (BOOL) isMouseGrabed;
> +- (BOOL) isMouseGrabbed;
>  - (BOOL) isAbsoluteEnabled;
>  - (float) cdx;
>  - (float) cdy;
> @@ -493,7 +493,7 @@ QemuCocoaView *cocoaView;
>          case NSFlagsChanged:
>              keycode = cocoa_keycode_to_qemu([event keyCode]);
>  
> -            if ((keycode == 219 || keycode == 220) && !isMouseGrabed) {
> +            if ((keycode == 219 || keycode == 220) && !isMouseGrabbed) {
>                /* Don't pass command key changes to guest unless mouse is grabbed */
>                keycode = 0;
>              }
> @@ -524,7 +524,7 @@ QemuCocoaView *cocoaView;
>              keycode = cocoa_keycode_to_qemu([event keyCode]);
>  
>              // forward command key combos to the host UI unless the mouse is grabbed
> -            if (!isMouseGrabed && ([event modifierFlags] & NSCommandKeyMask)) {
> +            if (!isMouseGrabbed && ([event modifierFlags] & NSCommandKeyMask)) {
>                  [NSApp sendEvent:event];
>                  return;
>              }
> @@ -588,7 +588,7 @@ QemuCocoaView *cocoaView;
>  
>              // don't pass the guest a spurious key-up if we treated this
>              // command-key combo as a host UI action
> -            if (!isMouseGrabed && ([event modifierFlags] & NSCommandKeyMask)) {
> +            if (!isMouseGrabbed && ([event modifierFlags] & NSCommandKeyMask)) {
>                  return;
>              }
>  
> @@ -649,7 +649,7 @@ QemuCocoaView *cocoaView;
>          case NSLeftMouseUp:
>              if (isTabletEnabled) {
>                      COCOA_MOUSE_EVENT
> -            } else if (!isMouseGrabed) {
> +            } else if (!isMouseGrabbed) {
>                  if (p.x > -1 && p.x < screen.width && p.y > -1 && p.y < screen.height) {
>                      [self grabMouse];
>                  } else {
> @@ -666,7 +666,7 @@ QemuCocoaView *cocoaView;
>              COCOA_MOUSE_EVENT
>              break;
>          case NSScrollWheel:
> -            if (isTabletEnabled || isMouseGrabed) {
> +            if (isTabletEnabled || isMouseGrabbed) {
>                  kbd_mouse_event(0, 0, -[event deltaY], 0);
>              } else {
>                  [NSApp sendEvent:event];
> @@ -689,7 +689,7 @@ QemuCocoaView *cocoaView;
>      }
>      [NSCursor hide];
>      CGAssociateMouseAndMouseCursorPosition(FALSE);
> -    isMouseGrabed = TRUE; // while isMouseGrabed = TRUE, QemuCocoaApp sends all events to [cocoaView handleEvent:]
> +    isMouseGrabbed = TRUE; // while isMouseGrabbed = TRUE, QemuCocoaApp sends all events to [cocoaView handleEvent:]
>  }
>  
>  - (void) ungrabMouse
> @@ -704,11 +704,11 @@ QemuCocoaView *cocoaView;
>      }
>      [NSCursor unhide];
>      CGAssociateMouseAndMouseCursorPosition(TRUE);
> -    isMouseGrabed = FALSE;
> +    isMouseGrabbed = FALSE;
>  }
>  
>  - (void) setAbsoluteEnabled:(BOOL)tIsAbsoluteEnabled {isAbsoluteEnabled = tIsAbsoluteEnabled;}
> -- (BOOL) isMouseGrabed {return isMouseGrabed;}
> +- (BOOL) isMouseGrabbed {return isMouseGrabbed;}
>  - (BOOL) isAbsoluteEnabled {return isAbsoluteEnabled;}
>  - (float) cdx {return cdx;}
>  - (float) cdy {return cdy;}
> @@ -779,7 +779,7 @@ QemuCocoaView *cocoaView;
>  {
>      COCOA_DEBUG("QemuCocoaAppController: applicationDidFinishLaunching\n");
>  
> -    // Display an open dialog box if no argument were passed or
> +    // Display an open dialog box if no arguments were passed or
>      // if qemu was launched from the finder ( the Finder passes "-psn" )
>      if( gArgc <= 1 || strncmp ((char *)gArgv[1], "-psn", 4) == 0) {
>          NSOpenPanel *op = [[NSOpenPanel alloc] init];
> @@ -1011,7 +1011,7 @@ static void cocoa_refresh(DisplayChangeListener *dcl)
>  
>      if (kbd_mouse_is_absolute()) {
>          if (![cocoaView isAbsoluteEnabled]) {
> -            if ([cocoaView isMouseGrabed]) {
> +            if ([cocoaView isMouseGrabbed]) {
>                  [cocoaView ungrabMouse];
>              }
>          }



Reviewed-by: Stefan Weil <sw@weilnetz.de>

PS. Does anybody know how to add the QEMU mascot as a Cocoa application
icon for all QEMU applications?
Peter Maydell Dec. 24, 2013, 2:28 a.m. UTC | #2
On 13 December 2013 20:18, Stefan Weil <sw@weilnetz.de> wrote:
> PS. Does anybody know how to add the QEMU mascot as a Cocoa application
> icon for all QEMU applications?

I have some code which programmatically sets the icon for QEMU
from a file when it runs:

+    const char *iconfile = "qemu-icon.bmp";
+    const char *icondir = os_find_datadir(gArgv[0]);
+    if (!icondir) {
+        icondir = CONFIG_QEMU_DATADIR;
+    }
+    NSString *iconstring = [NSString stringWithFormat:@"%s/%s",
icondir, iconfile];
+    NSImage *icon = [[NSImage alloc] initWithContentsOfFile:iconstring];
+    if (icon) {
+        [NSApp setApplicationIconImage:icon];
+    }

(goes in ui/cocoa.m just before we set up the menus).
However the qemu-icon.bmp looks awful in the MacOS
dock: it has a white background, not transparent, and the resolution
is probably wrong too.

I suspect the best approach is going to be to create and ship a
TIFF file with the relevant set of icons for various resolutions in it,
as per the documentation on 'tiffutil' in this page:
https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html#//apple_ref/doc/uid/TP40012302-CH7-SW13

but that's beyond my artistic and/or image mangling abilities
I think. If somebody else feels like doing that I can clean
up the code patch for posting, but there's not much point
otherwise.

(I don't think it's possible to make the QEMU executable
have an icon in the Finder, unless we turn it from a plain
command line executable into an "app bundle". And if
we did that you wouldn't be able to run it easily from the
terminal with command line arguments, which in practice
you absolutely have to be able to do for it to be at all useful.)

thanks
-- PMM
diff mbox

Patch

diff --git a/ui/cocoa.m b/ui/cocoa.m
index d38cf22..f55747f 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -52,7 +52,7 @@ 
 #define COCOA_MOUSE_EVENT \
         if (isTabletEnabled) { \
             kbd_mouse_event((int)(p.x * 0x7FFF / (screen.width - 1)), (int)((screen.height - p.y) * 0x7FFF / (screen.height - 1)), 0, buttons); \
-        } else if (isMouseGrabed) { \
+        } else if (isMouseGrabbed) { \
             kbd_mouse_event((int)[event deltaX], (int)[event deltaY], 0, buttons); \
         } else { \
             [NSApp sendEvent:event]; \
@@ -204,7 +204,7 @@  int keymap[] =
     200,//  126     0x7E    0xc8    E0,48   U ARROW QZ_UP
 /* completed according to http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/video/quartz/SDL_QuartzKeys.h?rev=1.6&content-type=text/x-cvsweb-markup */
 
-/* Aditional 104 Key XP-Keyboard Scancodes from http://www.computer-engineering.org/ps2keyboard/scancodes1.html */
+/* Additional 104 Key XP-Keyboard Scancodes from http://www.computer-engineering.org/ps2keyboard/scancodes1.html */
 /*
     221 //          0xdd            e0,5d   APPS
         //              E0,2A,E0,37         PRNT SCRN
@@ -260,7 +260,7 @@  static int cocoa_keycode_to_qemu(int keycode)
     float cx,cy,cw,ch,cdx,cdy;
     CGDataProviderRef dataProviderRef;
     int modifiers_state[256];
-    BOOL isMouseGrabed;
+    BOOL isMouseGrabbed;
     BOOL isFullscreen;
     BOOL isAbsoluteEnabled;
     BOOL isTabletEnabled;
@@ -271,7 +271,7 @@  static int cocoa_keycode_to_qemu(int keycode)
 - (void) toggleFullScreen:(id)sender;
 - (void) handleEvent:(NSEvent *)event;
 - (void) setAbsoluteEnabled:(BOOL)tIsAbsoluteEnabled;
-- (BOOL) isMouseGrabed;
+- (BOOL) isMouseGrabbed;
 - (BOOL) isAbsoluteEnabled;
 - (float) cdx;
 - (float) cdy;
@@ -493,7 +493,7 @@  QemuCocoaView *cocoaView;
         case NSFlagsChanged:
             keycode = cocoa_keycode_to_qemu([event keyCode]);
 
-            if ((keycode == 219 || keycode == 220) && !isMouseGrabed) {
+            if ((keycode == 219 || keycode == 220) && !isMouseGrabbed) {
               /* Don't pass command key changes to guest unless mouse is grabbed */
               keycode = 0;
             }
@@ -524,7 +524,7 @@  QemuCocoaView *cocoaView;
             keycode = cocoa_keycode_to_qemu([event keyCode]);
 
             // forward command key combos to the host UI unless the mouse is grabbed
-            if (!isMouseGrabed && ([event modifierFlags] & NSCommandKeyMask)) {
+            if (!isMouseGrabbed && ([event modifierFlags] & NSCommandKeyMask)) {
                 [NSApp sendEvent:event];
                 return;
             }
@@ -588,7 +588,7 @@  QemuCocoaView *cocoaView;
 
             // don't pass the guest a spurious key-up if we treated this
             // command-key combo as a host UI action
-            if (!isMouseGrabed && ([event modifierFlags] & NSCommandKeyMask)) {
+            if (!isMouseGrabbed && ([event modifierFlags] & NSCommandKeyMask)) {
                 return;
             }
 
@@ -649,7 +649,7 @@  QemuCocoaView *cocoaView;
         case NSLeftMouseUp:
             if (isTabletEnabled) {
                     COCOA_MOUSE_EVENT
-            } else if (!isMouseGrabed) {
+            } else if (!isMouseGrabbed) {
                 if (p.x > -1 && p.x < screen.width && p.y > -1 && p.y < screen.height) {
                     [self grabMouse];
                 } else {
@@ -666,7 +666,7 @@  QemuCocoaView *cocoaView;
             COCOA_MOUSE_EVENT
             break;
         case NSScrollWheel:
-            if (isTabletEnabled || isMouseGrabed) {
+            if (isTabletEnabled || isMouseGrabbed) {
                 kbd_mouse_event(0, 0, -[event deltaY], 0);
             } else {
                 [NSApp sendEvent:event];
@@ -689,7 +689,7 @@  QemuCocoaView *cocoaView;
     }
     [NSCursor hide];
     CGAssociateMouseAndMouseCursorPosition(FALSE);
-    isMouseGrabed = TRUE; // while isMouseGrabed = TRUE, QemuCocoaApp sends all events to [cocoaView handleEvent:]
+    isMouseGrabbed = TRUE; // while isMouseGrabbed = TRUE, QemuCocoaApp sends all events to [cocoaView handleEvent:]
 }
 
 - (void) ungrabMouse
@@ -704,11 +704,11 @@  QemuCocoaView *cocoaView;
     }
     [NSCursor unhide];
     CGAssociateMouseAndMouseCursorPosition(TRUE);
-    isMouseGrabed = FALSE;
+    isMouseGrabbed = FALSE;
 }
 
 - (void) setAbsoluteEnabled:(BOOL)tIsAbsoluteEnabled {isAbsoluteEnabled = tIsAbsoluteEnabled;}
-- (BOOL) isMouseGrabed {return isMouseGrabed;}
+- (BOOL) isMouseGrabbed {return isMouseGrabbed;}
 - (BOOL) isAbsoluteEnabled {return isAbsoluteEnabled;}
 - (float) cdx {return cdx;}
 - (float) cdy {return cdy;}
@@ -779,7 +779,7 @@  QemuCocoaView *cocoaView;
 {
     COCOA_DEBUG("QemuCocoaAppController: applicationDidFinishLaunching\n");
 
-    // Display an open dialog box if no argument were passed or
+    // Display an open dialog box if no arguments were passed or
     // if qemu was launched from the finder ( the Finder passes "-psn" )
     if( gArgc <= 1 || strncmp ((char *)gArgv[1], "-psn", 4) == 0) {
         NSOpenPanel *op = [[NSOpenPanel alloc] init];
@@ -1011,7 +1011,7 @@  static void cocoa_refresh(DisplayChangeListener *dcl)
 
     if (kbd_mouse_is_absolute()) {
         if (![cocoaView isAbsoluteEnabled]) {
-            if ([cocoaView isMouseGrabed]) {
+            if ([cocoaView isMouseGrabbed]) {
                 [cocoaView ungrabMouse];
             }
         }