xquartz: Convert X11Application ivars into @properties
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
(cherry picked from commit c2750e1fab
)
This commit is contained in:
parent
3017fec605
commit
625c7e4dec
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user