summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>2021-02-18 14:39:46 -0800
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2021-02-18 22:32:14 -0800
commitc2750e1fab774c8e6675ecf284124ff55b5be9cf (patch)
treec6f144d727c8d79dd295e677119caf9b2e18e4e5
parentf51b97b0de2e562e341f2d72c5f00a74c71a159f (diff)
xquartz: Convert X11Application ivars into @properties
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-rw-r--r--hw/xquartz/X11Application.h12
-rw-r--r--hw/xquartz/X11Application.m39
-rw-r--r--hw/xquartz/X11Controller.m2
3 files changed, 19 insertions, 34 deletions
diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index d636a3a69..d3ff4ebd0 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -37,13 +37,10 @@
#import "X11Controller.h"
-@interface X11Application : NSApplication {
- X11Controller *_controller;
+@interface X11Application : NSApplication
- unsigned int _x_active : 1;
-}
-
-- (void)set_controller:controller;
+@property (nonatomic, readwrite, strong) X11Controller *controller;
+@property (nonatomic, readonly, assign) OSX_BOOL x_active;
- (CFPropertyListRef)prefs_get_copy:(NSString *)key CF_RETURNS_RETAINED;
- (int)prefs_get_integer:(NSString *)key default:(int)def;
@@ -59,9 +56,6 @@
- (void)prefs_set_array:(NSString *)key value:(NSArray *)value;
- (void)prefs_set_string:(NSString *)key value:(NSString *)value;
- (void)prefs_synchronize;
-
-- (X11Controller *)controller;
-- (OSX_BOOL)x_active;
@end
extern X11Application * X11App;
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 67c638b6d..1dacea369 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -106,6 +106,10 @@ CFStringRef app_prefs_domain_cfstr = NULL;
- (void) sendX11NSEvent:(NSEvent *)e;
@end
+@interface X11Application ()
+@property (nonatomic, readwrite, assign) OSX_BOOL x_active;
+@end
+
@implementation X11Application
typedef struct message_struct message;
@@ -120,15 +124,9 @@ struct message_struct {
Bool
QuartzModeBundleInit(void);
-- (void) set_controller:obj
-{
- if (_controller == nil) _controller = [obj retain];
-}
-
- (void) dealloc
{
- if (_controller != nil) [_controller release];
-
+ self.controller = nil;
[super dealloc];
}
@@ -158,10 +156,12 @@ QuartzModeBundleInit(void);
- (void) activateX:(OSX_BOOL)state
{
- if (_x_active == state)
+ OSX_BOOL const x_active = self.x_active;
+
+ if (x_active == state)
return;
- DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active);
+ DEBUG_LOG("state=%d, x_active=%d, \n", state, x_active);
if (state) {
if (bgMouseLocationUpdated) {
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
@@ -185,7 +185,7 @@ QuartzModeBundleInit(void);
DarwinSendDDXEvent(kXquartzDeactivate, 0);
}
- _x_active = state;
+ self.x_active = state;
}
- (void) became_key:(NSWindow *)win
@@ -196,6 +196,7 @@ QuartzModeBundleInit(void);
- (void) sendEvent:(NSEvent *)e
{
OSX_BOOL for_appkit, for_x;
+ OSX_BOOL const x_active = self.x_active;
/* By default pass down the responder chain and to X. */
for_appkit = YES;
@@ -211,13 +212,13 @@ QuartzModeBundleInit(void);
if ([e window] != nil) {
/* Pointer event has an (AppKit) window. Probably something for the kit. */
for_x = NO;
- if (_x_active) [self activateX:NO];
+ if (x_active) [self activateX:NO];
}
else if ([self modalWindow] == nil) {
/* Must be an X window. Tell appkit windows to resign main/key */
for_appkit = NO;
- if (!_x_active && quartzProcs->IsX11Window([e windowNumber])) {
+ if (!x_active && quartzProcs->IsX11Window([e windowNumber])) {
if ([self respondsToSelector:@selector(_setKeyWindow:)] && [self respondsToSelector:@selector(_setMainWindow:)]) {
NSWindow *keyWindow = [self keyWindow];
if (keyWindow) {
@@ -434,7 +435,7 @@ QuartzModeBundleInit(void);
- (void) set_apps_menu:(NSArray *)list
{
- [_controller set_apps_menu:list];
+ [self.controller set_apps_menu:list];
}
- (void) set_front_process:unused
@@ -457,7 +458,7 @@ QuartzModeBundleInit(void);
- (void) launch_client:(NSString *)cmd
{
- (void)[_controller application:self openFile:cmd];
+ (void)[self.controller application:self openFile:cmd];
}
/* user preferences */
@@ -867,16 +868,6 @@ cfarray_to_nsarray(CFArrayRef in)
AppleWMCopyToPasteboard);
}
-- (X11Controller *) controller
-{
- return _controller;
-}
-
-- (OSX_BOOL) x_active
-{
- return _x_active;
-}
-
@end
void
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index d489dde5d..1e37fcceb 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -64,7 +64,7 @@ extern char *bundle_id_prefix;
NSArray *array;
/* Point X11Application at ourself. */
- [xapp set_controller:self];
+ xapp.controller = self;
array = [xapp prefs_get_array:@PREFS_APPSMENU];
if (array != nil) {