xquartz: Convert X11Application ivars into @properties
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
This commit is contained in:
parent
f51b97b0de
commit
c2750e1fab
|
@ -37,13 +37,10 @@
|
||||||
|
|
||||||
#import "X11Controller.h"
|
#import "X11Controller.h"
|
||||||
|
|
||||||
@interface X11Application : NSApplication {
|
@interface X11Application : NSApplication
|
||||||
X11Controller *_controller;
|
|
||||||
|
|
||||||
unsigned int _x_active : 1;
|
@property (nonatomic, readwrite, strong) X11Controller *controller;
|
||||||
}
|
@property (nonatomic, readonly, assign) OSX_BOOL x_active;
|
||||||
|
|
||||||
- (void)set_controller:controller;
|
|
||||||
|
|
||||||
- (CFPropertyListRef)prefs_get_copy:(NSString *)key CF_RETURNS_RETAINED;
|
- (CFPropertyListRef)prefs_get_copy:(NSString *)key CF_RETURNS_RETAINED;
|
||||||
- (int)prefs_get_integer:(NSString *)key default:(int)def;
|
- (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_array:(NSString *)key value:(NSArray *)value;
|
||||||
- (void)prefs_set_string:(NSString *)key value:(NSString *)value;
|
- (void)prefs_set_string:(NSString *)key value:(NSString *)value;
|
||||||
- (void)prefs_synchronize;
|
- (void)prefs_synchronize;
|
||||||
|
|
||||||
- (X11Controller *)controller;
|
|
||||||
- (OSX_BOOL)x_active;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
extern X11Application * X11App;
|
extern X11Application * X11App;
|
||||||
|
|
|
@ -106,6 +106,10 @@ CFStringRef app_prefs_domain_cfstr = NULL;
|
||||||
- (void) sendX11NSEvent:(NSEvent *)e;
|
- (void) sendX11NSEvent:(NSEvent *)e;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface X11Application ()
|
||||||
|
@property (nonatomic, readwrite, assign) OSX_BOOL x_active;
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation X11Application
|
@implementation X11Application
|
||||||
|
|
||||||
typedef struct message_struct message;
|
typedef struct message_struct message;
|
||||||
|
@ -120,15 +124,9 @@ struct message_struct {
|
||||||
Bool
|
Bool
|
||||||
QuartzModeBundleInit(void);
|
QuartzModeBundleInit(void);
|
||||||
|
|
||||||
- (void) set_controller:obj
|
|
||||||
{
|
|
||||||
if (_controller == nil) _controller = [obj retain];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
if (_controller != nil) [_controller release];
|
self.controller = nil;
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,10 +156,12 @@ QuartzModeBundleInit(void);
|
||||||
|
|
||||||
- (void) activateX:(OSX_BOOL)state
|
- (void) activateX:(OSX_BOOL)state
|
||||||
{
|
{
|
||||||
if (_x_active == state)
|
OSX_BOOL const x_active = self.x_active;
|
||||||
|
|
||||||
|
if (x_active == state)
|
||||||
return;
|
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 (state) {
|
||||||
if (bgMouseLocationUpdated) {
|
if (bgMouseLocationUpdated) {
|
||||||
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
|
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
|
||||||
|
@ -185,7 +185,7 @@ QuartzModeBundleInit(void);
|
||||||
DarwinSendDDXEvent(kXquartzDeactivate, 0);
|
DarwinSendDDXEvent(kXquartzDeactivate, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_x_active = state;
|
self.x_active = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) became_key:(NSWindow *)win
|
- (void) became_key:(NSWindow *)win
|
||||||
|
@ -196,6 +196,7 @@ QuartzModeBundleInit(void);
|
||||||
- (void) sendEvent:(NSEvent *)e
|
- (void) sendEvent:(NSEvent *)e
|
||||||
{
|
{
|
||||||
OSX_BOOL for_appkit, for_x;
|
OSX_BOOL for_appkit, for_x;
|
||||||
|
OSX_BOOL const x_active = self.x_active;
|
||||||
|
|
||||||
/* By default pass down the responder chain and to X. */
|
/* By default pass down the responder chain and to X. */
|
||||||
for_appkit = YES;
|
for_appkit = YES;
|
||||||
|
@ -211,13 +212,13 @@ QuartzModeBundleInit(void);
|
||||||
if ([e window] != nil) {
|
if ([e window] != nil) {
|
||||||
/* Pointer event has an (AppKit) window. Probably something for the kit. */
|
/* Pointer event has an (AppKit) window. Probably something for the kit. */
|
||||||
for_x = NO;
|
for_x = NO;
|
||||||
if (_x_active) [self activateX:NO];
|
if (x_active) [self activateX:NO];
|
||||||
}
|
}
|
||||||
else if ([self modalWindow] == nil) {
|
else if ([self modalWindow] == nil) {
|
||||||
/* Must be an X window. Tell appkit windows to resign main/key */
|
/* Must be an X window. Tell appkit windows to resign main/key */
|
||||||
for_appkit = NO;
|
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:)]) {
|
if ([self respondsToSelector:@selector(_setKeyWindow:)] && [self respondsToSelector:@selector(_setMainWindow:)]) {
|
||||||
NSWindow *keyWindow = [self keyWindow];
|
NSWindow *keyWindow = [self keyWindow];
|
||||||
if (keyWindow) {
|
if (keyWindow) {
|
||||||
|
@ -434,7 +435,7 @@ QuartzModeBundleInit(void);
|
||||||
|
|
||||||
- (void) set_apps_menu:(NSArray *)list
|
- (void) set_apps_menu:(NSArray *)list
|
||||||
{
|
{
|
||||||
[_controller set_apps_menu:list];
|
[self.controller set_apps_menu:list];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) set_front_process:unused
|
- (void) set_front_process:unused
|
||||||
|
@ -457,7 +458,7 @@ QuartzModeBundleInit(void);
|
||||||
|
|
||||||
- (void) launch_client:(NSString *)cmd
|
- (void) launch_client:(NSString *)cmd
|
||||||
{
|
{
|
||||||
(void)[_controller application:self openFile:cmd];
|
(void)[self.controller application:self openFile:cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* user preferences */
|
/* user preferences */
|
||||||
|
@ -867,16 +868,6 @@ cfarray_to_nsarray(CFArrayRef in)
|
||||||
AppleWMCopyToPasteboard);
|
AppleWMCopyToPasteboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (X11Controller *) controller
|
|
||||||
{
|
|
||||||
return _controller;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (OSX_BOOL) x_active
|
|
||||||
{
|
|
||||||
return _x_active;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -64,7 +64,7 @@ extern char *bundle_id_prefix;
|
||||||
NSArray *array;
|
NSArray *array;
|
||||||
|
|
||||||
/* Point X11Application at ourself. */
|
/* Point X11Application at ourself. */
|
||||||
[xapp set_controller:self];
|
xapp.controller = self;
|
||||||
|
|
||||||
array = [xapp prefs_get_array:@PREFS_APPSMENU];
|
array = [xapp prefs_get_array:@PREFS_APPSMENU];
|
||||||
if (array != nil) {
|
if (array != nil) {
|
||||||
|
|
Loading…
Reference in New Issue