diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-02-05 14:01:29 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-02-05 14:01:29 +0000 |
commit | 01a9a51ffaf4699827ea6425cb2b834a356e159d (patch) | |
tree | 9e068156b4102402649fcbceb8c3a2e462cfae25 /ui/cocoa.m | |
parent | 1c3d45df5e94042d5fb2bb31416072563ab30e49 (diff) | |
parent | 19c1b9fd3dd5955893c0d3c187a4180313e9a0f1 (diff) |
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20190205-pull-request' into staging
ui: add kbd stats tracker.
ui: gtk scroll fixes.
ui: egl cursor scale fix.
ui: more sdl1 cleanup.
# gpg: Signature made Tue 05 Feb 2019 10:57:42 GMT
# gpg: using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138
* remotes/kraxel/tags/ui-20190205-pull-request:
keymap: fix keyup mappings
keymap: pass full keyboard state to keysym2scancode
kbd-state: use state tracker for vnc
kbd-state: use state tracker for gtk
sdl2: use only QKeyCode in sdl2_process_key()
kbd-state: use state tracker for sdl2
sdl2: remove sdl2_reset_keys() function
kbd-state: add keyboard state tracker
ui/egl-helpers: Augment parameter list of egl_texture_blend() to convey scales of viewport
ui/cocoa.m: Fix macOS 10.14 deprecation warnings
ui/sdl_keysym: Remove obsolete SDL1.2 related code
ui: listen for GDK_SMOOTH_SCROLL events
ui: don't send any event if delta_y == 0
Remove deprecated -no-frame option
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/cocoa.m')
-rw-r--r-- | ui/cocoa.m | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/ui/cocoa.m b/ui/cocoa.m index ddc058e76e..e2567d6946 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -54,6 +54,9 @@ #ifndef MAC_OS_X_VERSION_10_12 #define MAC_OS_X_VERSION_10_12 101200 #endif +#ifndef MAC_OS_X_VERSION_10_13 +#define MAC_OS_X_VERSION_10_13 101300 +#endif /* macOS 10.12 deprecated many constants, #define the new names for older SDKs */ #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 @@ -90,6 +93,14 @@ #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9 #define NSModalResponseOK NSFileHandlingPanelOKButton #endif +/* 10.14 deprecates NSOnState and NSOffState in favor of + * NSControlStateValueOn/Off, which were introduced in 10.13. + * Define for older versions + */ +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13 +#define NSControlStateValueOn NSOnState +#define NSControlStateValueOff NSOffState +#endif //#define DEBUG @@ -377,7 +388,12 @@ QemuCocoaView *cocoaView; COCOA_DEBUG("QemuCocoaView: drawRect\n"); // get CoreGraphic context +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10 CGContextRef viewContextRef = [[NSGraphicsContext currentContext] graphicsPort]; +#else + CGContextRef viewContextRef = [[NSGraphicsContext currentContext] CGContext]; +#endif + CGContextSetInterpolationQuality (viewContextRef, kCGInterpolationNone); CGContextSetShouldAntialias (viewContextRef, NO); @@ -1147,9 +1163,9 @@ QemuCocoaView *cocoaView; { stretch_video = !stretch_video; if (stretch_video == true) { - [sender setState: NSOnState]; + [sender setState: NSControlStateValueOn]; } else { - [sender setState: NSOffState]; + [sender setState: NSControlStateValueOff]; } } @@ -1390,15 +1406,15 @@ QemuCocoaView *cocoaView; { /* Unselect the currently selected item */ for (NSMenuItem *item in [menu itemArray]) { - if (item.state == NSOnState) { - [item setState: NSOffState]; + if (item.state == NSControlStateValueOn) { + [item setState: NSControlStateValueOff]; break; } } } // check the menu item - [sender setState: NSOnState]; + [sender setState: NSControlStateValueOn]; // get the throttle percentage throttle_pct = [sender tag]; @@ -1502,7 +1518,7 @@ int main (int argc, const char * argv[]) { initWithTitle: [NSString stringWithFormat: @"%d%%", percentage] action:@selector(adjustSpeed:) keyEquivalent:@""] autorelease]; if (percentage == 100) { - [menuItem setState: NSOnState]; + [menuItem setState: NSControlStateValueOn]; } /* Calculate the throttle percentage */ |