xserver: Branch 'master' - 6 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Fri Jul 11 10:13:45 PDT 2008
hw/xquartz/X11Application.m | 6 ++++
hw/xquartz/darwinEvents.c | 49 ++++++++++++++++++++++++----------
hw/xquartz/darwinEvents.h | 3 ++
hw/xquartz/mach-startup/bundle-main.c | 25 +++++++++++++++--
hw/xquartz/mach-startup/stub.c | 33 +++++++++++++++++-----
hw/xquartz/pseudoramiX.c | 4 --
hw/xquartz/quartzCocoa.m | 4 --
hw/xquartz/quartzKeyboard.c | 40 +++++++++++++--------------
hw/xquartz/quartzStartup.c | 1
include/servermd.h | 2 -
10 files changed, 112 insertions(+), 55 deletions(-)
New commits:
commit c3267106fb599213555829cb76df7848c4ebe23b
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Wed Jul 9 10:02:41 2008 -0700
XQuartz: Use CFEqual to compare keyboards
(cherry picked from commit 5538e43b9ae7d06d2f48842b065810ce74286eb6)
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 40d8cbb..5e7a13c 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -1087,16 +1087,26 @@ Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
return 1;
}
+/* TODO: Not thread safe */
unsigned int QuartzSystemKeymapSeed(void) {
- static unsigned int seed;
- static TISInputSourceRef last_key_layout;
+ static unsigned int seed = 0;
+ static TISInputSourceRef last_key_layout = NULL;
TISInputSourceRef key_layout;
key_layout = TISCopyCurrentKeyboardLayoutInputSource();
- if (key_layout != last_key_layout) seed++;
- last_key_layout = key_layout;
-
+ if(last_key_layout) {
+ if (CFEqual(key_layout, last_key_layout)) {
+ CFRelease(key_layout);
+ } else {
+ seed++;
+ CFRelease(last_key_layout);
+ last_key_layout = key_layout;
+ }
+ } else {
+ last_key_layout = key_layout;
+ }
+
return seed;
}
commit 90dd2de845ae12153296f6f1bff0c87f79c57854
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Mon Jul 7 10:55:58 2008 -0700
XQuartz: Some fd handoff cleanup.
(cherry picked from commit 9c20a4804d97e67a988f00f49866997209cce518)
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index c6c9c59..1f90b24 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -202,6 +202,12 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
for_appkit = YES;
for_x = YES;
+// fprintf(stderr, "fd_add_count: %d\n", fd_add_count);
+ if(fd_add_count) {
+ DarwinProcessFDAdditionQueue();
+ fprintf(stderr, "ran it - fd_add_count: %d\n", fd_add_count);
+ }
+
switch (type) {
case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 911aac7..900ee43 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -79,6 +79,11 @@ void QuartzModeEQInit(void);
static int old_flags = 0; // last known modifier state
+#define FD_ADD_MAX 128
+static int fd_add[FD_ADD_MAX];
+int fd_add_count = 0;
+static pthread_mutex_t fd_add_lock = PTHREAD_MUTEX_INITIALIZER;
+
static xEvent *darwinEvents = NULL;
static pthread_mutex_t mieq_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -232,15 +237,6 @@ static void DarwinSimulateMouseClick(
DarwinUpdateModifiers(KeyPress, modifierMask);
}
-static void kXquartzListenOnOpenFDHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
- size_t i;
- TA_SERVER();
-
- for (i=0; i<nevents; i++) {
- ListenOnOpenFD(xe[i].u.clientMessage.u.l.longs0);
- }
-}
-
/* Generic handler for Xquartz-specifc events. When possible, these should
be moved into their own individual functions and set as handlers using
mieqSetHandler. */
@@ -249,7 +245,7 @@ static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, in
int i;
TA_SERVER();
-
+
DEBUG_LOG("DarwinEventHandler(%d, %p, %p, %d)\n", screenNum, xe, dev, nevents);
for (i=0; i<nevents; i++) {
switch(xe[i].u.u.type) {
@@ -331,6 +327,35 @@ static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, in
}
}
+void DarwinListenOnOpenFD(int fd) {
+ ErrorF("DarwinListenOnOpenFD: %d\n", fd);
+
+ pthread_mutex_lock(&fd_add_lock);
+ if(fd_add_count < FD_ADD_MAX)
+ fd_add[fd_add_count++] = fd;
+ else
+ ErrorF("FD Addition buffer at max. Dropping fd addition request.\n");
+
+ pthread_mutex_unlock(&fd_add_lock);
+}
+
+void DarwinProcessFDAdditionQueue() {
+ pthread_mutex_lock(&fd_add_lock);
+ while(fd_add_count) {
+ DarwinSendDDXEvent(kXquartzListenOnOpenFD, 1, fd_add[--fd_add_count]);
+ }
+ pthread_mutex_unlock(&fd_add_lock);
+}
+
+static void kXquartzListenOnOpenFDHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents) {
+ size_t i;
+ TA_SERVER();
+
+ for (i=0; i<nevents; i++) {
+ ListenOnOpenFD(xe[i].u.clientMessage.u.l.longs0);
+ }
+}
+
Bool DarwinEQInit(void) {
mieqInit();
mieqSetHandler(kXquartzReloadKeymap, DarwinKeyboardReloadHandler);
@@ -576,10 +601,6 @@ void DarwinUpdateModKeys(int flags) {
old_flags = flags;
}
-void DarwinListenOnOpenFD(int fd) {
- DarwinSendDDXEvent(kXquartzListenOnOpenFD, 1, fd);
-}
-
/*
* DarwinSendDDXEvent
* Send the X server thread a message by placing it on the event queue.
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 7a1e8ca..747dccb 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -41,6 +41,9 @@ void DarwinSendScrollEvents(float count_x, float count_y, int pointer_x, int poi
void DarwinUpdateModKeys(int flags);
void DarwinListenOnOpenFD(int fd);
+extern int fd_add_count;
+void DarwinProcessFDAdditionQueue(void);
+
/*
* Special ddx events understood by the X server
*/
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index de92361..9894ae8 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -57,6 +57,8 @@ extern int noPanoramiXExtension;
#define DEFAULT_STARTX "/usr/X11/bin/startx"
#define DEFAULT_SHELL "/bin/sh"
+#define DEBUG 1
+
static int execute(const char *command);
static char *command_from_prefs(const char *key, const char *default_value);
@@ -198,8 +200,8 @@ static void socket_handoff_thread(void *arg) {
servaddr_len = sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) + strlen(filename);
handoff_fd = socket(AF_UNIX, SOCK_STREAM, 0);
- if(handoff_fd == 0) {
- fprintf(stderr, "Failed to create socket: %s - %s\n", filename, strerror(errno));
+ if(handoff_fd == -1) {
+ fprintf(stderr, "X11.app: Failed to create socket: %d - %s\n", errno, strerror(errno));
data->retval = EXIT_FAILURE;
pthread_cond_broadcast(&data->cond);
@@ -213,7 +215,7 @@ static void socket_handoff_thread(void *arg) {
pthread_mutex_unlock(&data->lock);
if(connect(handoff_fd, servaddr, servaddr_len) < 0) {
- fprintf(stderr, "Failed to connect to socket: %s - %s\n", filename, strerror(errno));
+ fprintf(stderr, "X11.app: Failed to connect to socket: %s - %d - %s\n", filename, errno, strerror(errno));
return;
}
@@ -226,6 +228,10 @@ static void socket_handoff_thread(void *arg) {
kern_return_t do_prep_fd_handoff(mach_port_t port, string_t socket_filename) {
handoff_data_t handoff_data;
+#ifdef DEBUG
+ fprintf(stderr, "X11.app: Prepping for fd handoff.\n");
+#endif
+
/* Initialize our data */
pthread_mutex_init(&handoff_data.lock, NULL);
pthread_cond_init(&handoff_data.cond, NULL);
@@ -235,6 +241,10 @@ kern_return_t do_prep_fd_handoff(mach_port_t port, string_t socket_filename) {
create_thread(socket_handoff_thread, &handoff_data);
+#ifdef DEBUG
+ fprintf(stderr, "X11.app: Thread created for handoff. Waiting on return value.\n");
+#endif
+
/* Wait for our return value */
pthread_cond_wait(&handoff_data.cond, &handoff_data.lock);
pthread_mutex_unlock(&handoff_data.lock);
@@ -242,6 +252,10 @@ kern_return_t do_prep_fd_handoff(mach_port_t port, string_t socket_filename) {
/* Cleanup */
pthread_cond_destroy(&handoff_data.cond);
pthread_mutex_destroy(&handoff_data.lock);
+
+#ifdef DEBUG
+ fprintf(stderr, "X11.app: Sending return value: %d\n", handoff_data.retval);
+#endif
return handoff_data.retval;
}
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index d7b248b..9928aa9 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -57,6 +57,8 @@
#define XSERVER_VERSION "?"
#endif
+#define DEBUG 1
+
static char x11_path[PATH_MAX + 1];
static void set_x11_path() {
@@ -132,23 +134,27 @@ static int create_socket(char *filename_out) {
servaddr_len = sizeof(struct sockaddr_un) - sizeof(servaddr_un.sun_path) + strlen(filename_out);
ret_fd = socket(PF_UNIX, SOCK_STREAM, 0);
- if(ret_fd == 0) {
- fprintf(stderr, "Failed to create socket (try %d / %d): %s - %s\n", (int)try+1, (int)try_max, filename_out, strerror(errno));
+ if(ret_fd == -1) {
+ fprintf(stderr, "Xquartz: Failed to create socket (try %d / %d): %s - %s\n", (int)try+1, (int)try_max, filename_out, strerror(errno));
continue;
}
if(bind(ret_fd, servaddr, servaddr_len) != 0) {
- fprintf(stderr, "Failed to bind socket: %s - %s\n", filename_out, strerror(errno));
+ fprintf(stderr, "Xquartz: Failed to bind socket: %d - %s\n", errno, strerror(errno));
close(ret_fd);
return 0;
}
if(listen(ret_fd, 10) != 0) {
- fprintf(stderr, "Failed to listen to socket: %s - %s\n", filename_out, strerror(errno));
+ fprintf(stderr, "Xquartz: Failed to listen to socket: %s - %d - %s\n", filename_out, errno, strerror(errno));
close(ret_fd);
return 0;
}
-
+
+#ifdef DEBUG
+ fprintf(stderr, "Xquartz: Listening on socket for fd handoff: %s\n", filename_out);
+#endif
+
return ret_fd;
}
@@ -186,19 +192,30 @@ static void send_fd_handoff(int handoff_fd, int launchd_fd) {
*((int*)CMSG_DATA(cmsg)) = launchd_fd;
+#ifdef DEBUG
+ fprintf(stderr, "Xquartz: Waiting for fd handoff connection.\n");
+#endif
connected_fd = accept(handoff_fd, NULL, NULL);
if(connected_fd == -1) {
- fprintf(stderr, "Failed to accept incoming connection on socket: %s\n", strerror(errno));
+ fprintf(stderr, "Xquartz: Failed to accept incoming connection on socket: %s\n", strerror(errno));
return;
}
+#ifdef DEBUG
+ fprintf(stderr, "Xquartz: Handoff connection established. Sending message.\n");
+#endif
if(sendmsg(connected_fd, &msg, 0) < 0) {
- fprintf(stderr, "Error sending $DISPLAY file descriptor: %s\n", strerror(errno));
+ fprintf(stderr, "Xquartz: Error sending $DISPLAY file descriptor: %s\n", strerror(errno));
return;
}
+#ifdef DEBUG
+ fprintf(stderr, "Xquartz: Message sent. Closing.\n");
+#endif
close(connected_fd);
- fprintf(stderr, "send %d %d %d %s\n", handoff_fd, launchd_fd, errno, strerror(errno));
+#ifdef DEBUG
+ fprintf(stderr, "Xquartz: end of send debug: %d %d %d %s\n", handoff_fd, launchd_fd, errno, strerror(errno));
+#endif
}
int main(int argc, char **argv, char **envp) {
commit 26d8030c3836816de8c12b2cb9d67315e5c887eb
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Fri Jul 4 19:23:21 2008 -0700
XQuartz: Remove deprecated keyboard code.
(cherry picked from commit 69cfc1a21e12bb38a6130dea2e5f20f1e6a3ee7c)
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 5b8d32d..40d8cbb 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -891,6 +891,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
#ifdef XQUARTZ_USE_XKB
XkbComponentNamesRec names;
bzero(&names, sizeof(names));
+ /* We need to really have rules... or something... */
XkbSetRulesDflts("base", "pc105", "us", NULL, NULL);
assert(XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, keyInfo.modMap,
QuartzBell, DarwinChangeKeyboardControl));
@@ -1088,13 +1089,14 @@ Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
unsigned int QuartzSystemKeymapSeed(void) {
static unsigned int seed;
- static KeyboardLayoutRef last_key_layout;
- KeyboardLayoutRef key_layout;
+ static TISInputSourceRef last_key_layout;
+ TISInputSourceRef key_layout;
+
+ key_layout = TISCopyCurrentKeyboardLayoutInputSource();
- KLGetCurrentKeyboardLayout (&key_layout);
if (key_layout != last_key_layout) seed++;
last_key_layout = key_layout;
-
+
return seed;
}
@@ -1136,7 +1138,6 @@ static KeySym make_dead_key(KeySym in) {
}
Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
- KeyboardLayoutRef key_layout;
const void *chr_data = NULL;
int num_keycodes = NUM_KEYCODES;
UInt32 keyboard_type = 0;
@@ -1150,18 +1151,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
CFDataRef currentKeyLayoutDataRef = (CFDataRef )TISGetInputSourceProperty(currentKeyLayoutRef, kTISPropertyUnicodeKeyLayoutData);
if (currentKeyLayoutDataRef) chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef);
}
-
- if (chr_data == NULL) {
- KLGetCurrentKeyboardLayout (&key_layout);
- KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data);
- }
-
- if (chr_data == NULL) {
- KLGetKeyboardLayoutProperty (key_layout, kKLKCHRData, &chr_data);
- is_uchr = 0;
- num_keycodes = 128;
- }
-
+
if (chr_data == NULL) {
ErrorF ( "Couldn't get uchr or kchr resource\n");
return FALSE;
commit 5cfcbd54d98cc77ee02a3a099ebbad9af511a0ee
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Wed Jul 2 00:47:08 2008 -0700
Set machine dependent defaults for ppc64
(cherry picked from commit 0733ef2e8abda99cfd62966e73017949e9cd507f)
diff --git a/include/servermd.h b/include/servermd.h
index f10e6bc..7c8dd58 100644
--- a/include/servermd.h
+++ b/include/servermd.h
@@ -110,7 +110,7 @@ SOFTWARE.
/* byte boundries */
#endif /* hpux || __hppa__ */
-#if defined(__powerpc__) || defined(__ppc__)
+#if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__)
#define IMAGE_BYTE_ORDER MSBFirst
#define BITMAP_BIT_ORDER MSBFirst
commit e69b9f9ca45c0c6bfb93ea9143737116bf1f2453
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Wed Jun 25 11:51:27 2008 -0700
XQuartz: Set noPanoramixExtension earlier to avoid a possible race.
(cherry picked from commit 49668e8a88137e9f258eae970826883b88b7d8ba)
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
index d2bc9d3..de92361 100644
--- a/hw/xquartz/mach-startup/bundle-main.c
+++ b/hw/xquartz/mach-startup/bundle-main.c
@@ -51,6 +51,8 @@
/* From darwinEvents.c ... but don't want to pull in all the server cruft */
void DarwinListenOnOpenFD(int fd);
+extern int noPanoramiXExtension;
+
#define DEFAULT_CLIENT "/usr/X11/bin/xterm"
#define DEFAULT_STARTX "/usr/X11/bin/startx"
#define DEFAULT_SHELL "/bin/sh"
@@ -359,6 +361,9 @@ int main(int argc, char **argv, char **envp) {
mach_msg_size_t mxmsgsz = sizeof(union MaxMsgSize) + MAX_TRAILER_SIZE;
mach_port_t mp;
kern_return_t kr;
+
+ // The server must not run the PanoramiX operations.
+ noPanoramiXExtension = TRUE;
fprintf(stderr, "X11.app: main(): argc=%d\n", argc);
for(i=1; i < argc; i++) {
diff --git a/hw/xquartz/pseudoramiX.c b/hw/xquartz/pseudoramiX.c
index aafaa26..f4ceff3 100644
--- a/hw/xquartz/pseudoramiX.c
+++ b/hw/xquartz/pseudoramiX.c
@@ -46,7 +46,6 @@ Equipment Corporation.
#include "globals.h"
Bool noPseudoramiXExtension = FALSE;
-extern int noPanoramiXExtension;
extern int ProcPanoramiXQueryVersion (ClientPtr client);
@@ -131,9 +130,6 @@ void PseudoramiXExtensionInit(int argc, char *argv[])
}
#endif
- // The server must not run the PanoramiX operations.
- noPanoramiXExtension = TRUE;
-
if (pseudoramiXGeneration != serverGeneration) {
extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0,
ProcPseudoramiXDispatch,
diff --git a/hw/xquartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m
index 2890d34..0ab9493 100644
--- a/hw/xquartz/quartzCocoa.m
+++ b/hw/xquartz/quartzCocoa.m
@@ -44,10 +44,6 @@
#include "darwin.h"
-extern void FatalError(const char *, ...);
-extern char *display;
-extern int noPanoramiXExtension;
-
/*
* QuartzWriteCocoaPasteboard
* Write text to the Mac OS X pasteboard.
commit 8d2e2e1d856efec4459de2a20af642dc1ec9b8a5
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date: Wed Jun 11 11:44:45 2008 -0700
Xquartz: Removed include directive for removed header
(cherry picked from commit e65a36d57f338410c5a5b02cb5ae1214a81d072d)
diff --git a/hw/xquartz/quartzStartup.c b/hw/xquartz/quartzStartup.c
index 968cde8..ba92ece 100644
--- a/hw/xquartz/quartzStartup.c
+++ b/hw/xquartz/quartzStartup.c
@@ -37,7 +37,6 @@
#include <unistd.h>
#include <CoreFoundation/CoreFoundation.h>
#include "quartzCommon.h"
-#include "quartzForeground.h"
#include "X11Controller.h"
#include "darwin.h"
#include "darwinEvents.h"
More information about the xorg-commit
mailing list