macOs: Fix build fix for tab view

Fix the build for displaying the tabs wrongly on mac

Change-Id: I58265b7cf9a4758885ef1add13417c42a467be9d
Reviewed-on: https://code.wireshark.org/review/30462
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Roland Knall 2018-11-01 12:09:02 +01:00
parent 7306e2b8ee
commit 5769a72963
2 changed files with 39 additions and 2 deletions

View File

@ -11,6 +11,7 @@
*/
#include <ui/macosx/cocoa_bridge.h>
#include <ui/macosx/macos_compat.h>
#import <Cocoa/Cocoa.h>
@ -20,8 +21,8 @@ void CocoaBridge::cleanOSGeneratedMenuItems()
// Remove (don't allow) the "Show Tab Bar" menu item from the "View" menu, if
// supported
if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)])
NSWindow.allowsAutomaticWindowTabbing = NO;
if ([NSWindow respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)])
[NSWindow setAllowsAutomaticWindowTabbing: NO];
#endif
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];

36
ui/macosx/macos_compat.h Normal file
View File

@ -0,0 +1,36 @@
/* cocoa_bridge.h
*
* This code was taken directly from:
* https://forum.qt.io/topic/82609/remove-native-mac-menu-items-such-as-show-tab-bar
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef MACOS_COMPAT_H
#define MACOS_COMPAT_H
#import <Cocoa/Cocoa.h>
#if !defined(MAC_OS_X_VERSION_10_9)
# define MAC_OS_X_VERSION_10_9 1090
#endif
#if !defined(MAC_OS_X_VERSION_10_10)
# define MAC_OS_X_VERSION_10_10 101000
#endif
#if !defined(MAC_OS_X_VERSION_10_12)
# define MAC_OS_X_VERSION_10_12 101200
#endif
#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12)
@interface NSWindow (macOS10_12_SDK)
+ (void)setAllowsAutomaticWindowTabbing:(BOOL)allow;
@end
#endif
#endif // MACOS_COMPAT_H