summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2008-10-03 11:12:49 -0700
committerJeremy Huddleston <jeremyhu@freedesktop.org>2008-10-03 11:12:49 -0700
commit5446adebfb085dd05471729bf5c55bf820b1cbe3 (patch)
tree426347ed1aa9e0aceabc907badef9d2ec8393d63
parent6020c3fbfe06530cb2b90178d17a7d63beae028a (diff)
XQuartz: Send AppleWMReloadPreferences where appropriate.
(cherry picked from commit 490cbe9888e2c1080495b003c429fdb1659444e1)
-rw-r--r--hw/xquartz/X11Controller.m59
-rw-r--r--hw/xquartz/darwin.h6
-rw-r--r--hw/xquartz/darwinEvents.c17
-rw-r--r--hw/xquartz/darwinEvents.h1
4 files changed, 39 insertions, 44 deletions
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index bbc5fd140..2482c05f6 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -54,13 +54,6 @@
#include <sys/types.h>
#include <sys/wait.h>
-// This will live in pbproxy/x-selection.m when we integrage that into a server thread... for now, living here for testing the UI.
-int pbproxy_active = YES;
-int pbproxy_primary_on_grab = NO; // This is provided as an option for people who want it and has issues that won't ever be addressed to make it *always* work
-int pbproxy_clipboard_to_pasteboard = YES;
-int pbproxy_pasteboard_to_primary = YES;
-int pbproxy_pasteboard_to_clipboard = YES;
-
@implementation X11Controller
- (void) awakeFromNib
@@ -630,21 +623,6 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
X11EnableKeyEquivalents = [enable_keyequivs intValue];
darwinSyncKeymap = [sync_keymap intValue];
- pbproxy_active = [sync_pasteboard intValue];
- pbproxy_pasteboard_to_clipboard = [sync_pasteboard_to_clipboard intValue];
- pbproxy_pasteboard_to_primary = [sync_pasteboard_to_primary intValue];
- pbproxy_clipboard_to_pasteboard = [sync_clipboard_to_pasteboard intValue];
- pbproxy_primary_on_grab = [sync_primary_immediately intValue];
-
- [sync_pasteboard_to_clipboard setEnabled:pbproxy_active];
- [sync_pasteboard_to_primary setEnabled:pbproxy_active];
- [sync_clipboard_to_pasteboard setEnabled:pbproxy_active];
- [sync_primary_immediately setEnabled:pbproxy_active];
-
- // setEnabled doesn't do this...
- [sync_text1 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
- [sync_text2 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
-
/* after adding prefs here, also add to [X11Application read_defaults]
and prefs_show */
@@ -659,19 +637,32 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
[NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]];
[NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]];
- [NSApp prefs_set_integer:@PREFS_SYNC_PB value:pbproxy_active];
- [NSApp prefs_set_integer:@PREFS_SYNC_PB_TO_CLIPBOARD value:pbproxy_pasteboard_to_clipboard];
- [NSApp prefs_set_integer:@PREFS_SYNC_PB_TO_PRIMARY value:pbproxy_pasteboard_to_primary];
- [NSApp prefs_set_integer:@PREFS_SYNC_CLIPBOARD_TO_PB value:pbproxy_clipboard_to_pasteboard];
- [NSApp prefs_set_integer:@PREFS_SYNC_PRIMARY_ON_SELECT value:pbproxy_primary_on_grab];
+ BOOL pbproxy_active = [sync_pasteboard intValue];
+
+ [NSApp prefs_set_boolean:@PREFS_SYNC_PB value:pbproxy_active];
+ [NSApp prefs_set_boolean:@PREFS_SYNC_PB_TO_CLIPBOARD value:[sync_pasteboard_to_clipboard intValue]];
+ [NSApp prefs_set_boolean:@PREFS_SYNC_PB_TO_PRIMARY value:[sync_pasteboard_to_primary intValue]];
+ [NSApp prefs_set_boolean:@PREFS_SYNC_CLIPBOARD_TO_PB value:[sync_clipboard_to_pasteboard intValue]];
+ [NSApp prefs_set_boolean:@PREFS_SYNC_PRIMARY_ON_SELECT value:[sync_primary_immediately intValue]];
- system("killall -HUP quartz-wm");
-
[NSApp prefs_synchronize];
+
+ [sync_pasteboard_to_clipboard setEnabled:pbproxy_active];
+ [sync_pasteboard_to_primary setEnabled:pbproxy_active];
+ [sync_clipboard_to_pasteboard setEnabled:pbproxy_active];
+ [sync_primary_immediately setEnabled:pbproxy_active];
+
+ // setEnabled doesn't do this...
+ [sync_text1 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
+ [sync_text2 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
+
+ DarwinSendDDXEvent(kXquartzReloadPreferences, 0);
}
- (IBAction) prefs_show:sender
{
+ BOOL pbproxy_active = [NSApp prefs_get_boolean:@PREFS_SYNC_PB default:YES];
+
[fake_buttons setIntValue:darwinFakeButtons];
[use_sysbeep setIntValue:quartzUseSysBeep];
[enable_keyequivs setIntValue:X11EnableKeyEquivalents];
@@ -684,12 +675,12 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
[enable_tcp setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_TCP default:NO]];
[depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]];
-
+
[sync_pasteboard setIntValue:pbproxy_active];
- [sync_pasteboard_to_clipboard setIntValue:pbproxy_pasteboard_to_clipboard];
- [sync_pasteboard_to_primary setIntValue:pbproxy_pasteboard_to_primary];
- [sync_clipboard_to_pasteboard setIntValue:pbproxy_clipboard_to_pasteboard];
- [sync_primary_immediately setIntValue:pbproxy_primary_on_grab];
+ [sync_pasteboard_to_clipboard setIntValue:[NSApp prefs_get_boolean:@PREFS_SYNC_PB_TO_CLIPBOARD default:YES]];
+ [sync_pasteboard_to_primary setIntValue:[NSApp prefs_get_boolean:@PREFS_SYNC_PB_TO_PRIMARY default:YES]];
+ [sync_clipboard_to_pasteboard setIntValue:[NSApp prefs_get_boolean:@PREFS_SYNC_CLIPBOARD_TO_PB default:YES]];
+ [sync_primary_immediately setIntValue:[NSApp prefs_get_boolean:@PREFS_SYNC_PRIMARY_ON_SELECT default:NO]];
[sync_pasteboard_to_clipboard setEnabled:pbproxy_active];
[sync_pasteboard_to_primary setEnabled:pbproxy_active];
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index e45ab19f3..da5ad74a1 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -89,12 +89,6 @@ extern unsigned int darwinDesiredWidth, darwinDesiredHeight;
extern int darwinDesiredDepth;
extern int darwinDesiredRefresh;
-extern int pbproxy_active;
-extern int pbproxy_primary_on_grab;
-extern int pbproxy_clipboard_to_pasteboard;
-extern int pbproxy_pasteboard_to_primary;
-extern int pbproxy_pasteboard_to_clipboard;
-
// location of X11's (0,0) point in global screen coordinates
extern int darwinMainScreenX;
extern int darwinMainScreenY;
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 729cc9a4d..92179d38c 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -107,7 +107,8 @@ static pthread_t create_thread(void *func, void *arg) {
return tid;
}
-static inline void darwinEvents_lock(void) {
+void darwinEvents_lock(void);
+void darwinEvents_lock(void) {
int err;
if((err = pthread_mutex_lock(&mieq_lock))) {
ErrorF("%s:%s:%d: Failed to lock mieq_lock: %d\n",
@@ -225,6 +226,13 @@ static void DarwinEventHandler(int screenNum, xEventPtr xe, DeviceIntPtr dev, in
QuartzHide();
break;
+ case kXquartzReloadPreferences:
+ DEBUG_LOG("kXquartzReloadPreferences\n");
+ AppleWMSendEvent(AppleWMActivationNotify,
+ AppleWMActivationNotifyMask,
+ AppleWMReloadPreferences, 0);
+ break;
+
case kXquartzToggleFullscreen:
DEBUG_LOG("kXquartzToggleFullscreen\n");
#ifdef DARWIN_DDX_MISSING
@@ -315,6 +323,7 @@ Bool DarwinEQInit(void) {
mieqSetHandler(kXquartzReloadKeymap, DarwinKeyboardReloadHandler);
mieqSetHandler(kXquartzActivate, DarwinEventHandler);
mieqSetHandler(kXquartzDeactivate, DarwinEventHandler);
+ mieqSetHandler(kXquartzReloadPreferences, DarwinEventHandler);
mieqSetHandler(kXquartzSetRootClip, DarwinEventHandler);
mieqSetHandler(kXquartzQuit, DarwinEventHandler);
mieqSetHandler(kXquartzReadPasteboard, QuartzReadPasteboard);
@@ -394,8 +403,8 @@ static void DarwinPrepareValuators(int *valuators, ScreenPtr screen,
valuators[3] = tilt_x * SCALEFACTOR_TILT;
valuators[4] = tilt_y * SCALEFACTOR_TILT;
- DEBUG_LOG("Valuators: {%d,%d,%d,%d,%d}\n",
- valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]);
+// DEBUG_LOG("Valuators: {%d,%d,%d,%d,%d}\n",
+// valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]);
}
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y,
@@ -406,7 +415,7 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
ScreenPtr screen;
int valuators[5];
- DEBUG_LOG("x=%d, y=%d, p=%f, tx=%f, ty=%f\n", pointer_x, pointer_y, pressure, tilt_x, tilt_y);
+// DEBUG_LOG("x=%d, y=%d, p=%f, tx=%f, ty=%f\n", pointer_x, pointer_y, pressure, tilt_x, tilt_y);
if(!darwinEvents) {
DEBUG_LOG("DarwinSendPointerEvents called before darwinEvents was initialized\n");
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 7a1e8ca5d..61efa7526 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -63,6 +63,7 @@ enum {
*/
kXquartzControllerNotify, // send an AppleWMControllerNotify event
kXquartzPasteboardNotify, // notify the WM to copy or paste
+ kXquartzReloadPreferences, // send AppleWMReloadPreferences
/*
* Xplugin notification events
*/