Repository: godotengine/godot
File: platform/macos/display_server_macos.mm (Objective-C++)

Code before:
		case WINDOW_FLAG_MOUSE_PASSTHROUGH: {
			return wd.mpass;
		} break;
		case WINDOW_FLAG_POPUP: {
			return wd.is_popup;
		} break;
		default: {
		}
	}

	return false;
}

void DisplayServerMacOS::window_request_attention(WindowID p_window) {
	// It's app global, ignore window id.
	[NSApp requestUserAttention:NSCriticalRequest];
}

@interface GodotProgressView : NSView {
	DisplayServer::ProgressState pr_state;
	float pr_value;
	float pr_offset;
}
- (void)setValue:(float)value;
- (void)setState:(DisplayServer::ProgressState)state;
@end

@implementation GodotProgressView

- (id)init {
	self = [super init];
	pr_state = DisplayServer::PROGRESS_STATE_NOPROGRESS;
	pr_value = 0.f;
	pr_offset = 0.f;
	return self;
}

- (void)setValue:(float)value {
	pr_value = value;
}

- (void)setState:(DisplayServer::ProgressState)state {
	pr_state = state;
}

- (void)drawRect:(NSRect)dirtyRect {
	// Icon draw.
	[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
	[[NSApp applicationIconImage] drawInRect:self.bounds];

	if (pr_state == DisplayServer::PROGRESS_STATE_NOPROGRESS) {

Review comment (suggestion):
Ideally, interface and implementation should be moved to separate files:

```obj-c++
/**************************************************************************/
/*  godot_progress_view.h                                                 */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
...

#pragma once

#include "servers/display_server.h"

#import <AppKit/AppKit.h>
#import <Foundation/Foundation.h>

@interface GodotProgressView : NSView {
	DisplayServer::ProgressState pr_state;
	float pr_value;
	float pr_offset;
}
- (void)setValue:(float)value;
- (void)setState:(DisplayServer::ProgressState)state;
@end
```

```obj-c++
/**************************************************************************/
/*  godot_progress_view.mm                                                */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
...

#include "godot_progress_view.h"

@implementation GodotProgressView

- (id)init {
	self = [super init];
	pr_state = DisplayServer::PROGRESS_STATE_NOPROGRESS;
	pr_value = 0.f;
	pr_offset = 0.f;
	return self;
}

- (void)setValue:(float)value {
	pr_value = value;
}

- (void)setState:(DisplayServer::ProgressState)state {
	pr_state = state;
}

- (void)drawRect:(NSRect)dirtyRect {
	// Icon draw.
	[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
	[[NSApp applicationIconImage] drawInRect:self.bounds];

	if (pr_state == DisplayServer::PROGRESS_STATE_NOPROGRESS) {
		return;
	}

	// Border draw.
	NSRect rect = NSMakeRect(1.f, 1.f, self.bounds.size.width - 2.f, 16.f);
	NSBezierPath *bezier_path = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:8.f yRadius:8.f];
	[bezier_path setLineWidth:2.0];
	[[NSColor grayColor] set];
	[bezier_path stroke];

	// Fill clip path.
	rect = NSMakeRect(2.f, 2.f, self.bounds.size.width - 4.f, 14.f);
	bezier_path = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:7.f yRadius:7.f];
	[bezier_path setLineWidth:1.0];
	[bezier_path addClip];

	// Fill draw.
	if (pr_state == DisplayServer::PROGRESS_STATE_INDETERMINATE) {
		rect.size.width /= 5.0;
		pr_offset += rect.size.width / 10.0;
		if (pr_offset > self.bounds.size.width - rect.size.width) {
			pr_offset = 0.f;
		}
		rect.origin.x += pr_offset;
	} else {
		rect.size.width = floor(rect.size.width * pr_value);
	}
	if (pr_state == DisplayServer::PROGRESS_STATE_ERROR) {
		[[NSColor colorWithSRGBRed:1.0 green:0.2 blue:0.2 alpha:1.0] set];
	} else if (pr_state == DisplayServer::PROGRESS_STATE_PAUSED) {
		[[NSColor colorWithSRGBRed:1.0 green:1.0 blue:0.2 alpha:1.0] set];
	} else {
		[[NSColor colorWithSRGBRed:0.2 green:0.6 blue:1.0 alpha:1.0] set];
	}
	NSRectFill(rect);
}

@end
```

And `#include "godot_progress_view.h"` in the `display_server_macos.mm`.

Code after:
#endif
}

void DisplayServerMacOS::window_set_vsync_mode(DisplayServer::VSyncMode p_vsync_mode, WindowID p_window) {
	_THREAD_SAFE_METHOD_
#if defined(GLES3_ENABLED)
	if (gl_manager_angle) {
		gl_manager_angle->set_use_vsync(p_vsync_mode != DisplayServer::VSYNC_DISABLED);
	}
	if (gl_manager_legacy) {
		gl_manager_legacy->set_use_vsync(p_vsync_mode != DisplayServer::VSYNC_DISABLED);
	}
#endif
#if defined(RD_ENABLED)
	if (rendering_context) {
		rendering_context->window_set_vsync_mode(p_window, p_vsync_mode);
	}
#endif
}

DisplayServer::VSyncMode DisplayServerMacOS::window_get_vsync_mode(WindowID p_window) const {
	_THREAD_SAFE_METHOD_
#if defined(GLES3_ENABLED)
	if (gl_manager_angle) {
		return (gl_manager_angle->is_using_vsync() ? DisplayServer::VSyncMode::VSYNC_ENABLED : DisplayServer::VSyncMode::VSYNC_DISABLED);
	}
	if (gl_manager_legacy) {
		return (gl_manager_legacy->is_using_vsync() ? DisplayServer::VSyncMode::VSYNC_ENABLED : DisplayServer::VSyncMode::VSYNC_DISABLED);
	}
#endif
#if defined(RD_ENABLED)
	if (rendering_context) {
		return rendering_context->window_get_vsync_mode(p_window);
	}
#endif
	return DisplayServer::VSYNC_ENABLED;
}

int DisplayServerMacOS::accessibility_should_increase_contrast() const {
	return [(GodotApplicationDelegate *)[[NSApplication sharedApplication] delegate] getHighContrast];
}

int DisplayServerMacOS::accessibility_should_reduce_animation() const {
	return [(GodotApplicationDelegate *)[[NSApplication sharedApplication] delegate] getReduceMotion];
}

int DisplayServerMacOS::accessibility_should_reduce_transparency() const {
	return [(GodotApplicationDelegate *)[[NSApplication sharedApplication] delegate] getReduceTransparency];
}

int DisplayServerMacOS::accessibility_screen_reader_active() const {