Commit Graph

486 Commits

Author SHA1 Message Date
Andreas Wettstein
9e017cf0cf XKB: Redirect actions defunct with Gtk3 (XInput?)
When redirect actions are used with Gtk3, Gtk3 complained about
events not holding a GdkDevice.  This was caused by device IDs
not being set for redirect actions.

More seriously, Gtk3 did not receive state changes redirect
actions might specify.  This was because event_set_state in
dix/inpututils.c accesses the prev_state field, but the changes
for the redirect action were only put into the state field.

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>
2012-03-22 11:33:18 +10:00
Daniel Stone
ab3a815a75 Indentation: Change '& stuff' to '&stuff'
If the typedef wasn't perfect, indent would get confused and change:
    foo = (SomePointlessTypedef *) &stuff[1];
to:
    foo = (SomePointlessTypedef *) & stuff[1];

Fix this up with a really naïve sed script, plus some hand-editing to
change some false positives in XKB back.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-21 14:02:30 -07:00
Keith Packard
9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Andreas Wettstein
6b19436536 xkb: Message actions suppress other key presses #28575
When a key to which a message action is mapped is held down, presses of
other keys were not registered.

Signed-off-by: Andreas Wettstein <wettstein509@solnet.ch>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-01-09 10:51:13 +10:00
Alan Coopersmith
41dd7cf673 _XkbFilterDeviceBtn: move variable declarations to match usage scope
The main body of this function is an if { } else if { } pair of blocks.
Previously there was int button at the top level scope which is used
only in the first block, and a redeclaration of int button inside the
second block.   Since there's no overlap in the code paths for the
two uses of button, move the one from the outer block into the first
block to help the programmer more quickly determine they are unrelated
usages, and to silence the gcc warning of:

xkbActions.c: In function '_XkbFilterDeviceBtn':
xkbActions.c:999:6: warning: declaration of 'button' shadows a previous local
xkbActions.c:955:6: warning: shadowed declaration is here

For consistency, move DeviceIntPtr dev declarations as well that are
used in the same way.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12 17:03:11 -08:00
Alan Coopersmith
d8eb9b5faa XkbFindSrvLedInfo: remove extraneous name-clashing sli variable
Variable is already defined outside the outer if statement, and
there's no need to redefine inside the if statement.

No point in setting sli before if (dev->kbdfeed->xkb_sli==NULL)
check - if check is true, we immediately set it, if check is false,
we immediately return without further reference or use of it.

The one thing we do with it inside the inner if statement is store
an allocation in it for a brief moment before writing to the final
destination, which is immediately returned to the caller.

In short, there's no benefit to the variable at all in this block,
it just gives the optimizer more code to figure out how to omit.

Fixes gcc warning:
xkbLEDs.c: In function 'XkbFindSrvLedInfo':
xkbLEDs.c:683:19: warning: declaration of 'sli' shadows a previous local
xkbLEDs.c:679:18: warning: shadowed declaration is here

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-12 17:03:11 -08:00
Alan Coopersmith
232f1ddf3d Fix gcc -Wwrite-strings warnings in XkbGetRulesDflts
Stop temporarily storing a pointer to a constant literal string
in a char *, just to strdup it a few lines later.

Fixes gcc -Wwrite-strings warnings:

xkbInit.c: In function 'XkbGetRulesDflts':
xkbInit.c:121:38: warning: assignment discards qualifiers from pointer target type
xkbInit.c:123:23: warning: assignment discards qualifiers from pointer target type
xkbInit.c:125:24: warning: assignment discards qualifiers from pointer target type
xkbInit.c:127:25: warning: assignment discards qualifiers from pointer target type
xkbInit.c:129:25: warning: assignment discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:07 -08:00
Alan Coopersmith
f8dd5efb67 Mark XKB char * as const to clean up gcc -Wwrite-strings warnings
Cleans up around 120 warnings from this set

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:06 -08:00
Alan Coopersmith
3d0ece5e84 Reduce unnecessary string copying in xkbtext routines
Instead of using sprintf to copy a static string to a local buffer,
just to pass it to TryCopyStr, pass the static string to TryCopyStr
directly, as is already done in other parts of this code.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:06 -08:00
Alan Coopersmith
05d8a7f7a7 Convert a bunch of sprintf to snprintf calls
This batch is the straightforward set - others are more complex and
need more analysis to determine right size to pass.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:06 -08:00
Alan Coopersmith
615f93a3d0 Remove unnecessary variable rtrn in XkbKeysymText
Also removes even more unnecessary use of variable assignment inside
function arguments.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-11-23 12:15:06 -08:00
Alan Coopersmith
6e6d732bac Convert strncpy/strncat to strlcpy/strlcat
As long as we're carrying around a compatibility copy in os/strl*.c,
might as well use them.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:05 -08:00
Peter Hutterer
35ec24cf24 input: replace remaining GetPairedDevice() with GetMaster()
Wherever it's obvious which device we need (keyboard or pointer), use
GetMaster() instead of GetPairedDevice(). It is more reliable in actually
getting the device type we want.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-11-09 13:26:47 +10:00
Colin Harrison
f6529a05a2 Xming: Always remove temporary file used when invoking xkbcomp on Win32
When built for native Win32, pipe() & fork() aren't available, so we
use a tempoary file and system() to invoke xkbcomp

Ensure the temporary file is always removed. It was only being removed
on most errors, not on success :S

Also fix a couple of warnings which occur when built with WIN32 defined

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2011-11-02 14:07:36 +00:00
Andreas Wettstein
e3f6a76dd4 xkb: Support noLock and noUnlock flags for LockMods
These flags are required by the XKB spec section 6.3.

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>
2011-10-25 14:06:41 +10:00
Alan Coopersmith
524e5445c0 Add #include "inpututils.h" to xkbAccessX.c for init_device_event
Fixes Sun compiler warning:
"xkbAccessX.c", line 128: warning: implicit function declaration: init_device_event

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-03 08:54:09 +10:00
Keith Packard
afb1fe695d Merge remote-tracking branch 'whot/next' 2011-09-26 20:24:15 -07:00
Peter Harris
c90903b4f7 xkb: add missing swaps for xkbGetDeviceInfoReply
Caught during review of e095369bf.

Signed-off-by: Peter Harris <pharris@opentext.com>
Reviewed-by-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21 17:14:45 -04:00
Matt Turner
54770c980c Cast char* buffers to swap functions
Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21 17:14:44 -04:00
Matt Turner
9edcae78c4 Use correct swap{l,s} (or none at all for CARD8)
Swapping the wrong size was never caught because swap{l,s} are macros.

It's clear in the case of Xext/xres.c, that the author believed
client_major/minor to be CARD16 from looking at the code in the first
hunk.

v2: dmx.c fixes from Keith.

Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21 17:14:16 -04:00
Matt Turner
2c7c520cfe Use internal temp variable for swap macros
Also, fix whitespace, mainly around
	swaps(&rep.sequenceNumber)

Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-09-21 17:12:04 -04:00
Peter Hutterer
3a077f246e input: provide a single function to init DeviceEvents to 0
getevents.c already had that function, but XKB was manually initializing it,
causing bugs when the event structure was updated in one place but not the
other.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-08-22 15:56:52 +10:00
Daniel Stone
82f5521a6d XKB: Work around broken interps from old xkbcomp
Bugfix for broken xkbcomp: if we encounter an XFree86Private action with
Any+AnyOfOrNone(All), then we skip the interp as broken.  Versions of
xkbcomp below 1.2.2 had a bug where they would interpret a symbol that
couldn't be found in an interpret as Any.  So, an
XF86LogWindowTree+AnyOfOrNone(All) interp that triggered the PrWins
action would make every key without an action trigger PrWins if libX11
didn't yet know about the XF86LogWindowTree keysym.  None too useful.

We only do this for XFree86 actions, as the current XKB dataset relies
on Any+AnyOfOrNone(All) -> SetMods for Ctrl in particular.

See xkbcomp commits 2a473b906943ffd807ad81960c47530ee7ae9a60 and
3caab5aa37decb7b5dc1642a0452efc3e1f5100e for more details.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-07-15 15:44:19 +10:00
Cyril Brulebois
ab0df72cd3 xkb: Fix case checks for Latin 4.
That one was missing _XkbKSLower:
  XK_kra: U+0138 LATIN SMALL LETTER KRA

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
2011-06-06 16:25:56 +02:00
Cyril Brulebois
9eb6e34c2d xkb: Fix case checks for Latin 2.
Those ones were getting _XkbKSLower for no reasons:
  XK_ogonek: U+02DB OGONEK
  XK_doubleacute: U+02DD DOUBLE ACUTE ACCENT

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
2011-06-06 16:25:52 +02:00
Cyril Brulebois
2b88189863 xkb: Fix case checks for Latin 1.
That one was missing _XkbKSLower:
  XK_ssharp: U+00DF LATIN SMALL LETTER SHARP S

That one was getting _XkbKSLower for no reasons:
  XK_division: U+00F7 DIVISION SIGN

For reference, XK_multiply was already excluded from the _XkbKSUpper
check, it's no big surprise XK_division has to be excluded from the
_XkbKSLower check.

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
2011-06-06 16:25:33 +02:00
Cyril Brulebois
408ed1576d xkb: Fix case checks for Latin 8.
Spotted by -Wlogical-op:
|   CC     xkbfmisc.lo
| xkbfmisc.c: In function '_XkbKSCheckCase':
| xkbfmisc.c:104:3: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]
| xkbfmisc.c:118:3: warning: logical 'and' of mutually exclusive tests is always false [-Wlogical-op]

A quick look at the keysymdef.h file (from xproto) suggests the
implementor chose to use interval checks to determine the case, but
since lines weren't sorted by codepoints, checks were quite wrong.

Implement _XkbKSUpper/_XkbKSLower checks based on a grep for
CAPITAL/SMALL (respectively) on the Latin 8 part of the said file.

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Cyril Brulebois <kibi@debian.org>
2011-06-03 18:09:48 +02:00
Peter Hutterer
8670c46bdf input: replace EventListPtr with InternalEvent array
EventListPtr is a relic from pre-1.6, when we had protocol events in the
event queue and thus events of varying size.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-05-11 14:27:36 +10:00
Daniel Stone
3231962db8 XKB: Fix sense inversion for core MapNotify events
Due to an unfortunate sense inversion incident while switching from a
if (foo) { ... } to if (!foo) continue; style in f06a9d, we punished any
client who attempted to use XKB to restrict the MapNotify events they
wanted by sending them exactly the events they _didn't_ want, and
nothing else.

NewKeyboardNotifies (coming from a client setting the map with an XKB
request, when switching between master devices, etc) weren't affected,
but this would impact anyone using xmodmap-style core requests.  Could
explain a fair bit.

Clarified the comments while I was at it.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-06 13:15:28 +10:00
Daniel Stone
460a377ef2 XKB: Send XKB events for all devices to all clients
We were using XIShouldNotify(client, device) as a test for whether or
not to send XKB map/state/etc changed events, which limits it to only
sending events for the current ClientPointer/ClientKeyboard for that
client.  While this makes perfect sense for core events (e.g.
MappingNotify), XKB events carry a device ID, so are safe to send to all
clients for all devices.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-06 13:15:26 +10:00
Daniel Stone
a79d4544fe XKB: Send NewKeyboardNotify for dev before its master/slaves
When we change the keymap on a device, send the NewKeyboardNotify for
that device before we copy the keymap to and notify for its attached
master/slave devices.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-06 13:15:25 +10:00
Daniel Stone
c7634498d4 XKB: Remove duplicate keymap-copying loop
Previously we had:
    foreach (device + slaves of device) {
        XkbCopyDeviceKeymap(i, device);
        [...]
    }
    if (device was last slave of its MD) {
        XkbCopyDeviceKeymap(master, device);
    }
and now:
    foreach (device + slaves of device + MD if device was last slave) {
        XkbCopyDeviceKeymap(i, device);
        [...]
    }

As an extra bonus, when changing the keymap on a slave device, we now
ensure the LED info on the master is kept in sync.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-06 13:15:24 +10:00
Daniel Stone
b8540d18c7 XKB: Simplify a loop in ProcXkbGetKbdByName
Replace:
    for (stuff; things; etc) {
        if (misc || other) {
            [...]
        }
    }
with:
    for (stuff; things; etc) {
        if (!misc && !other)
            continue;
        [...]
    }

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-06 13:15:23 +10:00
Daniel Stone
72b6639c83 XKB: Don't send unnecessary NewKeyboardNotifies
In the XKB GetKeyboardByName handler, we had the following pseudocode:
    if (device was last slave of its MD) {
        XkbCopyDeviceKeymap(master, slave);
        XkbSendNewKeyboardNotify(slave, &notify);
    }

Even if the SendNewKeyboardNotify line nominated the correct device,
which it didn't, it's unnecessary as XkbCopyDeviceKeymap already sends a
NewKeyboardNotify on the destination device.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-06 13:15:22 +10:00
Nicolas Kaiser
5423da9fb2 xkb: remove duplicated include
Remove duplicated include.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
2011-04-25 10:45:34 -07:00
Keith Packard
c9d89cec14 Merge remote-tracking branch 'vignatti/for-keith' 2011-04-04 11:57:39 -07:00
Tiago Vignatti
45b6667b65 xkb: fix fd leak in XkbDDXListComponent
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org>
2011-04-04 15:47:58 +03:00
Rami Ylimäki
9c4aae2141 xkb: Prevent leaking of XKB geometry information on copy.
Currently shapes, sections and doodads may leak on copy.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-04 09:55:05 +10:00
Rami Ylimäki
29d63ba175 xkb: Introduce helper function to handle similar reallocations.
This is preparation for a memory leak fix and doesn't contain any
functional changes.

Note that two variables are generally used for reallocation and
clearing of arrays: geom->sz_elems (reallocation) and geom->num_elems
(clearing). The interface of XkbGeomRealloc is deliberately kept
simple and it only accepts geom->sz_elems as argument, because that is
needed to determine whether the array needs to be resized. When the
array is cleared, we just assume that either geom->sz_elems and
geom->num_elems are synchronized to be equal or that unused elements
are cleared whenever geom->num_elems is set to be less than
geom->sz_elems without reallocation.

Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-04 09:55:04 +10:00
Rami Ylimäki
dc9ce695a6 xkb: Initialize pad bytes sent in replies of geometry requests.
Valgrind complains about uninitialized data being written to clients.

Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-17 10:53:35 +10:00
Peter Hutterer
ee3a4951a4 xkb: Document XkbWriteCountedString.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-03-17 10:53:22 +10:00
Rami Ylimäki
5c47f8beac xkb: Release XKB component names when compiling keymap.
Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-16 15:21:41 +10:00
Rami Ylimäki
40e56d3453 xkb: Ensure that XKB device private won't leak on device disconnect.
Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-09 07:59:40 +10:00
Peter Hutterer
579ee8f5d8 Merge branch 'mi-cleanup' into next 2011-02-23 08:44:42 +10:00
Peter Hutterer
17265ccb02 Move master/lastSlave out of the union into separate fields.
The removal of the double-use will cause some suble bugs as some conditions
to check for the dev->u.master case were broken and also evaluated as true
if lastSlave was set (instead of master).

Also breaks the input ABI.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2011-02-22 14:35:45 +10:00
Peter Hutterer
2936635698 xkb: Fix a check for MASTER_KEYBOARD
And copy into the master keyboard, not just the directly attached device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2011-02-22 14:35:45 +10:00
Peter Hutterer
dc57f89959 Switch to use IsFloating()
This is not a straightforward search/replacement due to a long-standing
issue.

dev->u.master is the same field as dev->u.lastSlave. Thus, if dev is a master
device, a check for dev->u.master may give us false positives and false
negatives.
The switch to IsFloating() spells out these cases and modifies the
conditions accordingly to cover both cases.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2011-02-22 14:35:44 +10:00
Alan Coopersmith
0f9c6f2f82 xkb: Replace malloc(strlen) + strcpy with strdup
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-02-15 10:35:45 +10:00
Alan Coopersmith
682865c460 XkbAddGeomProperty: Fix checks for malloc failure
Check the variable we just tried to malloc, not the string we're copying
and already checked for NULL at the beginning of the function.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-02-15 10:35:43 +10:00
Alan Coopersmith
aac1b43566 Replace _XkbDupString with Xstrdup
The two functions have identical semantics, including safely returning
NULL when NULL is passed in (which POSIX strdup does not guarantee).

Some callers could probably be adjusted to call libc strdup directly,
when we know the input is non-NULL.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-02-15 10:35:41 +10:00