kdrive: Fix a few easy cast warnings.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
kdrive: Fix const cast warnings in driver name handling.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
kdrive: Fix const cast warnings in arguments processing.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
ephyr: Drop is_ok logging.

The only cases that lead to !is_ok are already EPHYR_LOG_ERROR, and it
fixes set-but-unused compiler warnings.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
ephyr: Fix warning about XID vs unsigned long * by changing function args

There's no reason to pass the data back out to the caller, since the
caller was dropping it on the floor.  The original data is a CARD32,
so no need to mess with weird unsigned longs.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
DIX/Xi: Pass correct client to CheckDeviceGrabAndHintWindow()

If we have a client which has registered for a DeviceButton grab
be sure to pass this to CheckDeviceGrabAndHintWindow(). Since the
order of clients is arbitrary there is no guarantee that the last
client in the list is the one that belongs to this class.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
test: fix the gcc diagnostics pragma

pop without push restores the commandline options. The proper way is to
push, then ignore, then pop.

And while we're at it, change the pop argument to a comment - pop ignores
the argument, but be proper about it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
include: wrap EMASKSIZE in parentheses

Otherwise things like EMASKSIZE * foo will yield interesting results.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Xi: replace loop with memset

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
dix: check for grab type before checking XI2 mask

if the grab type isn't XI2, grab->xi2mask is random. That random data may
have the enter/leave mask set, leading to events sent to the client that the
client can't handler.

Source of these errors:
  _xgeWireToEvent: Unknown extension 131, this should never happen.

Simplest reproducer:
   Start Xephyr, press button inside window, move out. As the pointer leaves
   the Xephyr window, the errors appear.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Xi: allow for XIAllowEvent requests larger than XI < 2.2 size (#68554)

XIAllowEvents changed length in XI 2.2 (for the touchid). A bug in libXi
causes libXi to always use the new request length if the server supports
2.2, regardless of the client's XIQueryVersion request.

The server takes the client's XIQueryVersion request into account though,
resulting in a BadLength error if a 2.[0,1] client calls XIAllowEvents on a
XI 2.2+ server.

Can't fix this in libXi, so work around this in the server.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
hw/xwin: Fix inclusion of shlobj.h in MinGW64 build

Fix build with latest MinGW64 headers by wrapping Status type in shlobj.h as well

In file included from InitOutput.c:51:0:
/usr/i686-w64-mingw32/sys-root/mingw/include/shlobj.h:1231:44: error: expected identifier or ‘(’ before ‘int’
/usr/i686-w64-mingw32/sys-root/mingw/include/shlobj.h:1248:44: error: expected identifier or ‘(’ before ‘int’

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Marc Haesen <marha@users.sourceforge.net>
hw/xwin: Fix winglobals.h for MinGW64 build

Include pthread.h in winglobals.h to fix build with latest MinGW64 headers

In file included from
winmultiwindowicons.c:47:0:
winglobals.h:92:1: error: unknown type name ‘pthread_mutex_t’

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Marc Haesen <marha@users.sourceforge.net>
Move pseudoramiX code where it can be shared between Xwin and Xquartz

Move pseudoramiX code to a separate top-level directory.  Link Xwin and Xquartz
with libPseudoramiX

I'm not sure moving this to a top-level directory is appropriate, but I'm not
sure where else it fits.

Future work: pseudoramiX can probably be consolidated with the rrxinerama code
(which I think provides fake xinerama data when real XINERAMA is disabled and we
only have one screen)

v2: fix distcheck

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Marc Haesen <marha@users.sourceforge.net>
hw/xwin: Correct winprefs.c function signatures for x64.

Correct SetupRootMenu(), SetupSysMenu(), HandleCustomWM_INITMENU() and
HandleCustomWM_COMMAND() function signatures which use unsigned long parameters,
where just a specific HWND or HMENU handle type should have been used.

Signed-off-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Marc Haesen <marha@users.sourceforge.net>
hw/xwin: Correct size of _WINDOWSWM_NATIVE_HWND property on x86_64

Use the correct size of a HWND on x86_64 in XChangeProperty() and
XGetWindowProperty() calls for the _WINDOWSWM_NATIVE_HWND property.

Signed-off-by: Marc Haesen <marha@users.sourceforge.net>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
hw/xwin: Fix -Warray-bounds warning in winXCursorToHCURSOR()

Rewrite winXCursorToHCURSOR() so access to BITMAPINFO bmiColors member doesn't
trigger an -Warray-bounds warning.

Note that the underlying storage is allocated as a BITMAPV4HEADER, so has
sufficent room for the extra RGBQUADs bmiColors after the BITMAPINFO bmiHeader.

wincursor.c: In function 'winSetCursor':
wincursor.c:293:24: error: array subscript is above array bounds [-Werror=array-bounds]
wincursor.c:294:24: error: array subscript is above array bounds [-Werror=array-bounds]
wincursor.c:295:24: error: array subscript is above array bounds [-Werror=array-bounds]
wincursor.c:296:24: error: array subscript is above array bounds [-Werror=array-bounds]
wincursor.c:297:24: error: array subscript is above array bounds [-Werror=array-bounds]
wincursor.c:298:24: error: array subscript is above array bounds [-Werror=array-bounds]
wincursor.c:299:24: error: array subscript is above array bounds [-Werror=array-bounds]
wincursor.c:300:24: error: array subscript is above array bounds [-Werror=array-bounds]

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Marc Haesen <marha@users.sourceforge.net>
hw/xwin: Fix an issue in winSetSpansNativeGDI() identifed by -Warray-bounds

The BITMAPINFO local only has room for a single RBGQUAD in bmiColors, but we
access two (black and white for a mono-color DIB).  Fix by changing to a dynamic
allocation big enough for a BITMAPINFO and a RGBQUAD.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Marc Haesen <marha@users.sourceforge.net>
hw/xwin: Fix ARGB cursor conversion on x86_64

Fix erroneous use of unsigned long * for lpBits in winXCursorToHCURSOR() which
leads to ARGB cursors being vertically streched on x86_64 by interleaving blank
rows of pixels.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Marc Haesen <marha@users.sourceforge.net>
hw/xwin: Remove unused winProcQueryTreeOrig variable

Unused since 47c7b6d3e626497747ae2780f259a15b8e6c846f "Remove no-longer needed
tricks used to prevent the clipboard client from being killed"

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Marc Haesen <marha@users.sourceforge.net>