os: prevent negative array index access (#80890)

If an empty string is provided to LogMessageVerbSigSafe, the length of the
printed string is 0.

Read-only access only and the only effect it had was adding a linebreak or not.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
xfree86: don't force the screensaver off on DPMS unblank, merely suggest it

Commit 41d4beb2616ceb3f1a1b8694733e85bae70de59a added symmetry to the
screensaver/DPMS invocations so that one (en|dis)ables the other. Having
dependencies between DPMS and the screensaver is subject to further arguments,
but in this particular case using SCREENSAVER_FORCER is detrimental.
SCREENSAVER_FORCER(ScreenSaverReset) resets the idle time for all
devices on DPMS unblank.

It prevents at least one use-case that GNOME tries to implement:
GNOME displays a notification before suspending. If the display is
currently blanked, GNOME lights it up to display the message. With the
original patch in place DPMS unblank also resets the device idle times, thus
restarting the timeout ad infinitum.

Switch this to a more suggestive SCREENSAVER_OFF(ScreenSaverReset). This keeps
the symmetry in blanking mode (DPMS and screensaver turn each other on/off as
expected) but does not reset the idle time on the devices.

https://bugzilla.gnome.org/show_bug.cgi?id=731241

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-By: Egbert Eich <eich@freedesktop.org>
xfree86: Only support one sysconfigdir

When the X server is compiled with --prefix set to something other than /usr,
then it ends up with a nonstandard sysconfigdir in its .pc file.  This causes
various other components to install their xorg.conf.d snippets there.

However, the X server first looks for /usr/share/X11/xorg.conf.d before looking
in sysconfigdir.  That means that if the system administrator installed anything
that created that path, the user's custom sysconfigdir is not searched.

Rather than doing that, just look in the configured sysconfdir and nowhere else.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Revert "dix: fix up coordinate scaling when external monitors are present"

This reverts commit d90b5f83010248be65b2039b0b2d0b9e6a4e93cf.

Reverting for two reasons:
* the scaling does not work on devices that don't advertise resolution, and
  the default resolution used (100 units/mm) is higher than most devices,
  resulting in a significant slowdown of the touchpads.
* the scaling is still affected by resolution changing. The patch worked
  before acceleration but since it maps into resolution-dependent dx/dy
  coordinates the acceleration may distort the movement after the fact. So the
  same input data generates different movements depending on the resolution.
  This can't easily be fixed for all affected devices as synaptics has its own
  velocity calculation method whereas wacom doesn't. So anything in the server
  won't work for both at the same time.

Revert this for now, until a more integrated solution can be implemented.
Fix ODEV_ATTRIB_DRIVER overlapping with ODEV_ATTRIB_FD

Looks like the value of ODEV_ATTRIB_DRIVER was not updated when the patch
adding it got rebased on top of a newer server version.

This fixes the xserver crashing when systemd-logind integration is used.

https://bugzilla.redhat.com/show_bug.cgi?id=1118540

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
config_odev_add_attribute*: Check for right attribute type

Don't allow setting string attributes to integers and vice versa.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>