summaryrefslogtreecommitdiff
path: root/xkb
AgeCommit message (Collapse)AuthorFilesLines
2015-04-29Merge branch 'cygwin-patches-for-1.17' into cygwin-release-1.17xserver-cygwin-1.17.1-3Jon TURNEY1-1/+29
2015-03-19Capture xkbcomp exit status, stderr and stdout to logJon TURNEY1-1/+29
Also only consider exit status 0 to be success
2015-02-13Merge tag 'xorg-server-1.17.1' into cygwin-release-1.17Jon TURNEY1-41/+59
xorg-server-1.17.1
2015-02-10xkb: Check strings length against request sizeOlivier Fourdan1-25/+40
Ensure that the given strings length in an XkbSetGeometry request remain within the limits of the size of the request. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 20079c36cf7d377938ca5478447d8b9045cb7d43)
2015-02-10xkb: Don't swap XkbSetGeometry data in the input bufferOlivier Fourdan1-16/+19
The XkbSetGeometry request embeds data which needs to be swapped when the server and the client have different endianess. _XkbSetGeometry() invokes functions that swap these data directly in the input buffer. However, ProcXkbSetGeometry() may call _XkbSetGeometry() more than once (if there is more than one keyboard), thus causing on swapped clients the same data to be swapped twice in memory, further causing a server crash because the strings lengths on the second time are way off bounds. To allow _XkbSetGeometry() to run reliably more than once with swapped clients, do not swap the data in the buffer, use variables instead. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 81c90dc8f0aae3b65730409b1b615b5fa7280ebd)
2015-02-08Use spawnl() rather than pipe() & fork() to invoke xkbcompJon TURNEY1-8/+9
Implement System() specially on Cygwin not to use fork() and exec(), but spawnl() Use System() and a temp file rather than pipe() & fork() to invoke xkbcomp on cygwin, just as done on mingw Somewhat the counsel of despair, but sometimes Windows is being such a little bitch that the cygwin DLL just can't emulate fork() successfully, so just using spawnl() here is more robust and means I don't have to deal with end-users reporting this as a problem with the xserver Popen is not used, but must be built as it is referenced by sdksyms v2: Update to include fix to Win32TempDir() when TMP is set but TEMP isn't XXX: Really this should check TMPDIR first, as that's the canonical UNIX way to set the temporary directory? v3: Fix implicit-function-declaration of Win32TempDir() in XkbDDXCompileKeymapByNames() Add a prototype for Win32TempDir() v4: Improve handling of error conditions with the xkbcomp temporary file Fix a compilation conditional so that a failure to write to the xkbcomp temporary file is correctly reported, and reports the problematic filename. Improve Win32TempDir() so that the directory given by the TEMP and TMP environment variables is checked for accessibility, so that specifying a non-existent directory doesn't cause a failure. Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2014-11-12Drop trailing whitespacesPeter Hutterer25-224/+224
sed -i "s/[ ]\+$//g" **/*.(c|h) happy reviewing... git diff -w is an empty diff. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-10-28xkb: Initialize 'bad' Atom in _XkbSetNamesCheckKeith Packard1-1/+1
When _XkbCheckAtoms returns NULL for an error, it always sets the error return code, but GCC can't figure that out, so just initialize the local variable, 'bad', in _XkbSetNamesCheck to eliminate the warning. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-07-29xkb: Remove some fascinating paranoia from event emissionAdam Jackson1-9/+0
XkbInterestPtrs are created by clients that already exist, meaning, clients that have already had ProcVector installed as something other than InitialProcVector. Reviewed-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-04-18xkb: Verify reads of compiled keymap header and TOCKeith Packard1-2/+4
Check the return values from fread to make sure the elements are actually getting read from the file. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2014-04-03Revert "xkb: ProcesssPointerEvent must work on the VCP if it gets the VCP"Peter Hutterer1-1/+1
This was the wrong fix to the problem, and it triggered a change in XKB behavior: previously a button event would unlock a latched modifier, now it doesn't anymore. https://bugs.freedesktop.org/show_bug.cgi?id=73155 Note that the new behavior is is strictly spec compliant but we've had the other behavior for a long time so we shouldn't break it. The bug this patch originally fixed was a null-pointer dereference when releasing button events on server shutdown. This was addressed by the commit below, so the need for this patch has gone away anyway. commit 3e4be4033aed78b2bb3a18d51f0963989efd1af3 Author: Peter Hutterer <peter.hutterer@who-t.net> Date: Fri Jan 25 11:47:32 2013 +1000 dix: when shutting down slave devices, shut down xtest devices last This reverts commit 2decff6393a44b56d80d53570718f95354fde454. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-03-25xkb: Restore XkbCopyDeviceKeymapAdam Jackson1-0/+6
Removed in d35a02a767017f13db4bd4742eef49293d5a30ea, tigervnc 1.2.80 and xf86-video-nested need it for now. Signed-off-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>
2014-03-19xkb: add XkbLoadKeymapFromStringKristian Høgsberg2-8/+106
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-03-17xkb: add KeymapOrDefaultKristian Høgsberg1-16/+24
Helper function to return a default map if the keymap compilation failed. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-03-17xkb: factor out xkb loading to LoadXkmKristian Høgsberg1-23/+31
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-03-17xkb: add a callback to xkbcompPeter Hutterer1-20/+66
This provides a callback to write to xkbcomp's buffer once everything is prepared. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-03-17xkb: constify XkbDDXOpenConfigFilePeter Hutterer1-1/+1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-03-12xkb: Repurpose XkbCopyDeviceKeymap to apply a given keymap to a deviceRui Matos2-8/+8
This will also make it useful for cases when we have a new keymap to apply to a device but don't have a source device. Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-12xkb: Factor out a function to copy a keymap's controls onto anotherRui Matos2-13/+24
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-11xkb: push locked modifier state down to attached slave devicesPeter Hutterer1-0/+20
Whenever the master changes, push the locked modifier state to the attached slave devices, then update the indicators. This way, when NumLock or CapsLock are hit on any device, the LED will light up on all devices. Likewise, a new keyboard attached to a master device will light up with the correct indicators. The indicators are handled per-keyboard, depending on the layout, i.e. if one keyboard has grp_led:num set, the NumLock LED won't light up on that keyboard. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2014-03-11xkb: factor out state update into a functionPeter Hutterer1-23/+32
No functional changes Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2014-03-11xkb: factor out the StateNotify flag checkPeter Hutterer1-9/+18
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2014-02-04xkb: add a call to init an XkbRMLVOSet from const charsPeter Hutterer1-5/+20
Just forcing everything to const char* is not helpful, compiler warnings are supposed to warn about broken code. Forcing everything to const when it clearly isn't less than ideal. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-01-12Replace 'pointer' type with 'void *'Keith Packard6-27/+27
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer' is used throughout the X server for other things, and having duplicate names generates compiler warnings. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-12xkb: Make XkbWriteCountedString take a const char * input parameterKeith Packard1-1/+1
Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12xkb: Clean up warningsKeith Packard3-40/+45
Add const to lots of strings. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-07-02xkb: don't call atoi(NULL) when parsing argvJulien Cristau1-2/+4
If the -ardelay or -arinterval options have no argument, there's no point trying to read it. See http://www.forallsecure.com/bug-reports/feb3db57fc206d8df22ca53a6907f74973876272/ Reported-by: Alexandre Rebert <alexandre@cmu.edu> Signed-off-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-10input: print warnings if drivers don't initialize properlyPeter Hutterer1-2/+3
If drivers supply incorrect values don't just quietly return False, spew to the log so we can detect what's going on. All these cases are driver bugs and should be fixed immediately. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dave Airlie <airlied@redhat.com>
2013-05-10dix: don't overwrite proximity/focus classesPeter Hutterer1-1/+2
InitPointerClassDeviceStruct/InitKeyboardDeviceStruct allocate a proximity/focus class, respectively. If a driver calls InitFocusClassDeviceStruct or InitProximityClassDeviceStruct beforehand, the previously allocated class is overwritten, leaking the memory. Neither takes a parameter other than the device, so we can simply skip initialising it if we already have one. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dave Airlie <airlied@redhat.com>
2013-05-07xkb: free XkbRulesUsed and XkbRulesDflt on extension cleanupPeter Hutterer1-0/+15
==2547== 1 bytes in 1 blocks are still reachable in loss record 1 of 111 ==2547== at 0x4C2A4CD: malloc (vg_replace_malloc.c:236) ==2547== by 0x64D1551: strdup (strdup.c:43) ==2547== by 0x4802FB: Xstrdup (utils.c:1113) ==2547== by 0x585B6C: XkbSetRulesUsed (xkbInit.c:219) ==2547== by 0x58700F: InitKeyboardDeviceStruct (xkbInit.c:595) ==2547== by 0x419FA3: vfbKeybdProc (InitInput.c:74) ==2547== by 0x425A3D: ActivateDevice (devices.c:540) ==2547== by 0x425F65: InitAndStartDevices (devices.c:713) ==2547== by 0x5ACA57: main (main.c:259) and a few more of the above. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2013-03-06xkb: Fixes to LatchMods/LatchGroupAndreas Wettstein1-69/+80
The main problem this patch addresses is that if a latch is put on multi-level key with a Latch/Lock/Set, it is possible that after all keys are released, still base modifiers are set, which typically will make the keyboard unusable. To see how it happens (without the patch), assume that key AltGr sets Mod5 when pressed by itself, and latches Mod3 when pressed together with Shift. Now press Shift, then AltGr and release both keys in reverse order. Mod3 is now latched, and the LatchMods filter remains active as the second filter. Now press AltGr; Mod5 base modifier gets set, and the SetMods filter will become active as the first filter. Release AltGr: First, the SetMods filter will set clearMods to Mod5, then the LatchMods filter will overwrite clearMods with Mod3. Result: the Mod5 base modifier will remain set. This example becomes practically relevant for the revised German standard layout (DIN 2137-1:2012-06). Other changes implement the latch behaviour more accurately according to the specification. For example, releasing a modifier latching key can at the same time clear a locked modifier, promote another modifier that is latched to locked, and latch a third modifier. Overall, what the code does should be straightforward to compare what the XKB protocol specification demands, see the table in section 6.3. Finally, releasing a key no longer cancels a latch that has not become pending yet. In my opinion, the specification is not clear; it speaks of "operating" a key, which the patch effectivly interprets as "press" rather than "press or release". From my experience, using the latter interpretation makes latches on higher levels practically unusable. In the example given above, one would have to release AltGr always before Shift to get the Mod3-Latch. The practical relevance of latches on higher levels is once more given by the revised German standard layout. 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>
2013-02-21xkb: Set nIndicators in XkbGetIndicatorMapPeter Harris1-0/+1
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>
2013-02-15xkb: remove unused variable 'names'Peter Hutterer1-2/+0
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>
2013-02-08xkb: Fix repeat behaviour of redirect and message actionsAndreas Wettstein1-57/+90
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>
2013-01-09xkb: Do not use base group as an array index.Andreas Wettstein1-2/+8
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>
2012-12-19Merge remote-tracking branch 'yselkowitz/master'Keith Packard2-19/+19
I checked this patch with diff -w to check that it only affected whitespace.
2012-12-05Fix formatting of address operatorsYaakov Selkowitz2-19/+19
The formatter confused address operators preceded by casts with bitwise-and expressions, placing spaces on either side of both. That syntax isn't used by ordinary address operators, however, so fix them for consistency. Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-05xkb: only post a XTest release if the XTest device has the button downPeter Hutterer1-2/+7
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-05xkb: always post XTest button up when the physical button released (#28808)Peter Hutterer1-15/+14
Regression introduced by commit 2decff6393a44b56d80d53570718f95354fde454 xkb: ProcesssPointerEvent must work on the VCP if it gets the VCP XTest buttons must be released when a physical button is released. This was fixed in 14327858391ebe929b806efb53ad79e789361883, but 2decff6393a44b56d80d53570718f95354fde454 changed a condition that this code didn't get triggered anymore. "dev" for pointer events is now always the VCP which doesn't have a xkbi struct. So move this condition out and always trigger the XTest released for button events. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Frank Roscher <Frank-Roscher@gmx.net>
2012-11-29xkb: fill in keycode and event type for slow keys enablementPeter Hutterer1-2/+4
eventType is set for the type that triggered a XkbControlsNotify event. Technically, SlowKeys is triggered by a timer which doesn't have a matching core event type. So we used to use 0 here. Practically, the timer is triggered by a key press + hold and cancelled when the key is released before the timeout expires. So we might as well set KeyPress (keycode) in the ControlsNotify to give clients a chance to differ between timer-triggered SlowKeys and client-triggered ones. This is a chance in behaviour, though I suspect with little impact. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Daniel Stone <daniel@fooishbar.org>
2012-11-19XKB: Remove component listing supportDaniel Stone3-335/+20
No-one uses this - not xkbcomp, not GNOME, not KDE. The preferred way to deal with component listing (which gives you RMLVO rather than KcCGST) is to use the XML files on the client side. Indeed, a couple of hours after making this commit, it emerged that all *.dir files built with xkbcomp 1.1.1 (released two years ago) and later have been catastrophically broken and nearly empty. So I think that's reasonable proof that no-one uses them. Signed-off-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>
2012-11-05Merge remote-tracking branch 'whot/for-keith'Keith Packard1-0/+1
2012-11-06Apply partial matches for option (#25873)Alexey Ten (Lynn)1-0/+1
Rules which match star (*) and option, like one below, should be applied layout[2] option = symbols * misc:typo = +typo(base) This is port of patch from #19563 (https://bugs.freedesktop.org/19563) because here we have own copy of maprules.c X.Org Bug 25873 <http://bugs.freedesktop.org/show_bug.cgi?id=25873> Signed-off-by: Alexey Ten (Lynn) <alexeyten@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-05xkb: fix shadow warningsYaakov Selkowitz5-21/+15
Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-10-29xkb: ProcesssPointerEvent must work on the VCP if it gets the VCPPeter Hutterer1-1/+1
For button release events, the current code picks the VCK. Because that has a XKB struct, it thinks this is a PointerKeys event and proceeds to send the release event through the XTest pointer. That has no effect in normal operation as the button is never down and an attempt is silently discarded (normal event processing continues with the VCP). On server shutdown, the XTest device is already removed, leading to a null-pointer derefernce when the device is checked for whether buttons are down (XkbFakeDeviceButton → button_is_down(xtest pointer)). The current state has only worked by accident, the right approach here is to handle the VCP's event as such and not switch to the keyboard. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2012-07-17xwin: Clean up os wrappers for System, Popen and Pclose on WindowsKeith Packard2-81/+0
Popen and Pclose are never used on Windows, so don't bother to even try to define them. System(s) was defined as system(s), but the two users of that function are in xkb, which carefully redefines that as Win32System. Move Win32System and Win32TempDir to os/utils.c, renaming Win32System to be just System, which simplifies the xkb code Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2012-07-10XKB: Geom: Remove unused codeDaniel Stone2-146/+0
These codepaths were never called by anyone. Shame there weren't more of them. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-09Move extension initialisation prototypes into extinit.hDaniel Stone2-2/+1
Create extinit.h (and xf86Extensions.h, for Xorg-specific extensions) to hold all our extension initialisation prototypes, rather than duplicating them everywhere. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-07-09Use C99 designated initializers in extension EventsAlan Coopersmith1-16/+23
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09Use C99 designated initializers in xkb RepliesAlan Coopersmith1-160/+164
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>