XQuartz: Added a preferences UI for pbproxy options.

(cherry picked from commit d76cca5e1e)
This commit is contained in:
Jeremy Huddleston 2008-09-21 17:40:35 -07:00
parent a928cae57b
commit dba290ec23
8 changed files with 718 additions and 253 deletions

View File

@ -100,4 +100,10 @@ extern int quartzHasRoot, quartzEnableRootless;
#define PREFS_FFM "wm_ffm"
#define PREFS_FOCUS_ON_NEW_WINDOW "wm_focus_on_new_window"
#define PREFS_SYNC_PB "sync_pasteboard"
#define PREFS_SYNC_PB_TO_CLIPBOARD "sync_pasteboard_to_clipboard"
#define PREFS_SYNC_PB_TO_PRIMARY "sync_pasteboard_to_primary"
#define PREFS_SYNC_CLIPBOARD_TO_PB "sync_clipboard_to_pasteboard"
#define PREFS_SYNC_PRIMARY_ON_SELECT "sync_primary_on_select"
#endif /* X11APPLICATION_H */

View File

@ -673,6 +673,17 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
// enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO
// default:false];
pbproxy_active = [self prefs_get_boolean:@PREFS_SYNC_PB
default:pbproxy_active];
pbproxy_pasteboard_to_clipboard = [self prefs_get_boolean:@PREFS_SYNC_PB_TO_CLIPBOARD
default:pbproxy_pasteboard_to_clipboard];
pbproxy_pasteboard_to_primary = [self prefs_get_boolean:@PREFS_SYNC_PB_TO_PRIMARY
default:pbproxy_pasteboard_to_primary];
pbproxy_clipboard_to_pasteboard = [self prefs_get_boolean:@PREFS_SYNC_CLIPBOARD_TO_PB
default:pbproxy_clipboard_to_pasteboard];
pbproxy_primary_on_grab = [self prefs_get_boolean:@PREFS_SYNC_PRIMARY_ON_SELECT
default:pbproxy_primary_on_grab];
}
/* This will end up at the end of the responder chain. */

View File

@ -49,6 +49,13 @@
IBOutlet NSButton *focus_on_new_window;
IBOutlet NSButton *enable_auth;
IBOutlet NSButton *enable_tcp;
IBOutlet NSButton *sync_pasteboard;
IBOutlet NSButton *sync_pasteboard_to_clipboard;
IBOutlet NSButton *sync_pasteboard_to_primary;
IBOutlet NSButton *sync_clipboard_to_pasteboard;
IBOutlet NSButton *sync_primary_immediately;
IBOutlet NSTextField *sync_text1;
IBOutlet NSTextField *sync_text2;
IBOutlet NSPopUpButton *depth;
IBOutlet NSMenuItem *x11_about_item;
@ -56,6 +63,7 @@
IBOutlet NSMenuItem *dock_window_separator;
IBOutlet NSMenuItem *apps_separator;
IBOutlet NSMenuItem *toggle_fullscreen_item;
IBOutlet NSMenuItem *copy_menu_item;
IBOutlet NSMenu *dock_apps_menu;
IBOutlet NSTableView *apps_table;

View File

@ -54,6 +54,13 @@
#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
@ -622,9 +629,24 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
quartzUseSysBeep = [use_sysbeep intValue];
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];
// This doesn't seem to work.
[sync_text1 setEnabled:pbproxy_active];
[sync_text2 setEnabled:pbproxy_active];
/* after adding prefs here, also add to [X11Application read_defaults]
and below */
and prefs_show */
[NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons];
[NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep];
@ -636,6 +658,12 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
[NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]];
[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];
system("killall -HUP quartz-wm");
@ -656,7 +684,22 @@ 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 setEnabled:pbproxy_active];
[sync_pasteboard_to_primary setEnabled:pbproxy_active];
[sync_clipboard_to_pasteboard setEnabled:pbproxy_active];
[sync_primary_immediately setEnabled:pbproxy_active];
// This doesn't seem to work.
[sync_text1 setEnabled:pbproxy_active];
[sync_text2 setEnabled:pbproxy_active];
[enable_fullscreen setIntValue:!quartzEnableRootless];
// TODO: Add fullscreen support
[enable_fullscreen setEnabled:NO];
@ -677,9 +720,11 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (OSX_BOOL) validateMenuItem:(NSMenuItem *)item
{
NSMenu *menu = [item menu];
if (item == toggle_fullscreen_item)
return !quartzEnableRootless;
else if (item == copy_menu_item) // For some reason, this isn't working...
return NO;
else if (menu == [window_separator menu] || menu == dock_menu
|| (menu == [x11_about_item menu] && [item tag] == 42))
return (AppleWMSelectedEvents () & AppleWMControllerNotifyMask) != 0;

File diff suppressed because it is too large Load Diff

View File

@ -89,6 +89,12 @@ 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;

View File

@ -56,6 +56,21 @@ defaults to the depth of the main display.
.TP 8
.B defaults write org.x.X11 sync_keymap -boolean true
Keep the X11 keymap up to date with the OSX system keymap.
.TP 8
.B defaults write org.x.X11 sync_pasteboard -boolean true
Enable syncing between the OSX pasteboard and clipboard/primary selection buffers in X11. This option needs to be true for any of the other pasteboard sync options to have an effect.
.TP 8
.B defaults write org.x.X11 sync_pasteboard_to_clipboard -boolean true
Update the X11 CLIPBOARD when the OSX NSPasteboard is updated.
.TP 8
.B defaults write org.x.X11 sync_pasteboard_to_primary -boolean true
Update the the X11 PRIMARY buffer when the OSX NSPasteboard is updated.
.TP 8
.B defaults write org.x.X11 sync_clipboard_to_pasteboard -boolean true
Update the the OSX NSPasteboard when the X11 CLIPBOARD is updated. Note that enabling this option causes the clipboard synchronization to act as a clipboard manager in X11. This makes it impossible to use xclipboard, klipper, or any other such clipboard managers. If you want to use any of these programs, you must disable this option.
.TP 8
.B defaults write org.x.X11 sync_primary_on_select -boolean true
This option defaults to false and is provided only "for experts." It updates the NSPasteboard whenever a new X11 selection is made (rather than requiring you to hit cmd-c to copy the selection to the NSPasteboard). Since the X11 protocol does not require applications to send notification when they change selection, this might not work in all cases (if you run into this problem, try selecting text in another application first, then selecting the text you want).
.SH OPTIONS
.PP
In addition to the normal server options described in the \fIXserver(1)\fP