Commit graph

1447 commits

Author SHA1 Message Date
Niclas Zeising
d15c24c8b4 Fix input clients connecting to server
Fix a bug where some input clients can't connect to the input server.
This fixes #117.

FreeBSD bugzilla reference:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248549

Signed-off-by: Niclas Zeising <zeising@daemonic.se>
2020-08-17 02:21:40 +00:00
Maya Rashish
6dd618e5ea Avoid the use of "register" keyword in XkbTranslateKeySym.
This causes issues when compiling code for C++17.
While here, make function prototype match the header with regards
to removal of another register keyword.
2020-08-15 00:48:56 +03:00
Christopher Chavez
780d222343 Fix typo GCCLipYOrigin -> GCClipYOrigin in XCreateGC() manpage 2020-08-10 17:08:39 +00:00
Felix Yan
29a8251a45 Correct a typo in GetStCmap.c 2020-08-06 17:23:53 +00:00
Alan Coopersmith
0d8f038db8
libX11 1.6.11
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-08-06 08:07:57 -07:00
Yichao Yu
93fce3f4e7
Fix size calculation in _XimAttributeToValue.
The check here guards the read below.
For `XimType_XIMStyles`, these are `num` of `CARD32` and for `XimType_XIMHotKeyTriggers`
these are `num` of `XIMTRIGGERKEY` ref[1] which is defined as 3 x `CARD32`.
(There are data after the `XIMTRIGGERKEY` according to the spec but they are not read by this
function and doesn't need to be checked.)

The old code here used the native datatype size instead of the wire protocol size causing
the check to always fail.

Also fix the size calculation for the header (size). It is 2 x CARD16 for both types
despite the unused `CARD16` for `XimType_XIMStyles`.

[1] https://www.x.org/releases/X11R7.6/doc/libX11/specs/XIM/xim.html#Input_Method_Styles

This fixes a regression caused by 388b303c62 in 1.6.10.

Fix #116
2020-08-02 13:43:58 -04:00
Matthieu Herrb
9949364ea7 libX11 1.6.10
Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
2020-07-30 21:36:22 +02:00
Matthieu Herrb
1703b9f343 Change the data_len parameter of _XimAttributeToValue() to CARD16
It's coming from a length in the protocol (unsigned) and passed
to functions that expect unsigned int parameters (_XCopyToArg()
and memcpy()).

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Reviewed-by: Todd Carson <toc@daybefore.net>
2020-07-24 21:28:38 +02:00
Todd Carson
1a566c9e00 Zero out buffers in functions
It looks like uninitialized stack or heap memory can leak
out via padding bytes.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
2020-07-24 21:28:31 +02:00
Todd Carson
2fcfcc49f3 Fix more unchecked lengths
Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
2020-07-24 21:28:25 +02:00
Todd Carson
388b303c62 fix integer overflows in _XimAttributeToValue()
Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
2020-07-24 21:28:21 +02:00
Todd Carson
0e6561efcf Fix signed length values in _XimGetAttributeID()
The lengths are unsigned according to the specification. Passing
negative values can lead to data corruption.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
2020-07-24 21:27:56 +02:00
Alan Coopersmith
2b7598221d Fix spelling/wording issues
Found by using:
    codespell --builtin clear,rare,usage,informal,code,names

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-22 15:19:58 -07:00
Samuel Thibault
f9e3378ebc xlibi18n: Fix converting horizline keysyms to UCS
U+23BA - U+23BD are meant to represent the scan lines, and U+2500 is
unified with scan line 5.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2020-07-19 22:19:24 +02:00
Samuel Thibault
4385a84c4a Braille: Fix default lookup
cbb59d172 ('Braille: Fix typing quickly') broke the default lookup that
translates Braille keysym patterns to Braille Unicode patterns since it
rightfully clears brl_committing, but then we do not have it any more to
fill brl_committed.

This change saves the committed pattern so we can return it in the
default lookup.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2020-06-04 02:19:13 +02:00
Marko Myllynen
fb65b67169 Update Finnish compose sequences for SFS 5966:2019 standard
U0219, U0218, U021B, U021A are now part of the standard.

Fixes #70 which was printed incorrectly in the earlier standard version.
2020-04-25 12:53:44 -07:00
Tristan Miller
07724ce046 Add acute accent compose sequences for Russian vowels.
Fixes: https://gitlab.freedesktop.org/xorg/lib/libx11/issues/104

Signed-off-by: Tristan Miller <psychonaut@nothingisreal.com>
2020-04-25 19:13:21 +00:00
Thomas E. Dickey
3ec9264d01
document an ancient performance problem (see Debian #954845).
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2020-04-25 14:44:06 -04:00
Thomas E. Dickey
791c93816c
update/correct function prototypes in manpages to match headers
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2020-04-25 14:44:00 -04:00
Thomas E. Dickey
844271305a
reduce gcc-normal warnings using casts (no object change)
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2020-04-21 20:56:05 -04:00
Thomas E. Dickey
53b59ddfc1
reduce gcc-normal warnings using casts (no object change)
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2020-04-21 20:55:59 -04:00
Adam Jackson
68c72a7341 Fix XTS regression in XCopyColormapAndFree
XCopyColormapAndFree/5 threw an assertion:

    520|4 5 00014017 1 2|Assertion XCopyColormapAndFree-5.(A)
    520|4 5 00014017 1 3|When a colourmap argument does not name a valid colourmap,
    520|4 5 00014017 1 4|then a BadColor error occurs.
    520|4 5 00014017 1 5|METH: Create a bad colourmap by creating and freeing a colourmap.
    520|4 5 00014017 1 6|METH: Call test function using bad colourmap as the colourmap argument.
    520|4 5 00014017 1 7|METH: Verify that a BadColor error occurs.
    520|4 5 00014017 1 8|unexpected signal 6 (SIGABRT) received
    220|4 5 2 15:05:53|UNRESOLVED
    410|4 5 1 15:05:53|IC End
    510|4|system 0: Abandoning testset: caught unexpected signal 11 (SIGSEGV)

More specifically:

    lt-XCopyColormapAndFree: xcb_io.c:533: _XAllocID: Assertion `ret != inval_id' failed.

This bug was introduced (by following my advice, d'oh) in:

    commit 99a2cf1aa0
    Author: Tapani Pälli <tapani.palli@intel.com>
    Date:   Mon May 13 08:29:49 2019 +0300

        Protect colormap add/removal with display lock

In that patch we moved the call to _XcmsCopyCmapRecAndFree inside the
display lock. The problem is said routine has side effects, including
trying to implicitly create a colormap in some cases. Since we don't run
the XID handler until SyncHandle() we would see inconsistent internal
xlib state, triggering the above assert.

Fix this by dropping and re-taking the display lock before calling into
XCMS.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
2020-01-29 12:03:53 -05:00
Alex Henrie
7f46a38139 Handle small final sigma in XConvertCase
lowercase: GREEK SMALL LETTER FINAL SIGMA (U+03C2)
uppercase: GREEK CAPITAL LETTER SIGMA (U+03A3)

This mapping was correct in UCSConvertCase, but the "legacy" mapping
must also be correct for Caps Lock to work with the final sigma key.

https://gitlab.freedesktop.org/xorg/lib/libx11/issues/5

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
2020-01-01 14:54:06 -07:00
Peter Hutterer
a48787d3d1 Handle ssharp in XConvertCase()
lowercase: LATIN SMALL LETTER SHARP S (U+00DF)
uppercase: LATIN CAPITAL LETTER SHARP S (U+1E9E)

The uppercase sharp s (XK_ssharp) is a relatively recent addition to unicode
but was added to the relevant keyboard layouts in xkeyboard-config-2.25
(d1411e5e95c)
https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/issues/144

Alas, the CapsLock behavior was broken on the finnish layout (maybe others).
This was due to xkbcomp using XConvertCase() to determine whether a key
requires the type FOUR_LEVEL_ALPHABETIC or FOUR_LEVEL_SEMIALPHABETIC.

Let's make this function return the right lower/upper symbols for the sharp s
and hope that the world won't get any worse because of it.

https://gitlab.freedesktop.org/xorg/lib/libx11/issues/110

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-22 20:59:47 +00:00
Raul Fernandes
b8766a4384 Use memcmp and memcpy 2019-10-09 18:39:26 +00:00
Adam Jackson
db7cca17ad libX11 1.6.9
Signed-off-by: Adam Jackson <ajax@redhat.com>
2019-10-09 13:41:29 -04:00
Dmitry Osipenko
f5ba2c632a Fix lockup in _XReply() caused by recursive synchronization
This patch is based on a suggestion made by Uli Schlachter in a comment
to the bug report https://gitlab.freedesktop.org/xorg/lib/libx11/issues/93.

Explanation of the bug (given by Uli Schlachter as well):

An error was received and handled. Since there was an error callback set,
Xlib unlocks the display, runs the error callback, and then locks the display
again. This goes through _XLockDisplay and then calls _XSeqSyncFunction.
On this "lock the thing"-path, Xlib notices that sequence numbers are close to
wrap-around and tries to send a GetInputFocus request. However, the earlier
calls already registered themselves as "we are handling replies/errors, do
not interfere!" and so the code here waits for "that other thread" to be done
before it continues. Only that there is no other thread, but it is this thread
itself and thus a deadlock follows.

The bug is relatively easy to reproduce on any desktop environment by
using actively a touchscreen input that supports multitouch, i.e. practically
all mobile devices are affected.

Fixes: https://gitlab.freedesktop.org/xorg/lib/libx11/issues/93
Suggested-by: Uli Schlachter <psychon@znc.in>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Reported-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
2019-10-09 17:37:10 +00:00
Adam Jackson
1f1ca0863f xkb: Provide <X11/extensions/XKBgeom.h> ourselves
This header refers to libX11 types, it doesn't belong in xorgproto and
has been moved to legacy in 2019.2. Supply it ourselves.
2019-09-24 13:02:47 -04:00
Ross Burton
edc7680ed5 src/util/Makefile: explicitly reset LINK to not use libtool
Simply looking at libtool redefines LINK globally to use libtool, which when
you're trying to cross-compile to Windows can cause complications.

As in src/util/ we're simply building a small binary for the build host, reset
LINK to the automake default so that the traditional compile/link steps occur
without libtool.

Also remove -all-static from LDFLAGS as that is a libtool-specific argument
intended to solve this problem.

Closes: #100
Signed-off-by: Ross Burton <ross.burton@intel.com>
2019-08-06 14:55:50 +01:00
Thomas E. Dickey
f111bf3ac0
improve some formatting
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-30 16:53:27 -04:00
Thomas E. Dickey
1d0a6fe912
fix a substitution error from recent commit, e.g, "s/^\.EE/XDe/"
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-30 15:49:09 -04:00
Thomas E. Dickey
8fe8aafe7e
split lines at sentence endings
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-30 05:07:40 -04:00
Thomas E. Dickey
6f2cbcea5d
trim trailing whitespace from manpages
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-30 04:52:25 -04:00
Thomas E. Dickey
4abf482d8e
another fake-quote fix
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-30 04:36:24 -04:00
Thomas E. Dickey
c0f0651f2b
the last commit overlooked some fake-quote pairs
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-30 04:34:54 -04:00
Walter Harms
ef31143c9d fix ``fake quotes'' in text
to remove the fake quotes replace them with propper
predefined macros \*(lq and \*(rq. this will allow
nroff to choose the propper characters when using ps etc.

Signed-off-by: Walter Harms <wharms@bfs.de>
2019-07-29 18:50:19 +02:00
Walter Harms
705027ea9b get rid of ``fake quotes''
these fake quotes are inside a comment and can be replaced with
some double quotes

Signed-off-by: Walter Harms <wharms@bfs.de>
2019-07-29 18:27:12 +02:00
Walter Harms
fe46eb2871 remove all private macro defines
after converting everything to st. man page macros there is
no need to maintain X11 private nroff macros, so remove them.

Signed-off-by: Walter Harms <wharms@bfs.de>
2019-07-29 17:57:02 +02:00
Walter Harms
b7f09ae19c Replace home-grown .Ds .De macro with man page .EX/.EE macro
Same pages use the man page .EX/.EE macro. Replace all occurences
of .De/.Ds with the std. macros to make the code better to maintain.

Signed-off-by: Walter Harms <wharms@bfs.de>
2019-07-29 17:47:35 +02:00
Walter Harms
951e772bc8 fix TBL format
Signed-off-by: Walter Harms <wharms@bfs.de>
2019-07-03 18:23:51 +02:00
Walter Harms
4eb167f5ac replace home grown .ZN with std, .B and .BR
Replace the home grown macro .ZN with std. macros
from man macro paket. So we can get rid of the
definition an get a clean header.

Signed-off-by: Walter Harms <wharms@bfs.de>
2019-07-03 18:18:09 +02:00
Walter Harms
08e6b36292 remove in-text macros
remove in-text macros an fix a few typos on the way.
hopefuly that will make maintenance more easy.

Signed-off-by: Walter Harms <wharms@bfs.de>
2019-06-22 18:33:48 +02:00
Walter Harms
cb0e894fe9 note that we can handle kbd==NULL
Signed-off-by: Walter Harms <wharms@bfs.de>
2019-06-21 18:01:16 +02:00
Adam Jackson
0327c427d6 makekeys: Detach ourselves from X headers entirely
Subsequent to a121b7b0c2 we are no longer
building makekeys with enough -I/foo/bar to find the X11 headers, so if
they're not in a system include path, things fail. Since this utility is
only needed at build time, there's no real reason to demand the X
headers be installed for both the build and target machines if cross-
compiling, we can just assume a vaguely ANSI environment instead.

Tested-by: Niclas Zeising <zeising@daemonic.se>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2019-06-17 14:17:29 -04:00
Matt Turner
57f0d421a1 libX11 1.6.8
Signed-off-by: Matt Turner <mattst88@gmail.com>
2019-06-17 10:45:45 -04:00
Matt Turner
5464b302bc Use AC_SYS_LARGEFILE
... and include config.h in makekeys.c to get the definition of
_FILE_OFFSET_BITS. Without it, libX11 can fail to build on a file
system with 64-bit inode numbers.

Bug: https://bugs.gentoo.org/550502
Bug: https://bugs.gentoo.org/616140
Signed-off-by: Matt Turner <mattst88@gmail.com>
2019-06-09 14:55:04 -07:00
Ran Benita
33b9148a83 Compose.man: fix escaped hexadecimal char description
The man page says:
    Strings may be direct text encoded in the locale for which the
    compose file is to be used, or an escaped octal or hexadecimal
    character code.   Octal codes are specified as "\123" and
    hexadecimal codes as "\0x123a".

But the grammar in the parser and the implementation say:
    ESCAPED_CHAR  ::= ('\\' | '\"' | OCTAL | HEX )
    HEX           ::= '\' (x|X) HEX_CHAR [HEX_CHAR]]
    HEX_CHAR      ::= (0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F|a|b|c|d|e|f)

So "\0x123a" -> "\x3a".

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-06-09 10:42:07 -07:00
ojab
d9b2cc35ed Compose sequences for rouble sign
Cyrillic combinations mirror the Qwerty-Jcuken keyboard layout.

Signed-off-by: Slava Kardakov <ojab@ojab.ru>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-06-09 10:32:02 -07:00
Pavel Labath
3f211616f6 Fix a leak in XCreateFontSet
a simple snippet like XFreeFontSet(d, XCreateFontSet(d, ...)) will generate lots of memory leaks,
as evidenced by the following valgrind output:
==983== HEAP SUMMARY:
==983==     in use at exit: 39,409 bytes in 341 blocks
==983==   total heap usage: 4,795 allocs, 4,454 frees, 489,086 bytes allocated
==983==
==983== 1,688 (136 direct, 1,552 indirect) bytes in 1 blocks are definitely lost in loss record
40 of 46
==983==    at 0x4C2B042: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==983==    by 0x56D5A93: add_codeset.clone.9 (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56D5FE0: load_generic (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56D7612: initialize (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56D7E75: _XlcCreateLC (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56F9A5F: _XlcUtf8Loader (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56DF815: _XOpenLC (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56B255A: XOpenOM (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x56A665A: XCreateFontSet (in /usr/lib64/libX11.so.6.3.0)
==983==    by 0x4FCA80: conky::x11_output::create_gc() (x11.cc:746)
==983==    by 0x4FC3B4: conky::x11_output::use_own_window() (x11.cc:602)
==983==    by 0x4FAD42: conky::priv::own_window_setting::set(bool const&, bool) (x11.cc:92)
==983==
==983== LEAK SUMMARY:
==983==    definitely lost: 136 bytes in 1 blocks
==983==    indirectly lost: 1,552 bytes in 34 blocks
==983==      possibly lost: 0 bytes in 0 blocks
==983==    still reachable: 37,721 bytes in 306 blocks
==983==         suppressed: 0 bytes in 0 blocks

This patch makes the leak dissappear (Well, at least the "definitely lost part". The "still
reachable" thingy remains). After some analysis, I've discovered that the XLCd structure is
destroyed improperly. The "constructor" is in lcGeneric.c, but the structure is destroyed using
code from lcPublic.c. I've found that changing the destructor call to _XlcDestroyLC executes the
correct code path, and I'm pretty sure this is correct (the object was constructed using
_XlcCreateLC, it make sense to destroy it using its conterpart).

So far I haven't observed any strange behaviour on my system caused by this change (although, I'm
not sure, how many programs actually use this function).

Signed-off-by: Pavel Labath <pavelo@centrum.sk>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-06-09 09:52:32 -07:00
Jon Turney
4645e21913 Avoid using libtool wrapper for makekeys
For Windows targets, libtool uses a wrapper executable, not a wrapper
script (see [1]), which it compiles with the host compiler.  This
doesn't work when cross-compiling.

Since we don't actually need to link with anything, use the libtool flag
-all-static to tell it to stay completely out of this.

[1] https://www.gnu.org/software/libtool/manual/html_node/Wrapper-executables.html
2019-06-08 23:58:16 +00:00