platform/upstream/xorg-server.git
11 years agoephyr: Fix crash on 24bpp host framebuffer
Daniel Martin [Thu, 20 Dec 2012 12:50:17 +0000 (13:50 +0100)]
ephyr: Fix crash on 24bpp host framebuffer

Use bytes_per_line and bits_per_pixel from the created XImage to fix
    https://bugzilla.redhat.com/show_bug.cgi?id=518960

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoos: use libunwind to generate backtraces
Marcin Slusarz [Wed, 20 Feb 2013 23:02:44 +0000 (09:02 +1000)]
os: use libunwind to generate backtraces

Libunwind generates backtraces much more reliably than glibc's "backtrace".

Before:
0: /opt/xserver/bin/X (0x400000+0x18ce36) [0x58ce36]
1: /opt/xserver/bin/X (xorg_backtrace+0x9) [0x58d119]
2: /opt/xserver/bin/X (0x400000+0x190d69) [0x590d69]
3: /lib64/libpthread.so.0 (0x7fb904268000+0x10a90) [0x7fb904278a90]
4: /lib64/libc.so.6 (ioctl+0x7) [0x7fb902fbf987]
5: /usr/lib64/libdrm.so.2 (drmIoctl+0x28) [0x7fb90405ffa8]
6: /usr/lib64/libdrm.so.2 (drmCommandWrite+0x1b) [0x7fb90406235b]
7: /usr/lib64/libdrm_nouveau.so.2 (nouveau_bo_wait+0x89) [0x7fb902009719]
8: /opt/xserver/lib/xorg/modules/drivers/nouveau_drv.so (0x7fb90220e000+0x76f3) [0x7fb9022156f3]
9: /opt/xserver/lib/xorg/modules/libexa.so (0x7fb9019c7000+0xbae0) [0x7fb9019d2ae0]
10: /opt/xserver/bin/X (0x400000+0x17d2b3) [0x57d2b3]
11: /opt/xserver/bin/X (0x400000+0xc9930) [0x4c9930]
12: /opt/xserver/bin/X (0x400000+0x3a81a) [0x43a81a]
13: /opt/xserver/bin/X (0x400000+0x3d6a1) [0x43d6a1]
14: /opt/xserver/bin/X (0x400000+0x2c2ca) [0x42c2ca]
15: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x7fb902f019b5]
16: /opt/xserver/bin/X (0x400000+0x2c60d) [0x42c60d]
17: ?? [0x0]

After:
0: /opt/xserver/bin/X (OsSigHandler+0x39) [0x590d69]
1: /lib64/libpthread.so.0 (__restore_rt+0x0) [0x7fb904278a8f]
2: /lib64/libc.so.6 (ioctl+0x7) [0x7fb902fbf987]
3: /usr/lib64/libdrm.so.2 (drmIoctl+0x28) [0x7fb90405ffa8]
4: /usr/lib64/libdrm.so.2 (drmCommandWrite+0x1b) [0x7fb90406235b]
5: /usr/lib64/libdrm_nouveau.so.2 (nouveau_bo_wait+0x89) [0x7fb902009719]
6: /opt/xserver/lib/xorg/modules/drivers/nouveau_drv.so (nouveau_exa_download_from_screen+0x1a3) [0x7fb9022156f3]
7: /opt/xserver/lib/xorg/modules/libexa.so (exaGetImage+0x1f0) [0x7fb9019d2ae0]
8: /opt/xserver/bin/X (miSpriteGetImage+0x173) [0x57d2b3]
9: /opt/xserver/bin/X (compGetImage+0xb0) [0x4c9930]
10: /opt/xserver/bin/X (ProcGetImage+0x55a) [0x43a81a]
11: /opt/xserver/bin/X (Dispatch+0x341) [0x43d6a1]
12: /opt/xserver/bin/X (main+0x3ba) [0x42c2ca]
13: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x7fb902f019b5]
14: /opt/xserver/bin/X (_start+0x29) [0x42c60d]
15: ? (?+0x29) [0x29]

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Knut Petersen <knut.petersen@t-online.de>
11 years agoxkb: Set nIndicators in XkbGetIndicatorMap
Peter Harris [Tue, 19 Feb 2013 21:08:52 +0000 (16:08 -0500)]
xkb: Set nIndicators in XkbGetIndicatorMap

Xlib doesn't use this value (it computes it from the reply length
instead) which is why nobody has noticed yet. But the spec
http://www.x.org/releases/X11R7.7/doc/kbproto/xkbproto.html
says that it should be set.

Signed-off-by: Peter Harris <pharris@opentext.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoephyr: Add -resizeable option
Daniel Martin [Tue, 11 Dec 2012 16:23:55 +0000 (17:23 +0100)]
ephyr: Add -resizeable option

With this option passed, ephyr windows can be resized like normal
windows on the fly, without the need of an explicit parent window.

Signed-off-by: Daniel Martin <daniel.martin@secunet.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agodix: FreeAllAtoms() on reset
Peter Hutterer [Mon, 27 Feb 2012 06:43:10 +0000 (16:43 +1000)]
dix: FreeAllAtoms() on reset

==5712== 6 bytes in 1 blocks are still reachable in loss record 17 of 585
==5712==    at 0x4A074CD: malloc (vg_replace_malloc.c:236)
==5712==    by 0x3D1DE885B1: strndup (strndup.c:46)
==5712==    by 0x41CB71: MakeAtom (atom.c:121)
==5712==    by 0x55AE3E: XIGetKnownProperty (xiproperty.c:401)
==5712==    by 0x4251C9: AddInputDevice (devices.c:312)
==5712==    by 0x42AC0C: AllocDevicePair (devices.c:2657)
==5712==    by 0x425E6E: InitCoreDevices (devices.c:677)
==5712==    by 0x5ACA05: main (main.c:257)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
11 years agoMerge branch 'master' of git+ssh://people.freedesktop.org/~alanc/xserver into next
Peter Hutterer [Fri, 15 Feb 2013 01:58:52 +0000 (11:58 +1000)]
Merge branch 'master' of git+ssh://people.freedesktop.org/~alanc/xserver into next

11 years agoxfree86: remove redundant declaration of inputInfo
Peter Hutterer [Thu, 14 Feb 2013 00:21:47 +0000 (10:21 +1000)]
xfree86: remove redundant declaration of inputInfo

xf86Cursor.c:19:18: warning: redundant redeclaration of 'inputInfo'
[-Wredundant-decls]
In file included from xf86Cursor.c:18:0:
../../../include/inputstr.h:614:57: note: previous declaration of
'inputInfo' was here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
11 years agoxkb: remove unused variable 'names'
Peter Hutterer [Thu, 14 Feb 2013 00:15:33 +0000 (10:15 +1000)]
xkb: remove unused variable 'names'

xkb.c: In function '_XkbSetNamesCheck':
xkb.c:3987:18: warning: variable 'names' set but not used
[-Wunused-but-set-variable]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
11 years agoXext: rename two shadowing variables
Peter Hutterer [Thu, 14 Feb 2013 00:13:53 +0000 (10:13 +1000)]
Xext: rename two shadowing variables

panoramiX.c: In function 'PanoramiXCreateConnectionBlock':
panoramiX.c:599:10: warning: declaration of 'disableBackingStore' shadows a
global declaration [-Wshadow]
In file included from ../include/windowstr.h:60:0,
                 from panoramiX.c:47:
../include/opaque.h:56:52: warning: shadowed declaration is here [-Wshadow]

panoramiX.c: In function 'PanoramiXConsolidate':
panoramiX.c:834:19: warning: declaration of 'pScreen' shadows a previous
local [-Wshadow]
panoramiX.c:813:15: warning: shadowed declaration is here [-Wshadow]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
11 years agoXext: renaming shadowing variable
Peter Hutterer [Thu, 14 Feb 2013 00:09:53 +0000 (10:09 +1000)]
Xext: renaming shadowing variable

xvdisp.c: In function 'ProcXvStopVideo':
xvdisp.c:712:11: warning: declaration of 'rc' shadows a previous local
[-Wshadow]
xvdisp.c:705:17: warning: shadowed declaration is here [-Wshadow]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
11 years agofb: drop two unneeded shadowing variables
Peter Hutterer [Thu, 14 Feb 2013 00:06:55 +0000 (10:06 +1000)]
fb: drop two unneeded shadowing variables

fbpict.c: In function 'fbGlyphs':
fbpict.c:188:6: warning: declaration of 'x' shadows a previous local
[-Wshadow]
fbpict.c:111:9: warning: shadowed declaration is here [-Wshadow]
fbpict.c:188:9: warning: declaration of 'y' shadows a previous local
[-Wshadow]
fbpict.c:111:12: warning: shadowed declaration is here [-Wshadow]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Soren Sandmann <ssp@redhat.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
11 years agoxfree86: drop unused prevSIGIO
Peter Hutterer [Thu, 14 Feb 2013 00:04:06 +0000 (10:04 +1000)]
xfree86: drop unused prevSIGIO

Unused as of 5d309af2ed93e91c7d72f548a11052051efbb40f

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
11 years agorandr: fix "set but unused" warnings
Peter Hutterer [Thu, 14 Feb 2013 00:02:02 +0000 (10:02 +1000)]
randr: fix "set but unused" warnings

rrcrtc.c: In function 'RRCrtcDetachScanoutPixmap':
rrcrtc.c:366:9: warning: variable 'ret' set but not used
[-Wunused-but-set-variable]
rrcrtc.c: In function 'rrCheckPixmapBounding':
rrcrtc.c:505:13: warning: variable 'ret' set but not used
[-Wunused-but-set-variable]
rrcrtc.c:445:9: warning: unused variable 'i' [-Wunused-variable]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
11 years agoMerge remote-tracking branch 'jeremyhu/master'
Keith Packard [Thu, 14 Feb 2013 19:05:48 +0000 (11:05 -0800)]
Merge remote-tracking branch 'jeremyhu/master'

11 years agoos: fix pnprintf OOB buffer read for unterminated length modifiers
Peter Hutterer [Thu, 14 Feb 2013 06:31:13 +0000 (16:31 +1000)]
os: fix pnprintf OOB buffer read for unterminated length modifiers

Format strings with length modifiers but missing format specifier like "%0"
will read one byte past the array size.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoXORG_TLS: Pick the first option that works (ie: prefer __thread)
Jeremy Huddleston Sequoia [Sun, 10 Feb 2013 04:53:02 +0000 (20:53 -0800)]
XORG_TLS: Pick the first option that works (ie: prefer __thread)

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
11 years agoos: Ensure <dix-config.h> is included in strndup.c
Jeremy Huddleston Sequoia [Sun, 10 Feb 2013 04:40:10 +0000 (20:40 -0800)]
os: Ensure <dix-config.h> is included in strndup.c

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
11 years agoXQuartz: Ensure <dix-config.h> is included in capabilities.c
Jeremy Huddleston Sequoia [Sun, 10 Feb 2013 04:34:33 +0000 (20:34 -0800)]
XQuartz: Ensure <dix-config.h> is included in capabilities.c

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
11 years agoUpdate to version 1.3.99.902 (1.14 RC2) xorg-server-1.13.99.902
Keith Packard [Thu, 14 Feb 2013 05:39:37 +0000 (21:39 -0800)]
Update to version 1.3.99.902 (1.14 RC2)

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agorandr: unref the provider shared pixmap the appropriate number of times
Aaron Plattner [Thu, 24 Jan 2013 00:58:47 +0000 (16:58 -0800)]
randr: unref the provider shared pixmap the appropriate number of times

When an RandR shared pixmap is created in rrCreateSharedPixmap, it has a refcnt
of 1.  Then, PixmapShareToSlave bumps the refcnt to 2.  However, there's no
corresponding PixmapUnshareFromSlave where the refcnt can be decreased again,
and there's no convenient common place where the refcnt can be decremented when
the slave pixmap is destroyed.

Fix this by just unreffing the pixmap twice in RRCrtcDetachScanoutPixmap.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoxf86: use nt_list_for_each_entry_safe to walk InputHandlers in xf86Wakeup
Aaron Plattner [Mon, 11 Feb 2013 22:31:56 +0000 (14:31 -0800)]
xf86: use nt_list_for_each_entry_safe to walk InputHandlers in xf86Wakeup

This is necessary when the input handler deletes itself from the
list. Bug found by Maarten Lankhorst, this patch uses the list macros
instead of open-coding the fix.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoxfree86: Man page shouldn't say Device is mandatory anymore
Bryce Harrington [Fri, 8 Feb 2013 23:56:02 +0000 (15:56 -0800)]
xfree86: Man page shouldn't say Device is mandatory anymore

man xorg.conf states that the 'Device' identifier is required in the
'Screen' section, yet current xserver defaults properly and boots up
fine without it.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=20742
Signed-off-by: Bryce Harrington <bryce@canonical.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoxfree86: Use fbdev/vesa driver on Oaktrail, Medfield, CDV rather than -intel
Bryce Harrington [Fri, 8 Feb 2013 23:56:01 +0000 (15:56 -0800)]
xfree86: Use fbdev/vesa driver on Oaktrail, Medfield, CDV rather than -intel

Instead of defaulting to -intel for Oaktrail, Medfield, and CDV chips,
default to -fbdev.  For Poulsbo (only), attempt to use -psb if it's
installed, and fallback to fbdev otherwise.  All other Intel chips
should use -intel.

This fixed an issue where -intel would load on these chips and cause a
boot failure.  Newer -intel drivers avoid the boot hang, but it's still
the wrong driver to load, so why take chances.

The patch was originally created by Stefan Dirsch for OpenSUSE.  We have
included it in our stable release (Ubuntu "quantal" 12.10) since
December.

ref:  https://bugzilla.novell.com/show_bug.cgi?id=772279
ref:  https://bugs.launchpad.net/ubuntu/+bug/1069031
Fixes:  https://bugs.freedesktop.org/show_bug.cgi?id=60514
Signed-off-by: Bryce Harrington <bryce@canonical.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agorandr: bump advertised RandR version to 1.4
Dave Airlie [Tue, 5 Feb 2013 15:46:06 +0000 (07:46 -0800)]
randr: bump advertised RandR version to 1.4

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Tested-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoShort-cut the input device cleanup process during AbortServer()
Peter Hutterer [Wed, 30 Jan 2013 03:20:07 +0000 (03:20 +0000)]
Short-cut the input device cleanup process during AbortServer()

If we're about to abort, we're already in the signal handler and cannot call
down to the default device cleanup routines (which reset, free, alloc, and
do a bunch of other things).

Add a new DEVICE_ABORT mode to signal a driver's DeviceProc that it must
reset the hardware if needed but do nothing else. An actual HW reset is only
required for some drivers dealing with the HW directly.

This is largely backwards-compatible, hence the input ABI minor bump only.

Drivers we care about either return BadValue on a mode that's not
DEVICE_{INIT|ON|OFF|CLOSE} or print an error and return BadValue. Exception
here is vmmouse, which currently ignores it and would not reset anything.
This should be fixed if the reset is required.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agodix: support the transformation matrix for relative devices.
Peter Hutterer [Fri, 8 Feb 2013 04:52:02 +0000 (14:52 +1000)]
dix: support the transformation matrix for relative devices.

The transformation matrix we previously stored was a scaled matrix based on
the axis ranges of the device. For relative movements, the scaling is not
required (or desired).

Store two separate matrices, one as requested by the client, one as the
product of [scale . matrix . inv_scale]. Depending on the type of movement,
apply the respective matrix.

For relative movements, also drop the translation component since it doesn't
really make sense to use that bit.

Input ABI 19

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoos: Round fraction in pnprintf %f format
Keith Packard [Fri, 8 Feb 2013 16:57:43 +0000 (08:57 -0800)]
os: Round fraction in pnprintf %f format

Truncating the fraction part leads to a test failure where -1203.30 is
printed as -1203.29. Round this to the nearest value instead by adding
0.5 before converting to an integer

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agodix: Set focus field on XI2 crossing events
Carlos Garnacho [Wed, 6 Feb 2013 13:07:22 +0000 (14:07 +0100)]
dix: Set focus field on XI2 crossing events

Set on DeviceEnterLeaveEvent() the xXIEnterEvent->focus field
similarly to how the CoreEnterLeaveEvent() function above does
for core events.

This fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=677329
reported to GTK+, where focus handling on window managers with
sloppy focus or no window manager present was broken due to this
field being always set to FALSE.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agodix: when shutting down slave devices, shut down xtest devices last
Peter Hutterer [Fri, 25 Jan 2013 01:47:32 +0000 (11:47 +1000)]
dix: when shutting down slave devices, shut down xtest devices last

XTest devices are the first ones in the list, being initialised together
with the master devices. If we disable the devices in-order and a device has
a button down when being disabled, the XTest device is checked for a
required button release (xkbAccessX.c's ProcessPointerEvent). This fails if
the device is already NULL.

Instead of putting the check there, disable the devices in the reverse order
they are initialised. Disable physical slaves first, then xtest devices,
then the master devices.

Testcase: shut down server with a button still held down on a physical
device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agoMerge branch 'ptraccel-fixes' into for-keith
Peter Hutterer [Fri, 8 Feb 2013 04:10:52 +0000 (14:10 +1000)]
Merge branch 'ptraccel-fixes' into for-keith

11 years agodix: pre-scale relative events from abs devices to desktop ratio (#31636)
Peter Hutterer [Fri, 11 Jan 2013 04:22:07 +0000 (14:22 +1000)]
dix: pre-scale relative events from abs devices to desktop ratio (#31636)

Absolute devices may send relative events depending on the mode (synaptics
by default, wacom per option). The relative events are added to the previous
position, converted into device coordinates and then scaled into desktop
coordinates for pointer movement.

Because the device range must be mapped into the desktop coordinate range,
this results in uneven scaling depending dimensions, e.g. on a setup with
width == 2 * height, a relative movement of 10/10 in device coordinates
results in a cursor movement of 20/10 (+ acceleration)

Other commonly user-visible results:
* the touchpad changing acceleration once an external monitor as added.
* drawing a circle on a wacom tablet in relative mode gives an ellipsis in
  the same ratio as the desktop dimensions.

Solution: pre-scale the incoming relative x/y coordinates by width/height
ratio of the total desktop size. Then add them to the previous
coordinates and scale back with the previous mapping, which will undo the
pre-scaling and give us the right movement.

X.Org Bug 31636 <http://bugs.freedesktop.org/show_bug.cgi?id=31636>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agodix: unify prefix for ptraccel debugging in DebugAccelF macro
Peter Hutterer [Thu, 10 Jan 2013 22:53:24 +0000 (08:53 +1000)]
dix: unify prefix for ptraccel debugging in DebugAccelF macro

If we're already using our own custom macro, might as well use it properly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agodix: use BUG_RETURN_VAL for an error message
Peter Hutterer [Thu, 10 Jan 2013 22:52:08 +0000 (08:52 +1000)]
dix: use BUG_RETURN_VAL for an error message

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agodix: add some more info to a ptraccel debug msg
Peter Hutterer [Thu, 10 Jan 2013 22:49:15 +0000 (08:49 +1000)]
dix: add some more info to a ptraccel debug msg

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agodix: fix ptraccel debugging printfs
Peter Hutterer [Thu, 10 Jan 2013 03:19:27 +0000 (13:19 +1000)]
dix: fix ptraccel debugging printfs

This is mostly sigsafe code, so use sigsave printf. And update some fields
to double that used to be int.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agoxkb: Fix repeat behaviour of redirect and message actions
Andreas Wettstein [Tue, 29 Jan 2013 20:49:20 +0000 (21:49 +0100)]
xkb: Fix repeat behaviour of redirect and message actions

The redirect and the message action filter functions implicitly assumed that
when they receive an event for the same keycode they were activated for, that
this is the a release of the key that activated the filter.  This is not true
if the key autorepeats.  Due to the incorrect assumption, the effective key
repeat rate was effectively halved.

Signed-off-by: Andreas Wettstein <wettstein509@solnet.ch>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoXext: if a root window is given in XTestFakeInput, move to that
Peter Hutterer [Sat, 26 Jan 2013 05:53:08 +0000 (15:53 +1000)]
Xext: if a root window is given in XTestFakeInput, move to that

For absolute events, if the client specifies a screen number offset the
coordinates by that. And add a new flag so we know when _not_ to add the
screen offset in GPE.

Without this offset and the flag, GPE would simply add the offset of the
current screen if POINTER_SCREEN is set.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agoXext: pass the current screen to miProcessDeviceEvent() from xtest calls
Peter Hutterer [Tue, 29 Jan 2013 05:13:44 +0000 (15:13 +1000)]
Xext: pass the current screen to miProcessDeviceEvent() from xtest calls

Not passing in a screen means we skip the screen crossing updates, so a
xtest event that changes between ScreenRecs won't do so until the next
physical event comes in or never, whichever comes earlier.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agodix: when scaling from desktop coord, take the total desktop size (#51904)
Sybren van Elderen [Tue, 29 Jan 2013 05:43:57 +0000 (15:43 +1000)]
dix: when scaling from desktop coord, take the total desktop size (#51904)

Scaled is already in desktop coordinates, take the total width into account,
not just the current screen's width.

Fixes Xdmx pointer position calculation.

X.Org Bug 51904 <http://bugs.freedesktop.org/show_bug.cgi?id=51904>

Signed-off-by: Sybren van Elderen <sowmestno@msn.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoinclude: fix typo in list description
Peter Hutterer [Tue, 29 Jan 2013 02:51:15 +0000 (12:51 +1000)]
include: fix typo in list description

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoxfree86: bail on misformed acpi strings (#73227)
Ted Felix [Tue, 29 Jan 2013 06:36:48 +0000 (16:36 +1000)]
xfree86: bail on misformed acpi strings (#73227)

If acpid sends a string in a format that we can't parse, bail out instead of
potentially dereferencing a NULL-pointer.

X.Org Bug 73227 <http://bugs.freedesktop.org/show_bug.cgi?id=73227>

Signed-off-by: Ted Felix <ted@tedfelix.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoXi: limit valuator copy to valuator array size (#59939)
Peter Hutterer [Tue, 29 Jan 2013 01:01:29 +0000 (11:01 +1000)]
Xi: limit valuator copy to valuator array size (#59939)

mask[(MAX_VALUATORS + 7)/8] is larger than data[MAX_VALUATORS], so static
code checkers think we may be running OOB on the data array. Mask is
initialized to 0, so this should not happen, but change it anyway to shut up
code analyzer noise.

X.Org Bug 59939 <http://bugs.freedesktop.org/show_bug.cgi?id=59939>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
11 years agoXext: avoid null-pointer dereference in XTestFakeInput (#59937)
Alan Coopersmith [Tue, 29 Jan 2013 00:24:32 +0000 (10:24 +1000)]
Xext: avoid null-pointer dereference in XTestFakeInput (#59937)

dv is still NULL at this point, so return firstValuator instead (which is
the same value dv->firstValuator would be once initialized)

X.Org Bug 59937 <http://bugs.freedesktop.org/show_bug.cgi?id=59937>

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agodmx: don't include dmx-config.h from xdmxconfig (#37502)
Peter Hutterer [Sat, 26 Jan 2013 04:13:33 +0000 (14:13 +1000)]
dmx: don't include dmx-config.h from xdmxconfig (#37502)

dmx-config.h is a server header which includes dix-config.h. That again
defines a bunch of server-specifics, including setting the size of XID to
32 bit.

libX11 uses unsigned long (8 bits on x86_64). XGCValues thus ends up being
16 bytes smaller in xdmxconfig than in the library, causing garbage to be
sent to the server.

X.Org Bug 37502 <http://bugs.freedesktop.org/show_bug.cgi?id=37502>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agoAvoid memory leak in ddc resort() if find_header() fails
Alan Coopersmith [Sun, 27 Jan 2013 23:42:02 +0000 (15:42 -0800)]
Avoid memory leak in ddc resort() if find_header() fails

Call find_header first, returning on failure before calling malloc.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoxf86XvMCScreenInit: Avoid leak if dixRegisterPrivateKey fails
Alan Coopersmith [Sun, 27 Jan 2013 22:00:54 +0000 (14:00 -0800)]
xf86XvMCScreenInit: Avoid leak if dixRegisterPrivateKey fails

Found by parfait 1.1 memory analyser:
   Memory leak of pointer 'pAdapt' allocated with malloc((88 * num_adaptors))
        at line 162 of hw/xfree86/common/xf86xvmc.c in function 'xf86XvMCScreenInit'.
          'pAdapt' allocated at line 158 with malloc((88 * num_adaptors)).

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAvoid memory leak on realloc failure in localRegisterFreeBoxCallback
Alan Coopersmith [Sun, 27 Jan 2013 21:55:50 +0000 (13:55 -0800)]
Avoid memory leak on realloc failure in localRegisterFreeBoxCallback

Also avoids leaving invalid pointers in structures if realloc had to
move them elsewhere to make them larger.

Found by parfait 1.1 code analyzer:
   Memory leak of pointer 'newCallbacks' allocated with realloc(((char*)offman->FreeBoxesUpdateCallback), (8 * (offman->NumCallbacks + 1)))
        at line 328 of hw/xfree86/common/xf86fbman.c in function 'localRegisterFreeBoxCallback'.
          'newCallbacks' allocated at line 320 with realloc(((char*)offman->FreeBoxesUpdateCallback), (8 * (offman->NumCallbacks + 1))).
          newCallbacks leaks when newCallbacks != NULL at line 327.
   Memory leak of pointer 'newPrivates' allocated with realloc(((char*)offman->devPrivates), (8 * (offman->NumCallbacks + 1)))
        at line 328 of hw/xfree86/common/xf86fbman.c in function 'localRegisterFreeBoxCallback'.
          'newPrivates' allocated at line 324 with realloc(((char*)offman->devPrivates), (8 * (offman->NumCallbacks + 1))).
          newPrivates leaks when newCallbacks == NULL at line 327.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoAvoid NULL pointer dereference in xf86TokenToOptinfo if token not found
Alan Coopersmith [Sun, 27 Jan 2013 21:50:30 +0000 (13:50 -0800)]
Avoid NULL pointer dereference in xf86TokenToOptinfo if token not found

Reported by parfait 1.1 code analyzer:

Error: Null pointer dereference (CWE 476)
   Read from null pointer 'p'
        at line 746 of hw/xfree86/common/xf86Option.c in function 'xf86TokenToOptName'.
          Function 'xf86TokenToOptinfo' may return constant 'NULL' at line 721, called at line 745.
          Null pointer introduced at line 721 in function 'xf86TokenToOptinfo'.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoMake xf86ValidateModes actually copy clock range list to screen pointer
Alan Coopersmith [Sun, 27 Jan 2013 21:10:08 +0000 (13:10 -0800)]
Make xf86ValidateModes actually copy clock range list to screen pointer

Our in-house parfait 1.1 code analysis tool complained that every exit
path from xf86ValidateModes() in hw/xfree86/common/xf86Mode.c leaks the
storeClockRanges allocation made at line 1501 with XNFalloc.

Investigating, it seems that this code to copy the clock range list to
the clockRanges list in the screen pointer is just plain insane, and
according to git, has been since we first imported it from XFree86.

We start at line 1495 by walking the linked list from scrp->clockRanges
until we find the end.  But that was just a diversion, since we've found
the end and immediately forgotten it, and thus at 1499 we know that
storeClockRanges is NULL, but that's not a problem since we're going to
immediately overwrite that value as the first thing in the loop.

So we move on through this loop at 1499, which takes us through the
linked list from the clockRanges variable, and for every entry in
that list allocates a new structure and copies cp to it.  If we've
not filled in the screen's clockRanges pointer yet, we set it to
the first storeClockRanges we copied from cp.   Otherwise, as best
I can tell, we just drop it into memory and let it leak away, as
parfait warned.

And then we hit the loop action, which if we haven't hit the end of
the cp list, advances cp to the next item in the list, and then just
for the fun of it, also sets storeClockRanges to the ->next pointer it
has just copied from cp as well, even though it's going to overwrite
it as the very first instruction in the loop body.

v2: rewritten using nt_list_* macros from Xorg's list.h header

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoFree keymap on error in Xephyr's hostx_load_keymap
Alan Coopersmith [Sun, 27 Jan 2013 20:08:47 +0000 (12:08 -0800)]
Free keymap on error in Xephyr's hostx_load_keymap

Found by parfait 1.1 code analyser:
   Memory leak of pointer 'keymap' allocated with XGetKeyboardMapping(HostX.dpy, min_keycode, ((max_keycode - min_keycode) + 1), &host_width)
        at line 861 of hw/kdrive/ephyr/hostx.c in function 'hostx_load_keymap'.
          'keymap' allocated at line 845 with XGetKeyboardMapping(HostX.dpy, min_keycode, ((max_keycode - min_keycode) + 1), &host_width).

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoStop leaking overlayWin in PanoramiXCompositeGetOverlayWindow error paths
Alan Coopersmith [Sun, 27 Jan 2013 19:20:45 +0000 (11:20 -0800)]
Stop leaking overlayWin in PanoramiXCompositeGetOverlayWindow error paths

Found by parfait 1.1 code analyzer:

Error: Memory leak (CWE 401)
   Memory leak of pointer 'overlayWin' allocated with malloc(72)
        at line 806 of composite/compext.c in function 'PanoramiXCompositeGetOverlayWindow'.
          pointer allocated at line 794 with malloc(72).
          <unknown> leaks when rc != 0 at line 804.
        at line 816 of composite/compext.c in function 'PanoramiXCompositeGetOverlayWindow'.
          pointer allocated at line 794 with malloc(72).
          <unknown> leaks when pOc == NULL at line 815.
        at line 825 of composite/compext.c in function 'PanoramiXCompositeGetOverlayWindow'.
          pointer allocated at line 794 with malloc(72).
          <unknown> leaks when cs->pOverlayWin == NULL at line 822
              and compCreateOverlayWindow(pScreen) == 0 at line 823.
        at line 834 of composite/compext.c in function 'PanoramiXCompositeGetOverlayWindow'.
          pointer allocated at line 794 with malloc(72).
          <unknown> leaks when rc != 0 at line 832.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoHandle failure to create counter in init_system_idle_counter
Alan Coopersmith [Sun, 27 Jan 2013 18:06:42 +0000 (10:06 -0800)]
Handle failure to create counter in init_system_idle_counter

Check for NULL pointer (which can be returned for multiple reasons)
before trying to dereference it to add privates.   To avoid memory leak
in error path, delay malloc of privates until we're ready to add them.

In case we do return NULL up through SyncInitDeviceIdleTime, handle the
possibility of getting NULL passed back down to SyncRemoveDeviceIdleTime.

As reported by parfait 1.1:
Error: Null pointer dereference (CWE 476)
   Read from null pointer 'idle_time_counter'
        at line 2764 of xserver/Xext/sync.c in function 'init_system_idle_counter'.
          Function 'SyncCreateSystemCounter' may return constant 'NULL' at line 952, called at line 2756.
          Null pointer introduced at line 952 in function 'SyncCreateSystemCounter'.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoprotocol-versions: Bump minor version of XI
Jasper St. Pierre [Wed, 23 Jan 2013 18:11:55 +0000 (13:11 -0500)]
protocol-versions: Bump minor version of XI

This was accidentally excluded when we added barriers.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoconfig/udev: fix "removing GPU device" format string mistake
Aaron Plattner [Fri, 11 Jan 2013 01:01:17 +0000 (17:01 -0800)]
config/udev: fix "removing GPU device" format string mistake

 udev.c: In function 'device_removed':
 udev.c:270:9: warning: format '%d' expects argument of type 'int', but argument 3 has type 'const char *' [-Wformat]

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoxserver: fix build regression since 91ab237358c6e33da854914d3de493a9cbea7637
Dave Airlie [Mon, 21 Jan 2013 21:39:53 +0000 (07:39 +1000)]
xserver: fix build regression since 91ab237358c6e33da854914d3de493a9cbea7637

inputstr, double defines TouchListener typedef, maybe some gcc handles it,
but not all.

fixes tinderbox

Reported-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoMerge remote-tracking branch 'jturney/xserver-next'
Keith Packard [Sun, 20 Jan 2013 23:58:38 +0000 (15:58 -0800)]
Merge remote-tracking branch 'jturney/xserver-next'

11 years agoMerge remote-tracking branch 'whot/for-keith'
Keith Packard [Sun, 20 Jan 2013 23:52:26 +0000 (15:52 -0800)]
Merge remote-tracking branch 'whot/for-keith'

11 years agoos: add support for %f to pnprintf
Peter Hutterer [Thu, 10 Jan 2013 03:20:12 +0000 (13:20 +1000)]
os: add support for %f to pnprintf

This is the lazy man's %f support. Print the decimal part of the number,
then append a decimal point, then print the first two digits of the
fractional part. So %f in sigsafe printing is really %.2f.

No boundary checks in place here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agoos: silently ignore length modifiers in pnprintf
Peter Hutterer [Thu, 10 Jan 2013 03:24:05 +0000 (13:24 +1000)]
os: silently ignore length modifiers in pnprintf

Until we have support for them, ignore any length modifiers so we don't need
to update all callers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agotest/signal-logging: simplify tests using sprintf
Peter Hutterer [Thu, 17 Jan 2013 06:19:51 +0000 (16:19 +1000)]
test/signal-logging: simplify tests using sprintf

Ever looked at your own code and thought 'WTF was I thinking?'. yeah, that.

Instead of passing in the expected string just use sprintf to print the
number for us and compare. In the end we're just trying to emulate printf
behaviour anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agohw/xwin: Stop assuming WS_EX_APPWINDOW style in WM_SHOWWINDOW
Jon TURNEY [Sat, 11 Feb 2012 12:22:17 +0000 (12:22 +0000)]
hw/xwin: Stop assuming WS_EX_APPWINDOW style in WM_SHOWWINDOW

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
11 years agohw/xwin: Use ITaskBarList interface to ensure show-on-taskbar state is updated correctly
Jon TURNEY [Wed, 9 Jan 2013 20:15:01 +0000 (20:15 +0000)]
hw/xwin: Use ITaskBarList interface to ensure show-on-taskbar state is updated correctly

Use ITaskBarList interface to ensure that the taskbar notices if the window has
changed it's style in a way which affects if the taskbar shows it or not.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
11 years agohw/xwin: Ensure full styling is applied when the window is mapped
Jon TURNEY [Thu, 10 Jan 2013 14:35:56 +0000 (14:35 +0000)]
hw/xwin: Ensure full styling is applied when the window is mapped

Move styling update code from WM_WM_HINTS_EVENT to a function UpdateStyle(),
which is also invoked from WM_WM_MAP3, so everything which needs to be done
to style the window happens when it is mapped

(Otherwise, the appearance of the window is sensitive to the timing of the
notification of the windows appearance hint properties being set relative to
window creation. e.g. see [1])

[1] http://sourceware.org/ml/cygwin-xfree/2012-06/msg00004.html

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
11 years agohw/xwin: Make sure that WM_WM_HINTS_EVENT does nothing for override-redirect windows
Jon TURNEY [Sat, 31 Mar 2012 17:45:28 +0000 (18:45 +0100)]
hw/xwin: Make sure that WM_WM_HINTS_EVENT does nothing for override-redirect windows

Future work: It looks like this code could be rationalized quite a lot: It might
make sense to pull the checking for override-redirect up out of UpdateIcon() and
UpdateName() and consolidate WM_WM_MAP2 and WM_WM_MAP3

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
11 years agohw/xwin: Add a new WM_WM_HINTS_EVENT event to update window style
Jon TURNEY [Sun, 5 Feb 2012 11:25:39 +0000 (11:25 +0000)]
hw/xwin: Add a new WM_WM_HINTS_EVENT event to update window style

Add a new WM_WM_HINTS_EVENT event to update window style if any of the
properties which affect window style change

Check PropertyNotify events for any of the window properties which we consider
to decide on the window style, and update the window style by sending a
WM_WM_HINTS_EVENT message to the WM.

This allows the styling of the window to change during it's lifetime.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
11 years agohw/xwin: Move reshape code from winUpdateWindowPosition() to the map event handler
Jon TURNEY [Thu, 10 Jan 2013 14:37:45 +0000 (14:37 +0000)]
hw/xwin: Move reshape code from winUpdateWindowPosition() to the map event handler

Move reshape code, which was only used when handling a map event, from
winUpdateWindowPosition(), to put it explicitly in the map event handler.

Remove 'reshape' parameter from winUpdatePosition().

(Note that there's no handling of the ShapeNotify event to notice when the
window shape changes, instead we hook the screen SetShape procedure and reshape
the native window then)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
11 years agohw/xwin: Add missing include xwin-config.h to winglobals.h
Ryan Pavlik [Sat, 1 Dec 2012 16:58:40 +0000 (16:58 +0000)]
hw/xwin: Add missing include xwin-config.h to winglobals.h

winglobals.h checks if RELOCATE_PROJECTROOT is defined to see if a declaration
of g_fLogFileChanged is needed, so must include xwin-config.h

Signed-off-by: Ryan Pavlik <rpavlik@iastate.edu>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
11 years agoinclude: Add RELOCATE_PROJECTROOT to xwin-config.h header
Ryan Pavlik [Wed, 26 Oct 2011 22:03:25 +0000 (17:03 -0500)]
include: Add RELOCATE_PROJECTROOT to xwin-config.h header

RELOCATE_PROJECTROOT is AC_DEFINED in configure.ac, but currently has no effect
as it doesn't appear in any AC_CONFIG_HEADER header.

When packaged for Windows, we do not have a unix-style filesystem tree, where
file needed by the X server can be found in fixed, absolute paths under the
prefix (PROJECTROOT).

Instead, the filesystem tree containing files needed by the X server and clients
will be installed with the directory containing the X server executable as the
root directory of that tree.

(Typically, this will be in the Program Files directory, which does not have a
fixed name, as it can be moved, localized, or added to to indicate x86 or x64
binaries)

So, RELOCATE_PROJECTROOT is used to make a native Windows build of the X server
look for various files (fonts, xkb data) in locations relative to the X server
rather than at absolute paths, by translating those paths at run-time.

Additionally the XKEYSYMDB, XERRORDB, XLOCALEDIR env vars checked by libX11 are
set appropriately for clients started by the X server.

Signed-off-by: Ryan Pavlik <rpavlik@iastate.edu>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
11 years agoMerge branch 'pointer-emulation-fixes-56558-v2' into for-keith
Peter Hutterer [Fri, 11 Jan 2013 04:58:17 +0000 (14:58 +1000)]
Merge branch 'pointer-emulation-fixes-56558-v2' into for-keith

11 years agodix: typo fix in comment
Peter Hutterer [Thu, 10 Jan 2013 00:33:05 +0000 (10:33 +1000)]
dix: typo fix in comment

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agodix: fix error logging occuring in signal context of GetTouchEvents
Benjamin Tissoires [Wed, 9 Jan 2013 18:32:19 +0000 (19:32 +0100)]
dix: fix error logging occuring in signal context of GetTouchEvents

GetTouchEvents is usually called in a signal context.
Calling ErrorF for the error messages leads to X complaining about log:

(EE) BUG: triggered 'if (inSignalContext)'
(EE) BUG: log.c:484 in LogVMessageVerb()
(EE) Warning: attempting to log data in a signal unsafe manner while in signal context.
Please update to check inSignalContext and/or use LogMessageVerbSigSafe() or ErrorFSigSafe().
The offending log format message is:
%s: Attempted to start touch without x/y (driver bug)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoxfree86: don't access the old input handler after freeing it
Peter Hutterer [Wed, 9 Jan 2013 03:58:56 +0000 (13:58 +1000)]
xfree86: don't access the old input handler after freeing it

Introduced in 323869f3298cbbfe864af9404a8aed1bf7995d79

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
11 years agoxf86: bump input ABI version to 19
Dave Airlie [Sat, 5 Jan 2013 08:35:42 +0000 (18:35 +1000)]
xf86: bump input ABI version to 19

The changes to miPointerSetPosition interface from int->double breaks
the SIS driver build, so time to bump this.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoxfree86: update the device state for all DGA events (#59100)
Peter Hutterer [Tue, 8 Jan 2013 01:19:09 +0000 (11:19 +1000)]
xfree86: update the device state for all DGA events (#59100)

DGA only handles master devices but it does intercept slave device events as
well (since the event handlers are per event type, not per device).

The DGA code must thus call into UpdateDeviceState to reset the button/key
state on the slave device before it discards the remainder of the event.

Test case:
- Passive GrabModeSync on VCP
- Press button
- Enable DGA after ButtonPress
- AllowEvents(SyncPointer)
- Release button

The button release is handled by DGAProcessPointerEvent but the device state
is never updated, so the slave ends up with the button permanently down.
And since the master's button state is the union of the slave states, the
master has the button permanently down.

X.Org Bug 59100 <http://bugs.freedesktop.org/show_bug.cgi?id=59100>

Reported-by: Steven Elliott <selliott4@austin.rr.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
11 years agoxfree86: set event->detail for DGA pointer events
Peter Hutterer [Tue, 8 Jan 2013 00:13:53 +0000 (10:13 +1000)]
xfree86: set event->detail for DGA pointer events

Reported-by: Steven Elliott <selliott4@austin.rr.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
11 years agoFix two typos "requires an string value"
Peter Hutterer [Mon, 7 Jan 2013 00:44:33 +0000 (10:44 +1000)]
Fix two typos "requires an string value"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agodix: don't filter RawEvents if the grab window is not the root window (#53897)
Peter Hutterer [Wed, 22 Aug 2012 00:34:07 +0000 (10:34 +1000)]
dix: don't filter RawEvents if the grab window is not the root window (#53897)

If a XI2.1+ client has a grab on a non-root window, it  must still receive
raw events on the root window.

Test case: register for XI_ButtonPress on window and XI_RawMotion on root.
No raw events are received once the press activates an implicit grab on the
window.

X.Org Bug 53897 <http://bugs.freedesktop.org/show_bug.cgi?id=53897>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agohw/xwin: Fix MinGW build of winSetAppModelID.c
Jon TURNEY [Wed, 28 Nov 2012 22:25:35 +0000 (22:25 +0000)]
hw/xwin: Fix MinGW build of winSetAppModelID.c

Add missing #include <pthread.h>

In file included from /jhbuild/checkout/xorg/xserver/hw/xwin/winSetAppUserModelID.c:31:0:
/jhbuild/checkout/xorg/xserver/hw/xwin/winwindow.h:140:11: error: expected declaration specifiers or ‘...’ before ‘pthread_t’
/jhbuild/checkout/xorg/xserver/hw/xwin/winwindow.h:141:11: error: expected declaration specifiers or ‘...’ before ‘pthread_t’
/jhbuild/checkout/xorg/xserver/hw/xwin/winwindow.h:142:11: error: expected declaration specifiers or ‘...’ before ‘pthread_mutex_t’

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
11 years agohw/xwin: Process one Windows message per wakeup, rather than all of them.
Jon TURNEY [Tue, 23 Feb 2010 13:38:48 +0000 (13:38 +0000)]
hw/xwin: Process one Windows message per wakeup, rather than all of them.

De-queuing Windows messages and X events happens in the same thread of
execution.  Draining the windows message queue can lead to the X event queue
overflowing if lots of those windows messages cause X events (e.g. if a keyboard
macro program has just dumped thousands of keypresses into the Windows message
queue).  See the mailing list thread [1] for more details.

Processing one Windows message per wakeup, rather than all of them gives the X
server a chance to do stuff as well after each message.

[1] http://cygwin.com/ml/cygwin-xfree/2010-01/msg00056.html

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
11 years agohw/xwin: Fix some comments in winkeybd.c
Jon TURNEY [Mon, 17 Dec 2012 22:38:25 +0000 (22:38 +0000)]
hw/xwin: Fix some comments in winkeybd.c

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
11 years agohw/xwin: Bring the X screen window to the front on a single left-click on the tray...
Jon TURNEY [Thu, 1 Apr 2010 14:08:26 +0000 (15:08 +0100)]
hw/xwin: Bring the X screen window to the front on a single left-click on the tray icon

Bring the X screen window to the front on a single left click on the tray icon,
like the comment says we do

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
11 years agohw/xfree86: Require only one working CRTC to start the server.
Keith Packard [Wed, 9 Jan 2013 04:24:32 +0000 (20:24 -0800)]
hw/xfree86: Require only one working CRTC to start the server.

Instead of requiring every mode set to complete successfully, start up
as long as at least one CRTC is working. This avoids failures when one
or more CRTCs can't start due to mode setting conflicts.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
11 years agodix: remove already-moved hunk
Peter Hutterer [Fri, 4 Jan 2013 02:26:58 +0000 (12:26 +1000)]
dix: remove already-moved hunk

Should've been removed in bc1f90a615018c05994fae3e678dd2341256cd82a, but got
left here due to a botched rebase.

Fixes stray button events sent to clients after deactivating an async
pointer grab on a pointer-emulating-touch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agodix: check for the right device's xi2 mask
Peter Hutterer [Thu, 20 Dec 2012 06:25:43 +0000 (16:25 +1000)]
dix: check for the right device's xi2 mask

events.c: In function 'DeactivatePointerGrab':
events.c:1524:51: warning: 'dev' may be used uninitialized in this function
[-Wuninitialized

dev is unset when we get here, the device to check is "mouse".
Introduced in ece8157a59751b3ed492fb2e1eb8d5f20221e195.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
11 years agodix: add resource type to touch listeners
Peter Hutterer [Tue, 30 Oct 2012 02:44:08 +0000 (12:44 +1000)]
dix: add resource type to touch listeners

Instead of guessing what resource type the listener is and what property to
retrieve, store the resource type in the listener directly.

Breaks XIT test cases:
TouchGrabTestMultipleTaps.PassiveGrabPointerEmulationMultipleTouchesFastSuccession

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56557

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Chase Douglas <chase.douglas@ubuntu.com>
11 years agoinput: Record grab pointer in TouchListener
Keith Packard [Tue, 27 Nov 2012 19:21:17 +0000 (11:21 -0800)]
input: Record grab pointer in TouchListener

This places a pointer to the grab related to a TouchListener directly
in the TouchListener structure rather than hoping to find the grab
later on using the resource ID.

Passive grabs have resource ID in the resource DB so they can be
removed when a client exits, and those resource IDs get copied when
activated, but implicit grabs are constructed on-the-fly and have no
resource DB entry.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoinput: Pull TouchListener declaration to top-level
Keith Packard [Tue, 27 Nov 2012 19:21:16 +0000 (11:21 -0800)]
input: Pull TouchListener declaration to top-level

No reason to have a struct declared inside another struct

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoxkb: Do not use base group as an array index.
Andreas Wettstein [Wed, 19 Dec 2012 17:13:21 +0000 (18:13 +0100)]
xkb: Do not use base group as an array index.

The base group is not brought into range and, therefore, using it as an array
index crashed the X server.  Also, at this place, we should ignore locked
groups, but not latched groups.  Therefore, use sum of base and latched groups,
brought into range.

Reproducible with:
key <FK07> {
    type= "ONE_LEVEL",
    symbols[Group1]= [              NoSymbol ],
    actions[Group1]= [ LatchGroup(group=-1, clearLocks) ]
};

And hitting F7 will exceed the group level and access arbitrary memory.

Signed-off-by: Andreas Wettstein <wettstein509@solnet.ch>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agorender: Unwrap early on the animated cursor BlockHandler
Carlos Garnacho [Wed, 19 Dec 2012 17:42:39 +0000 (18:42 +0100)]
render: Unwrap early on the animated cursor BlockHandler

The loop above the previous call may end up triggering other
handlers attaching to the same function slot, so unwrapping
the handler after that could leave the just attached handler
in a dangling but not unset state.

This issue was most visible on the XO, where destroying a
window with an animated cursor set and running  would trigger
this inconsistent state, never calling the miSpriteBlockHandler
again after the animated cursor is unset.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agomi: Ensure pointer emulating touch events update the sprite
Carlos Garnacho [Wed, 19 Dec 2012 17:42:38 +0000 (18:42 +0100)]
mi: Ensure pointer emulating touch events update the sprite

Different miPointerSpriteFuncRec implementations do a varying
business at ultimately calling miPointerUpdateSprite(), this
particularly fails when using the plain mi sprite on touch events,
where the sprite is just moved/updated on cursor changes.

So, ensure miPointerUpdateSprite() is called generically for
pointer emulating touch events as with regular motion events.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agodix: Make small bitfields that store enums unsigned
Aaron Plattner [Fri, 21 Dec 2012 15:37:33 +0000 (07:37 -0800)]
dix: Make small bitfields that store enums unsigned

Commit 31bf81772e146af79b0c456aae2159eba8b0280f changed the clientState field
from a signed int to a signed int 2-bit bitfield.  The ClientState enum that is
expected to be assigned to this field has four values: ClientStateInitial (0),
ClientStateRunning (1), ClientStateRetained (2), and ClientStateGone (3).
However, because this bitfield is signed, ClientStateRetained becomes -2 when
assigned, and ClientStateGone becomes -1.  This causes warnings:

 test.c:54:10: error: case label value exceeds maximum value for type [-Werror]
 test.c:55:10: error: case label value exceeds maximum value for type [-Werror]

The code here is a switch statement:

 53     switch (client->clientState) {
 54     case ClientStateGone:
 55     case ClientStateRetained:
 56         [...]
 57         break;
 58
 59     default:
 60         [...]
 61         break;
 62     }

It also causes bizarre problems like this:

 client->clientState = ClientStateGone;
 assert(client->clientState == ClientStateGone); // this assert fails

Also change the signedness of nearby bitfields to match.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Colin Harrison <colin.harrison at virgin.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agotest/xi2: fix compiler warning
Peter Hutterer [Thu, 20 Dec 2012 02:44:16 +0000 (12:44 +1000)]
test/xi2: fix compiler warning

protocol-xiwarppointer.c: In function ‘ScreenSetCursorPosition’:
protocol-xiwarppointer.c:71:53: warning: declaration of ‘screen’ shadows a
global declaration [-Wshadow]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoUpdate to version 1.13.99.901 (1.14 RC1) xorg-server-1.13.99.901
Keith Packard [Wed, 19 Dec 2012 20:47:35 +0000 (12:47 -0800)]
Update to version 1.13.99.901 (1.14 RC1)

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoMerge remote-tracking branch 'jeremyhu/master'
Keith Packard [Wed, 19 Dec 2012 20:26:00 +0000 (12:26 -0800)]
Merge remote-tracking branch 'jeremyhu/master'

11 years agoMerge remote-tracking branch 'yselkowitz/master'
Keith Packard [Wed, 19 Dec 2012 20:21:31 +0000 (12:21 -0800)]
Merge remote-tracking branch 'yselkowitz/master'

I checked this patch with diff -w to check that it only affected
whitespace.

11 years agoMerge remote-tracking branch 'alanc/master'
Keith Packard [Wed, 19 Dec 2012 20:17:59 +0000 (12:17 -0800)]
Merge remote-tracking branch 'alanc/master'

11 years agoMerge remote-tracking branch 'whot/barriers'
Keith Packard [Wed, 19 Dec 2012 20:09:31 +0000 (12:09 -0800)]
Merge remote-tracking branch 'whot/barriers'

Conflicts:
Xi/xichangehierarchy.c

Small conflict with the patch from

Xi: don't use devices after removing them

Was easily resolved by hand.

Signed-off-by: Keith Packard <keithp@keithp.com>
11 years agoEnableDisableExtensionError: Use ARRAY_SIZE rather than sentinel
Alan Coopersmith [Tue, 18 Dec 2012 08:41:08 +0000 (00:41 -0800)]
EnableDisableExtensionError: Use ARRAY_SIZE rather than sentinel

d785368e0e converted the other miinitext functions to use ARRAY_SIZE,
and removed the sentinel, but missed EnableDisableExtensionError so
passing an invalid extension name could cause the server to walk off
the end off the list looking for a sentinel that wasn't there.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
11 years agoXQuartz: Don't add the 15bit visual any more
Jeremy Huddleston Sequoia [Tue, 18 Dec 2012 09:29:12 +0000 (01:29 -0800)]
XQuartz: Don't add the 15bit visual any more

Mountain Lion only supports 32bit backing stores, so don't use 15bit visuals until libXplugin adapts

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
11 years agoXQuartz: Revert some unfortunate auto-indenting mishaps with our super-nested for...
Jeremy Huddleston Sequoia [Tue, 18 Dec 2012 09:28:02 +0000 (01:28 -0800)]
XQuartz: Revert some unfortunate auto-indenting mishaps with our super-nested for-loops

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>