Merge remote-tracking branch 'whot/for-keith'

This commit is contained in:
Keith Packard 2012-06-28 10:11:44 -07:00
commit 59294a2179
6 changed files with 43 additions and 8 deletions

View File

@ -35,6 +35,7 @@
#include <X11/keysym.h>
#include <X11/Xproto.h>
#include <math.h>
#include <limits.h>
#include "misc.h"
#include "resource.h"
@ -756,6 +757,29 @@ clipAbsolute(DeviceIntPtr dev, ValuatorMask *mask)
}
}
static void
add_to_scroll_valuator(DeviceIntPtr dev, ValuatorMask *mask, int valuator, double value)
{
double v;
if (!valuator_mask_fetch_double(mask, valuator, &v))
return;
/* protect against scrolling overflow. INT_MAX for double, because
* we'll eventually write this as 32.32 fixed point */
if ((value > 0 && v > INT_MAX - value) || (value < 0 && v < INT_MIN - value)) {
v = 0;
/* reset last.scroll to avoid a button storm */
valuator_mask_set_double(dev->last.scroll, valuator, 0);
}
else
v += value;
valuator_mask_set_double(mask, valuator, v);
}
/**
* Move the device's pointer by the values given in @valuators.
*
@ -774,13 +798,17 @@ moveRelative(DeviceIntPtr dev, ValuatorMask *mask)
if (!valuator_mask_isset(mask, i))
continue;
val += valuator_mask_get_double(mask, i);
add_to_scroll_valuator(dev, mask, i, val);
/* x & y need to go over the limits to cross screens if the SD
* isn't currently attached; otherwise, clip to screen bounds. */
if (valuator_get_mode(dev, i) == Absolute &&
((i != 0 && i != 1) || clip_xy))
((i != 0 && i != 1) || clip_xy)) {
val = valuator_mask_get_double(mask, i);
clipAxis(dev, i, &val);
valuator_mask_set_double(mask, i, val);
valuator_mask_set_double(mask, i, val);
}
}
}
@ -1506,6 +1534,7 @@ emulate_scroll_button_events(InternalEvent *events,
return num_events;
}
/**
* Generate a complete series of InternalEvents (filled into the EventList)
* representing pointer motion, or button presses. If the device is a slave
@ -1560,7 +1589,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
* necessary. This only needs to cater for the XIScrollFlagPreferred
* axis (if more than one scrolling axis is present) */
if (type == ButtonPress) {
double val, adj;
double adj;
int axis;
int h_scroll_axis = -1;
int v_scroll_axis = -1;
@ -1596,8 +1625,7 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
if (adj != 0.0 && axis != -1) {
adj *= pDev->valuator->axes[axis].scroll.increment;
val = valuator_mask_get_double(&mask, axis) + adj;
valuator_mask_set_double(&mask, axis, val);
add_to_scroll_valuator(pDev, &mask, axis, adj);
type = MotionNotify;
buttons = 0;
flags |= POINTER_EMULATED;

View File

@ -301,6 +301,11 @@ extern _X_EXPORT const char *XkbBinDirectory;
extern _X_EXPORT CARD32 xkbDebugFlags;
#define _XkbLibError(c,l,d) /* Epoch fail */
/* "a" is a "unique" numeric identifier that just defines which error
* code statement it is. _XkbErrCode2(4, foo) means "this is the 4th error
* statement in this function". lovely.
*/
#define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff)))
#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c))
#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d)))

View File

@ -353,6 +353,7 @@ NotifyParentProcess(void)
#if !defined(WIN32)
if (dynamic_display[0]) {
write(displayfd, dynamic_display, strlen(dynamic_display));
write(displayfd, "\n", 1);
close(displayfd);
}
if (RunFromSmartParent) {

1
test/.gitignore vendored
View File

@ -1,4 +1,5 @@
fixes
hashtabletest
input
list
misc

View File

@ -20,7 +20,7 @@ INCLUDES += -I$(top_srcdir)/hw/xfree86/parser \
-I$(top_srcdir)/hw/xfree86/i2c -I$(top_srcdir)/hw/xfree86/modes \
-I$(top_srcdir)/hw/xfree86/ramdac
endif
TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS)
TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
if XORG
if SPECIAL_DTRACE_OBJECTS

View File

@ -18,7 +18,7 @@ TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
INCLUDES = @XORG_INCS@
TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS)
TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
COMMON_SOURCES=protocol-common.h protocol-common.c
if SPECIAL_DTRACE_OBJECTS