mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
impr: Hide window on macOS when close button is pressed
This commit is contained in:
@@ -48,6 +48,17 @@
|
||||
return [[NSScreen mainScreen] backingScaleFactor];
|
||||
}
|
||||
|
||||
void macOSCloseButtonPressed(void);
|
||||
|
||||
@interface CloseButtonHandler : NSObject
|
||||
@end
|
||||
|
||||
@implementation CloseButtonHandler
|
||||
- (void)pressed:(id)sender {
|
||||
macOSCloseButtonPressed();
|
||||
}
|
||||
@end
|
||||
|
||||
void setupMacosWindowStyle(GLFWwindow *window, bool borderlessWindowMode) {
|
||||
NSWindow* cocoaWindow = glfwGetCocoaWindow(window);
|
||||
|
||||
@@ -61,6 +72,10 @@
|
||||
[cocoaWindow setHasShadow:YES];
|
||||
[cocoaWindow setBackgroundColor:[NSColor colorWithWhite: 0 alpha: 0.001f]];
|
||||
}
|
||||
|
||||
NSButton *closeButton = [cocoaWindow standardWindowButton:NSWindowCloseButton];
|
||||
[closeButton setAction:@selector(pressed:)];
|
||||
[closeButton setTarget:[CloseButtonHandler alloc]];
|
||||
}
|
||||
|
||||
bool isMacosFullScreenModeEnabled(GLFWwindow *window) {
|
||||
|
||||
Reference in New Issue
Block a user