xserver: Branch 'xorg-server-1.5-apple' - 7 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Thu Oct 23 14:16:40 PDT 2008
hw/xquartz/X11Application.m | 10 +-
hw/xquartz/bundle/Resources/English.lproj/Localizable.strings |binary
hw/xquartz/darwin.c | 2
hw/xquartz/pbproxy/app-main.m | 17 ++-
hw/xquartz/pbproxy/main.m | 13 +-
hw/xquartz/pbproxy/pbproxy.h | 8 +
hw/xquartz/pbproxy/x-input.m | 20 ++--
hw/xquartz/pbproxy/x-selection.m | 3
mi/mieq.c | 47 +++++-----
miext/rootless/rootlessScreen.c | 3
10 files changed, 76 insertions(+), 47 deletions(-)
New commits:
commit ea8cc7c7c513079a788c881a7b07360ceaabcb01
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Thu Oct 23 14:08:30 2008 -0700
mi: Avoid possible deadlock in miEq
When the handler for an event requires sending a message to another thread that is waiting for the miEq mutex.
(cherry picked from commit d7d4cd30039992548bc298c9366fa51a6441ac17)
diff --git a/mi/mieq.c b/mi/mieq.c
index f49074e..a67e78f 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -232,7 +232,7 @@ mieqSetHandler(int event, mieqHandler handler)
void
mieqProcessInputEvents(void)
{
- EventRec *e = NULL;
+ EventRec e;
int x = 0, y = 0;
DeviceIntPtr dev = NULL;
@@ -251,45 +251,46 @@ mieqProcessInputEvents(void)
DPMSSet(serverClient, DPMSModeOn);
#endif
- e = &miEventQueue.events[miEventQueue.head];
+ memcpy(&e, &miEventQueue.events[miEventQueue.head], sizeof(EventRec));
miEventQueue.head = (miEventQueue.head + 1) % QUEUE_SIZE;
- if (miEventQueue.handlers[e->event->u.u.type]) {
+#ifdef XQUARTZ
+ pthread_mutex_unlock(&miEventQueueMutex);
+#endif
+
+ if (miEventQueue.handlers[e.event->u.u.type]) {
/* If someone's registered a custom event handler, let them
* steal it. */
- miEventQueue.handlers[e->event->u.u.type](miEventQueue.pDequeueScreen->myNum,
- e->event, dev,
- e->nevents);
+ miEventQueue.handlers[e.event->u.u.type](e.pScreen->myNum,
+ e.event, e.pDev,
+ e.nevents);
}
- else if (e->pScreen != miEventQueue.pDequeueScreen) {
+ else if (e.pScreen != miEventQueue.pDequeueScreen) {
/* Assumption - screen switching can only occur on motion events. */
- miEventQueue.pDequeueScreen = e->pScreen;
- x = e->event[0].u.keyButtonPointer.rootX;
- y = e->event[0].u.keyButtonPointer.rootY;
- NewCurrentScreen (miEventQueue.pDequeueScreen, x, y);
+ miEventQueue.pDequeueScreen = e.pScreen;
+ x = e.event[0].u.keyButtonPointer.rootX;
+ y = e.event[0].u.keyButtonPointer.rootY;
+ NewCurrentScreen(e.pScreen, x, y);
}
else {
/* If this is a core event, make sure our keymap, et al, is
* changed to suit. */
- if (e->event[0].u.u.type == KeyPress ||
- e->event[0].u.u.type == KeyRelease) {
- SwitchCoreKeyboard(e->pDev);
+ if (e.event[0].u.u.type == KeyPress ||
+ e.event[0].u.u.type == KeyRelease) {
+ SwitchCoreKeyboard(e.pDev);
dev = inputInfo.keyboard;
}
- else if (e->event[0].u.u.type == MotionNotify ||
- e->event[0].u.u.type == ButtonPress ||
- e->event[0].u.u.type == ButtonRelease) {
- SwitchCorePointer(e->pDev);
+ else if (e.event[0].u.u.type == MotionNotify ||
+ e.event[0].u.u.type == ButtonPress ||
+ e.event[0].u.u.type == ButtonRelease) {
+ SwitchCorePointer(e.pDev);
dev = inputInfo.pointer;
}
else {
- dev = e->pDev;
+ dev = e.pDev;
}
- dev->public.processInputProc(e->event, dev, e->nevents);
+ dev->public.processInputProc(e.event, dev, e.nevents);
}
}
-#ifdef XQUARTZ
- pthread_mutex_unlock(&miEventQueueMutex);
-#endif
}
commit 524dc8cb61edb58fb1f56999f22bb7a93511b565
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Thu Oct 23 11:41:22 2008 -0700
XQuartz: Comment explaining the 0x10 flag for [e data2]
(cherry picked from commit 3c695280641c1205b97d3bb9f1d5e15a19cfa45f)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 00c2c3c..f5b3aa2 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -302,7 +302,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
if(!ok)
switch_on_activate = YES;
- if ([e data2] & 0x10 && switch_on_activate)
+ if ([e data2] & 0x10 && switch_on_activate) // 0x10 is set when we use cmd-tab or the dock icon
DarwinSendDDXEvent(kXquartzBringAllToFront, 0);
}
break;
commit b64ffaaf28faf51b74808c8f8e49683b7778b2f9
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Thu Oct 23 11:39:04 2008 -0700
Rootless: Properly typed expose_1
(cherry picked from commit 78e874fe17174ac8f61586573edaf7f16ece7b21)
diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c
index 2f536ed..87d4c1c 100644
--- a/miext/rootless/rootlessScreen.c
+++ b/miext/rootless/rootlessScreen.c
@@ -471,8 +471,7 @@ RootlessMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst,
return result;
}
-expose_1 (WindowPtr pWin)
-{
+void expose_1 (WindowPtr pWin) {
WindowPtr pChild;
if (!pWin->realized)
commit 43d0bd6354daa7d07a700620520b7ed3785a3e9c
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Thu Oct 23 11:37:13 2008 -0700
XQuartz: Honor the Spaces preference for "When switching to an application, switch to a space with open windows for the application"
(cherry picked from commit bf561a06b2bf60395d26026ac7627d0cb254bc07)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index c1a5194..00c2c3c 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -294,7 +294,15 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
_appFlags._active = YES;
[self activateX:YES];
- if ([e data2] & 0x10)
+
+ /* Get the Spaces preference for SwitchOnActivate */
+ (void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences"));
+ BOOL switch_on_activate, ok;
+ switch_on_activate = CFPreferencesGetAppBooleanValue(CFSTR("AppleSpacesSwitchOnActivate"), CFSTR(".GlobalPreferences"), &ok);
+ if(!ok)
+ switch_on_activate = YES;
+
+ if ([e data2] & 0x10 && switch_on_activate)
DarwinSendDDXEvent(kXquartzBringAllToFront, 0);
}
break;
commit a1b7a04c6690019564a73a2f98e570f3d810e8fc
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Oct 21 19:36:48 2008 -0700
XQuartz: Added missing semicolons to Localizable.strings
(cherry picked from commit e9fe3f36d9529f00daeefa1379cdd6f01a88f410)
diff --git a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings
index dc19fc9..fec942e 100644
Binary files a/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings and b/hw/xquartz/bundle/Resources/English.lproj/Localizable.strings differ
commit 1519cffe1ce2078d10b7e6b4125b4ee9c5b089a8
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Oct 21 11:23:42 2008 -0700
XQuartz: Default dpi to 96 instead of 75
(cherry picked from commit 08a5a333d7fea68146cd9cf50682b811378ab3ce)
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 3269f26..6496bcd 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -234,7 +234,7 @@ static Bool DarwinAddScreen(int index, ScreenPtr pScreen, int argc, char **argv)
if (monitorResolution)
dpi = monitorResolution;
else
- dpi = 75;
+ dpi = 96;
// initialize fb
if (! fbScreenInit(pScreen,
commit 7e6f91e90a547c2df156fc37f45c8aa7e03f2bf6
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Tue Oct 21 11:19:06 2008 -0700
XQuartz: pbproxy: SIGHUP reloads preferences.
(cherry picked from commit cbc0935ef74ebd76ed3db16d6ab86043eeed42a3)
diff --git a/hw/xquartz/pbproxy/app-main.m b/hw/xquartz/pbproxy/app-main.m
index 3dfdcb4..4fb5ea0 100644
--- a/hw/xquartz/pbproxy/app-main.m
+++ b/hw/xquartz/pbproxy/app-main.m
@@ -10,8 +10,16 @@
#include <unistd.h> /*for getpid*/
#include <Cocoa/Cocoa.h>
+BOOL prefs_reload = NO;
+
static void signal_handler (int sig) {
- _exit(0);
+ switch(sig) {
+ case SIGHUP:
+ prefs_reload = YES;
+ break;
+ default:
+ _exit(EXIT_SUCCESS);
+ }
}
int main (int argc, const char *argv[]) {
@@ -19,15 +27,16 @@ int main (int argc, const char *argv[]) {
printf("pid: %u\n", getpid());
#endif
- if(x_init () !=0)
- return 1;
+ if(!x_init())
+ return EXIT_FAILURE;
signal (SIGINT, signal_handler);
signal (SIGTERM, signal_handler);
+ signal (SIGHUP, signal_handler);
signal (SIGPIPE, SIG_IGN);
[NSApplication sharedApplication];
[NSApp run];
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/hw/xquartz/pbproxy/main.m b/hw/xquartz/pbproxy/main.m
index ded18e1..231b212 100644
--- a/hw/xquartz/pbproxy/main.m
+++ b/hw/xquartz/pbproxy/main.m
@@ -34,13 +34,13 @@ static int x_error_handler (Display *dpy, XErrorEvent *errevent) {
return 0;
}
-int x_init (void) {
+BOOL x_init (void) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
x_dpy = XOpenDisplay (NULL);
if (x_dpy == NULL) {
fprintf (stderr, "can't open default display\n");
- return 1;
+ return FALSE;
}
XSetIOErrorHandler (x_io_error_handler);
@@ -49,7 +49,7 @@ int x_init (void) {
if (!XAppleWMQueryExtension (x_dpy, &x_apple_wm_event_base,
&x_apple_wm_error_base)) {
fprintf (stderr, "can't open AppleWM server extension\n");
- return 1;
+ return FALSE;
}
have_xfixes = XFixesQueryExtension(x_dpy, &x_xfixes_event_base, &x_xfixes_error_base);
@@ -59,12 +59,13 @@ int x_init (void) {
_selection_object = [[x_selection alloc] init];
- x_input_register ();
- x_input_run ();
+ if(!x_input_register())
+ return FALSE;
+ x_input_run();
[pool release];
- return 0;
+ return TRUE;
}
id x_selection_object (void) {
diff --git a/hw/xquartz/pbproxy/pbproxy.h b/hw/xquartz/pbproxy/pbproxy.h
index 5d4652b..1b0ed2b 100644
--- a/hw/xquartz/pbproxy/pbproxy.h
+++ b/hw/xquartz/pbproxy/pbproxy.h
@@ -16,12 +16,16 @@
#define DEBUG 0
#endif
+#ifndef INTEGRATED_XPBPROXY
+extern BOOL prefs_reload;
+#endif
+
/* from main.m */
extern void x_set_is_active (BOOL state);
extern BOOL x_get_is_active (void);
extern id x_selection_object (void);
extern Time x_current_timestamp (void);
-extern int x_init (void);
+extern BOOL x_init (void);
extern Display *x_dpy;
extern int x_apple_wm_event_base, x_apple_wm_error_base;
@@ -29,7 +33,7 @@ extern int x_xfixes_event_base, x_xfixes_error_base;
extern BOOL have_xfixes;
/* from x-input.m */
-extern void x_input_register (void);
+extern BOOL x_input_register (void);
extern void x_input_run (void);
#if DEBUG == 0
diff --git a/hw/xquartz/pbproxy/x-input.m b/hw/xquartz/pbproxy/x-input.m
index b34c39a..e091ef1 100644
--- a/hw/xquartz/pbproxy/x-input.m
+++ b/hw/xquartz/pbproxy/x-input.m
@@ -102,7 +102,7 @@ void x_input_run (void) {
[pool release];
}
-static int add_input_socket (int sock, CFOptionFlags callback_types,
+static BOOL add_input_socket (int sock, CFOptionFlags callback_types,
CFSocketCallBack callback, const CFSocketContext *ctx,
CFRunLoopSourceRef *cf_source) {
CFSocketRef cf_sock;
@@ -128,12 +128,18 @@ static int add_input_socket (int sock, CFOptionFlags callback_types,
static void x_input_callback (CFSocketRef sock, CFSocketCallBackType type,
CFDataRef address, const void *data, void *info) {
- x_input_run ();
-}
-void x_input_register(void) {
- if (!add_input_socket (ConnectionNumber (x_dpy), kCFSocketReadCallBack,
- x_input_callback, NULL, &x_dpy_source)) {
- exit (1);
+#ifndef INTEGRATED_XPBPROXY
+ if(prefs_reload) {
+ [x_selection_object() reload_preferences];
+ prefs_reload = NO;
}
+#endif
+
+ x_input_run();
+}
+
+BOOL x_input_register(void) {
+ return add_input_socket(ConnectionNumber(x_dpy), kCFSocketReadCallBack,
+ x_input_callback, NULL, &x_dpy_source);
}
diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m
index 16c4d52..304bee7 100644
--- a/hw/xquartz/pbproxy/x-selection.m
+++ b/hw/xquartz/pbproxy/x-selection.m
@@ -78,6 +78,7 @@ static struct {
static struct propdata null_propdata = {NULL, 0};
+#ifdef DEBUG
static void
dump_prefs (FILE *fp) {
fprintf(fp,
@@ -93,7 +94,7 @@ dump_prefs (FILE *fp) {
pbproxy_prefs.pasteboard_to_primary,
pbproxy_prefs.pasteboard_to_clipboard);
}
-
+#endif
#define APP_PREFS "org.x.X11"
static BOOL
More information about the xorg-commit
mailing list