XQuartz: Add a scroll_in_device_direction preference
This preference allows users to override the related option in Mac OS X's Mouse/Trackpad preferences. This effectively lets the user determine which "context" all of X11 fits into for context-based scrolling until such API exists within X11 itself to pass along to X11 clients. This is applicable to Mav OS X 10.7+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
parent
ec95a9c829
commit
ac43984215
|
@ -104,6 +104,9 @@ void X11ApplicationMain(int argc, char **argv, char **envp);
|
||||||
#define PREFS_FFM "wm_ffm"
|
#define PREFS_FFM "wm_ffm"
|
||||||
#define PREFS_FOCUS_ON_NEW_WINDOW "wm_focus_on_new_window"
|
#define PREFS_FOCUS_ON_NEW_WINDOW "wm_focus_on_new_window"
|
||||||
|
|
||||||
|
#define PREFS_SCROLL_IN_DEV_DIRECTION "scroll_in_device_direction"
|
||||||
|
extern Bool XQuartzScrollInDeviceDirection;
|
||||||
|
|
||||||
#define PREFS_SYNC_PB "sync_pasteboard"
|
#define PREFS_SYNC_PB "sync_pasteboard"
|
||||||
#define PREFS_SYNC_PB_TO_CLIPBOARD "sync_pasteboard_to_clipboard"
|
#define PREFS_SYNC_PB_TO_CLIPBOARD "sync_pasteboard_to_clipboard"
|
||||||
#define PREFS_SYNC_PB_TO_PRIMARY "sync_pasteboard_to_primary"
|
#define PREFS_SYNC_PB_TO_PRIMARY "sync_pasteboard_to_primary"
|
||||||
|
|
|
@ -79,6 +79,11 @@ static TISInputSourceRef last_key_layout;
|
||||||
static KeyboardLayoutRef last_key_layout;
|
static KeyboardLayoutRef last_key_layout;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* This preference is only tested on Lion or later as it's not relevant to
|
||||||
|
* earlier OS versions.
|
||||||
|
*/
|
||||||
|
Bool XQuartzScrollInDeviceDirection = FALSE;
|
||||||
|
|
||||||
extern int darwinFakeButtons;
|
extern int darwinFakeButtons;
|
||||||
|
|
||||||
/* Store the mouse location while in the background, and update X11's pointer
|
/* Store the mouse location while in the background, and update X11's pointer
|
||||||
|
@ -787,6 +792,9 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
|
||||||
|
|
||||||
noTestExtensions = ![self prefs_get_boolean:@PREFS_TEST_EXTENSIONS
|
noTestExtensions = ![self prefs_get_boolean:@PREFS_TEST_EXTENSIONS
|
||||||
default:FALSE];
|
default:FALSE];
|
||||||
|
|
||||||
|
XQuartzScrollInDeviceDirection = [self prefs_get_boolean:@PREFS_SCROLL_IN_DEV_DIRECTION
|
||||||
|
default:XQuartzScrollInDeviceDirection];
|
||||||
|
|
||||||
#if XQUARTZ_SPARKLE
|
#if XQUARTZ_SPARKLE
|
||||||
NSURL *url = [self prefs_copy_url:@PREFS_UPDATE_FEED default:nil];
|
NSURL *url = [self prefs_copy_url:@PREFS_UPDATE_FEED default:nil];
|
||||||
|
@ -1339,20 +1347,30 @@ static const char *untrusted_str(NSEvent *e) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSScrollWheel:
|
case NSScrollWheel:
|
||||||
|
{
|
||||||
|
float deltaX = [e deltaX];
|
||||||
|
float deltaY = [e deltaY];
|
||||||
#if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION == 0
|
#if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION == 0
|
||||||
/* If we're in the background, we need to send a MotionNotify event
|
/* If we're in the background, we need to send a MotionNotify event
|
||||||
* first, since we aren't getting them on background mouse motion
|
* first, since we aren't getting them on background mouse motion
|
||||||
*/
|
*/
|
||||||
if(!XQuartzServerVisible && noTestExtensions) {
|
if(!XQuartzServerVisible && noTestExtensions) {
|
||||||
bgMouseLocationUpdated = FALSE;
|
bgMouseLocationUpdated = FALSE;
|
||||||
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, location.x,
|
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, location.x,
|
||||||
location.y, pressure, tilt.x, tilt.y);
|
location.y, pressure, tilt.x, tilt.y);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
DarwinSendScrollEvents([e deltaX], [e deltaY], location.x, location.y,
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||||
pressure, tilt.x, tilt.y);
|
// TODO: Change 1117 to NSAppKitVersionNumber10_7 when it is defined
|
||||||
break;
|
if(NSAppKitVersionNumber >= 1117 && XQuartzScrollInDeviceDirection && [e isDirectionInvertedFromDevice]) {
|
||||||
|
deltaX *= -1;
|
||||||
|
deltaY *= -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
DarwinSendScrollEvents(deltaX, deltaY, location.x, location.y,
|
||||||
|
pressure, tilt.x, tilt.y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case NSKeyDown: case NSKeyUp:
|
case NSKeyDown: case NSKeyUp:
|
||||||
{
|
{
|
||||||
/* XKB clobbers our keymap at startup, so we need to force it on the first keypress.
|
/* XKB clobbers our keymap at startup, so we need to force it on the first keypress.
|
||||||
|
|
|
@ -83,6 +83,9 @@ This option defaults to false and is provided only "for experts." It updates th
|
||||||
.TP 8
|
.TP 8
|
||||||
.B defaults write __bundle_id_prefix__.X11 enable_test_extensions -boolean true
|
.B defaults write __bundle_id_prefix__.X11 enable_test_extensions -boolean true
|
||||||
This option defaults to false and is only accessible through the command line. Enable this option to turn on the DEC-XTRAP, RECORD, and XTEST extensions in the server.
|
This option defaults to false and is only accessible through the command line. Enable this option to turn on the DEC-XTRAP, RECORD, and XTEST extensions in the server.
|
||||||
|
.TP 8
|
||||||
|
.B defaults write __laucnd_id_prefix__.X11 scroll_in_device_direction -boolean true
|
||||||
|
This option defaults to false. Enable this option to ensure that X11 scroll events are always in the direction of the device. This overrides the related option in the Mouse/Trackpad section of System Preferences.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.PP
|
.PP
|
||||||
In addition to the normal server options described in the \fIXserver(1)\fP
|
In addition to the normal server options described in the \fIXserver(1)\fP
|
||||||
|
|
Loading…
Reference in New Issue