summaryrefslogtreecommitdiffstats
path: root/widget/cocoa/nsWindowMap.mm
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /widget/cocoa/nsWindowMap.mm
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'widget/cocoa/nsWindowMap.mm')
-rw-r--r--widget/cocoa/nsWindowMap.mm54
1 files changed, 28 insertions, 26 deletions
diff --git a/widget/cocoa/nsWindowMap.mm b/widget/cocoa/nsWindowMap.mm
index d93f89cb58..6f92adceaf 100644
--- a/widget/cocoa/nsWindowMap.mm
+++ b/widget/cocoa/nsWindowMap.mm
@@ -115,31 +115,31 @@
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
if ((self = [super init])) {
- [[NSNotificationCenter defaultCenter]
+ [NSNotificationCenter.defaultCenter
addObserver:self
selector:@selector(windowBecameKey:)
name:NSWindowDidBecomeKeyNotification
object:inWindow];
- [[NSNotificationCenter defaultCenter]
+ [NSNotificationCenter.defaultCenter
addObserver:self
selector:@selector(windowResignedKey:)
name:NSWindowDidResignKeyNotification
object:inWindow];
- [[NSNotificationCenter defaultCenter]
+ [NSNotificationCenter.defaultCenter
addObserver:self
selector:@selector(windowBecameMain:)
name:NSWindowDidBecomeMainNotification
object:inWindow];
- [[NSNotificationCenter defaultCenter]
+ [NSNotificationCenter.defaultCenter
addObserver:self
selector:@selector(windowResignedMain:)
name:NSWindowDidResignMainNotification
object:inWindow];
- [[NSNotificationCenter defaultCenter]
+ [NSNotificationCenter.defaultCenter
addObserver:self
selector:@selector(windowWillClose:)
name:NSWindowWillCloseNotification
@@ -153,7 +153,7 @@
- (void)dealloc {
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [NSNotificationCenter.defaultCenter removeObserver:self];
[super dealloc];
NS_OBJC_END_TRY_IGNORE_BLOCK;
@@ -171,7 +171,7 @@
+ (void)activateInWindow:(NSWindow*)aWindow {
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
- WindowDelegate* delegate = (WindowDelegate*)[aWindow delegate];
+ WindowDelegate* delegate = (WindowDelegate*)aWindow.delegate;
if (!delegate || ![delegate isKindOfClass:[WindowDelegate class]]) return;
if ([delegate toplevelActiveState]) return;
@@ -191,7 +191,7 @@
+ (void)deactivateInWindow:(NSWindow*)aWindow {
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
- WindowDelegate* delegate = (WindowDelegate*)[aWindow delegate];
+ WindowDelegate* delegate = (WindowDelegate*)aWindow.delegate;
if (!delegate || ![delegate isKindOfClass:[WindowDelegate class]]) return;
if (![delegate toplevelActiveState]) return;
@@ -205,9 +205,10 @@
+ (void)activateInWindowViews:(NSWindow*)aWindow {
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
- id firstResponder = [aWindow firstResponder];
- if ([firstResponder isKindOfClass:[ChildView class]])
+ id firstResponder = aWindow.firstResponder;
+ if ([firstResponder isKindOfClass:[ChildView class]]) {
[firstResponder viewsWindowDidBecomeKey];
+ }
NS_OBJC_END_TRY_IGNORE_BLOCK;
}
@@ -217,9 +218,10 @@
+ (void)deactivateInWindowViews:(NSWindow*)aWindow {
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
- id firstResponder = [aWindow firstResponder];
- if ([firstResponder isKindOfClass:[ChildView class]])
+ id firstResponder = aWindow.firstResponder;
+ if ([firstResponder isKindOfClass:[ChildView class]]) {
[firstResponder viewsWindowDidResignKey];
+ }
NS_OBJC_END_TRY_IGNORE_BLOCK;
}
@@ -230,23 +232,23 @@
// should be sent when a native window becomes key, and the NS_DEACTIVATE
// event should be sent when it resignes key.
- (void)windowBecameKey:(NSNotification*)inNotification {
- NSWindow* window = (NSWindow*)[inNotification object];
+ NSWindow* window = inNotification.object;
- id delegate = [window delegate];
+ id delegate = window.delegate;
if (!delegate || ![delegate isKindOfClass:[WindowDelegate class]]) {
[TopLevelWindowData activateInWindowViews:window];
- } else if ([window isSheet] || [NSApp modalWindow]) {
+ } else if (window.isSheet || NSApp.modalWindow) {
[TopLevelWindowData activateInWindow:window];
}
}
- (void)windowResignedKey:(NSNotification*)inNotification {
- NSWindow* window = (NSWindow*)[inNotification object];
+ NSWindow* window = inNotification.object;
- id delegate = [window delegate];
+ id delegate = window.delegate;
if (!delegate || ![delegate isKindOfClass:[WindowDelegate class]]) {
[TopLevelWindowData deactivateInWindowViews:window];
- } else if ([window isSheet] || [NSApp modalWindow]) {
+ } else if (window.isSheet || NSApp.modalWindow) {
[TopLevelWindowData deactivateInWindow:window];
}
}
@@ -255,24 +257,24 @@
// state). So (for non-embedders) we need to ensure that a top-level window
// is main when an NS_ACTIVATE event is sent to Gecko for it.
- (void)windowBecameMain:(NSNotification*)inNotification {
- NSWindow* window = (NSWindow*)[inNotification object];
-
- id delegate = [window delegate];
+ NSWindow* window = inNotification.object;
+ id delegate = window.delegate;
// Don't send events to a top-level window that has a sheet/modal-window open
// above it -- as far as Gecko is concerned, it's inactive, and stays so until
// the sheet/modal-window closes.
if (delegate && [delegate isKindOfClass:[WindowDelegate class]] &&
- ![window attachedSheet] && ![NSApp modalWindow])
+ !window.attachedSheet && !NSApp.modalWindow) {
[TopLevelWindowData activateInWindow:window];
+ }
}
- (void)windowResignedMain:(NSNotification*)inNotification {
- NSWindow* window = (NSWindow*)[inNotification object];
-
- id delegate = [window delegate];
+ NSWindow* window = inNotification.object;
+ id delegate = window.delegate;
if (delegate && [delegate isKindOfClass:[WindowDelegate class]] &&
- ![window attachedSheet] && ![NSApp modalWindow])
+ ![window attachedSheet] && ![NSApp modalWindow]) {
[TopLevelWindowData deactivateInWindow:window];
+ }
}
- (void)windowWillClose:(NSNotification*)inNotification {