aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xquartz/pbproxy/x-input.m
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
committermarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
commit0f834b91a4768673833ab4917e87d86c237bb1a6 (patch)
tree363489504ed4b2d360259b8de4c9e392918e5d02 /xorg-server/hw/xquartz/pbproxy/x-input.m
parentfc72edebf875378459368c5383d9023730cbca54 (diff)
downloadvcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.gz
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.bz2
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.zip
libX11 xserver fontconfig mesa pixman xkbcomp xkeyboard-config git update
23 Mar 2012
Diffstat (limited to 'xorg-server/hw/xquartz/pbproxy/x-input.m')
-rw-r--r--xorg-server/hw/xquartz/pbproxy/x-input.m176
1 files changed, 94 insertions, 82 deletions
diff --git a/xorg-server/hw/xquartz/pbproxy/x-input.m b/xorg-server/hw/xquartz/pbproxy/x-input.m
index ebb89980f..134bf59d8 100644
--- a/xorg-server/hw/xquartz/pbproxy/x-input.m
+++ b/xorg-server/hw/xquartz/pbproxy/x-input.m
@@ -48,126 +48,138 @@ BOOL xpbproxy_prefs_reload = NO;
/* Timestamp when the X server last told us it's active */
static Time last_activation_time;
-static void x_event_apple_wm_notify(XAppleWMNotifyEvent *e) {
+static void
+x_event_apple_wm_notify(XAppleWMNotifyEvent * e)
+{
int type = e->type - xpbproxy_apple_wm_event_base;
int kind = e->kind;
/* We want to reload prefs even if we're not active */
- if(type == AppleWMActivationNotify &&
- kind == AppleWMReloadPreferences)
- [xpbproxy_selection_object() reload_preferences];
+ if (type == AppleWMActivationNotify && kind == AppleWMReloadPreferences)
+ [xpbproxy_selection_object()reload_preferences];
- if(![xpbproxy_selection_object() is_active])
+ if (![xpbproxy_selection_object()is_active])
return;
- switch (type) {
- case AppleWMActivationNotify:
- switch (kind) {
- case AppleWMIsActive:
- last_activation_time = e->time;
- [xpbproxy_selection_object() x_active:e->time];
- break;
-
- case AppleWMIsInactive:
- [xpbproxy_selection_object() x_inactive:e->time];
- break;
- }
+ switch (type) {
+ case AppleWMActivationNotify:
+ switch (kind) {
+ case AppleWMIsActive:
+ last_activation_time = e->time;
+ [xpbproxy_selection_object()x_active:e->time];
break;
-
- case AppleWMPasteboardNotify:
- switch (kind) {
- case AppleWMCopyToPasteboard:
- [xpbproxy_selection_object() x_copy:e->time];
- }
+
+ case AppleWMIsInactive:
+ [xpbproxy_selection_object()x_inactive:e->time];
break;
+ }
+ break;
+
+ case AppleWMPasteboardNotify:
+ switch (kind) {
+ case AppleWMCopyToPasteboard:
+ [xpbproxy_selection_object()x_copy:e->time];
+ }
+ break;
}
}
-static void xpbproxy_process_xevents(void) {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- if(pool == nil) {
+static void
+xpbproxy_process_xevents(void)
+{
+ NSAutoreleasePool *pool =[[NSAutoreleasePool alloc] init];
+
+ if (pool == nil) {
ErrorF("unable to allocate/init auto release pool!\n");
return;
}
-
+
while (XPending(xpbproxy_dpy) != 0) {
XEvent e;
-
- XNextEvent (xpbproxy_dpy, &e);
-
- switch (e.type) {
- case SelectionClear:
- if([xpbproxy_selection_object() is_active])
- [xpbproxy_selection_object () clear_event:&e.xselectionclear];
- break;
-
- case SelectionRequest:
- [xpbproxy_selection_object () request_event:&e.xselectionrequest];
- break;
-
- case SelectionNotify:
- [xpbproxy_selection_object () notify_event:&e.xselection];
- break;
-
- case PropertyNotify:
- [xpbproxy_selection_object () property_event:&e.xproperty];
- break;
-
- default:
- if(e.type >= xpbproxy_apple_wm_event_base &&
- e.type < xpbproxy_apple_wm_event_base + AppleWMNumberEvents) {
- x_event_apple_wm_notify((XAppleWMNotifyEvent *) &e);
- } else if(e.type == xpbproxy_xfixes_event_base + XFixesSelectionNotify) {
- [xpbproxy_selection_object() xfixes_selection_notify:(XFixesSelectionNotifyEvent *)&e];
- }
- break;
+
+ XNextEvent(xpbproxy_dpy, &e);
+
+ switch (e.type) {
+ case SelectionClear:
+ if ([xpbproxy_selection_object()is_active])
+ [xpbproxy_selection_object()clear_event:&e.xselectionclear];
+ break;
+
+ case SelectionRequest:
+ [xpbproxy_selection_object()request_event:&e.xselectionrequest];
+ break;
+
+ case SelectionNotify:
+ [xpbproxy_selection_object()notify_event:&e.xselection];
+ break;
+
+ case PropertyNotify:
+ [xpbproxy_selection_object()property_event:&e.xproperty];
+ break;
+
+ default:
+ if (e.type >= xpbproxy_apple_wm_event_base &&
+ e.type < xpbproxy_apple_wm_event_base + AppleWMNumberEvents) {
+ x_event_apple_wm_notify((XAppleWMNotifyEvent *) & e);
+ }
+ else if (e.type ==
+ xpbproxy_xfixes_event_base + XFixesSelectionNotify) {
+ [xpbproxy_selection_object()xfixes_selection_notify:(XFixesSelectionNotifyEvent *) &
+ e];
+ }
+ break;
}
-
+
XFlush(xpbproxy_dpy);
}
-
+
[pool release];
}
-static BOOL add_input_socket (int sock, CFOptionFlags callback_types,
- CFSocketCallBack callback, const CFSocketContext *ctx,
- CFRunLoopSourceRef *cf_source) {
+static BOOL
+add_input_socket(int sock, CFOptionFlags callback_types,
+ CFSocketCallBack callback, const CFSocketContext * ctx,
+ CFRunLoopSourceRef * cf_source)
+{
CFSocketRef cf_sock;
-
- cf_sock = CFSocketCreateWithNative (kCFAllocatorDefault, sock,
- callback_types, callback, ctx);
+
+ cf_sock = CFSocketCreateWithNative(kCFAllocatorDefault, sock,
+ callback_types, callback, ctx);
if (cf_sock == NULL) {
- close (sock);
+ close(sock);
return FALSE;
}
-
- *cf_source = CFSocketCreateRunLoopSource (kCFAllocatorDefault,
- cf_sock, 0);
- CFRelease (cf_sock);
-
+
+ *cf_source = CFSocketCreateRunLoopSource(kCFAllocatorDefault, cf_sock, 0);
+ CFRelease(cf_sock);
+
if (*cf_source == NULL)
return FALSE;
-
- CFRunLoopAddSource (CFRunLoopGetCurrent (),
- *cf_source, kCFRunLoopDefaultMode);
+
+ CFRunLoopAddSource(CFRunLoopGetCurrent(),
+ *cf_source, kCFRunLoopDefaultMode);
return TRUE;
}
-static void x_input_callback (CFSocketRef sock, CFSocketCallBackType type,
- CFDataRef address, const void *data, void *info) {
+static void
+x_input_callback(CFSocketRef sock, CFSocketCallBackType type,
+ CFDataRef address, const void *data, void *info)
+{
#ifdef STANDALONE_XPBPROXY
- if(xpbproxy_prefs_reload) {
- [xpbproxy_selection_object() reload_preferences];
+ if (xpbproxy_prefs_reload) {
+ [xpbproxy_selection_object()reload_preferences];
xpbproxy_prefs_reload = NO;
}
#endif
-
+
xpbproxy_process_xevents();
}
-BOOL xpbproxy_input_register(void) {
- return add_input_socket(ConnectionNumber(xpbproxy_dpy), kCFSocketReadCallBack,
- x_input_callback, NULL, &xpbproxy_dpy_source);
+BOOL
+xpbproxy_input_register(void)
+{
+ return add_input_socket(ConnectionNumber(xpbproxy_dpy),
+ kCFSocketReadCallBack, x_input_callback, NULL,
+ &xpbproxy_dpy_source);
}