Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • core_lib
  • src
  • external
  • macosx
macosxnative.mm
1#include "macosxnative.h"
2
3#include <AppKit/NSWindow.h>
4#include <AppKit/Appkit.h>
5#include <Availability.h>
6
7namespace MacOSXNative
8{
9 #if !defined(MAC_OS_X_VERSION_10_14) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_14
10 NSString* const NSAppearanceNameDarkAqua = @"NSAppearanceNameDarkAqua";
11 #endif
12
13 void removeUnwantedMenuItems()
14 {
15 // Remove "Show Tab Bar" option from the "View" menu if possible
16
17 if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)])
18 {
19 NSWindow.allowsAutomaticWindowTabbing = NO;
20 }
21 }
22
23 bool isMouseCoalescingEnabled()
24 {
25 return NSEvent.isMouseCoalescingEnabled;
26 }
27
28 void setMouseCoalescingEnabled(bool enabled)
29 {
30 NSEvent.mouseCoalescingEnabled = enabled;
31 }
32
33 bool isDarkMode()
34 {
35 if (@available(macOS 10.14, *))
36 {
37 NSAppearanceName appearance =
38 [[NSApp effectiveAppearance] bestMatchFromAppearancesWithNames:@[
39 NSAppearanceNameAqua, NSAppearanceNameDarkAqua
40 ]];
41 return [appearance isEqual:NSAppearanceNameDarkAqua];
42 }
43 return false;
44 }
45}
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39