diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-10-04 18:54:15 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-10-04 21:17:02 -0700 |
commit | b3a971d8b5df5ab4af0be49105ef32f67d010901 (patch) | |
tree | 470bd2cdf7aa59db5156cae7845fc97dfe4d237e /hw/xquartz/pbproxy/x-input.m | |
parent | fc35c7a2e2888cb767413f5e85a79c7f422a6284 (diff) |
XQuartz: xpbproxy: Support some of the preference toggles from X11.app, cleaned up CLIPBOARD_MANAGER atom management.
(cherry picked from commit f7673bb4de3c1f71eb390a3279eed3589efc3df4)
Diffstat (limited to 'hw/xquartz/pbproxy/x-input.m')
-rw-r--r-- | hw/xquartz/pbproxy/x-input.m | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/hw/xquartz/pbproxy/x-input.m b/hw/xquartz/pbproxy/x-input.m index c11ffb382..1b2475cb9 100644 --- a/hw/xquartz/pbproxy/x-input.m +++ b/hw/xquartz/pbproxy/x-input.m @@ -21,29 +21,35 @@ static CFRunLoopSourceRef x_dpy_source; static Time last_activation_time; static void x_event_apple_wm_notify(XAppleWMNotifyEvent *e) { + int type = e->type - x_apple_wm_event_base; + int kind = e->kind; - switch (e->type - x_apple_wm_event_base) { + /* We want to reload prefs even if we're not active */ + if(type == AppleWMActivationNotify && + kind == AppleWMReloadPreferences) + [x_selection_object() reload_preferences]; + + if(![x_selection_object() is_active]) + return; + + switch (type) { case AppleWMActivationNotify: - switch (e->kind) { + switch (kind) { case AppleWMIsActive: last_activation_time = e->time; - [x_selection_object () x_active:e->time]; + [x_selection_object() x_active:e->time]; break; case AppleWMIsInactive: - [x_selection_object () x_inactive:e->time]; + [x_selection_object() x_inactive:e->time]; break; - - case AppleWMReloadPreferences: - [x_selection_object () reload_preferences]; - break; } break; case AppleWMPasteboardNotify: - switch (e->kind) { - case AppleWMCopyToPasteboard: - [x_selection_object () x_copy:e->time]; + switch (kind) { + case AppleWMCopyToPasteboard: + [x_selection_object() x_copy:e->time]; } break; } @@ -54,22 +60,18 @@ void x_input_run (void) { if (nil == pool) { - fprintf(stderr, "unable to allocate/init auto release pool!\n"); - return; + fprintf(stderr, "unable to allocate/init auto release pool!\n"); + return; } - + while (XPending (x_dpy) != 0) { - XEvent e; - + XEvent e; XNextEvent (x_dpy, &e); - - /* If pbproxy isn't active (in the preferences), then don't do anything. */ - if (![x_selection_object() is_active]) - continue; - + switch (e.type) { case SelectionClear: - [x_selection_object () clear_event:&e.xselectionclear]; + if([x_selection_object() is_active]) + [x_selection_object () clear_event:&e.xselectionclear]; break; case SelectionRequest: @@ -80,10 +82,10 @@ void x_input_run (void) { [x_selection_object () notify_event:&e.xselection]; break; - case PropertyNotify: - [x_selection_object () property_event:&e.xproperty]; - break; - + case PropertyNotify: + [x_selection_object () property_event:&e.xproperty]; + break; + default: if (e.type - x_apple_wm_event_base >= 0 && e.type - x_apple_wm_event_base < AppleWMNumberEvents) { @@ -91,10 +93,10 @@ void x_input_run (void) { } break; } - - XFlush(x_dpy); + + XFlush(x_dpy); } - + [pool release]; } |