mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-31 14:48:25 +02:00
Compare commits
62 commits
master
...
xorg-serve
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16f157cbf6 | ||
|
|
9b037af041 | ||
|
|
f7ff55a374 | ||
|
|
8e7c4380a5 | ||
|
|
1069ca9929 | ||
|
|
044764b5c6 | ||
|
|
73b1880eb3 | ||
|
|
912df16404 | ||
|
|
92de7a90a1 | ||
|
|
44ed4a6547 | ||
|
|
fe9672204a | ||
|
|
525db4433b | ||
|
|
cbf197e1c9 | ||
|
|
7590915c9d | ||
|
|
20bc891f76 | ||
|
|
233429c1d8 | ||
|
|
e7dc700de9 | ||
|
|
25e0fe2b59 | ||
|
|
de17ad13eb | ||
|
|
1d496e046e | ||
|
|
5a4760babd | ||
|
|
efacb60e01 | ||
|
|
3b4aa58d56 | ||
|
|
4f30f4dd47 | ||
|
|
18c7f1e49b | ||
|
|
0ad9121071 | ||
|
|
df64ac7206 | ||
|
|
ea45001614 | ||
|
|
e3a1255a72 | ||
|
|
c092c31c83 | ||
|
|
3d8e2731b5 | ||
|
|
4d3d93c68b | ||
|
|
d88c66541e | ||
|
|
db386cd6a1 | ||
|
|
2883994f9f | ||
|
|
c2515e9dfd | ||
|
|
cbfdb284c9 | ||
|
|
b022d4ef9d | ||
|
|
f1365eb0ec | ||
|
|
07b01bb5bd | ||
|
|
d1bd02fb67 | ||
|
|
77ef968c86 | ||
|
|
f1fc86d61e | ||
|
|
386329ec72 | ||
|
|
a471a15c77 | ||
|
|
4393c7f1ba | ||
|
|
151ec89574 | ||
|
|
a4d9637504 | ||
|
|
a7c207cc8e | ||
|
|
27600a6b20 | ||
|
|
0e62f275aa | ||
|
|
f7ca20cacf | ||
|
|
0e0951ce3e | ||
|
|
b501462e5d | ||
|
|
3ce47886c5 | ||
|
|
c48d07cf0e | ||
|
|
fbe977941a | ||
|
|
484b881ecd | ||
|
|
af2e9e3bb1 | ||
|
|
b7a24467f7 | ||
|
|
a793483e38 | ||
|
|
3c0431b891 |
1826 changed files with 269798 additions and 123477 deletions
|
|
@ -1,84 +0,0 @@
|
|||
branches:
|
||||
except:
|
||||
- /travis.*/
|
||||
version: '{build}'
|
||||
skip_tags: true
|
||||
clone_depth: 8
|
||||
environment:
|
||||
APPVEYOR_SAVE_CACHE_ON_ERROR: true
|
||||
CYGWIN_MIRROR: http://cygwin.mirror.constant.com
|
||||
CACHE: C:\cache
|
||||
matrix:
|
||||
- BUILD: i686-pc-cygwin
|
||||
CYGWIN_ROOT: C:\cygwin
|
||||
SETUP: setup-x86.exe
|
||||
- BUILD: x86_64-pc-cygwin
|
||||
CYGWIN_ROOT: C:\cygwin64
|
||||
SETUP: setup-x86_64.exe
|
||||
install:
|
||||
- echo Updating Cygwin and installing build prerequisites
|
||||
- "%CYGWIN_ROOT%\\%SETUP% -qnNdO -R %CYGWIN_ROOT% -s %CYGWIN_MIRROR% -l %CACHE% -g -P \
|
||||
binutils,\
|
||||
bison,\
|
||||
ccache,\
|
||||
flex,\
|
||||
gcc-core,\
|
||||
meson,\
|
||||
ninja,\
|
||||
pkg-config,\
|
||||
python38,\
|
||||
windowsdriproto,\
|
||||
xorgproto,\
|
||||
libepoxy-devel,\
|
||||
libfontenc-devel,\
|
||||
libfreetype-devel,\
|
||||
libGL-devel,\
|
||||
libnettle-devel,\
|
||||
libpixman1-devel,\
|
||||
libtirpc-devel,\
|
||||
libXRes-devel,\
|
||||
libXaw-devel,\
|
||||
libXdmcp-devel,\
|
||||
libXext-devel,\
|
||||
libXfont2-devel,\
|
||||
libXi-devel,\
|
||||
libXinerama-devel,\
|
||||
libXmu-devel,\
|
||||
libXpm-devel,\
|
||||
libXrender-devel,\
|
||||
libXtst-devel,\
|
||||
libxcb-composite-devel,\
|
||||
libxcb-ewmh-devel,\
|
||||
libxcb-icccm-devel,\
|
||||
libxcb-image-devel,\
|
||||
libxcb-keysyms-devel,\
|
||||
libxcb-randr-devel,\
|
||||
libxcb-render-devel,\
|
||||
libxcb-render-util-devel,\
|
||||
libxcb-shape-devel,\
|
||||
libxcb-util-devel,\
|
||||
libxcb-xkb-devel,\
|
||||
libxcvt-devel,\
|
||||
libxkbfile-devel,\
|
||||
font-util,\
|
||||
khronos-opengl-registry,\
|
||||
python38-lxml,\
|
||||
xkbcomp-devel,\
|
||||
xkeyboard-config,\
|
||||
xtrans"
|
||||
- echo Install done
|
||||
- "%CYGWIN_ROOT%\\%SETUP% -qnNdO -R %CYGWIN_ROOT% -s %CYGWIN_MIRROR% -l %CACHE% -g"
|
||||
cache:
|
||||
- C:\cache
|
||||
- '%CYGWIN_ROOT%\home\%USERNAME%\.ccache'
|
||||
build_script:
|
||||
- SET PATH=%CYGWIN_ROOT%/bin
|
||||
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Dxephyr=true -Dxnest=true -Dxvfb=true -Dxwin=true -Dxorg=true -Dpciaccess=false -Dint10=false -Dglamor=false build"'
|
||||
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson configure build"'
|
||||
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ninja -C build"'
|
||||
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ccache -s"'
|
||||
test_script:
|
||||
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ninja -C build test"'
|
||||
after_test:
|
||||
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ninja -C build install"'
|
||||
deploy: off
|
||||
|
|
@ -1 +1 @@
|
|||
((c-mode . ((c-basic-offset . 4) (indent-tabs-mode . nil))))
|
||||
((c-mode . ((c-basic-offset . 4) (indent-tabs-mode . nil))))
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# This file contains revisions to be ignored by git blame.
|
||||
# These revisions are expected to be formatting-only changes.
|
||||
#
|
||||
# Calling `git blame --ignore-revs-file .git-blame-ignore-revs` will
|
||||
# tell git blame to ignore changes made by these revisions when assigning
|
||||
# assigning blame, as if the change never happened.
|
||||
#
|
||||
# You can enable this as a default for your local repository by running
|
||||
# `git config blame.ignoreRevsFile .git-blame-ignore-revs`
|
||||
# Important: if you do this, then switch to a branch without this file,
|
||||
# `git blame` will fail with an error.
|
||||
#
|
||||
|
||||
# Introduce a consistent coding style
|
||||
9838b7032ea9792bec21af424c53c07078636d21
|
||||
|
||||
# Drop trailing whitespaces
|
||||
732fd7e571b81d63aa44d6e4cf55883479e88f2f
|
||||
|
||||
# glamor: Apply x-indent.sh.
|
||||
d84d71029ae9e462559d64eff7259e2cc7732fac
|
||||
|
||||
# indent fixes (OMG SO UGLY), and nuke old RCS keywords.
|
||||
6d7083bd69724586338d79784655328f1fcd2ae5
|
||||
82
.gitignore
vendored
82
.gitignore
vendored
|
|
@ -1,4 +1,82 @@
|
|||
#
|
||||
# X.Org module default exclusion patterns
|
||||
# The next section if for module specific patterns
|
||||
#
|
||||
# Do not edit the following section
|
||||
# GNU Build System (Autotools)
|
||||
aclocal.m4
|
||||
autom4te.cache/
|
||||
autoscan.log
|
||||
ChangeLog
|
||||
compile
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config-ml.in
|
||||
config.py
|
||||
config.status
|
||||
config.status.lineno
|
||||
config.sub
|
||||
configure
|
||||
configure.scan
|
||||
depcomp
|
||||
.deps/
|
||||
INSTALL
|
||||
install-sh
|
||||
.libs/
|
||||
libtool
|
||||
libtool.m4
|
||||
ltmain.sh
|
||||
lt~obsolete.m4
|
||||
ltoptions.m4
|
||||
ltsugar.m4
|
||||
ltversion.m4
|
||||
Makefile
|
||||
Makefile.in
|
||||
mdate-sh
|
||||
missing
|
||||
mkinstalldirs
|
||||
*.pc
|
||||
py-compile
|
||||
stamp-h?
|
||||
symlink-tree
|
||||
test-driver
|
||||
texinfo.tex
|
||||
ylwrap
|
||||
|
||||
# Do not edit the following section
|
||||
# Edit Compile Debug Document Distribute
|
||||
*~
|
||||
*.swp
|
||||
*.[0-9]
|
||||
*.[0-9]x
|
||||
*.bak
|
||||
*.bin
|
||||
core
|
||||
*.dll
|
||||
*.exe
|
||||
*-ISO*.bdf
|
||||
*-JIS*.bdf
|
||||
*-KOI8*.bdf
|
||||
*.kld
|
||||
*.ko
|
||||
*.ko.cmd
|
||||
*.lai
|
||||
*.l[oa]
|
||||
*.[oa]
|
||||
*.obj
|
||||
*.patch
|
||||
tags
|
||||
*.so
|
||||
*.pcf.gz
|
||||
*.pdb
|
||||
*.tar.bz2
|
||||
*.tar.gz
|
||||
#
|
||||
# Add & Override patterns for xserver
|
||||
#
|
||||
# Edit the following section as needed
|
||||
# For example, !report.pc overrides *.pc. See 'man gitignore'
|
||||
#
|
||||
doltcompile
|
||||
doltlibtool
|
||||
xserver.ent
|
||||
|
|
|
|||
366
.mailmap
366
.mailmap
|
|
@ -1,366 +0,0 @@
|
|||
Adam Jackson <ajax@redhat.com> <ajax@aspartame.nwnk.net>
|
||||
Adam Jackson <ajax@redhat.com> <ajax@benzedrine.nwnk.net>
|
||||
Adam Jackson <ajax@redhat.com> <ajax@nwnk.net>
|
||||
Adam Jackson <ajax@redhat.com> <ajax@theobromine.nwnk.net>
|
||||
|
||||
Adam Tkac <atkac@redhat.com> <vonsch@gmail.com>
|
||||
|
||||
Alan Coopersmith <alan.coopersmith@oracle.com> <alan.coopersmith@sun.com>
|
||||
Alan Coopersmith <alan.coopersmith@oracle.com> <alanc@alf.(none)>
|
||||
|
||||
Alan Hourihane <alanh@vmware.com> <alanh@fairlite.demon.co.uk>
|
||||
Alan Hourihane <alanh@vmware.com> <alanh@tungstengraphics.com>
|
||||
|
||||
Alex Deucher <alexdeucher@gmail.com> <agd5f@yahoo.com>
|
||||
Alex Deucher <alexdeucher@gmail.com> <alex@botch2.(none)>
|
||||
Alex Deucher <alexdeucher@gmail.com> <alex@botch2.com>
|
||||
Alex Deucher <alexdeucher@gmail.com> <alex@cube.(none)>
|
||||
Alex Deucher <alexdeucher@gmail.com> <alex@samba.(none)>
|
||||
Alex Deucher <alexdeucher@gmail.com> <alexander.deucher@amd.com>
|
||||
|
||||
Alexandr Shadchin <alexandr.shadchin@gmail.com> <Alexandr.Shadchin@gmail.com>
|
||||
|
||||
Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> <ander@mandriva.com.br>
|
||||
|
||||
Arjan van de Ven <arjan@infradead.org> <arjan@linux.intel.com>
|
||||
|
||||
Arkadiusz Miśkiewicz <arekm@maven.pl>
|
||||
|
||||
Axel Davy <davyaxel0@gmail.com> <axel.davy@ens.fr>
|
||||
|
||||
Bart Trojanowski <bart@jukie.net> <bart@symbio-technologies.com>
|
||||
|
||||
Ben Byer <bbyer@apple.com> <bbyer@bbyer.(none)>
|
||||
Ben Byer <bbyer@apple.com> <bbyer@bbyer.apple.com>
|
||||
Ben Byer <bbyer@apple.com> <bbyer@bbyer.local>
|
||||
Ben Byer <bbyer@apple.com> <bbyer@bushing.apple.com>
|
||||
Ben Byer <bbyer@apple.com> <bbyer@freedesktop.org>
|
||||
Ben Byer <bbyer@apple.com> <bbyer@xyzzy.local>
|
||||
|
||||
Ben Gamari <bgamari.foss@gmail.com> <bgamari@gmail.com>
|
||||
|
||||
Ben Skeggs <bskeggs@redhat.com> <skeggsb@gmail.com>
|
||||
|
||||
Benjamin Close <benjamin.close@clearchain.com> <Benjamin.Close@clearchain.com>
|
||||
|
||||
Benjamin Tissoires <benjamin.tissoires@gmail.com> <tissoire@cena.fr>
|
||||
|
||||
Brian Paul <brianp@vmware.com> Brian <brian@i915.localnet.net>
|
||||
Brian Paul <brianp@vmware.com> Brian <brian@yutani.localnet.net>
|
||||
Brian Paul <brianp@vmware.com> <brian.paul@tungstengraphics.com>
|
||||
|
||||
Brice Goglin <bgoglin@debian.org> <brice.goglin@ens-lyon.org>
|
||||
|
||||
Carl Worth <cworth@cworth.org> <cworth@samich.home.cworth.org>
|
||||
Carl Worth <cworth@cworth.org> <root@samich.home.cworth.org>
|
||||
|
||||
Chase Douglas <chase.douglas@canonical.com> <chase.douglas@ubuntu.com>
|
||||
Chase Douglas <chase.douglas@canonical.com> <chasedouglas@gmail.com>
|
||||
|
||||
Christian König <christian.koenig@amd.com> <christian.koenig at amd.com>
|
||||
|
||||
Colin Guthrie <gmane@colin.guthr.ie> <cguthrie@mandriva.org>
|
||||
|
||||
Colin Harrison <colin@xming.myzen.co.uk> <colin.harrison-at-virgin.net>
|
||||
Colin Harrison <colin@xming.myzen.co.uk> <colin.harrison@virgin.net>
|
||||
|
||||
Dan Nicholson <dbn.lists@gmail.com> <dan@conor.dwcab.com>
|
||||
|
||||
Daniel Drake <drake@endlessm.com> <d.drake@mmm.com>
|
||||
Daniel Drake <drake@endlessm.com> <dsd@gentoo.org>
|
||||
Daniel Drake <drake@endlessm.com> <dsd@laptop.org>
|
||||
|
||||
Daniel Martin <consume.noise@gmail.com> <daniel.martin@secunet.com>
|
||||
|
||||
Daniel Stone <daniels@collabora.com> <daniel.stone@nokia.com>
|
||||
Daniel Stone <daniels@collabora.com> <daniel@fooishbar.org>
|
||||
|
||||
Dave Airlie <airlied@redhat.com> <airlied@clockmaker.usersys.redhat.com>
|
||||
Dave Airlie <airlied@redhat.com> <airlied@gmail.com>
|
||||
Dave Airlie <airlied@redhat.com> <airlied@linux.ie>
|
||||
Dave Airlie <airlied@redhat.com> <airlied@panoply-rh.(none)>
|
||||
Dave Airlie <airlied@redhat.com> <airlied@pegasus.(none)>
|
||||
|
||||
David Heidelberg <david@ixit.cz> David Heidelberger <david.heidelberger@ixit.cz>
|
||||
|
||||
David Miller <davem@davemloft.net>
|
||||
|
||||
David Nusinow <dnusinow@debian.org> <david@nee.(none)>
|
||||
|
||||
David Reveman <reveman@chromium.org> <c99drn@cs.umu.se>
|
||||
David Reveman <reveman@chromium.org> <davidr@novell.com>
|
||||
|
||||
Demi Marie Obenour <demiobenour@gmail.com> <demi@invisiblethingslab.com>
|
||||
|
||||
Dodji Seketeli <dodji@seketeli.org> <dodji@openedhand.com>
|
||||
|
||||
Donnie Berkholz <dberkholz@gentoo.org> <donnie@supernova.(none)>
|
||||
Donnie Berkholz <dberkholz@gentoo.org> <spyderous@gentoo.org>
|
||||
|
||||
Drew Parsons <dparsons@debian.org> <drew@emerall.com>
|
||||
Drew Parsons <dparsons@debian.org> <drew@pug.localdomain>
|
||||
|
||||
Eamon Walsh <ewalsh@tycho.nsa.gov> <efw@eamonwalsh.com>
|
||||
Eamon Walsh <ewalsh@tycho.nsa.gov> <ewalsh@epoch.ncsc.mil>
|
||||
Eamon Walsh <ewalsh@tycho.nsa.gov> <ewalsh@moss-huskies.epoch.ncsc.mil>
|
||||
Eamon Walsh <ewalsh@tycho.nsa.gov> <ewalsh@moss-uranus.epoch.ncsc.mil>
|
||||
|
||||
Egbert Eich <eich@suse.de> <eich@freedesktop.org>
|
||||
Egbert Eich <eich@suse.de> <eich@ovid.suse.de>
|
||||
Egbert Eich <eich@suse.de> <eich@pdx.freedesktop.org>
|
||||
|
||||
Emil Velikov <emil.l.velikov@gmail.com> <emil.velikov@collabora.com>
|
||||
|
||||
Emma Anholt <emma@anholt.net> <anholt@FreeBSD.org>
|
||||
Emma Anholt <emma@anholt.net> <eric@anholt.net>
|
||||
|
||||
Eric Engestrom <eric@igalia.com> <eric@engestrom.ch>
|
||||
Eric Engestrom <eric@igalia.com> <eric.engestrom@imgtec.com>
|
||||
|
||||
Éric Piel <eric.piel@trempin-utc.net>
|
||||
Éric Piel <eric.piel@trempin-utc.net> <E.A.B.Piel@tudelft.nl>
|
||||
|
||||
Erik Andrén <erik.andren@gmail.com>
|
||||
|
||||
Faith Ekstrand <faith.ekstrand@collabora.com> <jason@jlekstrand.net>
|
||||
Faith Ekstrand <faith.ekstrand@collabora.com> <jason.ekstrand@intel.com>
|
||||
Faith Ekstrand <faith.ekstrand@collabora.com> <faith@gfxstrand.net>
|
||||
|
||||
Felix Kuehling <felix.kuehling@amd.com> <fxkuehl@gmx.de>
|
||||
|
||||
François Tigeot <ftigeot@wolfpond.org>
|
||||
|
||||
George Sapountzis <gsapountzis@gmail.com> <gsap7@yahoo.gr>
|
||||
|
||||
George Staplin <gstaplin@apple.com> <gps@Georges-Workstation.local>
|
||||
George Staplin <gstaplin@apple.com> <georgestaplin@george-staplins-mac-pro.local>
|
||||
|
||||
Haihao Xiang <haihao.xiang@intel.com>
|
||||
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Hans de Goede <hdegoede@redhat.com> <j.w.r.degoede@hhs.nl>
|
||||
|
||||
Henry Zhao <henry.zhao@oracle.com> <henryz@localhost.localdomain>
|
||||
|
||||
Ian Romanick <ian.d.romanick@intel.com> <idr@localhost.localdomain>
|
||||
Ian Romanick <ian.d.romanick@intel.com> <idr@umwelt.(none)>
|
||||
Ian Romanick <ian.d.romanick@intel.com> <idr@us.ibm.com>
|
||||
|
||||
Jan Beich <jbeich@freebsd.org> <jbeich@FreeBSD.org>
|
||||
|
||||
Jay Cotton <jay.cotton@oracle.com> <jay.cotton@sun.com>
|
||||
|
||||
Jeffrey Smith <whydoubt@gmail.com>
|
||||
Jeffrey Smith <whydoubt@gmail.com> <whydoubt@yahoo.com>
|
||||
|
||||
Jeremy C. Reed <reed@glacier.reedmedia.net> <reed@reedmedia.net>
|
||||
|
||||
Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremy@dhcp-38-248.EECS.Berkeley.EDU>
|
||||
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremy@tifa-2.local>
|
||||
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremy@tifa.local>
|
||||
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremy@yuffie.local>
|
||||
Jeremy Huddleston Sequoia <jeremyhu@apple.com> <jeremyhu@freedesktop.org>
|
||||
|
||||
Jeremy Uejio <jeremy.uejio@oracle.com> <jeremy.uejio@sun.com>
|
||||
|
||||
Jerome Glisse <jglisse@redhat.com> <glisse@freedesktop.org>
|
||||
|
||||
Jesse Adkins <jesserayadkins@gmail.com> <jesse_adkins7@yahoo.com>
|
||||
|
||||
Jesse Barnes <jesse.barnes@intel.com> <jbarnes@jbarnes-mobile.amr.corp.intel.com>
|
||||
Jesse Barnes <jesse.barnes@intel.com> <jbarnes@jbarnes-t61.(none)>
|
||||
Jesse Barnes <jesse.barnes@intel.com> <jbarnes@nietzche.virtuousgeek.org>
|
||||
Jesse Barnes <jesse.barnes@intel.com> <jbarnes@virtuousgeek.org>
|
||||
|
||||
Joel Bosveld <joel.bosveld@gmail.com> <Joel.Bosveld@gmail.com>
|
||||
|
||||
John Tapsell <johnflux@gmail.com> <john.tapsell@john-desktop.(none)>
|
||||
|
||||
Jon Turney <jon.turney@dronecode.org.uk>
|
||||
|
||||
Julien Isorce <j.isorce@samsung.com> <julien.isorce@gmail.com>
|
||||
|
||||
Keith Packard <keithp@keithp.com> <keithp@dulcimer.keithp.com>
|
||||
Keith Packard <keithp@keithp.com> <keithp@guitar.keithp.com>
|
||||
Keith Packard <keithp@keithp.com> <keithp@koto.keithp.com>
|
||||
Keith Packard <keithp@keithp.com> <keithp@mandolin.keithp.com>
|
||||
Keith Packard <keithp@keithp.com> <keithp@neko.keithp.com>
|
||||
Keith Packard <keithp@keithp.com> <keithp@ukulele.keithp.com>
|
||||
Keith Packard <keithp@keithp.com> <keithp@viola.jf.intel.com>
|
||||
|
||||
Kevin E Martin <kem@redhat.com> <kem@freedesktop.org>
|
||||
Kevin E Martin <kem@redhat.com> <kem@kem.org>
|
||||
|
||||
Kristian Høgsberg <krh@bitplanet.net>
|
||||
Kristian Høgsberg <krh@bitplanet.net> <krh@redhat.com>
|
||||
Kristian Høgsberg <krh@bitplanet.net> <krh@sasori.boston.redhat.com>
|
||||
Kristian Høgsberg <krh@bitplanet.net> <krh@temari.boston.redhat.com>
|
||||
|
||||
Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
|
||||
Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br> <lbsousajr@gmail.com>
|
||||
|
||||
Lina Versace <lina@kiwitree.net> <chad.versace@linux.intel.com>
|
||||
|
||||
Lucas Stach <dev@lynxeye.de> <l.stach@pengutronix.de>
|
||||
|
||||
Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
|
||||
Łukasz Spintzyk <lukasz.spintzyk@synaptics.com> <lukasz.spintzyk@gmail.com>
|
||||
|
||||
Lyude Paul <lyude@redhat.com>
|
||||
Lyude Paul <lyude@redhat.com> <cpaul@redhat.com>
|
||||
|
||||
Maarten Lankhorst <maarten.lankhorst@ubuntu.com> <dev@mblankhorst.nl>
|
||||
Maarten Lankhorst <maarten.lankhorst@ubuntu.com> <maarten.lankhorst@canonical.com>
|
||||
|
||||
Marc Aurele La France <tsi@ualberta.ca> <tsi@ualberta.edu>
|
||||
|
||||
Mario Kleiner <mario.kleiner.de@gmail.com> <mario.kleiner@tuebingen.mpg.de>
|
||||
|
||||
Mark Kettenis <kettenis@openbsd.org> <mark.kettenis@xs4all.nl>
|
||||
|
||||
Matthew Allum <mallum@openedhand.com> <breakfast@10.am>
|
||||
Matthew Allum <mallum@openedhand.com> <mallum@polystyrene.(none)>
|
||||
|
||||
Matthieu Herrb <matthieu@herrb.eu> <matthieu.herrb@laas.fr>
|
||||
Matthieu Herrb <matthieu@herrb.eu> <matthieu@bluenote.herrb.com>
|
||||
Matthieu Herrb <matthieu@herrb.eu> <matthieu@blues.laas.fr>
|
||||
Matthieu Herrb <matthieu@herrb.eu> <matthieu@crux.(none)>
|
||||
Matthieu Herrb <matthieu@herrb.eu> <matthieu@deville.herrb.com>
|
||||
Matthieu Herrb <matthieu@herrb.eu> <matthieu@laas.fr>
|
||||
Matthieu Herrb <matthieu@herrb.eu> <matthieu@roadrock.(none)>
|
||||
|
||||
Max Schwarz <Max@x-quadraht.de> <max.schwarz@online.de>
|
||||
|
||||
Maya Rashish <maya@NetBSD.org>
|
||||
Maya Rashish <maya@NetBSD.org> <coypu@sdf.org>
|
||||
|
||||
Michal Srb <msrb@suse.com> <msrb@novell.com>
|
||||
|
||||
Michal Suchanek <hramrach@gmail.com> <hramrach@centrum.cz>
|
||||
|
||||
Michał Górny <gentoo@mgorny.alt.pl>
|
||||
Michał Górny <gentoo@mgorny.alt.pl> <mgorny@gentoo.org>
|
||||
|
||||
Michael Vogt <mvo@ubuntu.com> <michael.vogt@ubuntu.com>
|
||||
|
||||
Michel Dänzer <michel@daenzer.net>
|
||||
Michel Dänzer <michel@daenzer.net> <daenzer@debian.org>
|
||||
Michel Dänzer <michel@daenzer.net> <daenzer@vmware.com>
|
||||
Michel Dänzer <michel@daenzer.net> <mdaenzer@redhat.com>
|
||||
Michel Dänzer <michel@daenzer.net> <michel.daenzer@amd.com>
|
||||
Michel Dänzer <michel@daenzer.net> <michel@tungstengraphics.com>
|
||||
|
||||
Michele Baldessari <michele@redhat.com> <michele@acksyn.org>
|
||||
|
||||
Neil Roberts <nroberts@igalia.com> <neil@linux.intel.com>
|
||||
|
||||
nerdopolis <bluescreen_avenger@verizon.net> nerdopolis <rbos@rbos>
|
||||
|
||||
Nicolai Hähnle <nicolai.haehnle@amd.com>
|
||||
Nicolai Hähnle <nicolai.haehnle@amd.com> <nhaehnle@gmail.com>
|
||||
|
||||
Niveditha Rau <niveditha.rau@oracle.com> <niveditha.rau@sun.com>
|
||||
|
||||
Oliver McFadden <oliver.mcfadden@linux.intel.com> <oliver.mcfadden@nokia.com>
|
||||
|
||||
Olivier Fourdan <ofourdan@redhat.com> <fourdan@xfce.org>
|
||||
|
||||
Owen W. Taylor <otaylor@fishsoup.net>
|
||||
Owen W. Taylor <otaylor@fishsoup.net> <otaylor@huygens.home.fishsoup.net>
|
||||
Owen W. Taylor <otaylor@fishsoup.net> <otaylor@redhat.com>
|
||||
|
||||
Pauli Nieminen <pauli.nieminen@linux.intel.com> <ext-pauli.nieminen@nokia.com>
|
||||
|
||||
Paulo Zanoni <paulo.r.zanoni@intel.com> Paulo Ricardo Zanoni <prz05@c3sl.ufpr.br>
|
||||
Paulo Zanoni <paulo.r.zanoni@intel.com> Paulo Ricardo Zanoni <pzanoni@mandriva.com>
|
||||
|
||||
Pekka Paalanen <pekka.paalanen@collabora.co.uk> <pekka.paalanen@collabora.com>
|
||||
|
||||
Peter Harris <pharris2@rocketsoftware.com> <peter.harris@hummingbird.com>
|
||||
Peter Harris <pharris2@rocketsoftware.com> <pharris@opentext.com>
|
||||
|
||||
Peter Hutterer <peter.hutterer@who-t.net> <peter.hutterer@redhat.com>
|
||||
Peter Hutterer <peter.hutterer@who-t.net> <peter@cs.unisa.edu.au>
|
||||
Peter Hutterer <peter.hutterer@who-t.net> <whot@potoroo.wearablelab.ml.unisa.edu.au>
|
||||
Peter Hutterer <peter.hutterer@who-t.net> rpm-build <rpm-build>
|
||||
|
||||
Pierre Willenbrock <pierre@pirsoft.de> <pierre@pirsoft.dnsalias.org>
|
||||
|
||||
Qiang Yu <yuq825@gmail.com> <Qiang.Yu@amd.com>
|
||||
|
||||
Rami Ylimaki <rami.ylimaki@vincit.fi>
|
||||
Rami Ylimaki <rami.ylimaki@vincit.fi> <ext-rami.ylimaki@nokia.com>
|
||||
|
||||
Rémi Cardona <remi@gentoo.org>
|
||||
Rémi Cardona <remi@gentoo.org> <remi.cardona@lri.fr>
|
||||
|
||||
Rob Clark <robclark@freedesktop.org> <robdclark@gmail.com>
|
||||
|
||||
Roland Bär <roland@verifysoft.de>
|
||||
|
||||
Roland Scheidegger <sroland@vmware.com> <rscheidegger_lists@hispeed.ch>
|
||||
Roland Scheidegger <sroland@vmware.com> <sroland@tungstengraphics.com>
|
||||
|
||||
Roman Gilg <subdiff@gmail.com>
|
||||
Roman Kapl <code@rkapl.cz>
|
||||
|
||||
Ross Burton <ross.burton@intel.com> <ross@burtonini.com>
|
||||
Ross Burton <ross.burton@intel.com> <ross@linux.intel.com>
|
||||
|
||||
Sam Lau <sam.lau@oracle.com> <sam.lau@sun.com>
|
||||
|
||||
Simon Farnsworth <simon.farnsworth@onelan.com> <simon.farnsworth@onelan.co.uk>
|
||||
|
||||
Sjoerd Simons <sjoerd@collabora.com> <sjoerd.simons@collabora.co.uk>
|
||||
|
||||
Søren Sandmann Pedersen <sandmann@redhat.com>
|
||||
Søren Sandmann Pedersen <sandmann@redhat.com> <soren.sandmann@gmail.com>
|
||||
Søren Sandmann Pedersen <sandmann@redhat.com> <sandmann@daimi.au.dk>
|
||||
Søren Sandmann Pedersen <sandmann@redhat.com> <ssp@l3000.localdomain>
|
||||
Søren Sandmann Pedersen <sandmann@redhat.com> <ssp@redhat.com>
|
||||
Søren Sandmann Pedersen <sandmann@redhat.com> <ssp@dhcp83-218.boston.redhat.com>
|
||||
|
||||
Stuart Kreitman <stuart.kreitman@oracle.com> <stuart.kreitman@sun.com>
|
||||
|
||||
Thierry Reding <treding@nvidia.com> <thierry.reding@avionic-design.de>
|
||||
Thierry Reding <treding@nvidia.com> <thierry.reding@gmail.com>
|
||||
|
||||
Thomas Hellstrom <thellstrom@vmware.com> <thomas-at-tungstengraphics-dot-com>
|
||||
Thomas Hellstrom <thellstrom@vmware.com> <thomas-at-tungstengraphics.com>
|
||||
Thomas Hellstrom <thellstrom@vmware.com> <unichrome@shipmail.org>
|
||||
|
||||
Thomas Jaeger <thjaeger@gmail.com> <ThJaeger@gmail.com>
|
||||
|
||||
Tiago Vignatti <tiago.vignatti@nokia.com>
|
||||
Tiago Vignatti <tiago.vignatti@nokia.com> <tiago.vignatti@Nokia.com>
|
||||
Tiago Vignatti <tiago.vignatti@nokia.com> <tiagov@balalaika.(none)>
|
||||
Tiago Vignatti <tiago.vignatti@nokia.com> <tv02@c3sl.ufpr.br>
|
||||
Tiago Vignatti <tiago.vignatti@nokia.com> <vignatti@c3sl.ufpr.br>
|
||||
|
||||
Timo Aaltonen <tjaalton@debian.org> <tjaalton@cc.hut.fi>
|
||||
Timo Aaltonen <tjaalton@debian.org> <tjaalton@ubuntu.com>
|
||||
|
||||
Tomas Carnecky <tomas.carnecky@gmail.com> <tom@dbservice.com>
|
||||
|
||||
Tormod Volden <debian.tormod@gmail.com> <lists.tormod@gmail.com>
|
||||
Tormod Volden <debian.tormod@gmail.com> <bugzi06.fdo.tormod@xoxy.net>
|
||||
|
||||
Ville Syrjälä <ville.syrjala@linux.intel.com>
|
||||
Ville Syrjälä <ville.syrjala@linux.intel.com> <syrjala@sci.fi>
|
||||
Ville Syrjälä <ville.syrjala@linux.intel.com> <ville.syrjala@nokia.com>
|
||||
|
||||
Yuriy Vasilev <uuvasiliev@yandex.ru>
|
||||
|
||||
Zack Rusin <zackr@vmware.com> <zack@kde.org>
|
||||
Zack Rusin <zackr@vmware.com> <zack@tungstengraphics.com>
|
||||
|
||||
Zephaniah E. Hull <warp@aehallh.com> <warp@agamemnon.b5>
|
||||
|
||||
Zhenyu Wang <zhenyuw@linux.intel.com> <zhenyu.z.wang@intel.com>
|
||||
|
||||
Zhigang Gong <zhigang.gong@intel.com> <zhigang.gong@gmail.com>
|
||||
Zhigang Gong <zhigang.gong@intel.com> <zhigang.gong@linux.intel.com>
|
||||
|
||||
Zoltán Böszörményi <zboszor@gmail.com>
|
||||
Zoltán Böszörményi <zboszor@gmail.com> <zboszor@pr.hu>
|
||||
27
.travis.yml
27
.travis.yml
|
|
@ -1,27 +0,0 @@
|
|||
language: c
|
||||
cache:
|
||||
ccache: true
|
||||
directories:
|
||||
- $HOME/Library/Caches/Homebrew
|
||||
branches:
|
||||
except:
|
||||
- /appveyor.*/
|
||||
|
||||
os: osx
|
||||
osx_image: xcode9.2
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- env: TOOL=meson
|
||||
- env: TOOL=autotools
|
||||
|
||||
install:
|
||||
- brew update
|
||||
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache meson
|
||||
|
||||
script:
|
||||
- ./test/scripts/build-travis-osx.sh $TOOL
|
||||
- ccache -s
|
||||
|
||||
before_cache:
|
||||
- brew cleanup
|
||||
26
COPYING
26
COPYING
|
|
@ -8,7 +8,6 @@ possible, and insert their name to this list. Please sort by surname
|
|||
for people, and by the full name for other entities (e.g. Juliusz
|
||||
Chroboczek sorts before Intel Corporation sorts before Daniel Stone).
|
||||
|
||||
Copyright © 2011 Dave Airlie
|
||||
Copyright © 2000-2001 Juliusz Chroboczek
|
||||
Copyright © 1998 Egbert Eich
|
||||
Copyright © 2006-2007 Intel Corporation
|
||||
|
|
@ -16,7 +15,7 @@ Copyright © 2006 Nokia Corporation
|
|||
Copyright © 2006-2008 Peter Hutterer
|
||||
Copyright © 2006 Adam Jackson
|
||||
Copyright © 2009-2010 NVIDIA Corporation
|
||||
Copyright © 1987, 2003-2006, 2008-2010, 2025 Oracle and/or its affiliates.
|
||||
Copyright © 1987, 2003-2006, 2008-2010 Oracle and/or its affiliates.
|
||||
Copyright © 1999 Keith Packard
|
||||
Copyright © 2007-2009 Red Hat, Inc.
|
||||
Copyright © 2005-2008 Daniel Stone
|
||||
|
|
@ -146,29 +145,6 @@ used in advertising or otherwise to promote the sale, use or other dealings
|
|||
in this Software without prior written authorization from the X Consortium.
|
||||
|
||||
|
||||
Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sub license, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the
|
||||
next paragraph) shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
Copyright © 1999-2000 SuSE, Inc.
|
||||
Copyright © 2007 Red Hat, Inc.
|
||||
|
||||
|
|
|
|||
130
Makefile.am
Normal file
130
Makefile.am
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
AUTOMAKE_OPTIONS=nostdinc
|
||||
|
||||
# Required for automake < 1.14
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
if COMPOSITE
|
||||
COMPOSITE_DIR=composite
|
||||
endif
|
||||
|
||||
if GLX
|
||||
GLX_DIR=glx
|
||||
endif
|
||||
|
||||
if DBE
|
||||
DBE_DIR=dbe
|
||||
endif
|
||||
|
||||
if RECORD
|
||||
RECORD_DIR=record
|
||||
endif
|
||||
|
||||
if DRI3
|
||||
DRI3_DIR=dri3
|
||||
endif
|
||||
|
||||
if PRESENT
|
||||
PRESENT_DIR=present
|
||||
endif
|
||||
|
||||
if PSEUDORAMIX
|
||||
PSEUDORAMIX_DIR=pseudoramiX
|
||||
endif
|
||||
|
||||
if GLAMOR
|
||||
GLAMOR_DIR=glamor
|
||||
endif
|
||||
|
||||
SUBDIRS = \
|
||||
doc \
|
||||
man \
|
||||
include \
|
||||
dix \
|
||||
fb \
|
||||
mi \
|
||||
Xext \
|
||||
miext \
|
||||
os \
|
||||
randr \
|
||||
render \
|
||||
Xi \
|
||||
xkb \
|
||||
$(PSEUDORAMIX_DIR) \
|
||||
$(DBE_DIR) \
|
||||
$(RECORD_DIR) \
|
||||
xfixes \
|
||||
damageext \
|
||||
$(COMPOSITE_DIR) \
|
||||
$(GLX_DIR) \
|
||||
$(PRESENT_DIR) \
|
||||
$(DRI3_DIR) \
|
||||
exa \
|
||||
$(GLAMOR_DIR) \
|
||||
config \
|
||||
hw \
|
||||
test
|
||||
|
||||
if XORG
|
||||
aclocaldir = $(datadir)/aclocal
|
||||
aclocal_DATA = xorg-server.m4
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = xorg-server.pc
|
||||
endif
|
||||
|
||||
EXTRA_DIST = xorg-server.pc.in xorg-server.m4 autogen.sh
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS=\
|
||||
--with-xkb-path=$(XKB_BASE_DIRECTORY) \
|
||||
--with-xkb-bin-directory=$(XKB_BIN_DIRECTORY) \
|
||||
--with-xkb-output='$${datadir}/X11/xkb/compiled'
|
||||
|
||||
.PHONY: ChangeLog INSTALL
|
||||
|
||||
INSTALL:
|
||||
$(INSTALL_CMD)
|
||||
|
||||
ChangeLog:
|
||||
$(CHANGELOG_CMD)
|
||||
|
||||
dist-hook: ChangeLog INSTALL
|
||||
|
||||
DIST_SUBDIRS = \
|
||||
doc \
|
||||
man \
|
||||
include \
|
||||
dix \
|
||||
fb \
|
||||
mi \
|
||||
Xext \
|
||||
miext \
|
||||
os \
|
||||
pseudoramiX \
|
||||
randr \
|
||||
render \
|
||||
Xi \
|
||||
xkb \
|
||||
dbe \
|
||||
record \
|
||||
xfixes \
|
||||
damageext \
|
||||
composite \
|
||||
glx \
|
||||
exa \
|
||||
glamor \
|
||||
config \
|
||||
dri3 \
|
||||
present \
|
||||
hw \
|
||||
test
|
||||
|
||||
# gross hack
|
||||
relink: all
|
||||
$(AM_V_at)$(MAKE) -C hw relink
|
||||
|
||||
install-headers: Makefile
|
||||
+find . -name Makefile | while read m; do \
|
||||
if grep -q install-sdkHEADERS $$m; then \
|
||||
(cd `dirname "$$m"` && make install-sdkHEADERS) \
|
||||
fi \
|
||||
done
|
||||
38
README
Normal file
38
README
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
X Server
|
||||
|
||||
The X server accepts requests from client applications to create windows,
|
||||
which are (normally rectangular) "virtual screens" that the client program
|
||||
can draw into.
|
||||
|
||||
Windows are then composed on the actual screen by the X server
|
||||
(or by a separate composite manager) as directed by the window manager,
|
||||
which usually communicates with the user via graphical controls such as buttons
|
||||
and draggable titlebars and borders.
|
||||
|
||||
For a comprehensive overview of X Server and X Window System, consult the
|
||||
following article:
|
||||
http://en.wikipedia.org/wiki/X_server
|
||||
|
||||
All questions regarding this software should be directed at the
|
||||
Xorg mailing list:
|
||||
|
||||
http://lists.freedesktop.org/mailman/listinfo/xorg
|
||||
|
||||
Please submit bug reports to the Xorg bugzilla:
|
||||
|
||||
https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
|
||||
|
||||
The master development code repository can be found at:
|
||||
|
||||
git://anongit.freedesktop.org/git/xorg/xserver
|
||||
|
||||
http://cgit.freedesktop.org/xorg/xserver
|
||||
|
||||
For patch submission instructions, see:
|
||||
|
||||
http://www.x.org/wiki/Development/Documentation/SubmittingPatches
|
||||
|
||||
For more information on the git code manager, see:
|
||||
|
||||
http://wiki.x.org/wiki/GitPage
|
||||
|
||||
41
README.md
41
README.md
|
|
@ -1,41 +0,0 @@
|
|||
************************************************************************
|
||||
* This is the now defunct 'master' branch of the xserver repository. *
|
||||
* Ongoing development has moved to the 'main' branch instead. *
|
||||
************************************************************************
|
||||
|
||||
|
||||
X Server
|
||||
--------
|
||||
|
||||
The X server accepts requests from client applications to create windows,
|
||||
which are (normally rectangular) "virtual screens" that the client program
|
||||
can draw into.
|
||||
|
||||
Windows are then composed on the actual screen by the X server
|
||||
(or by a separate composite manager) as directed by the window manager,
|
||||
which usually communicates with the user via graphical controls such as buttons
|
||||
and draggable titlebars and borders.
|
||||
|
||||
For a comprehensive overview of X Server and X Window System, consult the
|
||||
following article:
|
||||
https://en.wikipedia.org/wiki/X_server
|
||||
|
||||
All questions regarding this software should be directed at the
|
||||
Xorg mailing list:
|
||||
|
||||
https://lists.freedesktop.org/mailman/listinfo/xorg
|
||||
|
||||
The primary development code repository can be found at:
|
||||
|
||||
https://gitlab.freedesktop.org/xorg/xserver
|
||||
|
||||
For patch submission instructions, see:
|
||||
|
||||
https://www.x.org/wiki/Development/Documentation/SubmittingPatches
|
||||
|
||||
As with other projects hosted on freedesktop.org, X.Org follows its
|
||||
Code of Conduct, based on the Contributor Covenant. Please conduct
|
||||
yourself in a respectful and civilized manner when using the above
|
||||
mailing lists, bug trackers, etc:
|
||||
|
||||
https://www.freedesktop.org/wiki/CodeOfConduct
|
||||
50
SECURITY.md
50
SECURITY.md
|
|
@ -1,50 +0,0 @@
|
|||
# Reporting Security Issues
|
||||
|
||||
Please notify us of any security issues by sending mail to
|
||||
<xorg-security@lists.x.org>.
|
||||
|
||||
See https://www.x.org/wiki/Development/Security/Organization/
|
||||
for more information about the X.Org security team.
|
||||
|
||||
# Learning about Security Fixes
|
||||
|
||||
X.Org announces security bugs and bug fix releases on the xorg-announce
|
||||
mailing list. See the archives at https://lists.x.org/archives/xorg-announce/
|
||||
and see https://lists.x.org/mailman/listinfo/xorg-announce to subscribe.
|
||||
|
||||
Security advisories are also listed on our wiki at
|
||||
https://www.x.org/wiki/Development/Security/ and mailed to the
|
||||
https://oss-security.openwall.org/wiki/mailing-lists/oss-security mailing list.
|
||||
|
||||
# Security model and trust boundaries
|
||||
|
||||
Only the Xorg server is expected to run with elevated privileges.
|
||||
(Some distros may run Xorg with a wrapper to only grant these privileges when
|
||||
necessary.) The Xorg server usually requires root access to hardware devices
|
||||
and I/O registers when using a UMS (Userspace Mode Setting) driver, and not
|
||||
when using a KMS (Kernel Mode Setting) driver, or drivers which do not require
|
||||
actual hardware access (such as xf86-video-dummy).
|
||||
|
||||
All other X servers (Xephyr, Xnest, Xvfb, etc.) are expected to run with only
|
||||
the privileges of the user who started the server. They should not require
|
||||
direct access to any devices.
|
||||
|
||||
The Xorg server uses configuration files to control various aspects of its
|
||||
operation (see the xorg.conf(5) man page), including specifying loadable
|
||||
object modules to run code from with the full privileges of the X server.
|
||||
There is no attempt to sandbox these modules - they are considered to be fully
|
||||
trusted, and thus anyone who can edit a config file is considered to be fully
|
||||
trusted - a module being able to control or crash the X server is not considered
|
||||
a security vulnerability (though a crash would be a non-security bug in the
|
||||
module). The configuration file loading mechanism takes steps to verify that
|
||||
config files are owned by trusted users before reading them, and failure to do
|
||||
so would be considered a security vulnerability.
|
||||
|
||||
Access control for which clients can connect to the X server is provided by
|
||||
a number of mechanisms, see the Xsecurity(7) man page for details. Once a
|
||||
client is authenticated via those mechanisms and has an active connection,
|
||||
we do not consider it a security vulnerability for them to be able to take
|
||||
any actions described in the X11 protocol or extension specifications, such
|
||||
as changing monitor configurations or killing other clients, though we will
|
||||
accept non-security bug reports for clients doing so in a manner or via
|
||||
requests not documented in the protocol specs as doing those operations.
|
||||
113
Xext/Makefile.am
Normal file
113
Xext/Makefile.am
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
noinst_LTLIBRARIES = libXext.la libXextdpmsstubs.la
|
||||
|
||||
AM_CFLAGS = $(DIX_CFLAGS)
|
||||
|
||||
if XORG
|
||||
sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h syncsdk.h
|
||||
endif
|
||||
|
||||
# Sources always included in libXextbuiltin.la & libXext.la
|
||||
BUILTIN_SRCS = \
|
||||
bigreq.c \
|
||||
geext.c \
|
||||
shape.c \
|
||||
sleepuntil.c \
|
||||
sleepuntil.h \
|
||||
sync.c \
|
||||
syncsdk.h \
|
||||
syncsrv.h \
|
||||
xcmisc.c \
|
||||
xtest.c
|
||||
BUILTIN_LIBS =
|
||||
|
||||
# Optional sources included if extension enabled by configure.ac rules
|
||||
|
||||
# MIT Shared Memory extension
|
||||
MITSHM_SRCS = shm.c shmint.h
|
||||
if MITSHM
|
||||
BUILTIN_SRCS += $(MITSHM_SRCS)
|
||||
endif
|
||||
|
||||
# XVideo extension
|
||||
XV_SRCS = xvmain.c xvdisp.c xvmc.c xvdix.h xvmcext.h xvdisp.h
|
||||
if XV
|
||||
BUILTIN_SRCS += $(XV_SRCS)
|
||||
endif
|
||||
|
||||
# XResource extension: lets clients get data about per-client resource usage
|
||||
RES_SRCS = hashtable.c hashtable.h xres.c
|
||||
if RES
|
||||
BUILTIN_SRCS += $(RES_SRCS)
|
||||
endif
|
||||
|
||||
# MIT ScreenSaver extension
|
||||
SCREENSAVER_SRCS = saver.c
|
||||
if SCREENSAVER
|
||||
BUILTIN_SRCS += $(SCREENSAVER_SRCS)
|
||||
endif
|
||||
|
||||
# Xinerama extension: making multiple video devices act as one virtual screen
|
||||
XINERAMA_SRCS = panoramiX.c panoramiX.h panoramiXh.h panoramiXsrv.h panoramiXprocs.c panoramiXSwap.c
|
||||
if XINERAMA
|
||||
BUILTIN_SRCS += $(XINERAMA_SRCS)
|
||||
if XORG
|
||||
sdk_HEADERS += panoramiXsrv.h panoramiX.h
|
||||
endif
|
||||
endif
|
||||
|
||||
# X-ACE extension: provides hooks for building security policy extensions
|
||||
# like XC-Security, X-SELinux & XTSol
|
||||
XACE_SRCS = xace.c xace.h xacestr.h
|
||||
if XACE
|
||||
BUILTIN_SRCS += $(XACE_SRCS)
|
||||
if XORG
|
||||
sdk_HEADERS += xace.h xacestr.h
|
||||
endif
|
||||
endif
|
||||
|
||||
# SELinux extension: provides SELinux policy support for X objects
|
||||
# requires X-ACE extension
|
||||
XSELINUX_SRCS = xselinux_ext.c xselinux_hooks.c xselinux_label.c xselinux.h xselinuxint.h
|
||||
if XSELINUX
|
||||
BUILTIN_SRCS += $(XSELINUX_SRCS)
|
||||
BUILTIN_LIBS += $(SELINUX_LIBS)
|
||||
endif
|
||||
|
||||
# Security extension: multi-level security to protect clients from each other
|
||||
XCSECURITY_SRCS = security.c securitysrv.h
|
||||
if XCSECURITY
|
||||
BUILTIN_SRCS += $(XCSECURITY_SRCS)
|
||||
endif
|
||||
|
||||
# XF86 Big Font extension
|
||||
BIGFONT_SRCS = xf86bigfont.c xf86bigfontsrv.h
|
||||
if XF86BIGFONT
|
||||
BUILTIN_SRCS += $(BIGFONT_SRCS)
|
||||
endif
|
||||
|
||||
# DPMS extension
|
||||
DPMS_SRCS = dpms.c dpmsproc.h
|
||||
if DPMSExtension
|
||||
BUILTIN_SRCS += $(DPMS_SRCS)
|
||||
endif
|
||||
|
||||
# Now take all of the above, mix well, bake for 10 minutes and get libXext*.la
|
||||
|
||||
libXext_la_SOURCES = $(BUILTIN_SRCS)
|
||||
libXext_la_LIBADD = $(BUILTIN_LIBS)
|
||||
|
||||
libXextdpmsstubs_la_SOURCES = dpmsstubs.c
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(MITSHM_SRCS) \
|
||||
$(XV_SRCS) \
|
||||
$(RES_SRCS) \
|
||||
$(SCREENSAVER_SRCS) \
|
||||
$(XACE_SRCS) \
|
||||
$(XCSECURITY_SRCS) \
|
||||
$(XSELINUX_SRCS) \
|
||||
$(XINERAMA_SRCS) \
|
||||
$(BIGFONT_SRCS) \
|
||||
$(DPMS_SRCS) \
|
||||
$(GE_SRCS)
|
||||
|
||||
|
|
@ -26,18 +26,19 @@ from The Open Group.
|
|||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "dix_priv.h"
|
||||
#include "extnsionst.h"
|
||||
#include <X11/extensions/bigreqsproto.h>
|
||||
#include "opaque.h"
|
||||
#include "extinit_priv.h"
|
||||
#include "extinit.h"
|
||||
|
||||
static int
|
||||
ProcBigReqDispatch(ClientPtr client)
|
||||
|
|
@ -45,6 +46,9 @@ ProcBigReqDispatch(ClientPtr client)
|
|||
REQUEST(xBigReqEnableReq);
|
||||
xBigReqEnableReply rep;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&stuff->length);
|
||||
}
|
||||
if (stuff->brReqType != X_BigReqEnable)
|
||||
return BadRequest;
|
||||
REQUEST_SIZE_MATCH(xBigReqEnableReq);
|
||||
|
|
|
|||
406
Xext/dpms.c
406
Xext/dpms.c
|
|
@ -14,26 +14,24 @@ all copies or substantial portions of the Software.
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
|
||||
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
|
||||
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Digital Equipment Corporation
|
||||
Except as contained in this notice, the name of Digital Equipment Corporation
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization from Digital
|
||||
dealings in this Software without prior written authorization from Digital
|
||||
Equipment Corporation.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
|
||||
#include "os/screensaver.h"
|
||||
#include "Xext/geext.h"
|
||||
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
|
|
@ -41,255 +39,7 @@ Equipment Corporation.
|
|||
#include "opaque.h"
|
||||
#include <X11/extensions/dpmsproto.h>
|
||||
#include "dpmsproc.h"
|
||||
#include "extinit_priv.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "protocol-versions.h"
|
||||
|
||||
CARD16 DPMSPowerLevel = 0;
|
||||
Bool DPMSDisabledSwitch = FALSE;
|
||||
CARD32 DPMSStandbyTime = -1;
|
||||
CARD32 DPMSSuspendTime = -1;
|
||||
CARD32 DPMSOffTime = -1;
|
||||
Bool DPMSEnabled;
|
||||
|
||||
static int DPMSReqCode = 0;
|
||||
static RESTYPE ClientType, DPMSEventType; /* resource types for event masks */
|
||||
static XID eventResource;
|
||||
|
||||
typedef struct _DPMSEvent *DPMSEventPtr;
|
||||
typedef struct _DPMSEvent {
|
||||
DPMSEventPtr next;
|
||||
ClientPtr client;
|
||||
XID clientResource;
|
||||
unsigned int mask;
|
||||
} DPMSEventRec;
|
||||
|
||||
/*ARGSUSED*/ static int
|
||||
DPMSFreeClient(void *data, XID id)
|
||||
{
|
||||
DPMSEventPtr pEvent;
|
||||
DPMSEventPtr *pHead, pCur, pPrev;
|
||||
|
||||
pEvent = (DPMSEventPtr) data;
|
||||
dixLookupResourceByType((void *) &pHead, eventResource, DPMSEventType,
|
||||
NullClient, DixUnknownAccess);
|
||||
if (pHead) {
|
||||
pPrev = 0;
|
||||
for (pCur = *pHead; pCur && pCur != pEvent; pCur = pCur->next)
|
||||
pPrev = pCur;
|
||||
if (pCur) {
|
||||
if (pPrev)
|
||||
pPrev->next = pEvent->next;
|
||||
else
|
||||
*pHead = pEvent->next;
|
||||
}
|
||||
}
|
||||
free((void *) pEvent);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/ static int
|
||||
DPMSFreeEvents(void *data, XID id)
|
||||
{
|
||||
DPMSEventPtr *pHead, pCur, pNext;
|
||||
|
||||
pHead = (DPMSEventPtr *) data;
|
||||
for (pCur = *pHead; pCur; pCur = pNext) {
|
||||
pNext = pCur->next;
|
||||
FreeResource(pCur->clientResource, ClientType);
|
||||
free((void *) pCur);
|
||||
}
|
||||
free((void *) pHead);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
SDPMSInfoNotifyEvent(xGenericEvent * from,
|
||||
xGenericEvent * to)
|
||||
{
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber);
|
||||
swapl(&to->length);
|
||||
swaps(&to->evtype);
|
||||
if (from->evtype == DPMSInfoNotify) {
|
||||
xDPMSInfoNotifyEvent *c = (xDPMSInfoNotifyEvent *) to;
|
||||
swapl(&c->timestamp);
|
||||
swaps(&c->power_level);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
ProcDPMSSelectInput(register ClientPtr client)
|
||||
{
|
||||
REQUEST(xDPMSSelectInputReq);
|
||||
DPMSEventPtr pEvent, pNewEvent, *pHead;
|
||||
XID clientResource;
|
||||
int i;
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSSelectInputReq);
|
||||
i = dixLookupResourceByType((void **)&pHead, eventResource, DPMSEventType,
|
||||
client,
|
||||
DixWriteAccess);
|
||||
if (stuff->eventMask == DPMSInfoNotifyMask) {
|
||||
if (i == Success && pHead) {
|
||||
/* check for existing entry. */
|
||||
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
|
||||
if (pEvent->client == client) {
|
||||
pEvent->mask = stuff->eventMask;
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* build the entry */
|
||||
pNewEvent = (DPMSEventPtr)malloc(sizeof(DPMSEventRec));
|
||||
if (!pNewEvent)
|
||||
return BadAlloc;
|
||||
pNewEvent->next = 0;
|
||||
pNewEvent->client = client;
|
||||
pNewEvent->mask = stuff->eventMask;
|
||||
/*
|
||||
* add a resource that will be deleted when
|
||||
* the client goes away
|
||||
*/
|
||||
clientResource = FakeClientID(client->index);
|
||||
pNewEvent->clientResource = clientResource;
|
||||
if (!AddResource(clientResource, ClientType, (void *)pNewEvent))
|
||||
return BadAlloc;
|
||||
/*
|
||||
* create a resource to contain a pointer to the list
|
||||
* of clients selecting input
|
||||
*/
|
||||
if (i != Success || !pHead) {
|
||||
pHead = (DPMSEventPtr *)malloc(sizeof(DPMSEventPtr));
|
||||
if (!pHead ||
|
||||
!AddResource(eventResource, DPMSEventType, (void *)pHead)) {
|
||||
FreeResource(clientResource, X11_RESTYPE_NONE);
|
||||
return BadAlloc;
|
||||
}
|
||||
*pHead = 0;
|
||||
}
|
||||
pNewEvent->next = *pHead;
|
||||
*pHead = pNewEvent;
|
||||
}
|
||||
else if (stuff->eventMask == 0) {
|
||||
/* delete the interest */
|
||||
if (i == Success && pHead) {
|
||||
pNewEvent = 0;
|
||||
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
|
||||
if (pEvent->client == client)
|
||||
break;
|
||||
pNewEvent = pEvent;
|
||||
}
|
||||
if (pEvent) {
|
||||
FreeResource(pEvent->clientResource, ClientType);
|
||||
if (pNewEvent)
|
||||
pNewEvent->next = pEvent->next;
|
||||
else
|
||||
*pHead = pEvent->next;
|
||||
free(pEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
client->errorValue = stuff->eventMask;
|
||||
return BadValue;
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
static void
|
||||
SendDPMSInfoNotify(void)
|
||||
{
|
||||
DPMSEventPtr *pHead, pEvent;
|
||||
xDPMSInfoNotifyEvent se;
|
||||
int i;
|
||||
|
||||
i = dixLookupResourceByType((void **)&pHead, eventResource, DPMSEventType,
|
||||
serverClient,
|
||||
DixReadAccess);
|
||||
if (i != Success || !pHead)
|
||||
return;
|
||||
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
|
||||
if ((pEvent->mask & DPMSInfoNotifyMask) == 0)
|
||||
continue;
|
||||
se.type = GenericEvent;
|
||||
se.extension = DPMSReqCode;
|
||||
se.length = (sizeof(xDPMSInfoNotifyEvent) - 32) >> 2;
|
||||
se.evtype = DPMSInfoNotify;
|
||||
se.timestamp = currentTime.milliseconds;
|
||||
se.power_level = DPMSPowerLevel;
|
||||
se.state = DPMSEnabled;
|
||||
WriteEventsToClient(pEvent->client, 1, (xEvent *)&se);
|
||||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
DPMSSupported(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* For each screen, check if DPMS is supported */
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
if (screenInfo.screens[i]->DPMS != NULL)
|
||||
return TRUE;
|
||||
|
||||
for (i = 0; i < screenInfo.numGPUScreens; i++)
|
||||
if (screenInfo.gpuscreens[i]->DPMS != NULL)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
isUnblank(int mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case SCREEN_SAVER_OFF:
|
||||
case SCREEN_SAVER_FORCER:
|
||||
return TRUE;
|
||||
case SCREEN_SAVER_ON:
|
||||
case SCREEN_SAVER_CYCLE:
|
||||
return FALSE;
|
||||
default:
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
DPMSSet(ClientPtr client, int level)
|
||||
{
|
||||
int rc, i;
|
||||
int old_level = DPMSPowerLevel;
|
||||
|
||||
DPMSPowerLevel = level;
|
||||
|
||||
if (level != DPMSModeOn) {
|
||||
if (isUnblank(screenIsSaved)) {
|
||||
rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
} else if (!isUnblank(screenIsSaved)) {
|
||||
rc = dixSaveScreens(client, SCREEN_SAVER_OFF, ScreenSaverReset);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
if (screenInfo.screens[i]->DPMS != NULL)
|
||||
screenInfo.screens[i]->DPMS(screenInfo.screens[i], level);
|
||||
|
||||
for (i = 0; i < screenInfo.numGPUScreens; i++)
|
||||
if (screenInfo.gpuscreens[i]->DPMS != NULL)
|
||||
screenInfo.gpuscreens[i]->DPMS(screenInfo.gpuscreens[i], level);
|
||||
|
||||
if (DPMSPowerLevel != old_level)
|
||||
SendDPMSInfoNotify();
|
||||
|
||||
return Success;
|
||||
}
|
||||
#include "extinit.h"
|
||||
|
||||
static int
|
||||
ProcDPMSGetVersion(ClientPtr client)
|
||||
|
|
@ -299,8 +49,8 @@ ProcDPMSGetVersion(ClientPtr client)
|
|||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.majorVersion = SERVER_DPMS_MAJOR_VERSION,
|
||||
.minorVersion = SERVER_DPMS_MINOR_VERSION
|
||||
.majorVersion = DPMSMajorVersion,
|
||||
.minorVersion = DPMSMinorVersion
|
||||
};
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
|
||||
|
|
@ -322,7 +72,7 @@ ProcDPMSCapable(ClientPtr client)
|
|||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.capable = TRUE
|
||||
.capable = DPMSCapableFlag
|
||||
};
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSCapableReq);
|
||||
|
|
@ -390,10 +140,10 @@ ProcDPMSEnable(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xDPMSEnableReq);
|
||||
|
||||
DPMSEnabled = TRUE;
|
||||
if (!was_enabled) {
|
||||
SetScreenSaverTimer();
|
||||
SendDPMSInfoNotify();
|
||||
if (DPMSCapableFlag) {
|
||||
DPMSEnabled = TRUE;
|
||||
if (!was_enabled)
|
||||
SetScreenSaverTimer();
|
||||
}
|
||||
|
||||
return Success;
|
||||
|
|
@ -402,8 +152,6 @@ ProcDPMSEnable(ClientPtr client)
|
|||
static int
|
||||
ProcDPMSDisable(ClientPtr client)
|
||||
{
|
||||
Bool was_enabled = DPMSEnabled;
|
||||
|
||||
/* REQUEST(xDPMSDisableReq); */
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSDisableReq);
|
||||
|
|
@ -411,8 +159,6 @@ ProcDPMSDisable(ClientPtr client)
|
|||
DPMSSet(client, DPMSModeOn);
|
||||
|
||||
DPMSEnabled = FALSE;
|
||||
if (was_enabled)
|
||||
SendDPMSInfoNotify();
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -483,27 +229,51 @@ ProcDPMSDispatch(ClientPtr client)
|
|||
return ProcDPMSForceLevel(client);
|
||||
case X_DPMSInfo:
|
||||
return ProcDPMSInfo(client);
|
||||
case X_DPMSSelectInput:
|
||||
return ProcDPMSSelectInput(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcDPMSGetVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDPMSGetVersionReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
|
||||
swaps(&stuff->majorVersion);
|
||||
swaps(&stuff->minorVersion);
|
||||
return ProcDPMSGetVersion(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcDPMSCapable(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDPMSCapableReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xDPMSCapableReq);
|
||||
|
||||
return ProcDPMSCapable(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDPMSGetTimeouts(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDPMSGetTimeoutsReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
|
||||
|
||||
return ProcDPMSGetTimeouts(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDPMSSetTimeouts(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDPMSSetTimeoutsReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
|
||||
|
||||
swaps(&stuff->standby);
|
||||
|
|
@ -512,10 +282,34 @@ SProcDPMSSetTimeouts(ClientPtr client)
|
|||
return ProcDPMSSetTimeouts(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcDPMSEnable(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDPMSEnableReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xDPMSEnableReq);
|
||||
|
||||
return ProcDPMSEnable(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDPMSDisable(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDPMSDisableReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xDPMSDisableReq);
|
||||
|
||||
return ProcDPMSDisable(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcDPMSForceLevel(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDPMSForceLevelReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
|
||||
|
||||
swaps(&stuff->level);
|
||||
|
|
@ -523,18 +317,18 @@ SProcDPMSForceLevel(ClientPtr client)
|
|||
return ProcDPMSForceLevel(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
SProcDPMSSelectInput(ClientPtr client)
|
||||
static int
|
||||
SProcDPMSInfo(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDPMSSelectInputReq);
|
||||
REQUEST_SIZE_MATCH(xDPMSSelectInputReq);
|
||||
swapl(&stuff->eventMask);
|
||||
return ProcDPMSSelectInput(client);
|
||||
REQUEST(xDPMSInfoReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xDPMSInfoReq);
|
||||
|
||||
return ProcDPMSInfo(client);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcDPMSDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
|
@ -542,58 +336,28 @@ SProcDPMSDispatch(ClientPtr client)
|
|||
case X_DPMSGetVersion:
|
||||
return SProcDPMSGetVersion(client);
|
||||
case X_DPMSCapable:
|
||||
return ProcDPMSCapable(client);
|
||||
return SProcDPMSCapable(client);
|
||||
case X_DPMSGetTimeouts:
|
||||
return ProcDPMSGetTimeouts(client);
|
||||
return SProcDPMSGetTimeouts(client);
|
||||
case X_DPMSSetTimeouts:
|
||||
return SProcDPMSSetTimeouts(client);
|
||||
case X_DPMSEnable:
|
||||
return ProcDPMSEnable(client);
|
||||
return SProcDPMSEnable(client);
|
||||
case X_DPMSDisable:
|
||||
return ProcDPMSDisable(client);
|
||||
return SProcDPMSDisable(client);
|
||||
case X_DPMSForceLevel:
|
||||
return SProcDPMSForceLevel(client);
|
||||
case X_DPMSInfo:
|
||||
return ProcDPMSInfo(client);
|
||||
case X_DPMSSelectInput:
|
||||
return SProcDPMSSelectInput(client);
|
||||
return SProcDPMSInfo(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
DPMSCloseDownExtension(ExtensionEntry *e)
|
||||
{
|
||||
DPMSSet(serverClient, DPMSModeOn);
|
||||
}
|
||||
|
||||
void
|
||||
DPMSExtensionInit(void)
|
||||
{
|
||||
ExtensionEntry *extEntry;
|
||||
|
||||
#define CONDITIONALLY_SET_DPMS_TIMEOUT(_timeout_value_) \
|
||||
if (_timeout_value_ == -1) { /* not yet set from config */ \
|
||||
_timeout_value_ = ScreenSaverTime; \
|
||||
}
|
||||
|
||||
CONDITIONALLY_SET_DPMS_TIMEOUT(DPMSStandbyTime)
|
||||
CONDITIONALLY_SET_DPMS_TIMEOUT(DPMSSuspendTime)
|
||||
CONDITIONALLY_SET_DPMS_TIMEOUT(DPMSOffTime)
|
||||
|
||||
DPMSPowerLevel = DPMSModeOn;
|
||||
DPMSEnabled = DPMSSupported();
|
||||
|
||||
ClientType = CreateNewResourceType(DPMSFreeClient, "DPMSClient");
|
||||
DPMSEventType = CreateNewResourceType(DPMSFreeEvents, "DPMSEvent");
|
||||
eventResource = FakeClientID(0);
|
||||
|
||||
if (DPMSEnabled && ClientType && DPMSEventType &&
|
||||
(extEntry = AddExtension(DPMSExtensionName, 0, 0,
|
||||
ProcDPMSDispatch, SProcDPMSDispatch,
|
||||
DPMSCloseDownExtension, StandardMinorOpcode))) {
|
||||
DPMSReqCode = extEntry->base;
|
||||
GERegisterExtension(DPMSReqCode, SDPMSInfoNotifyEvent);
|
||||
}
|
||||
AddExtension(DPMSExtensionName, 0, 0,
|
||||
ProcDPMSDispatch, SProcDPMSDispatch,
|
||||
NULL, StandardMinorOpcode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,14 +9,7 @@
|
|||
|
||||
#include "dixstruct.h"
|
||||
|
||||
extern int DPMSSet(ClientPtr client, int level);
|
||||
extern Bool DPMSSupported(void);
|
||||
|
||||
extern CARD32 DPMSStandbyTime;
|
||||
extern CARD32 DPMSSuspendTime;
|
||||
extern CARD32 DPMSOffTime;
|
||||
extern CARD16 DPMSPowerLevel;
|
||||
extern Bool DPMSEnabled;
|
||||
extern Bool DPMSDisabledSwitch;
|
||||
int _X_EXPORT DPMSSet(ClientPtr client, int level);
|
||||
Bool _X_EXPORT DPMSSupported(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
47
Xext/dpmsstubs.c
Normal file
47
Xext/dpmsstubs.c
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*****************************************************************
|
||||
|
||||
Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
|
||||
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Digital Equipment Corporation
|
||||
shall not be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Software without prior written authorization from Digital
|
||||
Equipment Corporation.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "dpmsproc.h"
|
||||
|
||||
#define FALSE 0
|
||||
|
||||
Bool
|
||||
DPMSSupported(void)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
DPMSSet(ClientPtr client, int level)
|
||||
{
|
||||
return Success;
|
||||
}
|
||||
110
Xext/geext.c
110
Xext/geext.c
|
|
@ -23,36 +23,31 @@
|
|||
* Author: Peter Hutterer, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
#include "windowstr.h"
|
||||
#include <X11/extensions/ge.h>
|
||||
|
||||
#include "geint.h"
|
||||
#include "geext.h"
|
||||
#include "protocol-versions.h"
|
||||
#include "extinit_priv.h"
|
||||
#include "extinit.h"
|
||||
|
||||
DevPrivateKeyRec GEClientPrivateKeyRec;
|
||||
|
||||
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
|
||||
GEExtension GEExtensions[MAXEXTENSIONS];
|
||||
|
||||
/** Struct to keep information about registered extensions */
|
||||
typedef struct _GEExtension {
|
||||
/** Event swapping routine */
|
||||
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
|
||||
} GEExtension, *GEExtensionPtr;
|
||||
|
||||
static GEExtension GEExtensions[MAXEXTENSIONS];
|
||||
|
||||
typedef struct _GEClientInfo {
|
||||
CARD32 major_version;
|
||||
CARD32 minor_version;
|
||||
} GEClientInfoRec, *GEClientInfoPtr;
|
||||
|
||||
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
|
||||
/* Major available requests */
|
||||
static const int version_requests[] = {
|
||||
X_GEQueryVersion, /* before client sends QueryVersion */
|
||||
X_GEQueryVersion, /* must be set to last request in version 1 */
|
||||
};
|
||||
|
||||
/* Forward declarations */
|
||||
static void SGEGenericEvent(xEvent *from, xEvent *to);
|
||||
|
||||
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
|
||||
#define EXT_MASK(ext) ((ext) & 0x7F)
|
||||
|
||||
/************************************************************/
|
||||
|
|
@ -95,19 +90,29 @@ ProcGEQueryVersion(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
|
||||
/* Version 1.0 */
|
||||
ProcGEQueryVersion};
|
||||
|
||||
/************************************************************/
|
||||
/* swapped request handlers */
|
||||
/************************************************************/
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcGEQueryVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGEQueryVersionReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
|
||||
swaps(&stuff->majorVersion);
|
||||
swaps(&stuff->minorVersion);
|
||||
return ProcGEQueryVersion(client);
|
||||
return (*ProcGEVector[stuff->ReqType]) (client);
|
||||
}
|
||||
|
||||
int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
|
||||
/* Version 1.0 */
|
||||
SProcGEQueryVersion};
|
||||
|
||||
/************************************************************/
|
||||
/* callbacks */
|
||||
/************************************************************/
|
||||
|
|
@ -116,35 +121,50 @@ SProcGEQueryVersion(ClientPtr client)
|
|||
static int
|
||||
ProcGEDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
GEClientInfoPtr pGEClient = GEGetClient(client);
|
||||
|
||||
switch (stuff->data) {
|
||||
case X_GEQueryVersion:
|
||||
return ProcGEQueryVersion(client);
|
||||
default:
|
||||
REQUEST(xGEReq);
|
||||
|
||||
if (pGEClient->major_version >= NUM_VERSION_REQUESTS)
|
||||
return BadRequest;
|
||||
}
|
||||
if (stuff->ReqType > version_requests[pGEClient->major_version])
|
||||
return BadRequest;
|
||||
|
||||
return (ProcGEVector[stuff->ReqType]) (client);
|
||||
}
|
||||
|
||||
/* dispatch swapped requests */
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcGEDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
swaps(&stuff->length);
|
||||
|
||||
switch (stuff->data) {
|
||||
case X_GEQueryVersion:
|
||||
return SProcGEQueryVersion(client);
|
||||
default:
|
||||
REQUEST(xGEReq);
|
||||
if (stuff->ReqType >= GENumberRequests)
|
||||
return BadRequest;
|
||||
}
|
||||
return (*SProcGEVector[stuff->ReqType]) (client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a new client inits a connection to the X server.
|
||||
*
|
||||
* We alloc a simple struct to store the client's major/minor version. Can be
|
||||
* used in the furture for versioning support.
|
||||
*/
|
||||
static void
|
||||
GEClientCallback(CallbackListPtr *list, void *closure, void *data)
|
||||
{
|
||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
||||
ClientPtr pClient = clientinfo->client;
|
||||
GEClientInfoPtr pGEClient = GEGetClient(pClient);
|
||||
|
||||
pGEClient->major_version = 0;
|
||||
pGEClient->minor_version = 0;
|
||||
}
|
||||
|
||||
/* Reset extension. Called on server shutdown. */
|
||||
static void
|
||||
GEResetProc(ExtensionEntry * extEntry)
|
||||
{
|
||||
DeleteCallback(&ClientStateCallback, GEClientCallback, 0);
|
||||
EventSwapVector[GenericEvent] = NotImplemented;
|
||||
}
|
||||
|
||||
|
|
@ -155,7 +175,7 @@ GEResetProc(ExtensionEntry * extEntry)
|
|||
* written on the wire, this one calls the registered swap function to do the
|
||||
* work.
|
||||
*/
|
||||
static void _X_COLD
|
||||
static void
|
||||
SGEGenericEvent(xEvent *from, xEvent *to)
|
||||
{
|
||||
xGenericEvent *gefrom = (xGenericEvent *) from;
|
||||
|
|
@ -177,16 +197,28 @@ SGEGenericEvent(xEvent *from, xEvent *to)
|
|||
void
|
||||
GEExtensionInit(void)
|
||||
{
|
||||
ExtensionEntry *extEntry;
|
||||
|
||||
if (!dixRegisterPrivateKey
|
||||
(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
|
||||
FatalError("GEExtensionInit: GE private request failed.\n");
|
||||
|
||||
if (!AddExtension(GE_NAME, 0, GENumberErrors, ProcGEDispatch, SProcGEDispatch,
|
||||
GEResetProc, StandardMinorOpcode))
|
||||
FatalError("GEInit: AddExtensions failed.\n");
|
||||
if (!AddCallback(&ClientStateCallback, GEClientCallback, 0)) {
|
||||
FatalError("GEExtensionInit: register client callback failed.\n");
|
||||
}
|
||||
|
||||
if ((extEntry = AddExtension(GE_NAME,
|
||||
0, GENumberErrors,
|
||||
ProcGEDispatch, SProcGEDispatch,
|
||||
GEResetProc, StandardMinorOpcode)) != 0) {
|
||||
memset(GEExtensions, 0, sizeof(GEExtensions));
|
||||
|
||||
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
|
||||
}
|
||||
else {
|
||||
FatalError("GEInit: AddExtensions failed.\n");
|
||||
}
|
||||
|
||||
memset(GEExtensions, 0, sizeof(GEExtensions));
|
||||
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
|
||||
}
|
||||
|
||||
/************************************************************/
|
||||
|
|
|
|||
42
Xext/geext.h
42
Xext/geext.h
|
|
@ -25,12 +25,50 @@ other dealings in this Software without prior written authorization
|
|||
from the author.
|
||||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef _GEEXT_H_
|
||||
#define _GEEXT_H_
|
||||
|
||||
#include <X11/Xfuncproto.h>
|
||||
#include <X11/extensions/geproto.h>
|
||||
|
||||
/** Struct to keep information about registered extensions */
|
||||
typedef struct _GEExtension {
|
||||
/** Event swapping routine */
|
||||
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
|
||||
} GEExtension, *GEExtensionPtr;
|
||||
|
||||
/* All registered extensions and their handling functions. */
|
||||
extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
|
||||
|
||||
/* Typecast to generic event */
|
||||
#define GEV(ev) ((xGenericEvent*)(ev))
|
||||
/* Returns the extension offset from the event */
|
||||
#define GEEXT(ev) (GEV(ev)->extension)
|
||||
|
||||
/* Return zero-based extension offset (offset - 128). Only for use in arrays */
|
||||
#define GEEXTIDX(ev) (GEEXT(ev) & 0x7F)
|
||||
/* True if mask is set for extension on window */
|
||||
#define GEMaskIsSet(pWin, extension, mask) \
|
||||
((pWin)->optional && \
|
||||
(pWin)->optional->geMasks && \
|
||||
((pWin)->optional->geMasks->eventMasks[(extension) & 0x7F] & (mask)))
|
||||
|
||||
/* Returns first client */
|
||||
#define GECLIENT(pWin) \
|
||||
(((pWin)->optional) ? (pWin)->optional->geMasks->geClients : NULL)
|
||||
|
||||
/* Returns the event_fill for the given event */
|
||||
#define GEEventFill(ev) \
|
||||
GEExtensions[GEEXTIDX(ev)].evfill
|
||||
|
||||
#define GEIsType(ev, ext, ev_type) \
|
||||
((GEV(ev)->type == GenericEvent) && \
|
||||
GEEXT(ev) == (ext) && \
|
||||
GEV(ev)->evtype == (ev_type))
|
||||
|
||||
/* Interface for other extensions */
|
||||
extern _X_EXPORT void GERegisterExtension(int extension,
|
||||
void (*ev_dispatch) (xGenericEvent
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates.
|
||||
* Copyright 2007-2008 Peter Hutterer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -19,23 +19,36 @@
|
|||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Author: Peter Hutterer, University of South Australia, NICTA
|
||||
*/
|
||||
|
||||
#ifndef XORG_PROBES_H
|
||||
#define XORG_PROBES_H
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
/* definitions needed to include Dtrace probes in a source file */
|
||||
#ifndef _GEINT_H_
|
||||
#define _GEINT_H_
|
||||
|
||||
#ifdef XSERVER_DTRACE
|
||||
#include <sys/types.h>
|
||||
typedef const char *string;
|
||||
typedef const uint8_t *const_uint8_p;
|
||||
typedef const double *const_double_p;
|
||||
#include "Xserver-dtrace.h"
|
||||
#endif
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include <X11/extensions/geproto.h>
|
||||
|
||||
#endif /* XORG_PROBES_H */
|
||||
extern _X_EXPORT DevPrivateKeyRec GEClientPrivateKeyRec;
|
||||
|
||||
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
|
||||
|
||||
typedef struct _GEClientInfo {
|
||||
CARD32 major_version;
|
||||
CARD32 minor_version;
|
||||
} GEClientInfoRec, *GEClientInfoPtr;
|
||||
|
||||
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
|
||||
|
||||
extern _X_EXPORT int (*ProcGEVector[ /*GENumRequests */ ]) (ClientPtr);
|
||||
extern _X_EXPORT int (*SProcGEVector[ /*GENumRequests */ ]) (ClientPtr);
|
||||
|
||||
#endif /* _GEINT_H_ */
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "misc.h"
|
||||
|
|
@ -52,7 +54,7 @@ ht_create(int keySize,
|
|||
ht->elements = 0;
|
||||
ht->bucketBits = INITHASHSIZE;
|
||||
numBuckets = 1 << ht->bucketBits;
|
||||
ht->buckets = xallocarray(numBuckets, sizeof(*ht->buckets));
|
||||
ht->buckets = malloc(numBuckets * sizeof(*ht->buckets));
|
||||
ht->cdata = cdata;
|
||||
|
||||
if (ht->buckets) {
|
||||
|
|
@ -75,13 +77,10 @@ ht_destroy(HashTable ht)
|
|||
for (c = 0; c < numBuckets; ++c) {
|
||||
xorg_list_for_each_entry_safe(it, tmp, &ht->buckets[c], l) {
|
||||
xorg_list_del(&it->l);
|
||||
free(it->key);
|
||||
free(it->data);
|
||||
free(it);
|
||||
}
|
||||
}
|
||||
free(ht->buckets);
|
||||
free(ht);
|
||||
}
|
||||
|
||||
static Bool
|
||||
|
|
@ -93,7 +92,7 @@ double_size(HashTable ht)
|
|||
int newNumBuckets = 1 << newBucketBits;
|
||||
int c;
|
||||
|
||||
newBuckets = xallocarray(newNumBuckets, sizeof(*ht->buckets));
|
||||
newBuckets = malloc(newNumBuckets * sizeof(*ht->buckets));
|
||||
if (newBuckets) {
|
||||
for (c = 0; c < newNumBuckets; ++c) {
|
||||
xorg_list_init(&newBuckets[c]);
|
||||
|
|
@ -238,7 +237,7 @@ unsigned
|
|||
ht_generic_hash(void *cdata, const void *ptr, int numBits)
|
||||
{
|
||||
HtGenericHashSetupPtr setup = cdata;
|
||||
return one_at_a_time_hash(ptr, setup->keySize) & ~((~0U) << numBits);
|
||||
return one_at_a_time_hash(ptr, setup->keySize) & ~((~0) << numBits);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ typedef struct {
|
|||
int keySize;
|
||||
} HtGenericHashSetupRec, *HtGenericHashSetupPtr;
|
||||
|
||||
/** @brief ht_create initializes a hash table for a certain hash table
|
||||
/** @brief ht_create initalizes a hash table for a certain hash table
|
||||
configuration
|
||||
|
||||
@param[out] ht The hash table structure to initialize
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
srcs_xext = [
|
||||
'bigreq.c',
|
||||
'geext.c',
|
||||
'shape.c',
|
||||
'sleepuntil.c',
|
||||
'sync.c',
|
||||
'xcmisc.c',
|
||||
'xtest.c',
|
||||
]
|
||||
|
||||
hdrs_xext = [
|
||||
'geext.h',
|
||||
'syncsdk.h',
|
||||
]
|
||||
|
||||
if build_dpms
|
||||
srcs_xext += 'dpms.c'
|
||||
endif
|
||||
|
||||
if build_mitshm
|
||||
srcs_xext += 'shm.c'
|
||||
hdrs_xext += ['shmint.h']
|
||||
endif
|
||||
|
||||
if build_hashtable
|
||||
srcs_xext += 'hashtable.c'
|
||||
endif
|
||||
|
||||
if build_res
|
||||
srcs_xext += 'xres.c'
|
||||
endif
|
||||
|
||||
if build_screensaver
|
||||
srcs_xext += 'saver.c'
|
||||
endif
|
||||
|
||||
if build_xace
|
||||
srcs_xext += 'xace.c'
|
||||
endif
|
||||
|
||||
if build_xf86bigfont
|
||||
srcs_xext += 'xf86bigfont.c'
|
||||
endif
|
||||
|
||||
if build_xinerama
|
||||
srcs_xext += ['panoramiX.c', 'panoramiXprocs.c', 'panoramiXSwap.c']
|
||||
hdrs_xext += ['panoramiX.h', 'panoramiXsrv.h']
|
||||
endif
|
||||
|
||||
if build_xsecurity
|
||||
srcs_xext += ['security.c']
|
||||
endif
|
||||
|
||||
if build_xselinux
|
||||
srcs_xext += ['xselinux_ext.c', 'xselinux_hooks.c', 'xselinux_label.c']
|
||||
endif
|
||||
|
||||
if build_xv
|
||||
srcs_xext += ['xvmain.c', 'xvdisp.c', 'xvmc.c']
|
||||
hdrs_xext += ['xvdix.h', 'xvmcext.h']
|
||||
endif
|
||||
|
||||
libxserver_xext = static_library('libxserver_xext',
|
||||
srcs_xext,
|
||||
include_directories: inc,
|
||||
dependencies: common_dep,
|
||||
)
|
||||
|
||||
libxserver_xext_vidmode = static_library('libxserver_xext_vidmode',
|
||||
'vidmode.c',
|
||||
include_directories: inc,
|
||||
dependencies: common_dep,
|
||||
)
|
||||
|
||||
if build_xorg
|
||||
install_data(hdrs_xext, install_dir: xorgsdkdir)
|
||||
endif
|
||||
|
|
@ -23,16 +23,18 @@ dealings in this Software without prior written authorization from Digital
|
|||
Equipment Corporation.
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DMX_CONFIG_H
|
||||
#include <dmx-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/Xarch.h>
|
||||
#include <X11/extensions/panoramiXproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
|
||||
#include "misc.h"
|
||||
#include "cursor.h"
|
||||
#include "cursorstr.h"
|
||||
|
|
@ -45,17 +47,18 @@ Equipment Corporation.
|
|||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "panoramiX.h"
|
||||
#include <X11/extensions/panoramiXproto.h>
|
||||
#include "panoramiXsrv.h"
|
||||
#include "globals.h"
|
||||
#include "servermd.h"
|
||||
#include "resource.h"
|
||||
#include "picturestr_priv.h"
|
||||
#include "picturestr.h"
|
||||
#include "xfixesint.h"
|
||||
#include "damageextint.h"
|
||||
#ifdef COMPOSITE
|
||||
#include "compint.h"
|
||||
#endif
|
||||
#include "extinit_priv.h"
|
||||
#include "extinit.h"
|
||||
#include "protocol-versions.h"
|
||||
|
||||
#ifdef GLXPROXY
|
||||
|
|
@ -424,7 +427,7 @@ XineramaReinitData(void)
|
|||
|
||||
/*
|
||||
* PanoramiXExtensionInit():
|
||||
* Called from InitExtensions in main().
|
||||
* Called from InitExtensions in main().
|
||||
* Register PanoramiXeen Extension
|
||||
* Initialize global variables.
|
||||
*/
|
||||
|
|
@ -744,11 +747,15 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth)
|
|||
|
||||
j = PanoramiXNumDepths;
|
||||
PanoramiXNumDepths++;
|
||||
PanoramiXDepths = XNFreallocarray(PanoramiXDepths,
|
||||
PanoramiXNumDepths, sizeof(DepthRec));
|
||||
PanoramiXDepths = realloc(PanoramiXDepths,
|
||||
PanoramiXNumDepths * sizeof(DepthRec));
|
||||
PanoramiXDepths[j].depth = pDepth->depth;
|
||||
PanoramiXDepths[j].numVids = 0;
|
||||
PanoramiXDepths[j].vids = NULL;
|
||||
/* XXX suboptimal, should grow these dynamically */
|
||||
if (pDepth->numVids)
|
||||
PanoramiXDepths[j].vids = malloc(sizeof(VisualID) * pDepth->numVids);
|
||||
else
|
||||
PanoramiXDepths[j].vids = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -782,16 +789,13 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual)
|
|||
/* found a matching visual on all screens, add it to the subset list */
|
||||
j = PanoramiXNumVisuals;
|
||||
PanoramiXNumVisuals++;
|
||||
PanoramiXVisuals = reallocarray(PanoramiXVisuals,
|
||||
PanoramiXNumVisuals, sizeof(VisualRec));
|
||||
PanoramiXVisuals = realloc(PanoramiXVisuals,
|
||||
PanoramiXNumVisuals * sizeof(VisualRec));
|
||||
|
||||
memcpy(&PanoramiXVisuals[j], pVisual, sizeof(VisualRec));
|
||||
|
||||
for (k = 0; k < PanoramiXNumDepths; k++) {
|
||||
if (PanoramiXDepths[k].depth == pVisual->nplanes) {
|
||||
PanoramiXDepths[k].vids = reallocarray(PanoramiXDepths[k].vids,
|
||||
PanoramiXDepths[k].numVids + 1,
|
||||
sizeof(VisualID));
|
||||
PanoramiXDepths[k].vids[PanoramiXDepths[k].numVids] = pVisual->vid;
|
||||
PanoramiXDepths[k].numVids++;
|
||||
break;
|
||||
|
|
@ -817,11 +821,11 @@ PanoramiXConsolidate(void)
|
|||
for (i = 0; i < pScreen->numVisuals; i++)
|
||||
PanoramiXMaybeAddVisual(pVisual++);
|
||||
|
||||
root = XNFcallocarray(1, sizeof(PanoramiXRes));
|
||||
root = malloc(sizeof(PanoramiXRes));
|
||||
root->type = XRT_WINDOW;
|
||||
defmap = XNFcallocarray(1, sizeof(PanoramiXRes));
|
||||
defmap = malloc(sizeof(PanoramiXRes));
|
||||
defmap->type = XRT_COLORMAP;
|
||||
saver = XNFcallocarray(1, sizeof(PanoramiXRes));
|
||||
saver = malloc(sizeof(PanoramiXRes));
|
||||
saver->type = XRT_WINDOW;
|
||||
|
||||
FOR_NSCREENS(i) {
|
||||
|
|
@ -984,11 +988,10 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
|
|||
xPanoramiXGetScreenSizeReply rep;
|
||||
int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
|
||||
|
||||
if (stuff->screen >= PanoramiXNumScreens)
|
||||
return BadMatch;
|
||||
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ Equipment Corporation.
|
|||
|
||||
/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
|
||||
|
||||
/*
|
||||
/*
|
||||
* PanoramiX definitions
|
||||
*/
|
||||
|
||||
|
|
@ -39,8 +39,9 @@ Equipment Corporation.
|
|||
#ifndef _PANORAMIX_H_
|
||||
#define _PANORAMIX_H_
|
||||
|
||||
#define _PANORAMIX_SERVER
|
||||
#include <X11/extensions/panoramiXproto.h>
|
||||
|
||||
#undef _PANORAMIX_SERVER
|
||||
#include "gcstruct.h"
|
||||
#include "dixstruct.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@ dealings in this Software without prior written authorization from Digital
|
|||
Equipment Corporation.
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <X11/X.h>
|
||||
|
|
@ -45,41 +47,77 @@ Equipment Corporation.
|
|||
#include "globals.h"
|
||||
#include "panoramiXh.h"
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcPanoramiXQueryVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xPanoramiXQueryVersionReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
|
||||
return ProcPanoramiXQueryVersion(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcPanoramiXGetState(ClientPtr client)
|
||||
{
|
||||
REQUEST(xPanoramiXGetStateReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
|
||||
swapl(&stuff->window);
|
||||
return ProcPanoramiXGetState(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcPanoramiXGetScreenCount(ClientPtr client)
|
||||
{
|
||||
REQUEST(xPanoramiXGetScreenCountReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
|
||||
swapl(&stuff->window);
|
||||
return ProcPanoramiXGetScreenCount(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcPanoramiXGetScreenSize(ClientPtr client)
|
||||
{
|
||||
REQUEST(xPanoramiXGetScreenSizeReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
|
||||
swapl(&stuff->window);
|
||||
swapl(&stuff->screen);
|
||||
return ProcPanoramiXGetScreenSize(client);
|
||||
}
|
||||
|
||||
int _X_COLD
|
||||
static int
|
||||
SProcXineramaIsActive(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXineramaIsActiveReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
|
||||
return ProcXineramaIsActive(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXineramaQueryScreens(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXineramaQueryScreensReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
|
||||
return ProcXineramaQueryScreens(client);
|
||||
}
|
||||
|
||||
int
|
||||
SProcPanoramiXDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data) {
|
||||
case X_PanoramiXQueryVersion:
|
||||
return ProcPanoramiXQueryVersion(client);
|
||||
return SProcPanoramiXQueryVersion(client);
|
||||
case X_PanoramiXGetState:
|
||||
return SProcPanoramiXGetState(client);
|
||||
case X_PanoramiXGetScreenCount:
|
||||
|
|
@ -87,9 +125,9 @@ SProcPanoramiXDispatch(ClientPtr client)
|
|||
case X_PanoramiXGetScreenSize:
|
||||
return SProcPanoramiXGetScreenSize(client);
|
||||
case X_XineramaIsActive:
|
||||
return ProcXineramaIsActive(client);
|
||||
return SProcXineramaIsActive(client);
|
||||
case X_XineramaQueryScreens:
|
||||
return ProcXineramaQueryScreens(client);
|
||||
return SProcXineramaQueryScreens(client);
|
||||
}
|
||||
return BadRequest;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,15 +25,13 @@ Equipment Corporation.
|
|||
|
||||
/* Massively rewritten by Mark Vojkovich <markv@valinux.com> */
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "os/osdep.h"
|
||||
|
||||
#include "windowstr.h"
|
||||
#include "dixfontstr.h"
|
||||
#include "gcstruct.h"
|
||||
|
|
@ -108,7 +106,7 @@ PanoramiXCreateWindow(ClientPtr client)
|
|||
if ((Mask) stuff->mask & CWColormap) {
|
||||
cmap_offset = Ones((Mask) stuff->mask & (CWColormap - 1));
|
||||
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
|
||||
if (tmp != CopyFromParent) {
|
||||
if ((tmp != CopyFromParent) && (tmp != None)) {
|
||||
result = dixLookupResourceByType((void **) &cmap, tmp,
|
||||
XRT_COLORMAP, client,
|
||||
DixReadAccess);
|
||||
|
|
@ -212,7 +210,7 @@ PanoramiXChangeWindowAttributes(ClientPtr client)
|
|||
if ((Mask) stuff->valueMask & CWColormap) {
|
||||
cmap_offset = Ones((Mask) stuff->valueMask & (CWColormap - 1));
|
||||
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
|
||||
if (tmp != CopyFromParent) {
|
||||
if ((tmp != CopyFromParent) && (tmp != None)) {
|
||||
result = dixLookupResourceByType((void **) &cmap, tmp,
|
||||
XRT_COLORMAP, client,
|
||||
DixReadAccess);
|
||||
|
|
@ -477,7 +475,7 @@ PanoramiXConfigureWindow(ClientPtr client)
|
|||
|
||||
/* because we need the parent */
|
||||
result = dixLookupResourceByType((void **) &pWin, stuff->window,
|
||||
X11_RESTYPE_WINDOW, client, DixWriteAccess);
|
||||
RT_WINDOW, client, DixWriteAccess);
|
||||
if (result != Success)
|
||||
return result;
|
||||
|
||||
|
|
@ -511,7 +509,7 @@ PanoramiXConfigureWindow(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
/* have to go forward or you get expose events before
|
||||
/* have to go forward or you get expose events before
|
||||
ConfigureNotify events */
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
stuff->window = win->info[j].id;
|
||||
|
|
@ -1039,7 +1037,7 @@ PanoramiXClearToBackground(ClientPtr client)
|
|||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
For Window to Pixmap copies you're screwed since each screen's
|
||||
pixmap will look like what it sees on its screen. Unless the
|
||||
screens overlap and the window lies on each, the two copies
|
||||
|
|
@ -1052,7 +1050,7 @@ PanoramiXClearToBackground(ClientPtr client)
|
|||
int
|
||||
PanoramiXCopyArea(ClientPtr client)
|
||||
{
|
||||
int j, result, srcx, srcy, dstx, dsty, width, height;
|
||||
int j, result, srcx, srcy, dstx, dsty;
|
||||
PanoramiXRes *gc, *src, *dst;
|
||||
Bool srcIsRoot = FALSE;
|
||||
Bool dstIsRoot = FALSE;
|
||||
|
|
@ -1093,8 +1091,6 @@ PanoramiXCopyArea(ClientPtr client)
|
|||
srcy = stuff->srcY;
|
||||
dstx = stuff->dstX;
|
||||
dsty = stuff->dstY;
|
||||
width = stuff->width;
|
||||
height = stuff->height;
|
||||
if ((dst->type == XRT_PIXMAP) && (src->type == XRT_WINDOW)) {
|
||||
DrawablePtr drawables[MAXSCREENS];
|
||||
DrawablePtr pDst;
|
||||
|
|
@ -1107,18 +1103,15 @@ PanoramiXCopyArea(ClientPtr client)
|
|||
DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
drawables[j]->pScreen->SourceValidate(drawables[j], 0, 0,
|
||||
drawables[j]->width,
|
||||
drawables[j]->height,
|
||||
IncludeInferiors);
|
||||
}
|
||||
|
||||
pitch = PixmapBytePad(width, drawables[0]->depth);
|
||||
if (!(data = calloc(height, pitch)))
|
||||
pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
|
||||
if (!(data = calloc(1, stuff->height * pitch)))
|
||||
return BadAlloc;
|
||||
|
||||
XineramaGetImageData(drawables, srcx, srcy, width, height, ZPixmap, ~0,
|
||||
data, pitch, srcIsRoot);
|
||||
XineramaGetImageData(drawables, srcx, srcy,
|
||||
stuff->width, stuff->height, ZPixmap, ~0, data,
|
||||
pitch, srcIsRoot);
|
||||
|
||||
FOR_NSCREENS_BACKWARD(j) {
|
||||
stuff->gc = gc->info[j].id;
|
||||
|
|
@ -1130,63 +1123,14 @@ PanoramiXCopyArea(ClientPtr client)
|
|||
}
|
||||
|
||||
(*pGC->ops->PutImage) (pDst, pGC, pDst->depth, dstx, dsty,
|
||||
width, height, 0, ZPixmap, data);
|
||||
stuff->width, stuff->height,
|
||||
0, ZPixmap, data);
|
||||
|
||||
if (dstShared)
|
||||
break;
|
||||
}
|
||||
|
||||
free(data);
|
||||
|
||||
if (pGC->graphicsExposures) {
|
||||
RegionRec rgn;
|
||||
int dx, dy;
|
||||
BoxRec sourceBox;
|
||||
|
||||
dx = drawables[0]->x;
|
||||
dy = drawables[0]->y;
|
||||
if (srcIsRoot) {
|
||||
dx += screenInfo.screens[0]->x;
|
||||
dy += screenInfo.screens[0]->y;
|
||||
}
|
||||
|
||||
sourceBox.x1 = min(srcx + dx, 0);
|
||||
sourceBox.y1 = min(srcy + dy, 0);
|
||||
sourceBox.x2 = max(sourceBox.x1 + width, 32767);
|
||||
sourceBox.y2 = max(sourceBox.y1 + height, 32767);
|
||||
|
||||
RegionInit(&rgn, &sourceBox, 1);
|
||||
|
||||
/* subtract the (screen-space) clips of the source drawables */
|
||||
FOR_NSCREENS(j) {
|
||||
ScreenPtr screen = screenInfo.screens[j];
|
||||
RegionPtr sd;
|
||||
|
||||
if (pGC->subWindowMode == IncludeInferiors)
|
||||
sd = NotClippedByChildren((WindowPtr)drawables[j]);
|
||||
else
|
||||
sd = &((WindowPtr)drawables[j])->clipList;
|
||||
|
||||
if (srcIsRoot)
|
||||
RegionTranslate(&rgn, -screen->x, -screen->y);
|
||||
|
||||
RegionSubtract(&rgn, &rgn, sd);
|
||||
|
||||
if (srcIsRoot)
|
||||
RegionTranslate(&rgn, screen->x, screen->y);
|
||||
|
||||
if (pGC->subWindowMode == IncludeInferiors)
|
||||
RegionDestroy(sd);
|
||||
}
|
||||
|
||||
/* -dx/-dy to get back to dest-relative, plus request offsets */
|
||||
RegionTranslate(&rgn, -dx + dstx, -dy + dsty);
|
||||
|
||||
/* intersect with gc clip; just one screen is fine because pixmap */
|
||||
RegionIntersect(&rgn, &rgn, pGC->pCompositeClip);
|
||||
|
||||
/* and expose */
|
||||
SendGraphicsExpose(client, &rgn, dst->info[0].id, X_CopyArea, 0);
|
||||
RegionUninit(&rgn);
|
||||
}
|
||||
}
|
||||
else {
|
||||
DrawablePtr pDst = NULL, pSrc = NULL;
|
||||
|
|
@ -1249,8 +1193,9 @@ PanoramiXCopyArea(ClientPtr client)
|
|||
Bool overlap;
|
||||
|
||||
RegionValidate(&totalReg, &overlap);
|
||||
SendGraphicsExpose(client, &totalReg, stuff->dstDrawable,
|
||||
X_CopyArea, 0);
|
||||
(*pDst->pScreen->SendGraphicsExpose) (client, &totalReg,
|
||||
stuff->dstDrawable,
|
||||
X_CopyArea, 0);
|
||||
RegionUninit(&totalReg);
|
||||
}
|
||||
}
|
||||
|
|
@ -1361,8 +1306,9 @@ PanoramiXCopyPlane(ClientPtr client)
|
|||
Bool overlap;
|
||||
|
||||
RegionValidate(&totalReg, &overlap);
|
||||
SendGraphicsExpose(client, &totalReg, stuff->dstDrawable,
|
||||
X_CopyPlane, 0);
|
||||
(*pdstDraw->pScreen->SendGraphicsExpose) (client, &totalReg,
|
||||
stuff->dstDrawable,
|
||||
X_CopyPlane, 0);
|
||||
RegionUninit(&totalReg);
|
||||
}
|
||||
|
||||
|
|
@ -1397,7 +1343,7 @@ PanoramiXPolyPoint(ClientPtr client)
|
|||
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
||||
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
|
||||
if (npoint > 0) {
|
||||
origPts = xallocarray(npoint, sizeof(xPoint));
|
||||
origPts = malloc(npoint * sizeof(xPoint));
|
||||
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
|
||||
|
|
@ -1462,7 +1408,7 @@ PanoramiXPolyLine(ClientPtr client)
|
|||
isRoot = IS_ROOT_DRAWABLE(draw);
|
||||
npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq));
|
||||
if (npoint > 0) {
|
||||
origPts = xallocarray(npoint, sizeof(xPoint));
|
||||
origPts = malloc(npoint * sizeof(xPoint));
|
||||
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
|
||||
|
|
@ -1531,7 +1477,7 @@ PanoramiXPolySegment(ClientPtr client)
|
|||
return BadLength;
|
||||
nsegs >>= 3;
|
||||
if (nsegs > 0) {
|
||||
origSegs = xallocarray(nsegs, sizeof(xSegment));
|
||||
origSegs = malloc(nsegs * sizeof(xSegment));
|
||||
memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
|
||||
|
|
@ -1599,7 +1545,7 @@ PanoramiXPolyRectangle(ClientPtr client)
|
|||
return BadLength;
|
||||
nrects >>= 3;
|
||||
if (nrects > 0) {
|
||||
origRecs = xallocarray(nrects, sizeof(xRectangle));
|
||||
origRecs = malloc(nrects * sizeof(xRectangle));
|
||||
memcpy((char *) origRecs, (char *) &stuff[1],
|
||||
nrects * sizeof(xRectangle));
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
|
|
@ -1666,7 +1612,7 @@ PanoramiXPolyArc(ClientPtr client)
|
|||
return BadLength;
|
||||
narcs /= sizeof(xArc);
|
||||
if (narcs > 0) {
|
||||
origArcs = xallocarray(narcs, sizeof(xArc));
|
||||
origArcs = malloc(narcs * sizeof(xArc));
|
||||
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
|
||||
|
|
@ -1728,7 +1674,7 @@ PanoramiXFillPoly(ClientPtr client)
|
|||
|
||||
count = bytes_to_int32((client->req_len << 2) - sizeof(xFillPolyReq));
|
||||
if (count > 0) {
|
||||
locPts = xallocarray(count, sizeof(DDXPointRec));
|
||||
locPts = malloc(count * sizeof(DDXPointRec));
|
||||
memcpy((char *) locPts, (char *) &stuff[1],
|
||||
count * sizeof(DDXPointRec));
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
|
|
@ -1797,7 +1743,7 @@ PanoramiXPolyFillRectangle(ClientPtr client)
|
|||
return BadLength;
|
||||
things >>= 3;
|
||||
if (things > 0) {
|
||||
origRects = xallocarray(things, sizeof(xRectangle));
|
||||
origRects = malloc(things * sizeof(xRectangle));
|
||||
memcpy((char *) origRects, (char *) &stuff[1],
|
||||
things * sizeof(xRectangle));
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
|
|
@ -1864,7 +1810,7 @@ PanoramiXPolyFillArc(ClientPtr client)
|
|||
return BadLength;
|
||||
narcs /= sizeof(xArc);
|
||||
if (narcs > 0) {
|
||||
origArcs = xallocarray(narcs, sizeof(xArc));
|
||||
origArcs = malloc(narcs * sizeof(xArc));
|
||||
memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
|
||||
FOR_NSCREENS_FORWARD(j) {
|
||||
|
||||
|
|
@ -1964,7 +1910,7 @@ PanoramiXGetImage(ClientPtr client)
|
|||
}
|
||||
|
||||
rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixReadAccess);
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? BadDrawable : rc;
|
||||
|
||||
|
|
@ -2013,12 +1959,6 @@ PanoramiXGetImage(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
FOR_NSCREENS_FORWARD(i) {
|
||||
drawables[i]->pScreen->SourceValidate(drawables[i], 0, 0,
|
||||
drawables[i]->width,
|
||||
drawables[i]->height,
|
||||
IncludeInferiors);
|
||||
}
|
||||
|
||||
xgi = (xGetImageReply) {
|
||||
.type = X_Reply,
|
||||
|
|
@ -2050,7 +1990,8 @@ PanoramiXGetImage(ClientPtr client)
|
|||
if (linesPerBuf > h)
|
||||
linesPerBuf = h;
|
||||
}
|
||||
if (!(pBuf = xallocarray(linesPerBuf, widthBytesLine)))
|
||||
length = linesPerBuf * widthBytesLine;
|
||||
if (!(pBuf = malloc(length)))
|
||||
return BadAlloc;
|
||||
|
||||
WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
|
||||
|
|
|
|||
228
Xext/saver.c
228
Xext/saver.c
|
|
@ -26,18 +26,12 @@ in this Software without prior written authorization from the X Consortium.
|
|||
* Author: Keith Packard, MIT X Consortium
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/extensions/saverproto.h>
|
||||
|
||||
#include "dix/colormap_priv.h"
|
||||
#include "dix/dix_priv.h"
|
||||
#include "os/osdep.h"
|
||||
#include "os/screensaver.h"
|
||||
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "windowstr.h"
|
||||
|
|
@ -47,35 +41,51 @@ in this Software without prior written authorization from the X Consortium.
|
|||
#include "dixstruct.h"
|
||||
#include "resource.h"
|
||||
#include "opaque.h"
|
||||
#include <X11/extensions/saverproto.h>
|
||||
#include "gcstruct.h"
|
||||
#include "cursorstr.h"
|
||||
#include "colormapst.h"
|
||||
#include "xace.h"
|
||||
#include "inputstr.h"
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
#include "panoramiX.h"
|
||||
#include "panoramiXsrv.h"
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
#ifdef DPMSExtension
|
||||
#include <X11/extensions/dpmsconst.h>
|
||||
#include "dpmsproc.h"
|
||||
#endif
|
||||
#include "protocol-versions.h"
|
||||
#include "extinit_priv.h"
|
||||
|
||||
// temporary workaround for win32/mingw32 name clash
|
||||
// see: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1355
|
||||
#undef CreateWindow
|
||||
#include <stdio.h>
|
||||
|
||||
#include "extinit.h"
|
||||
|
||||
static int ScreenSaverEventBase = 0;
|
||||
|
||||
static Bool ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force);
|
||||
static Bool CreateSaverWindow(ScreenPtr pScreen);
|
||||
static Bool DestroySaverWindow(ScreenPtr pScreen);
|
||||
static void UninstallSaverColormap(ScreenPtr pScreen);
|
||||
static void CheckScreenPrivate(ScreenPtr pScreen);
|
||||
static void SScreenSaverNotifyEvent(xScreenSaverNotifyEvent *from,
|
||||
xScreenSaverNotifyEvent *to);
|
||||
static Bool ScreenSaverHandle(ScreenPtr /* pScreen */ ,
|
||||
int /* xstate */ ,
|
||||
Bool /* force */
|
||||
);
|
||||
|
||||
static Bool
|
||||
CreateSaverWindow(ScreenPtr /* pScreen */
|
||||
);
|
||||
|
||||
static Bool
|
||||
DestroySaverWindow(ScreenPtr /* pScreen */
|
||||
);
|
||||
|
||||
static void
|
||||
UninstallSaverColormap(ScreenPtr /* pScreen */
|
||||
);
|
||||
|
||||
static void
|
||||
CheckScreenPrivate(ScreenPtr /* pScreen */
|
||||
);
|
||||
|
||||
static void SScreenSaverNotifyEvent(xScreenSaverNotifyEvent * /* from */ ,
|
||||
xScreenSaverNotifyEvent * /* to */
|
||||
);
|
||||
|
||||
static RESTYPE SuspendType; /* resource type for suspension records */
|
||||
|
||||
|
|
@ -182,6 +192,8 @@ static DevPrivateKeyRec ScreenPrivateKeyRec;
|
|||
dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v);
|
||||
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL)
|
||||
|
||||
#define New(t) (malloc(sizeof (t)))
|
||||
|
||||
static void
|
||||
CheckScreenPrivate(ScreenPtr pScreen)
|
||||
{
|
||||
|
|
@ -204,7 +216,7 @@ MakeScreenPrivate(ScreenPtr pScreen)
|
|||
|
||||
if (pPriv)
|
||||
return pPriv;
|
||||
pPriv = calloc(1, sizeof(ScreenSaverScreenPrivateRec));
|
||||
pPriv = New(ScreenSaverScreenPrivateRec);
|
||||
if (!pPriv)
|
||||
return 0;
|
||||
pPriv->events = 0;
|
||||
|
|
@ -254,7 +266,7 @@ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask)
|
|||
}
|
||||
else {
|
||||
if (!pEv) {
|
||||
pEv = calloc(1, sizeof(ScreenSaverEventRec));
|
||||
pEv = New(ScreenSaverEventRec);
|
||||
if (!pEv) {
|
||||
CheckScreenPrivate(pScreen);
|
||||
return FALSE;
|
||||
|
|
@ -353,7 +365,7 @@ ScreenSaverFreeSuspend(void *value, XID id)
|
|||
}
|
||||
}
|
||||
|
||||
/* Re-enable the screensaver if this was the last client suspending it. */
|
||||
/* Reenable the screensaver if this was the last client suspending it. */
|
||||
if (screenSaverSuspended && suspendingClients == NULL) {
|
||||
screenSaverSuspended = FALSE;
|
||||
|
||||
|
|
@ -414,7 +426,7 @@ SendScreenSaverNotify(ScreenPtr pScreen, int state, Bool forced)
|
|||
}
|
||||
}
|
||||
|
||||
static void _X_COLD
|
||||
static void
|
||||
SScreenSaverNotifyEvent(xScreenSaverNotifyEvent * from,
|
||||
xScreenSaverNotifyEvent * to)
|
||||
{
|
||||
|
|
@ -437,7 +449,7 @@ UninstallSaverColormap(ScreenPtr pScreen)
|
|||
|
||||
if (pPriv && pPriv->installedMap != None) {
|
||||
rc = dixLookupResourceByType((void **) &pCmap, pPriv->installedMap,
|
||||
X11_RESTYPE_COLORMAP, serverClient,
|
||||
RT_COLORMAP, serverClient,
|
||||
DixUninstallAccess);
|
||||
if (rc == Success)
|
||||
(*pCmap->pScreen->UninstallColormap) (pCmap);
|
||||
|
|
@ -455,13 +467,16 @@ CreateSaverWindow(ScreenPtr pScreen)
|
|||
WindowPtr pWin;
|
||||
int result;
|
||||
unsigned long mask;
|
||||
Colormap *installedMaps;
|
||||
int numInstalled;
|
||||
int i;
|
||||
Colormap wantMap;
|
||||
ColormapPtr pCmap;
|
||||
|
||||
pSaver = &pScreen->screensaver;
|
||||
if (pSaver->pWindow) {
|
||||
pSaver->pWindow = NullWindow;
|
||||
FreeResource(pSaver->wid, X11_RESTYPE_NONE);
|
||||
FreeResource(pSaver->wid, RT_NONE);
|
||||
if (pPriv) {
|
||||
UninstallSaverColormap(pScreen);
|
||||
pPriv->hasWindow = FALSE;
|
||||
|
|
@ -485,7 +500,7 @@ CreateSaverWindow(ScreenPtr pScreen)
|
|||
if (!pWin)
|
||||
return FALSE;
|
||||
|
||||
if (!AddResource(pWin->drawable.id, X11_RESTYPE_WINDOW, pWin))
|
||||
if (!AddResource(pWin->drawable.id, RT_WINDOW, pWin))
|
||||
return FALSE;
|
||||
|
||||
mask = 0;
|
||||
|
|
@ -505,7 +520,7 @@ CreateSaverWindow(ScreenPtr pScreen)
|
|||
CursorPtr cursor;
|
||||
if (!pWin->optional)
|
||||
if (!MakeWindowOptional(pWin)) {
|
||||
FreeResource(pWin->drawable.id, X11_RESTYPE_NONE);
|
||||
FreeResource(pWin->drawable.id, RT_NONE);
|
||||
return FALSE;
|
||||
}
|
||||
cursor = RefCursor(pAttr->pCursor);
|
||||
|
|
@ -530,10 +545,21 @@ CreateSaverWindow(ScreenPtr pScreen)
|
|||
|
||||
/* check and install our own colormap if it isn't installed now */
|
||||
wantMap = wColormap(pWin);
|
||||
if (wantMap == None || IsMapInstalled(wantMap, pWin))
|
||||
if (wantMap == None)
|
||||
return TRUE;
|
||||
installedMaps = malloc(pScreen->maxInstalledCmaps * sizeof(Colormap));
|
||||
numInstalled = (*pWin->drawable.pScreen->ListInstalledColormaps)
|
||||
(pScreen, installedMaps);
|
||||
for (i = 0; i < numInstalled; i++)
|
||||
if (installedMaps[i] == wantMap)
|
||||
break;
|
||||
|
||||
free((char *) installedMaps);
|
||||
|
||||
if (i < numInstalled)
|
||||
return TRUE;
|
||||
|
||||
result = dixLookupResourceByType((void **) &pCmap, wantMap, X11_RESTYPE_COLORMAP,
|
||||
result = dixLookupResourceByType((void **) &pCmap, wantMap, RT_COLORMAP,
|
||||
serverClient, DixInstallAccess);
|
||||
if (result != Success)
|
||||
return TRUE;
|
||||
|
|
@ -557,7 +583,7 @@ DestroySaverWindow(ScreenPtr pScreen)
|
|||
pSaver = &pScreen->screensaver;
|
||||
if (pSaver->pWindow) {
|
||||
pSaver->pWindow = NullWindow;
|
||||
FreeResource(pSaver->wid, X11_RESTYPE_NONE);
|
||||
FreeResource(pSaver->wid, RT_NONE);
|
||||
}
|
||||
pPriv->hasWindow = FALSE;
|
||||
CheckScreenPrivate(pScreen);
|
||||
|
|
@ -588,9 +614,9 @@ ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force)
|
|||
ret = TRUE;
|
||||
|
||||
}
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
if (noPanoramiXExtension || !pScreen->myNum)
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
SendScreenSaverNotify(pScreen, state, force);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -611,8 +637,6 @@ ProcScreenSaverQueryVersion(ClientPtr client)
|
|||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swaps(&rep.majorVersion);
|
||||
swaps(&rep.minorVersion);
|
||||
}
|
||||
WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), &rep);
|
||||
return Success;
|
||||
|
|
@ -634,7 +658,8 @@ ProcScreenSaverQueryInfo(ClientPtr client)
|
|||
DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
rc = XaceHookScreensaverAccess(client, pDraw->pScreen, DixGetAttrAccess);
|
||||
rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen,
|
||||
DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
|
@ -703,7 +728,8 @@ ProcScreenSaverSelectInput(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
rc = XaceHookScreensaverAccess(client, pDraw->pScreen, DixSetAttrAccess);
|
||||
rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen,
|
||||
DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
|
@ -713,8 +739,9 @@ ProcScreenSaverSelectInput(ClientPtr client)
|
|||
}
|
||||
|
||||
static int
|
||||
ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
|
||||
ScreenSaverSetAttributes(ClientPtr client)
|
||||
{
|
||||
REQUEST(xScreenSaverSetAttributesReq);
|
||||
DrawablePtr pDraw;
|
||||
WindowPtr pParent;
|
||||
ScreenPtr pScreen;
|
||||
|
|
@ -737,6 +764,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
|
|||
Colormap cmap;
|
||||
ColormapPtr pCmap;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
|
||||
ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
|
||||
DixGetAttrAccess);
|
||||
if (ret != Success)
|
||||
|
|
@ -744,11 +772,11 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
|
|||
pScreen = pDraw->pScreen;
|
||||
pParent = pScreen->root;
|
||||
|
||||
ret = XaceHookScreensaverAccess(client, pScreen, DixSetAttrAccess);
|
||||
ret = XaceHook(XACE_SCREENSAVER_ACCESS, client, pScreen, DixSetAttrAccess);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
|
||||
len = client->req_len - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
|
||||
len = stuff->length - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
|
||||
if (Ones(stuff->mask) != len)
|
||||
return BadLength;
|
||||
if (!stuff->width || !stuff->height) {
|
||||
|
|
@ -833,13 +861,13 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
|
|||
if (!pPriv)
|
||||
return FALSE;
|
||||
}
|
||||
pAttr = calloc(1, sizeof(ScreenSaverAttrRec));
|
||||
pAttr = New(ScreenSaverAttrRec);
|
||||
if (!pAttr) {
|
||||
ret = BadAlloc;
|
||||
goto bail;
|
||||
}
|
||||
/* over allocate for override redirect */
|
||||
pAttr->values = values = xallocarray(len + 1, sizeof(unsigned long));
|
||||
pAttr->values = values = malloc((len + 1) * sizeof(unsigned long));
|
||||
if (!values) {
|
||||
ret = BadAlloc;
|
||||
goto bail;
|
||||
|
|
@ -884,7 +912,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
|
|||
else {
|
||||
ret =
|
||||
dixLookupResourceByType((void **) &pPixmap, pixID,
|
||||
X11_RESTYPE_PIXMAP, client, DixReadAccess);
|
||||
RT_PIXMAP, client, DixReadAccess);
|
||||
if (ret == Success) {
|
||||
if ((pPixmap->drawable.depth != depth) ||
|
||||
(pPixmap->drawable.pScreen != pScreen)) {
|
||||
|
|
@ -916,7 +944,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
|
|||
else {
|
||||
ret =
|
||||
dixLookupResourceByType((void **) &pPixmap, pixID,
|
||||
X11_RESTYPE_PIXMAP, client, DixReadAccess);
|
||||
RT_PIXMAP, client, DixReadAccess);
|
||||
if (ret == Success) {
|
||||
if ((pPixmap->drawable.depth != depth) ||
|
||||
(pPixmap->drawable.pScreen != pScreen)) {
|
||||
|
|
@ -999,7 +1027,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
|
|||
break;
|
||||
case CWColormap:
|
||||
cmap = (Colormap) * pVlist;
|
||||
ret = dixLookupResourceByType((void **) &pCmap, cmap, X11_RESTYPE_COLORMAP,
|
||||
ret = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP,
|
||||
client, DixUseAccess);
|
||||
if (ret != Success) {
|
||||
client->errorValue = cmap;
|
||||
|
|
@ -1019,7 +1047,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
|
|||
}
|
||||
else {
|
||||
ret = dixLookupResourceByType((void **) &pCursor, cursorID,
|
||||
X11_RESTYPE_CURSOR, client, DixUseAccess);
|
||||
RT_CURSOR, client, DixUseAccess);
|
||||
if (ret != Success) {
|
||||
client->errorValue = cursorID;
|
||||
goto PatchUp;
|
||||
|
|
@ -1036,7 +1064,7 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
|
|||
pVlist++;
|
||||
}
|
||||
if (pPriv->attr)
|
||||
FreeResource(pPriv->attr->resource, AttrType);
|
||||
FreeScreenAttr(pPriv->attr);
|
||||
pPriv->attr = pAttr;
|
||||
pAttr->resource = FakeClientID(client->index);
|
||||
if (!AddResource(pAttr->resource, AttrType, (void *) pAttr))
|
||||
|
|
@ -1053,13 +1081,16 @@ ScreenSaverSetAttributes(ClientPtr client, xScreenSaverSetAttributesReq *stuff)
|
|||
}
|
||||
|
||||
static int
|
||||
ScreenSaverUnsetAttributes(ClientPtr client, Drawable drawable)
|
||||
ScreenSaverUnsetAttributes(ClientPtr client)
|
||||
{
|
||||
REQUEST(xScreenSaverSetAttributesReq);
|
||||
DrawablePtr pDraw;
|
||||
ScreenSaverScreenPrivatePtr pPriv;
|
||||
int rc;
|
||||
|
||||
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixGetAttrAccess);
|
||||
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
|
||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
|
||||
DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
pPriv = GetScreenPrivate(pDraw->pScreen);
|
||||
|
|
@ -1075,11 +1106,9 @@ ScreenSaverUnsetAttributes(ClientPtr client, Drawable drawable)
|
|||
static int
|
||||
ProcScreenSaverSetAttributes(ClientPtr client)
|
||||
{
|
||||
REQUEST(xScreenSaverSetAttributesReq);
|
||||
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
|
||||
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension) {
|
||||
REQUEST(xScreenSaverSetAttributesReq);
|
||||
PanoramiXRes *draw;
|
||||
PanoramiXRes *backPix = NULL;
|
||||
PanoramiXRes *bordPix = NULL;
|
||||
|
|
@ -1088,13 +1117,15 @@ ProcScreenSaverSetAttributes(ClientPtr client)
|
|||
int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
|
||||
XID orig_visual, tmp;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
|
||||
|
||||
status = dixLookupResourceByClass((void **) &draw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (status != Success)
|
||||
return (status == BadValue) ? BadDrawable : status;
|
||||
|
||||
len =
|
||||
client->req_len -
|
||||
stuff->length -
|
||||
bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
|
||||
if (Ones(stuff->mask) != len)
|
||||
return BadLength;
|
||||
|
|
@ -1126,7 +1157,7 @@ ProcScreenSaverSetAttributes(ClientPtr client)
|
|||
if ((Mask) stuff->mask & CWColormap) {
|
||||
cmap_offset = Ones((Mask) stuff->mask & (CWColormap - 1));
|
||||
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
|
||||
if (tmp != CopyFromParent) {
|
||||
if ((tmp != CopyFromParent) && (tmp != None)) {
|
||||
status = dixLookupResourceByType((void **) &cmap, tmp,
|
||||
XRT_COLORMAP, client,
|
||||
DixReadAccess);
|
||||
|
|
@ -1149,83 +1180,72 @@ ProcScreenSaverSetAttributes(ClientPtr client)
|
|||
if (orig_visual != CopyFromParent)
|
||||
stuff->visualID = PanoramiXTranslateVisualID(i, orig_visual);
|
||||
|
||||
status = ScreenSaverSetAttributes(client, stuff);
|
||||
status = ScreenSaverSetAttributes(client);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
|
||||
return ScreenSaverSetAttributes(client, stuff);
|
||||
return ScreenSaverSetAttributes(client);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcScreenSaverUnsetAttributes(ClientPtr client)
|
||||
{
|
||||
REQUEST(xScreenSaverUnsetAttributesReq);
|
||||
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
|
||||
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension) {
|
||||
REQUEST(xScreenSaverUnsetAttributesReq);
|
||||
PanoramiXRes *draw;
|
||||
int rc, i;
|
||||
|
||||
|
||||
rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? BadDrawable : rc;
|
||||
|
||||
for (i = PanoramiXNumScreens - 1; i > 0; i--) {
|
||||
ScreenSaverUnsetAttributes(client, draw->info[i].id);
|
||||
stuff->drawable = draw->info[i].id;
|
||||
ScreenSaverUnsetAttributes(client);
|
||||
}
|
||||
|
||||
stuff->drawable = draw->info[0].id;
|
||||
}
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
|
||||
return ScreenSaverUnsetAttributes(client, stuff->drawable);
|
||||
return ScreenSaverUnsetAttributes(client);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcScreenSaverSuspend(ClientPtr client)
|
||||
{
|
||||
ScreenSaverSuspensionPtr *prev, this;
|
||||
BOOL suspend;
|
||||
|
||||
REQUEST(xScreenSaverSuspendReq);
|
||||
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
|
||||
|
||||
/*
|
||||
* Old versions of XCB encode suspend as 1 byte followed by three
|
||||
* pad bytes (which are always cleared), instead of a 4 byte
|
||||
* value. Be compatible by just checking for a non-zero value in
|
||||
* all 32-bits.
|
||||
*/
|
||||
suspend = stuff->suspend != 0;
|
||||
|
||||
/* Check if this client is suspending the screensaver */
|
||||
for (prev = &suspendingClients; (this = *prev); prev = &this->next)
|
||||
if (this->pClient == client)
|
||||
break;
|
||||
|
||||
if (this) {
|
||||
if (suspend == TRUE)
|
||||
if (stuff->suspend == TRUE)
|
||||
this->count++;
|
||||
else if (--this->count == 0)
|
||||
FreeResource(this->clientResource, X11_RESTYPE_NONE);
|
||||
FreeResource(this->clientResource, RT_NONE);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
/* If we get to this point, this client isn't suspending the screensaver */
|
||||
if (suspend == FALSE)
|
||||
if (stuff->suspend == FALSE)
|
||||
return Success;
|
||||
|
||||
/*
|
||||
* Allocate a suspension record for the client, and stop the screensaver
|
||||
* if it isn't already suspended by another client. We attach a resource ID
|
||||
* to the record, so the screensaver will be re-enabled and the record freed
|
||||
* to the record, so the screensaver will be reenabled and the record freed
|
||||
* if the client disconnects without reenabling it first.
|
||||
*/
|
||||
this = malloc(sizeof(ScreenSaverSuspensionRec));
|
||||
|
|
@ -1253,47 +1273,59 @@ ProcScreenSaverSuspend(ClientPtr client)
|
|||
}
|
||||
|
||||
static int (*NormalVector[]) (ClientPtr /* client */ ) = {
|
||||
ProcScreenSaverQueryVersion,
|
||||
ProcScreenSaverQueryVersion,
|
||||
ProcScreenSaverQueryInfo,
|
||||
ProcScreenSaverSelectInput,
|
||||
ProcScreenSaverSetAttributes,
|
||||
ProcScreenSaverUnsetAttributes,
|
||||
ProcScreenSaverSuspend,
|
||||
};
|
||||
ProcScreenSaverUnsetAttributes, ProcScreenSaverSuspend,};
|
||||
|
||||
#define NUM_REQUESTS ((sizeof NormalVector) / (sizeof NormalVector[0]))
|
||||
|
||||
static int
|
||||
ProcScreenSaverDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
if (stuff->data < ARRAY_SIZE(NormalVector))
|
||||
if (stuff->data < NUM_REQUESTS)
|
||||
return (*NormalVector[stuff->data]) (client);
|
||||
return BadRequest;
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcScreenSaverQueryVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xScreenSaverQueryVersionReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
|
||||
return ProcScreenSaverQueryVersion(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcScreenSaverQueryInfo(ClientPtr client)
|
||||
{
|
||||
REQUEST(xScreenSaverQueryInfoReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xScreenSaverQueryInfoReq);
|
||||
swapl(&stuff->drawable);
|
||||
return ProcScreenSaverQueryInfo(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcScreenSaverSelectInput(ClientPtr client)
|
||||
{
|
||||
REQUEST(xScreenSaverSelectInputReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xScreenSaverSelectInputReq);
|
||||
swapl(&stuff->drawable);
|
||||
swapl(&stuff->eventMask);
|
||||
return ProcScreenSaverSelectInput(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcScreenSaverSetAttributes(ClientPtr client)
|
||||
{
|
||||
REQUEST(xScreenSaverSetAttributesReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
|
||||
swapl(&stuff->drawable);
|
||||
swaps(&stuff->x);
|
||||
|
|
@ -1307,39 +1339,39 @@ SProcScreenSaverSetAttributes(ClientPtr client)
|
|||
return ProcScreenSaverSetAttributes(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcScreenSaverUnsetAttributes(ClientPtr client)
|
||||
{
|
||||
REQUEST(xScreenSaverUnsetAttributesReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xScreenSaverUnsetAttributesReq);
|
||||
swapl(&stuff->drawable);
|
||||
return ProcScreenSaverUnsetAttributes(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcScreenSaverSuspend(ClientPtr client)
|
||||
{
|
||||
REQUEST(xScreenSaverSuspendReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
|
||||
swapl(&stuff->suspend);
|
||||
return ProcScreenSaverSuspend(client);
|
||||
}
|
||||
|
||||
static int (*SwappedVector[]) (ClientPtr /* client */ ) = {
|
||||
ProcScreenSaverQueryVersion,
|
||||
SProcScreenSaverQueryVersion,
|
||||
SProcScreenSaverQueryInfo,
|
||||
SProcScreenSaverSelectInput,
|
||||
SProcScreenSaverSetAttributes,
|
||||
SProcScreenSaverUnsetAttributes,
|
||||
SProcScreenSaverSuspend,
|
||||
};
|
||||
SProcScreenSaverUnsetAttributes, SProcScreenSaverSuspend,};
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcScreenSaverDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
if (stuff->data < ARRAY_SIZE(NormalVector))
|
||||
if (stuff->data < NUM_REQUESTS)
|
||||
return (*SwappedVector[stuff->data]) (client);
|
||||
return BadRequest;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,19 +24,9 @@ in this Software without prior written authorization from The Open Group.
|
|||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/extensions/securproto.h>
|
||||
#include <X11/Xfuncproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "dix/registry_priv.h"
|
||||
#include "include/extinit_priv.h"
|
||||
#include "os/audit.h"
|
||||
#include "os/auth.h"
|
||||
#include "os/client_priv.h"
|
||||
#include "os/osdep.h"
|
||||
#endif
|
||||
|
||||
#include "scrnintstr.h"
|
||||
#include "inputstr.h"
|
||||
|
|
@ -44,8 +34,10 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include "propertyst.h"
|
||||
#include "colormapst.h"
|
||||
#include "privates.h"
|
||||
#include "registry.h"
|
||||
#include "xacestr.h"
|
||||
#include "securitysrv.h"
|
||||
#include <X11/extensions/securproto.h>
|
||||
#include "extinit.h"
|
||||
#include "protocol-versions.h"
|
||||
|
||||
|
|
@ -71,10 +63,11 @@ typedef struct {
|
|||
XID authId;
|
||||
} SecurityStateRec;
|
||||
|
||||
/* The only extensions that untrusted clients have access to */
|
||||
/* Extensions that untrusted clients shouldn't have access to */
|
||||
static const char *SecurityTrustedExtensions[] = {
|
||||
"XC-MISC",
|
||||
"BIG-REQUESTS",
|
||||
"XpExtension",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -155,7 +148,7 @@ SecurityLabelInitial(void)
|
|||
/*
|
||||
* Looks up a request name
|
||||
*/
|
||||
static inline const char *
|
||||
static _X_INLINE const char *
|
||||
SecurityLookupRequestName(ClientPtr client)
|
||||
{
|
||||
return LookupRequestName(client->majorOp, client->minorOp);
|
||||
|
|
@ -206,7 +199,7 @@ SecurityDeleteAuthorization(void *value, XID id)
|
|||
.authId = pAuth->id
|
||||
};
|
||||
WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
|
||||
FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
|
||||
FreeResource(pEventClient->resource, RT_NONE);
|
||||
}
|
||||
|
||||
/* kill all clients using this auth */
|
||||
|
|
@ -220,7 +213,7 @@ SecurityDeleteAuthorization(void *value, XID id)
|
|||
CloseDownClient(clients[i]);
|
||||
}
|
||||
|
||||
SecurityAudit("revoked authorization ID %lu\n", (unsigned long)pAuth->id);
|
||||
SecurityAudit("revoked authorization ID %d\n", pAuth->id);
|
||||
free(pAuth);
|
||||
return Success;
|
||||
|
||||
|
|
@ -312,7 +305,7 @@ SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, void *pval)
|
|||
pAuth->secondsRemaining);
|
||||
}
|
||||
else {
|
||||
FreeResource(pAuth->id, X11_RESTYPE_NONE);
|
||||
FreeResource(pAuth->id, RT_NONE);
|
||||
return 0;
|
||||
}
|
||||
} /* SecurityAuthorizationExpired */
|
||||
|
|
@ -376,7 +369,7 @@ SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
|
|||
pEventClient; pEventClient = pEventClient->next) {
|
||||
if (SameClient(pEventClient, client)) {
|
||||
if (mask == 0)
|
||||
FreeResource(pEventClient->resource, X11_RESTYPE_NONE);
|
||||
FreeResource(pEventClient->resource, RT_NONE);
|
||||
else
|
||||
pEventClient->mask = mask;
|
||||
return Success;
|
||||
|
|
@ -557,9 +550,9 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
|
|||
WriteToClient(client, authdata_len, pAuthdata);
|
||||
|
||||
SecurityAudit
|
||||
("client %d generated authorization %lu trust %d timeout %lu group %lu events %lu\n",
|
||||
client->index, (unsigned long)pAuth->id, pAuth->trustLevel, (unsigned long)pAuth->timeout,
|
||||
(unsigned long)pAuth->group, (unsigned long)eventMask);
|
||||
("client %d generated authorization %d trust %d timeout %d group %d events %d\n",
|
||||
client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
|
||||
pAuth->group, eventMask);
|
||||
|
||||
/* the request succeeded; don't call RemoveAuthorization or free pAuth */
|
||||
return Success;
|
||||
|
|
@ -588,7 +581,7 @@ ProcSecurityRevokeAuthorization(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
FreeResource(stuff->authId, X11_RESTYPE_NONE);
|
||||
FreeResource(stuff->authId, RT_NONE);
|
||||
return Success;
|
||||
} /* ProcSecurityRevokeAuthorization */
|
||||
|
||||
|
|
@ -609,23 +602,27 @@ ProcSecurityDispatch(ClientPtr client)
|
|||
}
|
||||
} /* ProcSecurityDispatch */
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSecurityQueryVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xSecurityQueryVersionReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
|
||||
swaps(&stuff->majorVersion);
|
||||
swaps(&stuff->minorVersion);
|
||||
return ProcSecurityQueryVersion(client);
|
||||
} /* SProcSecurityQueryVersion */
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSecurityGenerateAuthorization(ClientPtr client)
|
||||
{
|
||||
REQUEST(xSecurityGenerateAuthorizationReq);
|
||||
CARD32 *values;
|
||||
unsigned long nvalues;
|
||||
int values_offset;
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
|
||||
swaps(&stuff->nbytesAuthProto);
|
||||
swaps(&stuff->nbytesAuthData);
|
||||
|
|
@ -633,24 +630,26 @@ SProcSecurityGenerateAuthorization(ClientPtr client)
|
|||
values_offset = bytes_to_int32(stuff->nbytesAuthProto) +
|
||||
bytes_to_int32(stuff->nbytesAuthData);
|
||||
if (values_offset >
|
||||
client->req_len - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
|
||||
stuff->length - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
|
||||
return BadLength;
|
||||
values = (CARD32 *) (&stuff[1]) + values_offset;
|
||||
nvalues = (((CARD32 *) stuff) + client->req_len) - values;
|
||||
nvalues = (((CARD32 *) stuff) + stuff->length) - values;
|
||||
SwapLongs(values, nvalues);
|
||||
return ProcSecurityGenerateAuthorization(client);
|
||||
} /* SProcSecurityGenerateAuthorization */
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSecurityRevokeAuthorization(ClientPtr client)
|
||||
{
|
||||
REQUEST(xSecurityRevokeAuthorizationReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
|
||||
swapl(&stuff->authId);
|
||||
return ProcSecurityRevokeAuthorization(client);
|
||||
} /* SProcSecurityRevokeAuthorization */
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSecurityDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
|
@ -667,7 +666,7 @@ SProcSecurityDispatch(ClientPtr client)
|
|||
}
|
||||
} /* SProcSecurityDispatch */
|
||||
|
||||
static void _X_COLD
|
||||
static void
|
||||
SwapSecurityAuthorizationRevokedEvent(xSecurityAuthorizationRevokedEvent * from,
|
||||
xSecurityAuthorizationRevokedEvent * to)
|
||||
{
|
||||
|
|
@ -749,12 +748,12 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|||
subj = dixLookupPrivate(&rec->client->devPrivates, stateKey);
|
||||
|
||||
/* disable background None for untrusted windows */
|
||||
if ((requested & DixCreateAccess) && (rec->rtype == X11_RESTYPE_WINDOW))
|
||||
if ((requested & DixCreateAccess) && (rec->rtype == RT_WINDOW))
|
||||
if (subj->haveState && subj->trustLevel != XSecurityClientTrusted)
|
||||
((WindowPtr) rec->res)->forcedBG = TRUE;
|
||||
|
||||
/* additional permissions for specific resource types */
|
||||
if (rec->rtype == X11_RESTYPE_WINDOW)
|
||||
if (rec->rtype == RT_WINDOW)
|
||||
allowed |= SecurityWindowExtraMask;
|
||||
|
||||
/* special checks for server-owned resources */
|
||||
|
|
@ -763,7 +762,7 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|||
/* additional operations allowed on root windows */
|
||||
allowed |= SecurityRootWindowExtraMask;
|
||||
|
||||
else if (rec->rtype == X11_RESTYPE_COLORMAP)
|
||||
else if (rec->rtype == RT_COLORMAP)
|
||||
/* allow access to default colormaps */
|
||||
allowed = requested;
|
||||
|
||||
|
|
@ -778,9 +777,9 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|||
return;
|
||||
}
|
||||
|
||||
SecurityAudit("Security: denied client %d access %lx to resource 0x%lx "
|
||||
SecurityAudit("Security: denied client %d access %x to resource 0x%x "
|
||||
"of client %d on request %s\n", rec->client->index,
|
||||
(unsigned long)requested, (unsigned long)rec->id, cid,
|
||||
requested, rec->id, cid,
|
||||
SecurityLookupRequestName(rec->client));
|
||||
rec->status = BadAccess; /* deny access */
|
||||
}
|
||||
|
|
@ -860,9 +859,9 @@ SecurityProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|||
|
||||
if (SecurityDoCheck(subj, obj, requested, allowed) != Success) {
|
||||
SecurityAudit("Security: denied client %d access to property %s "
|
||||
"(atom 0x%x) window 0x%lx of client %d on request %s\n",
|
||||
"(atom 0x%x) window 0x%x of client %d on request %s\n",
|
||||
rec->client->index, NameForAtom(name), name,
|
||||
(unsigned long)rec->pWin->drawable.id, wClient(rec->pWin)->index,
|
||||
rec->pWin->drawable.id, wClient(rec->pWin)->index,
|
||||
SecurityLookupRequestName(rec->client));
|
||||
rec->status = BadAccess;
|
||||
}
|
||||
|
|
@ -889,10 +888,10 @@ SecuritySend(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|||
rec->events[i].u.u.type != ClientMessage) {
|
||||
|
||||
SecurityAudit("Security: denied client %d from sending event "
|
||||
"of type %s to window 0x%lx of client %d\n",
|
||||
"of type %s to window 0x%x of client %d\n",
|
||||
rec->client->index,
|
||||
LookupEventName(rec->events[i].u.u.type),
|
||||
(unsigned long)rec->pWin->drawable.id,
|
||||
rec->pWin->drawable.id,
|
||||
wClient(rec->pWin)->index);
|
||||
rec->status = BadAccess;
|
||||
return;
|
||||
|
|
@ -913,8 +912,8 @@ SecurityReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|||
return;
|
||||
|
||||
SecurityAudit("Security: denied client %d from receiving an event "
|
||||
"sent to window 0x%lx of client %d\n",
|
||||
rec->client->index, (unsigned long)rec->pWin->drawable.id,
|
||||
"sent to window 0x%x of client %d\n",
|
||||
rec->client->index, rec->pWin->drawable.id,
|
||||
wClient(rec->pWin)->index);
|
||||
rec->status = BadAccess;
|
||||
}
|
||||
|
|
@ -930,12 +929,12 @@ SecurityReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|||
* Returns: nothing.
|
||||
*
|
||||
* Side Effects:
|
||||
*
|
||||
*
|
||||
* If a new client is connecting, its authorization ID is copied to
|
||||
* client->authID. If this is a generated authorization, its reference
|
||||
* count is bumped, its timer is cancelled if it was running, and its
|
||||
* trustlevel is copied to TRUSTLEVEL(client).
|
||||
*
|
||||
*
|
||||
* If a client is disconnecting and the client was using a generated
|
||||
* authorization, the authorization's reference count is decremented, and
|
||||
* if it is now zero, the timer for this authorization is started.
|
||||
|
|
|
|||
|
|
@ -30,8 +30,27 @@ from The Open Group.
|
|||
#ifndef _SECURITY_SRV_H
|
||||
#define _SECURITY_SRV_H
|
||||
|
||||
/* Allow client side portions of <X11/extensions/security.h> to compile */
|
||||
#ifndef Status
|
||||
#define Status int
|
||||
#define NEED_UNDEF_Status
|
||||
#endif
|
||||
#ifndef Display
|
||||
#define Display void
|
||||
#define NEED_UNDEF_Display
|
||||
#endif
|
||||
|
||||
#include <X11/extensions/secur.h>
|
||||
|
||||
#ifdef NEED_UNDEF_Status
|
||||
#undef Status
|
||||
#undef NEED_UNDEF_Status
|
||||
#endif
|
||||
#ifdef NEED_UNDEF_Display
|
||||
#undef Display
|
||||
#undef NEED_UNDEF_Display
|
||||
#endif
|
||||
|
||||
#include "input.h" /* for DeviceIntPtr */
|
||||
#include "property.h" /* for PropertyPtr */
|
||||
#include "pixmap.h" /* for DrawablePtr */
|
||||
|
|
|
|||
102
Xext/shape.c
102
Xext/shape.c
|
|
@ -24,16 +24,14 @@ in this Software without prior written authorization from The Open Group.
|
|||
|
||||
********************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/extensions/shapeproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "dix/gc_priv.h"
|
||||
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "windowstr.h"
|
||||
|
|
@ -43,9 +41,10 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include "dixstruct.h"
|
||||
#include "resource.h"
|
||||
#include "opaque.h"
|
||||
#include <X11/extensions/shapeproto.h>
|
||||
#include "regionstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "extinit_priv.h"
|
||||
#include "extinit.h"
|
||||
#include "protocol-versions.h"
|
||||
|
||||
typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */
|
||||
|
|
@ -65,10 +64,10 @@ static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
|
|||
* externally by the Xfixes extension and are now defined in window.h
|
||||
*/
|
||||
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
#include "panoramiX.h"
|
||||
#include "panoramiXsrv.h"
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
|
||||
static int ShapeEventBase = 0;
|
||||
static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
|
||||
|
|
@ -266,7 +265,7 @@ ProcShapeRectangles(ClientPtr client)
|
|||
client->errorValue = stuff->ordering;
|
||||
return BadValue;
|
||||
}
|
||||
nrects = ((client->req_len << 2) - sizeof(xShapeRectanglesReq));
|
||||
nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
|
||||
if (nrects & 4)
|
||||
return BadLength;
|
||||
nrects >>= 3;
|
||||
|
|
@ -297,7 +296,7 @@ ProcShapeRectangles(ClientPtr client)
|
|||
stuff->xOff, stuff->yOff, createDefault);
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShapeRectangles(ClientPtr client)
|
||||
{
|
||||
|
|
@ -320,7 +319,7 @@ ProcPanoramiXShapeRectangles(ClientPtr client)
|
|||
}
|
||||
return result;
|
||||
}
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
|
||||
/**************
|
||||
* ProcShapeMask
|
||||
|
|
@ -363,7 +362,7 @@ ProcShapeMask(ClientPtr client)
|
|||
srcRgn = 0;
|
||||
else {
|
||||
rc = dixLookupResourceByType((void **) &pPixmap, stuff->src,
|
||||
X11_RESTYPE_PIXMAP, client, DixReadAccess);
|
||||
RT_PIXMAP, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
if (pPixmap->drawable.pScreen != pScreen ||
|
||||
|
|
@ -395,7 +394,7 @@ ProcShapeMask(ClientPtr client)
|
|||
stuff->xOff, stuff->yOff, createDefault);
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShapeMask(ClientPtr client)
|
||||
{
|
||||
|
|
@ -429,7 +428,7 @@ ProcPanoramiXShapeMask(ClientPtr client)
|
|||
}
|
||||
return result;
|
||||
}
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
|
||||
/************
|
||||
* ProcShapeCombine
|
||||
|
|
@ -523,7 +522,7 @@ ProcShapeCombine(ClientPtr client)
|
|||
stuff->xOff, stuff->yOff, createDefault);
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShapeCombine(ClientPtr client)
|
||||
{
|
||||
|
|
@ -552,7 +551,7 @@ ProcPanoramiXShapeCombine(ClientPtr client)
|
|||
}
|
||||
return result;
|
||||
}
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
|
||||
/*************
|
||||
* ProcShapeOffset
|
||||
|
|
@ -594,7 +593,7 @@ ProcShapeOffset(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShapeOffset(ClientPtr client)
|
||||
{
|
||||
|
|
@ -617,7 +616,7 @@ ProcPanoramiXShapeOffset(ClientPtr client)
|
|||
}
|
||||
return result;
|
||||
}
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
|
||||
static int
|
||||
ProcShapeQueryExtents(ClientPtr client)
|
||||
|
|
@ -784,7 +783,7 @@ ProcShapeSelectInput(ClientPtr client)
|
|||
if (!pHead ||
|
||||
!AddResource(pWin->drawable.id, ShapeEventType,
|
||||
(void *) pHead)) {
|
||||
FreeResource(clientResource, X11_RESTYPE_NONE);
|
||||
FreeResource(clientResource, RT_NONE);
|
||||
return BadAlloc;
|
||||
}
|
||||
*pHead = 0;
|
||||
|
|
@ -882,7 +881,6 @@ SendShapeNotify(WindowPtr pWin, int which)
|
|||
default:
|
||||
return;
|
||||
}
|
||||
UpdateCurrentTimeIf();
|
||||
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
|
||||
xShapeNotifyEvent se = {
|
||||
.type = ShapeNotify + ShapeEventBase,
|
||||
|
|
@ -998,7 +996,7 @@ ProcShapeGetRectangles(ClientPtr client)
|
|||
|
||||
nrects = RegionNumRects(region);
|
||||
box = RegionRects(region);
|
||||
rects = xallocarray(nrects, sizeof(xRectangle));
|
||||
rects = malloc(nrects * sizeof(xRectangle));
|
||||
if (!rects && nrects)
|
||||
return BadAlloc;
|
||||
for (i = 0; i < nrects; i++, box++) {
|
||||
|
|
@ -1035,32 +1033,32 @@ ProcShapeDispatch(ClientPtr client)
|
|||
case X_ShapeQueryVersion:
|
||||
return ProcShapeQueryVersion(client);
|
||||
case X_ShapeRectangles:
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension)
|
||||
return ProcPanoramiXShapeRectangles(client);
|
||||
else
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
return ProcShapeRectangles(client);
|
||||
case X_ShapeMask:
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension)
|
||||
return ProcPanoramiXShapeMask(client);
|
||||
else
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
return ProcShapeMask(client);
|
||||
case X_ShapeCombine:
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension)
|
||||
return ProcPanoramiXShapeCombine(client);
|
||||
else
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
return ProcShapeCombine(client);
|
||||
case X_ShapeOffset:
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension)
|
||||
return ProcPanoramiXShapeOffset(client);
|
||||
else
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
return ProcShapeOffset(client);
|
||||
case X_ShapeQueryExtents:
|
||||
return ProcShapeQueryExtents(client);
|
||||
|
|
@ -1075,7 +1073,7 @@ ProcShapeDispatch(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
static void _X_COLD
|
||||
static void
|
||||
SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to)
|
||||
{
|
||||
to->type = from->type;
|
||||
|
|
@ -1090,10 +1088,21 @@ SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to)
|
|||
to->shaped = from->shaped;
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShapeQueryVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeQueryVersionReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
return ProcShapeQueryVersion(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcShapeRectangles(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeRectanglesReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
|
||||
swapl(&stuff->dest);
|
||||
swaps(&stuff->xOff);
|
||||
|
|
@ -1102,10 +1111,12 @@ SProcShapeRectangles(ClientPtr client)
|
|||
return ProcShapeRectangles(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShapeMask(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeMaskReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShapeMaskReq);
|
||||
swapl(&stuff->dest);
|
||||
swaps(&stuff->xOff);
|
||||
|
|
@ -1114,10 +1125,12 @@ SProcShapeMask(ClientPtr client)
|
|||
return ProcShapeMask(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShapeCombine(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeCombineReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShapeCombineReq);
|
||||
swapl(&stuff->dest);
|
||||
swaps(&stuff->xOff);
|
||||
|
|
@ -1126,10 +1139,12 @@ SProcShapeCombine(ClientPtr client)
|
|||
return ProcShapeCombine(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShapeOffset(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeOffsetReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShapeOffsetReq);
|
||||
swapl(&stuff->dest);
|
||||
swaps(&stuff->xOff);
|
||||
|
|
@ -1137,49 +1152,56 @@ SProcShapeOffset(ClientPtr client)
|
|||
return ProcShapeOffset(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShapeQueryExtents(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeQueryExtentsReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShapeQueryExtentsReq);
|
||||
swapl(&stuff->window);
|
||||
return ProcShapeQueryExtents(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShapeSelectInput(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeSelectInputReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShapeSelectInputReq);
|
||||
swapl(&stuff->window);
|
||||
return ProcShapeSelectInput(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShapeInputSelected(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeInputSelectedReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
|
||||
swapl(&stuff->window);
|
||||
return ProcShapeInputSelected(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShapeGetRectangles(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeGetRectanglesReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
|
||||
swapl(&stuff->window);
|
||||
return ProcShapeGetRectangles(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShapeDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data) {
|
||||
case X_ShapeQueryVersion:
|
||||
return ProcShapeQueryVersion(client);
|
||||
return SProcShapeQueryVersion(client);
|
||||
case X_ShapeRectangles:
|
||||
return SProcShapeRectangles(client);
|
||||
case X_ShapeMask:
|
||||
|
|
|
|||
260
Xext/shm.c
260
Xext/shm.c
|
|
@ -28,29 +28,21 @@ in this Software without prior written authorization from The Open Group.
|
|||
|
||||
#define SHM
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/extensions/shmproto.h>
|
||||
#include <X11/Xfuncproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "os/auth.h"
|
||||
#include "os/busfault.h"
|
||||
#include "os/client_priv.h"
|
||||
#include "os/osdep.h"
|
||||
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct_priv.h"
|
||||
#include "dixstruct.h"
|
||||
#include "resource.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
|
|
@ -60,8 +52,11 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include "servermd.h"
|
||||
#include "shmint.h"
|
||||
#include "xace.h"
|
||||
#include "extinit_priv.h"
|
||||
#include <X11/extensions/shmproto.h>
|
||||
#include <X11/Xfuncproto.h>
|
||||
#include <sys/mman.h>
|
||||
#include "protocol-versions.h"
|
||||
#include "busfault.h"
|
||||
|
||||
/* Needed for Solaris cross-zone shared memory extension */
|
||||
#ifdef HAVE_SHMCTL64
|
||||
|
|
@ -90,10 +85,12 @@ in this Software without prior written authorization from The Open Group.
|
|||
#define SHMPERM_MODE(p) p->mode
|
||||
#endif
|
||||
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
#include "panoramiX.h"
|
||||
#include "panoramiXsrv.h"
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
|
||||
#include "extinit.h"
|
||||
|
||||
typedef struct _ShmScrPrivateRec {
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
|
|
@ -156,6 +153,7 @@ static ShmFuncs fbFuncs = { fbShmCreatePixmap, NULL };
|
|||
}
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
|
||||
#include <sys/signal.h>
|
||||
|
||||
static Bool badSysCall = FALSE;
|
||||
|
||||
|
|
@ -172,7 +170,7 @@ CheckForShmSyscall(void)
|
|||
int shmid = -1;
|
||||
|
||||
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
|
||||
oldHandler = OsSignal(SIGSYS, SigSysHandler);
|
||||
oldHandler = signal(SIGSYS, SigSysHandler);
|
||||
|
||||
badSysCall = FALSE;
|
||||
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
|
||||
|
|
@ -185,7 +183,7 @@ CheckForShmSyscall(void)
|
|||
/* Allocation failed */
|
||||
badSysCall = TRUE;
|
||||
}
|
||||
OsSignal(SIGSYS, oldHandler);
|
||||
signal(SIGSYS, oldHandler);
|
||||
return !badSysCall;
|
||||
}
|
||||
|
||||
|
|
@ -210,7 +208,7 @@ ShmInitScreenPriv(ScreenPtr pScreen)
|
|||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
||||
|
||||
if (!screen_priv) {
|
||||
screen_priv = XNFcallocarray(1, sizeof(ShmScrPrivateRec));
|
||||
screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
|
||||
screen_priv->CloseScreen = pScreen->CloseScreen;
|
||||
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
|
||||
pScreen->CloseScreen = ShmCloseScreen;
|
||||
|
|
@ -251,19 +249,18 @@ ShmDestroyPixmap(PixmapPtr pPixmap)
|
|||
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
||||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
||||
void *shmdesc = NULL;
|
||||
Bool ret = TRUE;
|
||||
Bool ret;
|
||||
|
||||
if (pPixmap->refcnt == 1)
|
||||
shmdesc = dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey);
|
||||
|
||||
pScreen->DestroyPixmap = screen_priv->destroyPixmap;
|
||||
if (pScreen->DestroyPixmap)
|
||||
ret = pScreen->DestroyPixmap(pPixmap);
|
||||
ret = (*pScreen->DestroyPixmap) (pPixmap);
|
||||
screen_priv->destroyPixmap = pScreen->DestroyPixmap;
|
||||
pScreen->DestroyPixmap = ShmDestroyPixmap;
|
||||
|
||||
if (shmdesc)
|
||||
ShmDetachSegment(shmdesc, 0);
|
||||
ShmDetachSegment(shmdesc, pPixmap->drawable.id);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -304,8 +301,8 @@ ProcShmQueryVersion(ClientPtr client)
|
|||
}
|
||||
|
||||
/*
|
||||
* Simulate the access() system call for a shared memory segment,
|
||||
* using the credentials from the client if available.
|
||||
* Simulate the access() system call for a shared memory segement,
|
||||
* using the credentials from the client if available
|
||||
*/
|
||||
static int
|
||||
shm_access(ClientPtr client, SHMPERM_TYPE * perm, int readonly)
|
||||
|
|
@ -407,7 +404,7 @@ ProcShmAttach(ClientPtr client)
|
|||
}
|
||||
|
||||
/* The attach was performed with root privs. We must
|
||||
* do manual checking of access rights for the credentials
|
||||
* do manual checking of access rights for the credentials
|
||||
* of the client */
|
||||
|
||||
if (shm_access(client, &(SHM_PERM(buf)), stuff->readOnly) == -1) {
|
||||
|
|
@ -430,7 +427,7 @@ ProcShmAttach(ClientPtr client)
|
|||
|
||||
/*ARGSUSED*/ static int
|
||||
ShmDetachSegment(void *value, /* must conform to DeleteType */
|
||||
XID unused)
|
||||
XID shmseg)
|
||||
{
|
||||
ShmDescPtr shmdesc = (ShmDescPtr) value;
|
||||
ShmDescPtr *prev;
|
||||
|
|
@ -460,7 +457,7 @@ ProcShmDetach(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xShmDetachReq);
|
||||
VERIFY_SHMSEG(stuff->shmseg, shmdesc, client);
|
||||
FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
|
||||
FreeResource(stuff->shmseg, RT_NONE);
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
@ -482,8 +479,8 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
|
|||
PixmapBytePad(w, depth), data);
|
||||
if (!pPixmap)
|
||||
return;
|
||||
(void) pGC->ops->CopyArea((DrawablePtr) pPixmap, dst, pGC,
|
||||
sx, sy, sw, sh, dx, dy);
|
||||
pGC->ops->CopyArea((DrawablePtr) pPixmap, dst, pGC, sx, sy, sw, sh, dx,
|
||||
dy);
|
||||
FreeScratchPixmapHeader(pPixmap);
|
||||
}
|
||||
else {
|
||||
|
|
@ -622,7 +619,6 @@ ProcShmGetImage(ClientPtr client)
|
|||
xShmGetImageReply xgi;
|
||||
ShmDescPtr shmdesc;
|
||||
VisualID visual = None;
|
||||
RegionPtr pVisibleRegion = NULL;
|
||||
int rc;
|
||||
|
||||
REQUEST(xShmGetImageReq);
|
||||
|
|
@ -654,11 +650,6 @@ ProcShmGetImage(ClientPtr client)
|
|||
wBorderWidth((WindowPtr) pDraw) + (int) pDraw->height)
|
||||
return BadMatch;
|
||||
visual = wVisual(((WindowPtr) pDraw));
|
||||
if (pDraw->type == DRAWABLE_WINDOW)
|
||||
pVisibleRegion = &((WindowPtr) pDraw)->borderClip;
|
||||
pDraw->pScreen->SourceValidate(pDraw, stuff->x, stuff->y,
|
||||
stuff->width, stuff->height,
|
||||
IncludeInferiors);
|
||||
}
|
||||
else {
|
||||
if (stuff->x < 0 ||
|
||||
|
|
@ -695,11 +686,6 @@ ProcShmGetImage(ClientPtr client)
|
|||
stuff->width, stuff->height,
|
||||
stuff->format, stuff->planeMask,
|
||||
shmdesc->addr + stuff->offset);
|
||||
if (pVisibleRegion)
|
||||
XaceCensorImage(client, pVisibleRegion,
|
||||
PixmapBytePad(stuff->width, pDraw->depth), pDraw,
|
||||
stuff->x, stuff->y, stuff->width, stuff->height,
|
||||
stuff->format, shmdesc->addr + stuff->offset);
|
||||
}
|
||||
else {
|
||||
|
||||
|
|
@ -711,11 +697,6 @@ ProcShmGetImage(ClientPtr client)
|
|||
stuff->width, stuff->height,
|
||||
stuff->format, plane,
|
||||
shmdesc->addr + length);
|
||||
if (pVisibleRegion)
|
||||
XaceCensorImage(client, pVisibleRegion,
|
||||
BitmapBytePad(stuff->width), pDraw,
|
||||
stuff->x, stuff->y, stuff->width, stuff->height,
|
||||
stuff->format, shmdesc->addr + length);
|
||||
length += lenPer;
|
||||
}
|
||||
}
|
||||
|
|
@ -732,7 +713,7 @@ ProcShmGetImage(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShmPutImage(ClientPtr client)
|
||||
{
|
||||
|
|
@ -841,19 +822,6 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
return BadMatch;
|
||||
}
|
||||
|
||||
if (format == ZPixmap) {
|
||||
widthBytesLine = PixmapBytePad(w, pDraw->depth);
|
||||
length = widthBytesLine * h;
|
||||
}
|
||||
else {
|
||||
widthBytesLine = PixmapBytePad(w, 1);
|
||||
lenPer = widthBytesLine * h;
|
||||
plane = ((Mask) 1) << (pDraw->depth - 1);
|
||||
length = lenPer * Ones(planemask & (plane | (plane - 1)));
|
||||
}
|
||||
|
||||
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
|
||||
|
||||
drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr));
|
||||
if (!drawables)
|
||||
return BadAlloc;
|
||||
|
|
@ -867,12 +835,6 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
return rc;
|
||||
}
|
||||
}
|
||||
FOR_NSCREENS_FORWARD(i) {
|
||||
drawables[i]->pScreen->SourceValidate(drawables[i], 0, 0,
|
||||
drawables[i]->width,
|
||||
drawables[i]->height,
|
||||
IncludeInferiors);
|
||||
}
|
||||
|
||||
xgi = (xShmGetImageReply) {
|
||||
.type = X_Reply,
|
||||
|
|
@ -882,6 +844,18 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
.depth = pDraw->depth
|
||||
};
|
||||
|
||||
if (format == ZPixmap) {
|
||||
widthBytesLine = PixmapBytePad(w, pDraw->depth);
|
||||
length = widthBytesLine * h;
|
||||
}
|
||||
else {
|
||||
widthBytesLine = PixmapBytePad(w, 1);
|
||||
lenPer = widthBytesLine * h;
|
||||
plane = ((Mask) 1) << (pDraw->depth - 1);
|
||||
length = lenPer * Ones(planemask & (plane | (plane - 1)));
|
||||
}
|
||||
|
||||
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
|
||||
xgi.size = length;
|
||||
|
||||
if (length == 0) { /* nothing to do */
|
||||
|
|
@ -997,17 +971,11 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
|
|||
stuff->offset);
|
||||
|
||||
if (pMap) {
|
||||
result = XaceHookResourceAccess(client, stuff->pid,
|
||||
X11_RESTYPE_PIXMAP, pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
|
||||
if (result != Success) {
|
||||
pDraw->pScreen->DestroyPixmap(pMap);
|
||||
break;
|
||||
}
|
||||
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
|
||||
shmdesc->refcnt++;
|
||||
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
pMap->drawable.id = newPix->info[j].id;
|
||||
if (!AddResource(newPix->info[j].id, X11_RESTYPE_PIXMAP, (void *) pMap)) {
|
||||
if (!AddResource(newPix->info[j].id, RT_PIXMAP, (void *) pMap)) {
|
||||
result = BadAlloc;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1018,9 +986,9 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
if (result != Success) {
|
||||
if (result == BadAlloc) {
|
||||
while (j--)
|
||||
FreeResource(newPix->info[j].id, X11_RESTYPE_NONE);
|
||||
FreeResource(newPix->info[j].id, RT_NONE);
|
||||
free(newPix);
|
||||
}
|
||||
else
|
||||
|
|
@ -1028,7 +996,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
|
|||
|
||||
return result;
|
||||
}
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
|
||||
static PixmapPtr
|
||||
fbShmCreatePixmap(ScreenPtr pScreen,
|
||||
|
|
@ -1112,8 +1080,8 @@ ProcShmCreatePixmap(ClientPtr client)
|
|||
shmdesc->addr +
|
||||
stuff->offset);
|
||||
if (pMap) {
|
||||
rc = XaceHookResourceAccess(client, stuff->pid, X11_RESTYPE_PIXMAP,
|
||||
pMap, X11_RESTYPE_NONE, NULL, DixCreateAccess);
|
||||
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
|
||||
pMap, RT_NONE, NULL, DixCreateAccess);
|
||||
if (rc != Success) {
|
||||
pDraw->pScreen->DestroyPixmap(pMap);
|
||||
return rc;
|
||||
|
|
@ -1122,7 +1090,7 @@ ProcShmCreatePixmap(ClientPtr client)
|
|||
shmdesc->refcnt++;
|
||||
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
pMap->drawable.id = stuff->pid;
|
||||
if (AddResource(stuff->pid, X11_RESTYPE_PIXMAP, (void *) pMap)) {
|
||||
if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap)) {
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
|
|
@ -1140,7 +1108,7 @@ ShmBusfaultNotify(void *context)
|
|||
(unsigned int) shmdesc->resource);
|
||||
busfault_unregister(shmdesc->busfault);
|
||||
shmdesc->busfault = NULL;
|
||||
FreeResource (shmdesc->resource, X11_RESTYPE_NONE);
|
||||
FreeResource (shmdesc->resource, RT_NONE);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -1179,7 +1147,7 @@ ProcShmAttachFd(ClientPtr client)
|
|||
fd, 0);
|
||||
|
||||
close(fd);
|
||||
if (shmdesc->addr == ((char *) -1)) {
|
||||
if ((shmdesc->addr == ((char *) -1))) {
|
||||
free(shmdesc);
|
||||
return BadAccess;
|
||||
}
|
||||
|
|
@ -1207,55 +1175,30 @@ ProcShmAttachFd(ClientPtr client)
|
|||
static int
|
||||
shm_tmpfile(void)
|
||||
{
|
||||
const char *shmdirs[] = {
|
||||
"/run/shm",
|
||||
"/var/tmp",
|
||||
"/tmp",
|
||||
};
|
||||
int fd;
|
||||
|
||||
#ifdef HAVE_MEMFD_CREATE
|
||||
fd = memfd_create("xorg", MFD_CLOEXEC|MFD_ALLOW_SEALING);
|
||||
if (fd != -1) {
|
||||
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK);
|
||||
DebugF ("Using memfd_create\n");
|
||||
return fd;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SHMDIR
|
||||
int fd;
|
||||
int flags;
|
||||
char template[] = SHMDIR "/shmfd-XXXXXX";
|
||||
#ifdef O_TMPFILE
|
||||
for (int i = 0; i < ARRAY_SIZE(shmdirs); i++) {
|
||||
fd = open(shmdirs[i], O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
|
||||
if (fd >= 0) {
|
||||
DebugF ("Using O_TMPFILE\n");
|
||||
return fd;
|
||||
}
|
||||
}
|
||||
ErrorF ("Not using O_TMPFILE\n");
|
||||
fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
|
||||
if (fd >= 0) {
|
||||
ErrorF ("Using O_TMPFILE\n");
|
||||
return fd;
|
||||
}
|
||||
ErrorF ("Not using O_TMPFILE\n");
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(shmdirs); i++) {
|
||||
char template[PATH_MAX];
|
||||
snprintf(template, ARRAY_SIZE(template), "%s/shmfd-XXXXXX", shmdirs[i]);
|
||||
#ifdef HAVE_MKOSTEMP
|
||||
fd = mkostemp(template, O_CLOEXEC);
|
||||
fd = mkstemp(template);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
unlink(template);
|
||||
if (fcntl(fd, F_GETFD, &flags) >= 0) {
|
||||
flags |= FD_CLOEXEC;
|
||||
(void) fcntl(fd, F_SETFD, &flags);
|
||||
}
|
||||
return fd;
|
||||
#else
|
||||
fd = mkstemp(template);
|
||||
return -1;
|
||||
#endif
|
||||
if (fd < 0)
|
||||
continue;
|
||||
unlink(template);
|
||||
#ifndef HAVE_MKOSTEMP
|
||||
int flags = fcntl(fd, F_GETFD);
|
||||
if (flags != -1) {
|
||||
flags |= FD_CLOEXEC;
|
||||
(void) fcntl(fd, F_SETFD, flags);
|
||||
}
|
||||
#endif
|
||||
return fd;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -1272,7 +1215,6 @@ ProcShmCreateSegment(ClientPtr client)
|
|||
};
|
||||
|
||||
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
|
||||
LEGAL_NEW_RESOURCE(stuff->shmseg, client);
|
||||
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
|
||||
client->errorValue = stuff->readOnly;
|
||||
return BadValue;
|
||||
|
|
@ -1295,7 +1237,7 @@ ProcShmCreateSegment(ClientPtr client)
|
|||
MAP_SHARED,
|
||||
fd, 0);
|
||||
|
||||
if (shmdesc->addr == ((char *) -1)) {
|
||||
if ((shmdesc->addr == ((char *) -1))) {
|
||||
close(fd);
|
||||
free(shmdesc);
|
||||
return BadAccess;
|
||||
|
|
@ -1322,7 +1264,7 @@ ProcShmCreateSegment(ClientPtr client)
|
|||
}
|
||||
|
||||
if (WriteFdToClient(client, fd, TRUE) < 0) {
|
||||
FreeResource(stuff->shmseg, X11_RESTYPE_NONE);
|
||||
FreeResource(stuff->shmseg, RT_NONE);
|
||||
close(fd);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -1335,35 +1277,30 @@ static int
|
|||
ProcShmDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
if (stuff->data == X_ShmQueryVersion)
|
||||
return ProcShmQueryVersion(client);
|
||||
|
||||
if (!client->local)
|
||||
return BadRequest;
|
||||
|
||||
switch (stuff->data) {
|
||||
case X_ShmQueryVersion:
|
||||
return ProcShmQueryVersion(client);
|
||||
case X_ShmAttach:
|
||||
return ProcShmAttach(client);
|
||||
case X_ShmDetach:
|
||||
return ProcShmDetach(client);
|
||||
case X_ShmPutImage:
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension)
|
||||
return ProcPanoramiXShmPutImage(client);
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
return ProcShmPutImage(client);
|
||||
case X_ShmGetImage:
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension)
|
||||
return ProcPanoramiXShmGetImage(client);
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
return ProcShmGetImage(client);
|
||||
case X_ShmCreatePixmap:
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension)
|
||||
return ProcPanoramiXShmCreatePixmap(client);
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
return ProcShmCreatePixmap(client);
|
||||
#ifdef SHM_FD_PASSING
|
||||
case X_ShmAttachFd:
|
||||
|
|
@ -1376,7 +1313,7 @@ ProcShmDispatch(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
static void _X_COLD
|
||||
static void
|
||||
SShmCompletionEvent(xShmCompletionEvent * from, xShmCompletionEvent * to)
|
||||
{
|
||||
to->type = from->type;
|
||||
|
|
@ -1388,29 +1325,41 @@ SShmCompletionEvent(xShmCompletionEvent * from, xShmCompletionEvent * to)
|
|||
cpswapl(from->offset, to->offset);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShmQueryVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShmQueryVersionReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
return ProcShmQueryVersion(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcShmAttach(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShmAttachReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShmAttachReq);
|
||||
swapl(&stuff->shmseg);
|
||||
swapl(&stuff->shmid);
|
||||
return ProcShmAttach(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShmDetach(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShmDetachReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShmDetachReq);
|
||||
swapl(&stuff->shmseg);
|
||||
return ProcShmDetach(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShmPutImage(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShmPutImageReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShmPutImageReq);
|
||||
swapl(&stuff->drawable);
|
||||
swapl(&stuff->gc);
|
||||
|
|
@ -1427,10 +1376,11 @@ SProcShmPutImage(ClientPtr client)
|
|||
return ProcShmPutImage(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShmGetImage(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShmGetImageReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShmGetImageReq);
|
||||
swapl(&stuff->drawable);
|
||||
swaps(&stuff->x);
|
||||
|
|
@ -1443,10 +1393,11 @@ SProcShmGetImage(ClientPtr client)
|
|||
return ProcShmGetImage(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShmCreatePixmap(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShmCreatePixmapReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
|
||||
swapl(&stuff->pid);
|
||||
swapl(&stuff->drawable);
|
||||
|
|
@ -1458,20 +1409,22 @@ SProcShmCreatePixmap(ClientPtr client)
|
|||
}
|
||||
|
||||
#ifdef SHM_FD_PASSING
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShmAttachFd(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShmAttachFdReq);
|
||||
SetReqFds(client, 1);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShmAttachFdReq);
|
||||
swapl(&stuff->shmseg);
|
||||
return ProcShmAttachFd(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShmCreateSegment(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShmCreateSegmentReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
|
||||
swapl(&stuff->shmseg);
|
||||
swapl(&stuff->size);
|
||||
|
|
@ -1479,18 +1432,13 @@ SProcShmCreateSegment(ClientPtr client)
|
|||
}
|
||||
#endif /* SHM_FD_PASSING */
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcShmDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
if (stuff->data == X_ShmQueryVersion)
|
||||
return ProcShmQueryVersion(client);
|
||||
|
||||
if (!client->local)
|
||||
return BadRequest;
|
||||
|
||||
switch (stuff->data) {
|
||||
case X_ShmQueryVersion:
|
||||
return SProcShmQueryVersion(client);
|
||||
case X_ShmAttach:
|
||||
return SProcShmAttach(client);
|
||||
case X_ShmDetach:
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ in this Software without prior written authorization from The Open Group.
|
|||
|
||||
/* dixsleep.c - implement millisecond timeouts for X clients */
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "sleepuntil.h"
|
||||
#include <X11/X.h>
|
||||
|
|
@ -61,11 +63,14 @@ static void ClientAwaken(ClientPtr /* client */ ,
|
|||
static int SertafiedDelete(void * /* value */ ,
|
||||
XID /* id */
|
||||
);
|
||||
static void SertafiedBlockHandler(void *data,
|
||||
void *timeout);
|
||||
|
||||
static void SertafiedWakeupHandler(void *data,
|
||||
int i);
|
||||
static void SertafiedBlockHandler(void * /* data */ ,
|
||||
OSTimePtr /* wt */ ,
|
||||
void * /* LastSelectMask */
|
||||
);
|
||||
static void SertafiedWakeupHandler(void * /* data */ ,
|
||||
int /* i */ ,
|
||||
void * /* LastSelectMask */
|
||||
);
|
||||
|
||||
int
|
||||
ClientSleepUntil(ClientPtr client,
|
||||
|
|
@ -123,7 +128,8 @@ ClientSleepUntil(ClientPtr client,
|
|||
static void
|
||||
ClientAwaken(ClientPtr client, void *closure)
|
||||
{
|
||||
AttendClient(client);
|
||||
if (!client->clientGone)
|
||||
AttendClient(client);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -148,7 +154,7 @@ SertafiedDelete(void *value, XID id)
|
|||
}
|
||||
|
||||
static void
|
||||
SertafiedBlockHandler(void *data, void *wt)
|
||||
SertafiedBlockHandler(void *data, OSTimePtr wt, void *LastSelectMask)
|
||||
{
|
||||
SertafiedPtr pReq, pNext;
|
||||
unsigned long delay;
|
||||
|
|
@ -164,7 +170,7 @@ SertafiedBlockHandler(void *data, void *wt)
|
|||
pNext = pReq->next;
|
||||
if (CompareTimeStamps(pReq->revive, now) == LATER)
|
||||
break;
|
||||
FreeResource(pReq->id, X11_RESTYPE_NONE);
|
||||
FreeResource(pReq->id, RT_NONE);
|
||||
|
||||
/* AttendClient() may have been called via the resource delete
|
||||
* function so a client may have input to be processed and so
|
||||
|
|
@ -180,7 +186,7 @@ SertafiedBlockHandler(void *data, void *wt)
|
|||
}
|
||||
|
||||
static void
|
||||
SertafiedWakeupHandler(void *data, int i)
|
||||
SertafiedWakeupHandler(void *data, int i, void *LastSelectMask)
|
||||
{
|
||||
SertafiedPtr pReq, pNext;
|
||||
TimeStamp now;
|
||||
|
|
@ -193,7 +199,7 @@ SertafiedWakeupHandler(void *data, int i)
|
|||
pNext = pReq->next;
|
||||
if (CompareTimeStamps(pReq->revive, now) == LATER)
|
||||
break;
|
||||
FreeResource(pReq->id, X11_RESTYPE_NONE);
|
||||
FreeResource(pReq->id, RT_NONE);
|
||||
}
|
||||
if (!pPending) {
|
||||
RemoveBlockAndWakeupHandlers(SertafiedBlockHandler,
|
||||
|
|
|
|||
675
Xext/sync.c
675
Xext/sync.c
File diff suppressed because it is too large
Load diff
|
|
@ -29,9 +29,6 @@
|
|||
extern _X_EXPORT int
|
||||
SyncVerifyFence(SyncFence ** ppFence, XID fid, ClientPtr client, Mask mode);
|
||||
|
||||
extern _X_EXPORT SyncObject*
|
||||
SyncCreate(ClientPtr client, XID id, unsigned char type);
|
||||
|
||||
#define VERIFY_SYNC_FENCE(pFence, fid, client, mode) \
|
||||
do { \
|
||||
int rc; \
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ and Olivetti Research Limited, Cambridge, England.
|
|||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the names of Digital or Olivetti
|
||||
not be used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
|
|
@ -67,19 +67,19 @@ typedef enum {
|
|||
} SyncCounterType;
|
||||
|
||||
typedef void (*SyncSystemCounterQueryValue)(void *counter,
|
||||
int64_t *value_return
|
||||
CARD64 *value_return
|
||||
);
|
||||
typedef void (*SyncSystemCounterBracketValues)(void *counter,
|
||||
int64_t *pbracket_less,
|
||||
int64_t *pbracket_greater
|
||||
CARD64 *pbracket_less,
|
||||
CARD64 *pbracket_greater
|
||||
);
|
||||
|
||||
typedef struct _SysCounterInfo {
|
||||
SyncCounter *pCounter;
|
||||
char *name;
|
||||
int64_t resolution;
|
||||
int64_t bracket_greater;
|
||||
int64_t bracket_less;
|
||||
CARD64 resolution;
|
||||
CARD64 bracket_greater;
|
||||
CARD64 bracket_less;
|
||||
SyncCounterType counterType; /* how can this counter change */
|
||||
SyncSystemCounterQueryValue QueryValue;
|
||||
SyncSystemCounterBracketValues BracketValues;
|
||||
|
|
@ -97,7 +97,7 @@ typedef struct _SyncAlarm {
|
|||
SyncTrigger trigger;
|
||||
ClientPtr client;
|
||||
XSyncAlarm alarm_id;
|
||||
int64_t delta;
|
||||
CARD64 delta;
|
||||
int events;
|
||||
int state;
|
||||
SyncAlarmClientList *pEventClients;
|
||||
|
|
@ -111,7 +111,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
SyncTrigger trigger;
|
||||
int64_t event_threshold;
|
||||
CARD64 event_threshold;
|
||||
SyncAwaitHeader *pHeader;
|
||||
} SyncAwait;
|
||||
|
||||
|
|
@ -121,15 +121,16 @@ typedef union {
|
|||
} SyncAwaitUnion;
|
||||
|
||||
extern SyncCounter* SyncCreateSystemCounter(const char *name,
|
||||
int64_t initial_value,
|
||||
int64_t resolution,
|
||||
CARD64 initial_value,
|
||||
CARD64 resolution,
|
||||
SyncCounterType counterType,
|
||||
SyncSystemCounterQueryValue QueryValue,
|
||||
SyncSystemCounterBracketValues BracketValues
|
||||
);
|
||||
|
||||
extern void SyncChangeCounter(SyncCounter *pCounter,
|
||||
int64_t new_value);
|
||||
CARD64 new_value
|
||||
);
|
||||
|
||||
extern void SyncDestroySystemCounter(void *pCounter);
|
||||
|
||||
|
|
|
|||
272
Xext/xace.c
272
Xext/xace.c
|
|
@ -17,12 +17,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
********************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "os/client_priv.h"
|
||||
|
||||
#include "scrnintstr.h"
|
||||
#include "extnsionst.h"
|
||||
#include "pixmapstr.h"
|
||||
|
|
@ -30,20 +29,37 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "gcstruct.h"
|
||||
#include "xacestr.h"
|
||||
|
||||
CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = { 0 };
|
||||
#define XSERV_t
|
||||
#define TRANS_SERVER
|
||||
#include <X11/Xtrans/Xtrans.h>
|
||||
#include "../os/osdep.h"
|
||||
|
||||
_X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = { 0 };
|
||||
|
||||
/* Special-cased hook functions. Called by Xserver.
|
||||
*/
|
||||
int
|
||||
XaceHookDispatch0(ClientPtr client, int major)
|
||||
XaceHookDispatch(ClientPtr client, int major)
|
||||
{
|
||||
/* Call the extension dispatch hook */
|
||||
ExtensionEntry *ext = GetExtensionEntry(major);
|
||||
XaceExtAccessRec erec = { client, ext, DixUseAccess, Success };
|
||||
if (ext)
|
||||
CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &erec);
|
||||
/* On error, pretend extension doesn't exist */
|
||||
return (erec.status == Success) ? Success : BadRequest;
|
||||
/* Call the audit begin callback, there is no return value. */
|
||||
XaceAuditRec rec = { client, 0 };
|
||||
CallCallbacks(&XaceHooks[XACE_AUDIT_BEGIN], &rec);
|
||||
|
||||
if (major < 128) {
|
||||
/* Call the core dispatch hook */
|
||||
XaceCoreDispatchRec drec = { client, Success /* default allow */ };
|
||||
CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &drec);
|
||||
return drec.status;
|
||||
}
|
||||
else {
|
||||
/* Call the extension dispatch hook */
|
||||
ExtensionEntry *ext = GetExtensionEntry(major);
|
||||
XaceExtAccessRec erec = { client, ext, DixUseAccess, Success };
|
||||
if (ext)
|
||||
CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &erec);
|
||||
/* On error, pretend extension doesn't exist */
|
||||
return (erec.status == Success) ? Success : BadRequest;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -63,100 +79,138 @@ XaceHookSelectionAccess(ClientPtr client, Selection ** ppSel, Mask access_mode)
|
|||
return rec.status;
|
||||
}
|
||||
|
||||
int XaceHookResourceAccess(ClientPtr client, XID id, RESTYPE rtype, void *res,
|
||||
RESTYPE ptype, void *parent, Mask access_mode)
|
||||
void
|
||||
XaceHookAuditEnd(ClientPtr ptr, int result)
|
||||
{
|
||||
XaceResourceAccessRec rec = { client, id, rtype, res, ptype, parent,
|
||||
access_mode, Success };
|
||||
CallCallbacks(&XaceHooks[XACE_RESOURCE_ACCESS], &rec);
|
||||
return rec.status;
|
||||
XaceAuditRec rec = { ptr, result };
|
||||
/* call callbacks, there is no return value. */
|
||||
CallCallbacks(&XaceHooks[XACE_AUDIT_END], &rec);
|
||||
}
|
||||
|
||||
int XaceHookDeviceAccess(ClientPtr client, DeviceIntPtr dev, Mask access_mode)
|
||||
{
|
||||
XaceDeviceAccessRec rec = { client, dev, access_mode, Success };
|
||||
CallCallbacks(&XaceHooks[XACE_DEVICE_ACCESS], &rec);
|
||||
return rec.status;
|
||||
}
|
||||
|
||||
int XaceHookSendAccess(ClientPtr client, DeviceIntPtr dev, WindowPtr win,
|
||||
xEventPtr ev, int count)
|
||||
{
|
||||
XaceSendAccessRec rec = { client, dev, win, ev, count, Success };
|
||||
CallCallbacks(&XaceHooks[XACE_SEND_ACCESS], &rec);
|
||||
return rec.status;
|
||||
}
|
||||
|
||||
int XaceHookReceiveAccess(ClientPtr client, WindowPtr win,
|
||||
xEventPtr ev, int count)
|
||||
{
|
||||
XaceReceiveAccessRec rec = { client, win, ev, count, Success };
|
||||
CallCallbacks(&XaceHooks[XACE_RECEIVE_ACCESS], &rec);
|
||||
return rec.status;
|
||||
}
|
||||
|
||||
int XaceHookClientAccess(ClientPtr client, ClientPtr target, Mask access_mode)
|
||||
{
|
||||
XaceClientAccessRec rec = { client, target, access_mode, Success };
|
||||
CallCallbacks(&XaceHooks[XACE_CLIENT_ACCESS], &rec);
|
||||
return rec.status;
|
||||
}
|
||||
|
||||
int XaceHookExtAccess(ClientPtr client, ExtensionEntry *ext)
|
||||
{
|
||||
XaceExtAccessRec rec = { client, ext, DixGetAttrAccess, Success };
|
||||
CallCallbacks(&XaceHooks[XACE_EXT_ACCESS], &rec);
|
||||
return rec.status;
|
||||
}
|
||||
|
||||
int XaceHookServerAccess(ClientPtr client, Mask access_mode)
|
||||
{
|
||||
XaceServerAccessRec rec = { client, access_mode, Success };
|
||||
CallCallbacks(&XaceHooks[XACE_SERVER_ACCESS], &rec);
|
||||
return rec.status;
|
||||
}
|
||||
|
||||
int XaceHookScreenAccess(ClientPtr client, ScreenPtr screen, Mask access_mode)
|
||||
{
|
||||
XaceScreenAccessRec rec = { client, screen, access_mode, Success };
|
||||
CallCallbacks(&XaceHooks[XACE_SCREEN_ACCESS], &rec);
|
||||
return rec.status;
|
||||
}
|
||||
|
||||
int XaceHookScreensaverAccess(ClientPtr client, ScreenPtr screen, Mask access_mode)
|
||||
{
|
||||
XaceScreenAccessRec rec = { client, screen, access_mode, Success };
|
||||
CallCallbacks(&XaceHooks[XACE_SCREENSAVER_ACCESS], &rec);
|
||||
return rec.status;
|
||||
}
|
||||
|
||||
int XaceHookAuthAvail(ClientPtr client, XID authId)
|
||||
{
|
||||
XaceAuthAvailRec rec = { client, authId };
|
||||
CallCallbacks(&XaceHooks[XACE_AUTH_AVAIL], &rec);
|
||||
return Success;
|
||||
}
|
||||
|
||||
int XaceHookKeyAvail(xEventPtr ev, DeviceIntPtr dev, int count)
|
||||
{
|
||||
XaceKeyAvailRec rec = { ev, dev, count };
|
||||
CallCallbacks(&XaceHooks[XACE_KEY_AVAIL], &rec);
|
||||
return Success;
|
||||
}
|
||||
|
||||
/* XaceHookIsSet
|
||||
*
|
||||
* Utility function to determine whether there are any callbacks listening on a
|
||||
* particular XACE hook.
|
||||
*
|
||||
* Returns non-zero if there is a callback, zero otherwise.
|
||||
/* Entry point for hook functions. Called by Xserver.
|
||||
*/
|
||||
int
|
||||
XaceHookIsSet(int hook)
|
||||
XaceHook(int hook, ...)
|
||||
{
|
||||
if (hook < 0 || hook >= XACE_NUM_HOOKS)
|
||||
return 0;
|
||||
return XaceHooks[hook] != NULL;
|
||||
union {
|
||||
XaceResourceAccessRec res;
|
||||
XaceDeviceAccessRec dev;
|
||||
XaceSendAccessRec send;
|
||||
XaceReceiveAccessRec recv;
|
||||
XaceClientAccessRec client;
|
||||
XaceExtAccessRec ext;
|
||||
XaceServerAccessRec server;
|
||||
XaceScreenAccessRec screen;
|
||||
XaceAuthAvailRec auth;
|
||||
XaceKeyAvailRec key;
|
||||
} u;
|
||||
int *prv = NULL; /* points to return value from callback */
|
||||
va_list ap; /* argument list */
|
||||
|
||||
if (!XaceHooks[hook])
|
||||
return Success;
|
||||
|
||||
va_start(ap, hook);
|
||||
|
||||
/* Marshal arguments for passing to callback.
|
||||
* Each callback has its own case, which sets up a structure to hold
|
||||
* the arguments and integer return parameter, or in some cases just
|
||||
* sets calldata directly to a single argument (with no return result)
|
||||
*/
|
||||
switch (hook) {
|
||||
case XACE_RESOURCE_ACCESS:
|
||||
u.res.client = va_arg(ap, ClientPtr);
|
||||
u.res.id = va_arg(ap, XID);
|
||||
u.res.rtype = va_arg(ap, RESTYPE);
|
||||
u.res.res = va_arg(ap, void *);
|
||||
u.res.ptype = va_arg(ap, RESTYPE);
|
||||
u.res.parent = va_arg(ap, void *);
|
||||
u.res.access_mode = va_arg(ap, Mask);
|
||||
|
||||
u.res.status = Success; /* default allow */
|
||||
prv = &u.res.status;
|
||||
break;
|
||||
case XACE_DEVICE_ACCESS:
|
||||
u.dev.client = va_arg(ap, ClientPtr);
|
||||
u.dev.dev = va_arg(ap, DeviceIntPtr);
|
||||
u.dev.access_mode = va_arg(ap, Mask);
|
||||
|
||||
u.dev.status = Success; /* default allow */
|
||||
prv = &u.dev.status;
|
||||
break;
|
||||
case XACE_SEND_ACCESS:
|
||||
u.send.client = va_arg(ap, ClientPtr);
|
||||
u.send.dev = va_arg(ap, DeviceIntPtr);
|
||||
u.send.pWin = va_arg(ap, WindowPtr);
|
||||
|
||||
u.send.events = va_arg(ap, xEventPtr);
|
||||
u.send.count = va_arg(ap, int);
|
||||
|
||||
u.send.status = Success; /* default allow */
|
||||
prv = &u.send.status;
|
||||
break;
|
||||
case XACE_RECEIVE_ACCESS:
|
||||
u.recv.client = va_arg(ap, ClientPtr);
|
||||
u.recv.pWin = va_arg(ap, WindowPtr);
|
||||
|
||||
u.recv.events = va_arg(ap, xEventPtr);
|
||||
u.recv.count = va_arg(ap, int);
|
||||
|
||||
u.recv.status = Success; /* default allow */
|
||||
prv = &u.recv.status;
|
||||
break;
|
||||
case XACE_CLIENT_ACCESS:
|
||||
u.client.client = va_arg(ap, ClientPtr);
|
||||
u.client.target = va_arg(ap, ClientPtr);
|
||||
u.client.access_mode = va_arg(ap, Mask);
|
||||
|
||||
u.client.status = Success; /* default allow */
|
||||
prv = &u.client.status;
|
||||
break;
|
||||
case XACE_EXT_ACCESS:
|
||||
u.ext.client = va_arg(ap, ClientPtr);
|
||||
|
||||
u.ext.ext = va_arg(ap, ExtensionEntry *);
|
||||
u.ext.access_mode = DixGetAttrAccess;
|
||||
u.ext.status = Success; /* default allow */
|
||||
prv = &u.ext.status;
|
||||
break;
|
||||
case XACE_SERVER_ACCESS:
|
||||
u.server.client = va_arg(ap, ClientPtr);
|
||||
u.server.access_mode = va_arg(ap, Mask);
|
||||
|
||||
u.server.status = Success; /* default allow */
|
||||
prv = &u.server.status;
|
||||
break;
|
||||
case XACE_SCREEN_ACCESS:
|
||||
case XACE_SCREENSAVER_ACCESS:
|
||||
u.screen.client = va_arg(ap, ClientPtr);
|
||||
u.screen.screen = va_arg(ap, ScreenPtr);
|
||||
u.screen.access_mode = va_arg(ap, Mask);
|
||||
|
||||
u.screen.status = Success; /* default allow */
|
||||
prv = &u.screen.status;
|
||||
break;
|
||||
case XACE_AUTH_AVAIL:
|
||||
u.auth.client = va_arg(ap, ClientPtr);
|
||||
u.auth.authId = va_arg(ap, XID);
|
||||
|
||||
break;
|
||||
case XACE_KEY_AVAIL:
|
||||
u.key.event = va_arg(ap, xEventPtr);
|
||||
u.key.keybd = va_arg(ap, DeviceIntPtr);
|
||||
u.key.count = va_arg(ap, int);
|
||||
|
||||
break;
|
||||
default:
|
||||
va_end(ap);
|
||||
return 0; /* unimplemented hook number */
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
/* call callbacks and return result, if any. */
|
||||
CallCallbacks(&XaceHooks[hook], &u);
|
||||
return prv ? *prv : Success;
|
||||
}
|
||||
|
||||
/* XaceCensorImage
|
||||
|
|
@ -191,10 +245,10 @@ XaceCensorImage(ClientPtr client,
|
|||
BoxRec imageBox;
|
||||
int nRects;
|
||||
|
||||
imageBox.x1 = pDraw->x + x;
|
||||
imageBox.y1 = pDraw->y + y;
|
||||
imageBox.x2 = pDraw->x + x + w;
|
||||
imageBox.y2 = pDraw->y + y + h;
|
||||
imageBox.x1 = x;
|
||||
imageBox.y1 = y;
|
||||
imageBox.x2 = x + w;
|
||||
imageBox.y2 = y + h;
|
||||
RegionInit(&imageRegion, &imageBox, 1);
|
||||
RegionNull(&censorRegion);
|
||||
|
||||
|
|
@ -219,7 +273,7 @@ XaceCensorImage(ClientPtr client,
|
|||
goto failSafe;
|
||||
}
|
||||
for (pBox = RegionRects(&censorRegion), i = 0; i < nRects; i++, pBox++) {
|
||||
pRects[i].x = pBox->x1 - imageBox.x1;
|
||||
pRects[i].x = pBox->x1;
|
||||
pRects[i].y = pBox->y1 - imageBox.y1;
|
||||
pRects[i].width = pBox->x2 - pBox->x1;
|
||||
pRects[i].height = pBox->y2 - pBox->y1;
|
||||
|
|
@ -273,11 +327,15 @@ XaceCensorImage(ClientPtr client,
|
|||
int
|
||||
XaceGetConnectionNumber(ClientPtr client)
|
||||
{
|
||||
return GetClientFd(client);
|
||||
XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
|
||||
|
||||
return _XSERVTransGetConnectionNumber(ci);
|
||||
}
|
||||
|
||||
int
|
||||
XaceIsLocal(ClientPtr client)
|
||||
{
|
||||
return ClientIsLocal(client);
|
||||
XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
|
||||
|
||||
return _XSERVTransIsLocal(ci);
|
||||
}
|
||||
|
|
|
|||
62
Xext/xace.h
62
Xext/xace.h
|
|
@ -25,7 +25,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define XACE_MAJOR_VERSION 2
|
||||
#define XACE_MINOR_VERSION 0
|
||||
|
||||
#include "extnsionst.h"
|
||||
#include "pixmap.h"
|
||||
#include "region.h"
|
||||
#include "window.h"
|
||||
|
|
@ -53,7 +52,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define XACE_SCREENSAVER_ACCESS 12
|
||||
#define XACE_AUTH_AVAIL 13
|
||||
#define XACE_KEY_AVAIL 14
|
||||
#define XACE_NUM_HOOKS 15
|
||||
#define XACE_AUDIT_BEGIN 15
|
||||
#define XACE_AUDIT_END 16
|
||||
#define XACE_NUM_HOOKS 17
|
||||
|
||||
extern _X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
|
||||
|
||||
|
|
@ -64,40 +65,15 @@ extern _X_EXPORT int XaceHook(int /*hook */ ,
|
|||
... /*appropriate args for hook */
|
||||
);
|
||||
|
||||
/* determine whether any callbacks are present for the XACE hook */
|
||||
extern _X_EXPORT int XaceHookIsSet(int hook);
|
||||
|
||||
/* Special-cased hook functions
|
||||
*/
|
||||
int XaceHookDispatch0(ClientPtr client, int major);
|
||||
#define XaceHookDispatch(c, m) \
|
||||
((XaceHooks[XACE_EXT_DISPATCH] && (m) >= EXTENSION_BASE) ? \
|
||||
XaceHookDispatch0((c), (m)) : \
|
||||
Success)
|
||||
|
||||
extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major);
|
||||
extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
|
||||
PropertyPtr *ppProp,
|
||||
Mask access_mode);
|
||||
extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel,
|
||||
Mask access_mode);
|
||||
|
||||
/* needs to be exported for in-tree modsetting, but not part of public API */
|
||||
_X_EXPORT int XaceHookResourceAccess(ClientPtr client, XID id, RESTYPE rtype, void *res,
|
||||
RESTYPE ptype, void *parent, Mask access_mode);
|
||||
|
||||
int XaceHookDeviceAccess(ClientPtr client, DeviceIntPtr dev, Mask access_mode);
|
||||
|
||||
int XaceHookSendAccess(ClientPtr client, DeviceIntPtr dev, WindowPtr win,
|
||||
xEventPtr ev, int count);
|
||||
int XaceHookReceiveAccess(ClientPtr client, WindowPtr win, xEventPtr ev, int count);
|
||||
int XaceHookClientAccess(ClientPtr client, ClientPtr target, Mask access_mode);
|
||||
int XaceHookExtAccess(ClientPtr client, ExtensionEntry *ext);
|
||||
int XaceHookServerAccess(ClientPtr client, Mask access_mode);
|
||||
int XaceHookScreenAccess(ClientPtr client, ScreenPtr screen, Mask access_mode);
|
||||
int XaceHookScreensaverAccess(ClientPtr client, ScreenPtr screen, Mask access_mode);
|
||||
int XaceHookAuthAvail(ClientPtr client, XID authId);
|
||||
int XaceHookKeyAvail(xEventPtr ev, DeviceIntPtr dev, int count);
|
||||
|
||||
extern _X_EXPORT void XaceHookAuditEnd(ClientPtr ptr, int result);
|
||||
|
||||
/* Register a callback for a given hook.
|
||||
*/
|
||||
|
|
@ -132,38 +108,18 @@ extern _X_EXPORT void XaceCensorImage(ClientPtr client,
|
|||
/* Define calls away when XACE is not being built. */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define XaceHookIsSet(args...) 0
|
||||
#define XaceHook(args...) Success
|
||||
#define XaceHookDispatch(args...) Success
|
||||
#define XaceHookPropertyAccess(args...) Success
|
||||
#define XaceHookSelectionAccess(args...) Success
|
||||
#define XaceHookResourceAccess(args...) Success
|
||||
#define XaceHookDeviceAccess(args...) Success
|
||||
#define XaceHookSendAccess(args...) Success
|
||||
#define XaceHookReceiveAccess(args...) Success
|
||||
#define XaceHookClientAccess(args...) Success
|
||||
#define XaceHookExtAccess(args...) Success
|
||||
#define XaceHookServerAccess(args...) Success
|
||||
#define XaceHookScreenAccess(args...) Success
|
||||
#define XaceHookScreensaverAccess(args...) Success
|
||||
#define XaceHookAuthAvail(args...) Success
|
||||
#define XaceHookKeyAvail(args...) Success
|
||||
#define XaceHookAuditEnd(args...) { ; }
|
||||
#define XaceCensorImage(args...) { ; }
|
||||
#else
|
||||
#define XaceHookIsSet(...) 0
|
||||
#define XaceHook(...) Success
|
||||
#define XaceHookDispatch(...) Success
|
||||
#define XaceHookPropertyAccess(...) Success
|
||||
#define XaceHookSelectionAccess(...) Success
|
||||
#define XaceHookResourceAccess(...) Success
|
||||
#define XaceHookDeviceAccess(...) Success
|
||||
#define XaceHookSendAccess(...) Success
|
||||
#define XaceHookReceiveAccess(...) Success
|
||||
#define XaceHookClientAccess(...) Success
|
||||
#define XaceHookExtAccess(...) Success
|
||||
#define XaceHookServerAccess(...) Success
|
||||
#define XaceHookScreenAccess(...) Success
|
||||
#define XaceHookScreensaverAccess(...) Success
|
||||
#define XaceHookAuthAvail(...) Success
|
||||
#define XaceHookKeyAvail(...) Success
|
||||
#define XaceHookAuditEnd(...) { ; }
|
||||
#define XaceCensorImage(...) { ; }
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ from The Open Group.
|
|||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
|
|
@ -36,7 +38,7 @@ from The Open Group.
|
|||
#include "extnsionst.h"
|
||||
#include "swaprep.h"
|
||||
#include <X11/extensions/xcmiscproto.h>
|
||||
#include "extinit_priv.h"
|
||||
#include "extinit.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
@ -99,7 +101,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
|
|||
if (stuff->count > UINT32_MAX / sizeof(XID))
|
||||
return BadAlloc;
|
||||
|
||||
pids = xallocarray(stuff->count, sizeof(XID));
|
||||
pids = (XID *) malloc(stuff->count * sizeof(XID));
|
||||
if (!pids) {
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -140,27 +142,39 @@ ProcXCMiscDispatch(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXCMiscGetVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXCMiscGetVersionReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
|
||||
swaps(&stuff->majorVersion);
|
||||
swaps(&stuff->minorVersion);
|
||||
return ProcXCMiscGetVersion(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXCMiscGetXIDRange(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
return ProcXCMiscGetXIDRange(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXCMiscGetXIDList(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXCMiscGetXIDListReq);
|
||||
REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->count);
|
||||
return ProcXCMiscGetXIDList(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXCMiscDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
|
@ -168,7 +182,7 @@ SProcXCMiscDispatch(ClientPtr client)
|
|||
case X_XCMiscGetVersion:
|
||||
return SProcXCMiscGetVersion(client);
|
||||
case X_XCMiscGetXIDRange:
|
||||
return ProcXCMiscGetXIDRange(client);
|
||||
return SProcXCMiscGetXIDRange(client);
|
||||
case X_XCMiscGetXIDList:
|
||||
return SProcXCMiscGetXIDList(client);
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -34,10 +34,19 @@
|
|||
* XLoadQueryFont).
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef MITSHM
|
||||
#ifdef HAS_SHM
|
||||
#if defined(linux) && (!defined(__GNU_LIBRARY__) || __GNU_LIBRARY__ < 2)
|
||||
/* libc4 does not define __GNU_LIBRARY__, libc5 defines __GNU_LIBRARY__ as 1 */
|
||||
/* Linux libc4 and libc5 only (because glibc doesn't include kernel headers):
|
||||
Linux 2.0.x and 2.2.x define SHMLBA as PAGE_SIZE, but forget to define
|
||||
PAGE_SIZE. It is defined in <asm/page.h>. */
|
||||
#include <asm/page.h>
|
||||
#endif
|
||||
#ifdef SVR4
|
||||
#include <sys/sysmacros.h>
|
||||
#endif
|
||||
|
|
@ -56,24 +65,22 @@
|
|||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/extensions/xf86bigfproto.h>
|
||||
#include <X11/fonts/fontstruct.h>
|
||||
#include <X11/fonts/libxfont2.h>
|
||||
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "gcstruct.h"
|
||||
#include "dixfontstr.h"
|
||||
#include "extnsionst.h"
|
||||
#include "extinit_priv.h"
|
||||
#include "extinit.h"
|
||||
#include "protocol-versions.h"
|
||||
|
||||
#include <X11/extensions/xf86bigfproto.h>
|
||||
#include "xf86bigfontsrv.h"
|
||||
|
||||
static void XF86BigfontResetProc(ExtensionEntry *extEntry );
|
||||
static void XF86BigfontResetProc(ExtensionEntry * /* extEntry */
|
||||
);
|
||||
|
||||
#ifdef MITSHM
|
||||
#ifdef HAS_SHM
|
||||
|
||||
/* A random signature, transmitted to the clients so they can verify that the
|
||||
shared memory segment they are attaching to was really established by the
|
||||
|
|
@ -89,6 +96,8 @@ static Bool badSysCall = FALSE;
|
|||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
|
||||
|
||||
#include <sys/signal.h>
|
||||
|
||||
static void
|
||||
SigSysHandler(int signo)
|
||||
{
|
||||
|
|
@ -102,7 +111,7 @@ CheckForShmSyscall(void)
|
|||
int shmid = -1;
|
||||
|
||||
/* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
|
||||
oldHandler = OsSignal(SIGSYS, SigSysHandler);
|
||||
oldHandler = signal(SIGSYS, SigSysHandler);
|
||||
|
||||
badSysCall = FALSE;
|
||||
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
|
||||
|
|
@ -114,7 +123,7 @@ CheckForShmSyscall(void)
|
|||
/* Allocation failed */
|
||||
badSysCall = TRUE;
|
||||
}
|
||||
OsSignal(SIGSYS, oldHandler);
|
||||
signal(SIGSYS, oldHandler);
|
||||
return !badSysCall;
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +135,7 @@ CheckForShmSyscall(void)
|
|||
|
||||
/* ========== Management of shared memory segments ========== */
|
||||
|
||||
#ifdef MITSHM
|
||||
#ifdef HAS_SHM
|
||||
|
||||
#ifdef __linux__
|
||||
/* On Linux, shared memory marked as "removed" can still be attached.
|
||||
|
|
@ -221,7 +230,7 @@ shmdealloc(ShmDescPtr pDesc)
|
|||
void
|
||||
XF86BigfontFreeFontShm(FontPtr pFont)
|
||||
{
|
||||
#ifdef MITSHM
|
||||
#ifdef HAS_SHM
|
||||
ShmDescPtr pDesc;
|
||||
|
||||
/* If during shutdown of the server, XF86BigfontCleanup() has already
|
||||
|
|
@ -240,7 +249,7 @@ XF86BigfontFreeFontShm(FontPtr pFont)
|
|||
void
|
||||
XF86BigfontCleanup(void)
|
||||
{
|
||||
#ifdef MITSHM
|
||||
#ifdef HAS_SHM
|
||||
while (ShmList)
|
||||
shmdealloc(ShmList);
|
||||
#endif
|
||||
|
|
@ -277,7 +286,7 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
|
|||
.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION,
|
||||
.uid = geteuid(),
|
||||
.gid = getegid(),
|
||||
#ifdef MITSHM
|
||||
#ifdef HAS_SHM
|
||||
.signature = signature,
|
||||
.capabilities = (client->local && !client->swapped)
|
||||
? XF86Bigfont_CAP_LocalShm : 0
|
||||
|
|
@ -329,7 +338,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
|
|||
int nCharInfos;
|
||||
int shmid;
|
||||
|
||||
#ifdef MITSHM
|
||||
#ifdef HAS_SHM
|
||||
ShmDescPtr pDesc = NULL;
|
||||
#else
|
||||
#define pDesc 0
|
||||
|
|
@ -339,7 +348,9 @@ ProcXF86BigfontQueryFont(ClientPtr client)
|
|||
CARD16 *pUniqIndex2Index;
|
||||
CARD32 nUniqCharInfos;
|
||||
|
||||
/* protocol version is decided based on request packet size */
|
||||
#if 0
|
||||
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
|
||||
#else
|
||||
switch (client->req_len) {
|
||||
case 2: /* client with version 1.0 libX11 */
|
||||
stuff_flags = (client->local &&
|
||||
|
|
@ -351,7 +362,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
|
|||
default:
|
||||
return BadLength;
|
||||
}
|
||||
|
||||
#endif
|
||||
if (dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess) !=
|
||||
Success)
|
||||
return BadFont; /* procotol spec says only error is BadFont */
|
||||
|
|
@ -372,7 +383,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
|
|||
nUniqCharInfos = 0;
|
||||
|
||||
if (nCharInfos > 0) {
|
||||
#ifdef MITSHM
|
||||
#ifdef HAS_SHM
|
||||
if (!badSysCall)
|
||||
pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
|
||||
if (pDesc) {
|
||||
|
|
@ -390,10 +401,10 @@ ProcXF86BigfontQueryFont(ClientPtr client)
|
|||
}
|
||||
else {
|
||||
#endif
|
||||
pCI = xallocarray(nCharInfos, sizeof(xCharInfo));
|
||||
pCI = malloc(nCharInfos * sizeof(xCharInfo));
|
||||
if (!pCI)
|
||||
return BadAlloc;
|
||||
#ifdef MITSHM
|
||||
#ifdef HAS_SHM
|
||||
}
|
||||
#endif
|
||||
/* Fill nCharInfos starting at pCI. */
|
||||
|
|
@ -425,10 +436,10 @@ ProcXF86BigfontQueryFont(ClientPtr client)
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef MITSHM
|
||||
#ifdef HAS_SHM
|
||||
if (pDesc && !badSysCall) {
|
||||
*(CARD32 *) (pCI + nCharInfos) = signature;
|
||||
if (!xfont2_font_set_private(pFont, FontShmdescIndex, pDesc)) {
|
||||
if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) {
|
||||
shmdealloc(pDesc);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -452,7 +463,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
|
|||
if (hashModulus > nCharInfos + 1)
|
||||
hashModulus = nCharInfos + 1;
|
||||
|
||||
tmp = xallocarray(4 * nCharInfos + 1, sizeof(CARD16));
|
||||
tmp = malloc((4 * nCharInfos + 1) * sizeof(CARD16));
|
||||
if (!tmp) {
|
||||
if (!pDesc)
|
||||
free(pCI);
|
||||
|
|
@ -648,23 +659,27 @@ ProcXF86BigfontDispatch(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXF86BigfontQueryVersion(ClientPtr client)
|
||||
{
|
||||
/* REQUEST(xXF86BigfontQueryVersionReq); */
|
||||
REQUEST(xXF86BigfontQueryVersionReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
return ProcXF86BigfontQueryVersion(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXF86BigfontQueryFont(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXF86BigfontQueryFontReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
|
||||
swapl(&stuff->id);
|
||||
return ProcXF86BigfontQueryFont(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXF86BigfontDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
|
@ -688,7 +703,7 @@ XFree86BigfontExtensionInit(void)
|
|||
ProcXF86BigfontDispatch,
|
||||
SProcXF86BigfontDispatch,
|
||||
XF86BigfontResetProc, StandardMinorOpcode)) {
|
||||
#ifdef MITSHM
|
||||
#ifdef HAS_SHM
|
||||
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
|
||||
/*
|
||||
* Note: Local-clients will not be optimized without shared memory
|
||||
|
|
@ -708,7 +723,7 @@ XFree86BigfontExtensionInit(void)
|
|||
+ (unsigned int) (65536.0 / (RAND_MAX + 1.0) * rand());
|
||||
/* fprintf(stderr, "signature = 0x%08X\n", signature); */
|
||||
|
||||
FontShmdescIndex = xfont2_allocate_font_private_index();
|
||||
FontShmdescIndex = AllocateFontPrivateIndex();
|
||||
|
||||
#if !defined(CSRG_BASED) && !defined(__CYGWIN__)
|
||||
pagesize = SHMLBA;
|
||||
|
|
|
|||
175
Xext/xres.c
175
Xext/xres.c
|
|
@ -2,28 +2,28 @@
|
|||
Copyright (c) 2002 XFree86 Inc
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/extensions/XResproto.h>
|
||||
|
||||
#include "dix/registry_priv.h"
|
||||
#include "os/client_priv.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "extnsionst.h"
|
||||
#include "swaprep.h"
|
||||
#include "registry.h"
|
||||
#include <X11/extensions/XResproto.h>
|
||||
#include "pixmapstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "extinit_priv.h"
|
||||
#include "extinit.h"
|
||||
#include "protocol-versions.h"
|
||||
#include "client.h"
|
||||
#include "list.h"
|
||||
#include "misc.h"
|
||||
#include <string.h>
|
||||
|
|
@ -72,7 +72,7 @@ typedef struct {
|
|||
HashTable visitedResources;
|
||||
|
||||
/* Used by AddSubResourceSizeSpec when AddResourceSizeValue is
|
||||
handling cross-references */
|
||||
handling crossreferences */
|
||||
HashTable visitedSubResources;
|
||||
|
||||
/* used when ConstructResourceBytesCtx is passed to
|
||||
|
|
@ -223,9 +223,7 @@ ProcXResQueryClients(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xXResQueryClientsReq);
|
||||
|
||||
current_clients = xallocarray(currentMaxClients, sizeof(int));
|
||||
if (current_clients == NULL)
|
||||
return BadAlloc;
|
||||
current_clients = malloc(currentMaxClients * sizeof(int));
|
||||
|
||||
num_clients = 0;
|
||||
for (i = 0; i < currentMaxClients; i++) {
|
||||
|
|
@ -276,24 +274,6 @@ ResFindAllRes(void *value, XID id, RESTYPE type, void *cdata)
|
|||
counts[(type & TypeMask) - 1]++;
|
||||
}
|
||||
|
||||
static CARD32
|
||||
resourceTypeAtom(int i)
|
||||
{
|
||||
CARD32 ret;
|
||||
|
||||
const char *name = LookupResourceName(i);
|
||||
if (strcmp(name, XREGISTRY_UNKNOWN))
|
||||
ret = MakeAtom(name, strlen(name), TRUE);
|
||||
else {
|
||||
char buf[40];
|
||||
|
||||
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
|
||||
ret = MakeAtom(buf, strlen(buf), TRUE);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXResQueryClientResources(ClientPtr client)
|
||||
{
|
||||
|
|
@ -338,12 +318,22 @@ ProcXResQueryClientResources(ClientPtr client)
|
|||
|
||||
if (num_types) {
|
||||
xXResType scratch;
|
||||
const char *name;
|
||||
|
||||
for (i = 0; i < lastResourceType; i++) {
|
||||
if (!counts[i])
|
||||
continue;
|
||||
|
||||
scratch.resource_type = resourceTypeAtom(i + 1);
|
||||
name = LookupResourceName(i + 1);
|
||||
if (strcmp(name, XREGISTRY_UNKNOWN))
|
||||
scratch.resource_type = MakeAtom(name, strlen(name), TRUE);
|
||||
else {
|
||||
char buf[40];
|
||||
|
||||
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
|
||||
scratch.resource_type = MakeAtom(buf, strlen(buf), TRUE);
|
||||
}
|
||||
|
||||
scratch.count = counts[i];
|
||||
|
||||
if (client->swapped) {
|
||||
|
|
@ -359,6 +349,21 @@ ProcXResQueryClientResources(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
ResGetApproxPixmapBytes(PixmapPtr pix)
|
||||
{
|
||||
unsigned long nPixels;
|
||||
float bytesPerPixel;
|
||||
|
||||
bytesPerPixel = (float)pix->drawable.bitsPerPixel / 8.0;
|
||||
nPixels = pix->drawable.width * pix->drawable.height;
|
||||
|
||||
/* Divide by refcnt as pixmap could be shared between clients,
|
||||
* so total pixmap mem is shared between these.
|
||||
*/
|
||||
return (nPixels * bytesPerPixel) / pix->refcnt;
|
||||
}
|
||||
|
||||
static void
|
||||
ResFindResourcePixmaps(void *value, XID id, RESTYPE type, void *cdata)
|
||||
{
|
||||
|
|
@ -370,6 +375,57 @@ ResFindResourcePixmaps(void *value, XID id, RESTYPE type, void *cdata)
|
|||
*bytes += size.pixmapRefSize;
|
||||
}
|
||||
|
||||
static void
|
||||
ResFindPixmaps(void *value, XID id, void *cdata)
|
||||
{
|
||||
unsigned long *bytes = (unsigned long *) cdata;
|
||||
PixmapPtr pix = (PixmapPtr) value;
|
||||
|
||||
*bytes += ResGetApproxPixmapBytes(pix);
|
||||
}
|
||||
|
||||
static void
|
||||
ResFindWindowPixmaps(void *value, XID id, void *cdata)
|
||||
{
|
||||
unsigned long *bytes = (unsigned long *) cdata;
|
||||
WindowPtr pWin = (WindowPtr) value;
|
||||
|
||||
if (pWin->backgroundState == BackgroundPixmap)
|
||||
*bytes += ResGetApproxPixmapBytes(pWin->background.pixmap);
|
||||
|
||||
if (pWin->border.pixmap != NULL && !pWin->borderIsPixel)
|
||||
*bytes += ResGetApproxPixmapBytes(pWin->border.pixmap);
|
||||
}
|
||||
|
||||
static void
|
||||
ResFindGCPixmaps(void *value, XID id, void *cdata)
|
||||
{
|
||||
unsigned long *bytes = (unsigned long *) cdata;
|
||||
GCPtr pGC = (GCPtr) value;
|
||||
|
||||
if (pGC->stipple != NULL)
|
||||
*bytes += ResGetApproxPixmapBytes(pGC->stipple);
|
||||
|
||||
if (pGC->tile.pixmap != NULL && !pGC->tileIsPixel)
|
||||
*bytes += ResGetApproxPixmapBytes(pGC->tile.pixmap);
|
||||
}
|
||||
|
||||
static void
|
||||
ResFindPicturePixmaps(void *value, XID id, void *cdata)
|
||||
{
|
||||
#ifdef RENDER
|
||||
ResFindResourcePixmaps(value, id, PictureType, cdata);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
ResFindCompositeClientWindowPixmaps (void *value, XID id, void *cdata)
|
||||
{
|
||||
#ifdef COMPOSITE
|
||||
ResFindResourcePixmaps(value, id, CompositeClientWindowType, cdata);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXResQueryClientPixmapBytes(ClientPtr client)
|
||||
{
|
||||
|
|
@ -389,8 +445,34 @@ ProcXResQueryClientPixmapBytes(ClientPtr client)
|
|||
|
||||
bytes = 0;
|
||||
|
||||
FindAllClientResources(clients[clientID], ResFindResourcePixmaps,
|
||||
(void *) (&bytes));
|
||||
FindClientResourcesByType(clients[clientID], RT_PIXMAP, ResFindPixmaps,
|
||||
(void *) (&bytes));
|
||||
|
||||
/*
|
||||
* Make sure win background pixmaps also held to account.
|
||||
*/
|
||||
FindClientResourcesByType(clients[clientID], RT_WINDOW,
|
||||
ResFindWindowPixmaps, (void *) (&bytes));
|
||||
|
||||
/*
|
||||
* GC Tile & Stipple pixmaps too.
|
||||
*/
|
||||
FindClientResourcesByType(clients[clientID], RT_GC,
|
||||
ResFindGCPixmaps, (void *) (&bytes));
|
||||
|
||||
#ifdef RENDER
|
||||
/* Render extension picture pixmaps. */
|
||||
FindClientResourcesByType(clients[clientID], PictureType,
|
||||
ResFindPicturePixmaps,
|
||||
(void *)(&bytes));
|
||||
#endif
|
||||
|
||||
#ifdef COMPOSITE
|
||||
/* Composite extension client window pixmaps. */
|
||||
FindClientResourcesByType(clients[clientID], CompositeClientWindowType,
|
||||
ResFindCompositeClientWindowPixmaps,
|
||||
(void *)(&bytes));
|
||||
#endif
|
||||
|
||||
rep = (xXResQueryClientPixmapBytesReply) {
|
||||
.type = X_Reply,
|
||||
|
|
@ -444,7 +526,7 @@ WillConstructMask(ClientPtr client, CARD32 mask,
|
|||
client id spec
|
||||
|
||||
@param sendClient Which client wishes to receive this answer. Used for
|
||||
byte endianness.
|
||||
byte endianess.
|
||||
@param client Which client are we considering.
|
||||
@param mask The client id spec mask indicating which information
|
||||
we want about this client.
|
||||
|
|
@ -611,7 +693,7 @@ ProcXResQueryClientIds (ClientPtr client)
|
|||
return rc;
|
||||
}
|
||||
|
||||
/** @brief Swaps xXResResourceIdSpec endianness */
|
||||
/** @brief Swaps xXResResourceIdSpec endianess */
|
||||
static void
|
||||
SwapXResResourceIdSpec(xXResResourceIdSpec *spec)
|
||||
{
|
||||
|
|
@ -619,7 +701,7 @@ SwapXResResourceIdSpec(xXResResourceIdSpec *spec)
|
|||
swapl(&spec->type);
|
||||
}
|
||||
|
||||
/** @brief Swaps xXResResourceSizeSpec endianness */
|
||||
/** @brief Swaps xXResResourceSizeSpec endianess */
|
||||
static void
|
||||
SwapXResResourceSizeSpec(xXResResourceSizeSpec *size)
|
||||
{
|
||||
|
|
@ -629,7 +711,7 @@ SwapXResResourceSizeSpec(xXResResourceSizeSpec *size)
|
|||
swapl(&size->useCount);
|
||||
}
|
||||
|
||||
/** @brief Swaps xXResResourceSizeValue endianness */
|
||||
/** @brief Swaps xXResResourceSizeValue endianess */
|
||||
static void
|
||||
SwapXResResourceSizeValue(xXResResourceSizeValue *rep)
|
||||
{
|
||||
|
|
@ -703,7 +785,7 @@ AddSubResourceSizeSpec(void *value,
|
|||
sizeFunc(value, id, &size);
|
||||
|
||||
crossRef->spec.resource = id;
|
||||
crossRef->spec.type = resourceTypeAtom(type);
|
||||
crossRef->spec.type = type;
|
||||
crossRef->bytes = size.resourceSize;
|
||||
crossRef->refCount = size.refCnt;
|
||||
crossRef->useCount = 1;
|
||||
|
|
@ -776,7 +858,7 @@ AddResourceSizeValue(void *ptr, XID id, RESTYPE type, void *cdata)
|
|||
sizeFunc(ptr, id, &size);
|
||||
|
||||
value->size.spec.resource = id;
|
||||
value->size.spec.type = resourceTypeAtom(type);
|
||||
value->size.spec.type = type;
|
||||
value->size.bytes = size.resourceSize;
|
||||
value->size.refCount = size.refCnt;
|
||||
value->size.useCount = 1;
|
||||
|
|
@ -957,8 +1039,6 @@ ProcXResQueryResourceBytes (ClientPtr client)
|
|||
ConstructResourceBytesCtx ctx;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
|
||||
if (stuff->numSpecs > UINT32_MAX / sizeof(ctx.specs[0]))
|
||||
return BadLength;
|
||||
REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq,
|
||||
stuff->numSpecs * sizeof(ctx.specs[0]));
|
||||
|
||||
|
|
@ -1019,14 +1099,14 @@ ProcResDispatch(ClientPtr client)
|
|||
return BadRequest;
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXResQueryVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST_SIZE_MATCH(xXResQueryVersionReq);
|
||||
return ProcXResQueryVersion(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXResQueryClientResources(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXResQueryClientResourcesReq);
|
||||
|
|
@ -1035,7 +1115,7 @@ SProcXResQueryClientResources(ClientPtr client)
|
|||
return ProcXResQueryClientResources(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXResQueryClientPixmapBytes(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXResQueryClientPixmapBytesReq);
|
||||
|
|
@ -1044,7 +1124,7 @@ SProcXResQueryClientPixmapBytes(ClientPtr client)
|
|||
return ProcXResQueryClientPixmapBytes(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXResQueryClientIds (ClientPtr client)
|
||||
{
|
||||
REQUEST(xXResQueryClientIdsReq);
|
||||
|
|
@ -1057,15 +1137,15 @@ SProcXResQueryClientIds (ClientPtr client)
|
|||
/** @brief Implements the XResQueryResourceBytes of XResProto v1.2.
|
||||
This variant byteswaps request contents before issuing the
|
||||
rest of the work to ProcXResQueryResourceBytes */
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXResQueryResourceBytes (ClientPtr client)
|
||||
{
|
||||
REQUEST(xXResQueryResourceBytesReq);
|
||||
int c;
|
||||
xXResResourceIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff));
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
|
||||
swapl(&stuff->numSpecs);
|
||||
REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq);
|
||||
REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq,
|
||||
stuff->numSpecs * sizeof(specs[0]));
|
||||
|
||||
|
|
@ -1076,10 +1156,11 @@ SProcXResQueryResourceBytes (ClientPtr client)
|
|||
return ProcXResQueryResourceBytes(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcResDispatch (ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
swaps(&stuff->length);
|
||||
|
||||
switch (stuff->data) {
|
||||
case X_XResQueryVersion:
|
||||
|
|
|
|||
|
|
@ -136,12 +136,4 @@ typedef struct {
|
|||
CARD32 pad6;
|
||||
} SELinuxListItemsReply;
|
||||
|
||||
#ifdef XSELINUX
|
||||
#define SELINUX_MODE_DEFAULT 0
|
||||
#define SELINUX_MODE_DISABLED 1
|
||||
#define SELINUX_MODE_PERMISSIVE 2
|
||||
#define SELINUX_MODE_ENFORCING 3
|
||||
extern int selinuxEnforcingState;
|
||||
#endif
|
||||
|
||||
#endif /* _XSELINUX_H */
|
||||
|
|
|
|||
|
|
@ -17,16 +17,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
********************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#endif
|
||||
|
||||
#include "selection.h"
|
||||
#include "inputstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "propertyst.h"
|
||||
#include "extnsionst.h"
|
||||
#include "extinit_priv.h"
|
||||
#include "extinit.h"
|
||||
#include "xselinuxint.h"
|
||||
|
||||
#define CTX_DEV offsetof(SELinuxSubjectRec, dev_create_sid)
|
||||
|
|
@ -37,24 +37,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define USE_SEL offsetof(SELinuxSubjectRec, sel_use_sid)
|
||||
|
||||
typedef struct {
|
||||
char *octx;
|
||||
char *dctx;
|
||||
security_context_t octx;
|
||||
security_context_t dctx;
|
||||
CARD32 octx_len;
|
||||
CARD32 dctx_len;
|
||||
CARD32 id;
|
||||
} SELinuxListItemRec;
|
||||
|
||||
Bool noSELinuxExtension = FALSE;
|
||||
int selinuxEnforcingState = SELINUX_MODE_DEFAULT;
|
||||
|
||||
/*
|
||||
* Extension Dispatch
|
||||
*/
|
||||
|
||||
static char *
|
||||
static security_context_t
|
||||
SELinuxCopyContext(char *ptr, unsigned len)
|
||||
{
|
||||
char *copy = malloc(len + 1);
|
||||
security_context_t copy = malloc(len + 1);
|
||||
|
||||
if (!copy)
|
||||
return NULL;
|
||||
|
|
@ -69,6 +66,7 @@ ProcSELinuxQueryVersion(ClientPtr client)
|
|||
SELinuxQueryVersionReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.server_major = SELINUX_MAJOR_VERSION,
|
||||
.server_minor = SELINUX_MINOR_VERSION
|
||||
};
|
||||
|
|
@ -85,7 +83,8 @@ ProcSELinuxQueryVersion(ClientPtr client)
|
|||
static int
|
||||
SELinuxSendContextReply(ClientPtr client, security_id_t sid)
|
||||
{
|
||||
char *ctx = NULL;
|
||||
SELinuxGetContextReply rep;
|
||||
security_context_t ctx = NULL;
|
||||
int len = 0;
|
||||
|
||||
if (sid) {
|
||||
|
|
@ -94,7 +93,7 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
|
|||
len = strlen(ctx) + 1;
|
||||
}
|
||||
|
||||
SELinuxGetContextReply rep = {
|
||||
rep = (SELinuxGetContextReply) {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(len),
|
||||
|
|
@ -118,7 +117,7 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
|
|||
{
|
||||
PrivateRec **privPtr = &client->devPrivates;
|
||||
security_id_t *pSid;
|
||||
char *ctx = NULL;
|
||||
security_context_t ctx = NULL;
|
||||
char *ptr;
|
||||
int rc;
|
||||
|
||||
|
|
@ -166,7 +165,7 @@ ProcSELinuxGetCreateContext(ClientPtr client, unsigned offset)
|
|||
static int
|
||||
ProcSELinuxSetDeviceContext(ClientPtr client)
|
||||
{
|
||||
char *ctx;
|
||||
security_context_t ctx;
|
||||
security_id_t sid;
|
||||
DeviceIntPtr dev;
|
||||
SELinuxSubjectRec *subj;
|
||||
|
|
@ -341,9 +340,13 @@ static int
|
|||
SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
|
||||
int size, int count)
|
||||
{
|
||||
int rc = BadAlloc, k, pos = 0;
|
||||
CARD32 *buf = calloc(size, sizeof(CARD32));
|
||||
int rc, k, pos = 0;
|
||||
SELinuxListItemsReply rep;
|
||||
CARD32 *buf;
|
||||
|
||||
buf = calloc(size, sizeof(CARD32));
|
||||
if (size && !buf) {
|
||||
rc = BadAlloc;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -371,7 +374,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
|
|||
}
|
||||
|
||||
/* Send reply to client */
|
||||
SELinuxListItemsReply rep = {
|
||||
rep = (SELinuxListItemsReply) {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = size,
|
||||
|
|
@ -449,10 +452,8 @@ ProcSELinuxListSelections(ClientPtr client)
|
|||
count = 0;
|
||||
for (pSel = CurrentSelections; pSel; pSel = pSel->next)
|
||||
count++;
|
||||
if (count == 0)
|
||||
return SELinuxSendItemsToClient(client, NULL, 0, 0);
|
||||
items = calloc(count, sizeof(SELinuxListItemRec));
|
||||
if (!items)
|
||||
if (count && !items)
|
||||
return BadAlloc;
|
||||
|
||||
/* Fill in the items and calculate size */
|
||||
|
|
@ -527,13 +528,13 @@ ProcSELinuxDispatch(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSELinuxQueryVersion(ClientPtr client)
|
||||
{
|
||||
return ProcSELinuxQueryVersion(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
|
||||
{
|
||||
REQUEST(SELinuxSetCreateContextReq);
|
||||
|
|
@ -543,7 +544,7 @@ SProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
|
|||
return ProcSELinuxSetCreateContext(client, offset);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSELinuxSetDeviceContext(ClientPtr client)
|
||||
{
|
||||
REQUEST(SELinuxSetContextReq);
|
||||
|
|
@ -554,7 +555,7 @@ SProcSELinuxSetDeviceContext(ClientPtr client)
|
|||
return ProcSELinuxSetDeviceContext(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSELinuxGetDeviceContext(ClientPtr client)
|
||||
{
|
||||
REQUEST(SELinuxGetContextReq);
|
||||
|
|
@ -564,7 +565,7 @@ SProcSELinuxGetDeviceContext(ClientPtr client)
|
|||
return ProcSELinuxGetDeviceContext(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSELinuxGetDrawableContext(ClientPtr client)
|
||||
{
|
||||
REQUEST(SELinuxGetContextReq);
|
||||
|
|
@ -574,7 +575,7 @@ SProcSELinuxGetDrawableContext(ClientPtr client)
|
|||
return ProcSELinuxGetDrawableContext(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
|
||||
{
|
||||
REQUEST(SELinuxGetPropertyContextReq);
|
||||
|
|
@ -585,7 +586,7 @@ SProcSELinuxGetPropertyContext(ClientPtr client, void *privKey)
|
|||
return ProcSELinuxGetPropertyContext(client, privKey);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
|
||||
{
|
||||
REQUEST(SELinuxGetContextReq);
|
||||
|
|
@ -595,7 +596,7 @@ SProcSELinuxGetSelectionContext(ClientPtr client, void *privKey)
|
|||
return ProcSELinuxGetSelectionContext(client, privKey);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSELinuxListProperties(ClientPtr client)
|
||||
{
|
||||
REQUEST(SELinuxGetContextReq);
|
||||
|
|
@ -605,7 +606,7 @@ SProcSELinuxListProperties(ClientPtr client)
|
|||
return ProcSELinuxListProperties(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSELinuxGetClientContext(ClientPtr client)
|
||||
{
|
||||
REQUEST(SELinuxGetContextReq);
|
||||
|
|
@ -615,11 +616,13 @@ SProcSELinuxGetClientContext(ClientPtr client)
|
|||
return ProcSELinuxGetClientContext(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcSELinuxDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
|
||||
switch (stuff->data) {
|
||||
case X_SELinuxQueryVersion:
|
||||
return SProcSELinuxQueryVersion(client);
|
||||
|
|
@ -686,6 +689,8 @@ SELinuxResetProc(ExtensionEntry * extEntry)
|
|||
void
|
||||
SELinuxExtensionInit(void)
|
||||
{
|
||||
ExtensionEntry *extEntry;
|
||||
|
||||
/* Check SELinux mode on system, configuration file, and boolean */
|
||||
if (!is_selinux_enabled()) {
|
||||
LogMessage(X_INFO, "SELinux: Disabled on system\n");
|
||||
|
|
@ -705,7 +710,10 @@ SELinuxExtensionInit(void)
|
|||
SELinuxFlaskInit();
|
||||
|
||||
/* Add extension to server */
|
||||
AddExtension(SELINUX_EXTENSION_NAME, SELinuxNumberEvents,
|
||||
SELinuxNumberErrors, ProcSELinuxDispatch,
|
||||
SProcSELinuxDispatch, SELinuxResetProc, StandardMinorOpcode);
|
||||
extEntry = AddExtension(SELINUX_EXTENSION_NAME,
|
||||
SELinuxNumberEvents, SELinuxNumberErrors,
|
||||
ProcSELinuxDispatch, SProcSELinuxDispatch,
|
||||
SELinuxResetProc, StandardMinorOpcode);
|
||||
|
||||
AddExtensionAlias("Flask", extEntry);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,19 +22,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <libaudit.h>
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xfuncproto.h>
|
||||
|
||||
#include "dix/registry_priv.h"
|
||||
#include "os/client_priv.h"
|
||||
|
||||
#include "selection.h"
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
|
|
@ -42,6 +40,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "propertyst.h"
|
||||
#include "extnsionst.h"
|
||||
#include "xacestr.h"
|
||||
#include "client.h"
|
||||
#include "../os/osdep.h"
|
||||
#define _XSELINUX_NEED_FLASK_MAP
|
||||
#include "xselinuxint.h"
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ SELinuxLabelClient(ClientPtr client)
|
|||
int fd = XaceGetConnectionNumber(client);
|
||||
SELinuxSubjectRec *subj;
|
||||
SELinuxObjectRec *obj;
|
||||
char *ctx;
|
||||
security_context_t ctx;
|
||||
|
||||
subj = dixLookupPrivate(&client->devPrivates, subjectKey);
|
||||
obj = dixLookupPrivate(&client->devPrivates, objectKey);
|
||||
|
|
@ -147,7 +147,7 @@ SELinuxLabelClient(ClientPtr client)
|
|||
strncpy(subj->command, cmdname, COMMAND_LEN - 1);
|
||||
|
||||
if (!cached)
|
||||
free((void *) cmdname); /* const char * */
|
||||
free(cmdname); /* const char * */
|
||||
}
|
||||
|
||||
finish:
|
||||
|
|
@ -170,7 +170,7 @@ SELinuxLabelInitial(void)
|
|||
XaceScreenAccessRec srec;
|
||||
SELinuxSubjectRec *subj;
|
||||
SELinuxObjectRec *obj;
|
||||
char *ctx;
|
||||
security_context_t ctx;
|
||||
void *unused;
|
||||
|
||||
/* Do the serverClient */
|
||||
|
|
@ -200,7 +200,7 @@ SELinuxLabelInitial(void)
|
|||
|
||||
/* Do the default colormap */
|
||||
dixLookupResourceByType(&unused, screenInfo.screens[i]->defColormap,
|
||||
X11_RESTYPE_COLORMAP, serverClient, DixCreateAccess);
|
||||
RT_COLORMAP, serverClient, DixCreateAccess);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -294,9 +294,6 @@ SELinuxAudit(void *auditdata,
|
|||
audit->extension ? audit->extension : "");
|
||||
}
|
||||
|
||||
static int
|
||||
SELinuxLog(int type, const char *fmt, ...) _X_ATTRIBUTE_PRINTF(2, 3);
|
||||
|
||||
static int
|
||||
SELinuxLog(int type, const char *fmt, ...)
|
||||
{
|
||||
|
|
@ -319,7 +316,6 @@ SELinuxLog(int type, const char *fmt, ...)
|
|||
va_start(ap, fmt);
|
||||
vsnprintf(buf, MAX_AUDIT_MESSAGE_LENGTH, fmt, ap);
|
||||
rc = audit_log_user_avc_message(audit_fd, aut, buf, NULL, NULL, NULL, 0);
|
||||
(void) rc;
|
||||
va_end(ap);
|
||||
LogMessageVerb(X_WARNING, 0, "%s", buf);
|
||||
return 0;
|
||||
|
|
@ -480,7 +476,7 @@ SELinuxExtension(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|||
}
|
||||
|
||||
/* Perform the security check */
|
||||
auditdata.extension = (char *) rec->ext->name;
|
||||
auditdata.extension = rec->ext->name;
|
||||
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_EXTENSION, rec->access_mode,
|
||||
&auditdata);
|
||||
if (rc != Success)
|
||||
|
|
@ -663,7 +659,7 @@ SELinuxResource(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|||
rec->status = rc;
|
||||
|
||||
/* Perform the background none check on windows */
|
||||
if (access_mode & DixCreateAccess && rec->rtype == X11_RESTYPE_WINDOW) {
|
||||
if (access_mode & DixCreateAccess && rec->rtype == RT_WINDOW) {
|
||||
rc = SELinuxDoCheck(subj, obj, class, DixBlendAccess, &auditdata);
|
||||
if (rc != Success)
|
||||
((WindowPtr) rec->res)->forcedBG = TRUE;
|
||||
|
|
@ -765,7 +761,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|||
SELinuxObjectRec *obj;
|
||||
WindowPtr pWin;
|
||||
|
||||
if (rec->type != X11_RESTYPE_WINDOW)
|
||||
if (rec->type != RT_WINDOW)
|
||||
return;
|
||||
if (rec->state != ResourceStateAdding)
|
||||
return;
|
||||
|
|
@ -774,7 +770,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|||
subj = dixLookupPrivate(&wClient(pWin)->devPrivates, subjectKey);
|
||||
|
||||
if (subj->sid) {
|
||||
char *ctx;
|
||||
security_context_t ctx;
|
||||
int rc = avc_sid_to_context_raw(subj->sid, &ctx);
|
||||
|
||||
if (rc < 0)
|
||||
|
|
@ -792,7 +788,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|||
obj = dixLookupPrivate(&pWin->devPrivates, objectKey);
|
||||
|
||||
if (obj->sid) {
|
||||
char *ctx;
|
||||
security_context_t ctx;
|
||||
int rc = avc_sid_to_context_raw(obj->sid, &ctx);
|
||||
|
||||
if (rc < 0)
|
||||
|
|
@ -811,9 +807,15 @@ SELinuxResourceState(CallbackListPtr *pcbl, void *unused, void *calldata)
|
|||
static int netlink_fd;
|
||||
|
||||
static void
|
||||
SELinuxNetlinkNotify(int fd, int ready, void *data)
|
||||
SELinuxBlockHandler(void *data, struct timeval **tv, void *read_mask)
|
||||
{
|
||||
avc_netlink_check_nb();
|
||||
}
|
||||
|
||||
static void
|
||||
SELinuxWakeupHandler(void *data, int num_fds, void *read_mask)
|
||||
{
|
||||
if (num_fds > 0 && FD_ISSET(netlink_fd, (fd_set *) read_mask))
|
||||
avc_netlink_check_nb();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -839,7 +841,9 @@ SELinuxFlaskReset(void)
|
|||
/* Tear down SELinux stuff */
|
||||
audit_close(audit_fd);
|
||||
avc_netlink_release_fd();
|
||||
RemoveNotifyFd(netlink_fd);
|
||||
RemoveBlockAndWakeupHandlers(SELinuxBlockHandler, SELinuxWakeupHandler,
|
||||
NULL);
|
||||
RemoveGeneralSocket(netlink_fd);
|
||||
|
||||
avc_destroy();
|
||||
}
|
||||
|
|
@ -848,7 +852,7 @@ void
|
|||
SELinuxFlaskInit(void)
|
||||
{
|
||||
struct selinux_opt avc_option = { AVC_OPT_SETENFORCE, (char *) 0 };
|
||||
char *ctx;
|
||||
security_context_t ctx;
|
||||
int ret = TRUE;
|
||||
|
||||
switch (selinuxEnforcingState) {
|
||||
|
|
@ -911,7 +915,9 @@ SELinuxFlaskInit(void)
|
|||
FatalError("SELinux: Failed to create atom\n");
|
||||
|
||||
netlink_fd = avc_netlink_acquire_fd();
|
||||
SetNotifyFd(netlink_fd, SELinuxNetlinkNotify, X_NOTIFY_READ, NULL);
|
||||
AddGeneralSocket(netlink_fd);
|
||||
RegisterBlockAndWakeupHandlers(SELinuxBlockHandler, SELinuxWakeupHandler,
|
||||
NULL);
|
||||
|
||||
/* Register callbacks */
|
||||
ret &= AddCallback(&ClientStateCallback, SELinuxClientState, NULL);
|
||||
|
|
|
|||
|
|
@ -17,12 +17,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
********************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <selinux/label.h>
|
||||
|
||||
#include "dix/registry_priv.h"
|
||||
|
||||
#include "registry.h"
|
||||
#include "xselinuxint.h"
|
||||
|
||||
/* selection and property atom cache */
|
||||
|
|
@ -63,7 +64,7 @@ SELinuxArraySet(SELinuxArrayRec * rec, unsigned key, void *val)
|
|||
{
|
||||
if (key >= rec->size) {
|
||||
/* Need to increase size of array */
|
||||
rec->array = reallocarray(rec->array, key + 1, sizeof(val));
|
||||
rec->array = realloc(rec->array, (key + 1) * sizeof(val));
|
||||
if (!rec->array)
|
||||
return FALSE;
|
||||
memset(rec->array + rec->size, 0, (key - rec->size + 1) * sizeof(val));
|
||||
|
|
@ -96,7 +97,7 @@ static int
|
|||
SELinuxAtomToSIDLookup(Atom atom, SELinuxObjectRec * obj, int map, int polymap)
|
||||
{
|
||||
const char *name = NameForAtom(atom);
|
||||
char *ctx;
|
||||
security_context_t ctx;
|
||||
int rc = Success;
|
||||
|
||||
obj->poly = 1;
|
||||
|
|
@ -137,12 +138,8 @@ SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec ** obj_rtn)
|
|||
rec = SELinuxArrayGet(&arr_atoms, atom);
|
||||
if (!rec) {
|
||||
rec = calloc(1, sizeof(SELinuxAtomRec));
|
||||
if (!rec)
|
||||
if (!rec || !SELinuxArraySet(&arr_atoms, atom, rec))
|
||||
return BadAlloc;
|
||||
if (!SELinuxArraySet(&arr_atoms, atom, rec)) {
|
||||
free(rec);
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
|
||||
if (prop) {
|
||||
|
|
@ -258,7 +255,7 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
|
|||
{
|
||||
const char *name = LookupEventName(type);
|
||||
security_id_t sid;
|
||||
char *ctx;
|
||||
security_context_t ctx;
|
||||
|
||||
type &= 127;
|
||||
|
||||
|
|
@ -294,7 +291,7 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
|
|||
int
|
||||
SELinuxExtensionToSID(const char *name, security_id_t * sid_rtn)
|
||||
{
|
||||
char *ctx;
|
||||
security_context_t ctx;
|
||||
|
||||
/* Look in the mappings of extension names to contexts */
|
||||
if (selabel_lookup_raw(label_hnd, &ctx, name, SELABEL_X_EXT) < 0) {
|
||||
|
|
@ -325,13 +322,13 @@ SELinuxTypeToClass(RESTYPE type)
|
|||
|
||||
if (type & RC_DRAWABLE)
|
||||
class = SECCLASS_X_DRAWABLE;
|
||||
else if (type == X11_RESTYPE_GC)
|
||||
else if (type == RT_GC)
|
||||
class = SECCLASS_X_GC;
|
||||
else if (type == X11_RESTYPE_FONT)
|
||||
else if (type == RT_FONT)
|
||||
class = SECCLASS_X_FONT;
|
||||
else if (type == X11_RESTYPE_CURSOR)
|
||||
else if (type == RT_CURSOR)
|
||||
class = SECCLASS_X_CURSOR;
|
||||
else if (type == X11_RESTYPE_COLORMAP)
|
||||
else if (type == RT_COLORMAP)
|
||||
class = SECCLASS_X_COLORMAP;
|
||||
else {
|
||||
/* Need to do a string lookup */
|
||||
|
|
@ -350,10 +347,10 @@ SELinuxTypeToClass(RESTYPE type)
|
|||
return (security_class_t) (unsigned long) tmp;
|
||||
}
|
||||
|
||||
char *
|
||||
security_context_t
|
||||
SELinuxDefaultClientLabel(void)
|
||||
{
|
||||
char *ctx;
|
||||
security_context_t ctx;
|
||||
|
||||
if (selabel_lookup_raw(label_hnd, &ctx, "remote", SELABEL_X_CLIENT) < 0)
|
||||
FatalError("SELinux: failed to look up remote-client context\n");
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "dixstruct.h"
|
||||
#include "privates.h"
|
||||
#include "resource.h"
|
||||
#include "registry.h"
|
||||
#include "inputstr.h"
|
||||
#include "xselinux.h"
|
||||
|
||||
|
|
@ -98,7 +99,7 @@ int
|
|||
|
||||
security_class_t SELinuxTypeToClass(RESTYPE type);
|
||||
|
||||
char *SELinuxDefaultClientLabel(void);
|
||||
security_context_t SELinuxDefaultClientLabel(void);
|
||||
|
||||
void
|
||||
SELinuxLabelInit(void);
|
||||
|
|
|
|||
127
Xext/xtest.c
127
Xext/xtest.c
|
|
@ -26,22 +26,13 @@
|
|||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/extensions/xtestproto.h>
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/input_priv.h"
|
||||
#include "dix/dix_priv.h"
|
||||
#include "dix/exevents_priv.h"
|
||||
#include "mi/mipointer_priv.h"
|
||||
#include "os/client_priv.h"
|
||||
#include "os/osdep.h"
|
||||
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
|
|
@ -54,17 +45,21 @@
|
|||
#include "mi.h"
|
||||
#include "xkbsrv.h"
|
||||
#include "xkbstr.h"
|
||||
#include <X11/extensions/xtestproto.h>
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exglobals.h"
|
||||
#include "mipointer.h"
|
||||
#include "xserver-properties.h"
|
||||
#include "exevents.h"
|
||||
#include "eventstr.h"
|
||||
#include "inpututils.h"
|
||||
#include "extinit_priv.h"
|
||||
|
||||
/* XTest events are sent during request processing and may be interrupted by
|
||||
#include "extinit.h"
|
||||
|
||||
/* XTest events are sent during request processing and may be interruped by
|
||||
* a SIGIO. We need a separate event list to avoid events overwriting each
|
||||
* other's memory.
|
||||
*/
|
||||
* other's memory */
|
||||
static InternalEvent *xtest_evlist;
|
||||
|
||||
/**
|
||||
|
|
@ -79,10 +74,10 @@ static InternalEvent *xtest_evlist;
|
|||
*/
|
||||
DeviceIntPtr xtestpointer, xtestkeyboard;
|
||||
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
#include "panoramiX.h"
|
||||
#include "panoramiXsrv.h"
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
|
||||
static int XTestSwapFakeInput(ClientPtr /* client */ ,
|
||||
xReq * /* req */
|
||||
|
|
@ -133,7 +128,7 @@ ProcXTestCompareCursor(ClientPtr client)
|
|||
pCursor = GetSpriteCursor(ptr);
|
||||
else {
|
||||
rc = dixLookupResourceByType((void **) &pCursor, stuff->cursor,
|
||||
X11_RESTYPE_CURSOR, client, DixReadAccess);
|
||||
RT_CURSOR, client, DixReadAccess);
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->cursor;
|
||||
return rc;
|
||||
|
|
@ -152,35 +147,6 @@ ProcXTestCompareCursor(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
XTestDeviceSendEvents(DeviceIntPtr dev,
|
||||
int type,
|
||||
int detail,
|
||||
int flags,
|
||||
const ValuatorMask *mask)
|
||||
{
|
||||
int nevents = 0;
|
||||
int i;
|
||||
|
||||
switch (type) {
|
||||
case MotionNotify:
|
||||
nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags, mask);
|
||||
break;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
nevents = GetPointerEvents(xtest_evlist, dev, type, detail, flags, mask);
|
||||
break;
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
nevents =
|
||||
GetKeyboardEvents(xtest_evlist, dev, type, detail);
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < nevents; i++)
|
||||
mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXTestFakeInput(ClientPtr client)
|
||||
{
|
||||
|
|
@ -194,11 +160,13 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
int valuators[MAX_VALUATORS] = { 0 };
|
||||
int numValuators = 0;
|
||||
int firstValuator = 0;
|
||||
int nevents = 0;
|
||||
int i;
|
||||
int base = 0;
|
||||
int flags = 0;
|
||||
int need_ptr_update = 1;
|
||||
|
||||
nev = (client->req_len << 2) - sizeof(xReq);
|
||||
nev = (stuff->length << 2) - sizeof(xReq);
|
||||
if ((nev % sizeof(xEvent)) || !nev)
|
||||
return BadLength;
|
||||
nev /= sizeof(xEvent);
|
||||
|
|
@ -350,10 +318,6 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
return BadAccess;
|
||||
|
||||
dev = GetXTestDevice(dev);
|
||||
|
||||
/* This can only happen if we passed a slave to GetXTestDevice() */
|
||||
if (!dev)
|
||||
return BadAccess;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -378,6 +342,7 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
/* swap the request back so we can simply re-execute it */
|
||||
if (client->swapped) {
|
||||
(void) XTestSwapFakeInput(client, (xReq *) stuff);
|
||||
swaps(&stuff->length);
|
||||
}
|
||||
ResetCurrentRequest(client);
|
||||
client->sequence--;
|
||||
|
|
@ -416,7 +381,7 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
if ((flags & POINTER_ABSOLUTE) && firstValuator <= 1 && numValuators > 0) {
|
||||
if (firstValuator == 0)
|
||||
valuators[0] += root->drawable.pScreen->x;
|
||||
if (firstValuator + numValuators > 1)
|
||||
if (firstValuator < 2 && firstValuator + numValuators > 1)
|
||||
valuators[1 - firstValuator] += root->drawable.pScreen->y;
|
||||
}
|
||||
}
|
||||
|
|
@ -442,10 +407,26 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
if (screenIsSaved == SCREEN_SAVER_ON)
|
||||
dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
|
||||
|
||||
valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
|
||||
switch (type) {
|
||||
case MotionNotify:
|
||||
valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
|
||||
nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags, &mask);
|
||||
break;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
valuator_mask_set_range(&mask, firstValuator, numValuators, valuators);
|
||||
nevents = GetPointerEvents(xtest_evlist, dev, type, ev->u.u.detail,
|
||||
flags, &mask);
|
||||
break;
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
nevents =
|
||||
GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
if (dev->sendEventsProc)
|
||||
(*dev->sendEventsProc) (dev, type, ev->u.u.detail, flags, &mask);
|
||||
for (i = 0; i < nevents; i++)
|
||||
mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));
|
||||
|
||||
if (need_ptr_update)
|
||||
miPointerUpdateSprite(dev);
|
||||
|
|
@ -487,26 +468,30 @@ ProcXTestDispatch(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXTestGetVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXTestGetVersionReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
|
||||
swaps(&stuff->minorVersion);
|
||||
return ProcXTestGetVersion(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXTestCompareCursor(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXTestCompareCursorReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xXTestCompareCursorReq);
|
||||
swapl(&stuff->window);
|
||||
swapl(&stuff->cursor);
|
||||
return ProcXTestCompareCursor(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
XTestSwapFakeInput(ClientPtr client, xReq * req)
|
||||
{
|
||||
int nev;
|
||||
|
|
@ -514,13 +499,12 @@ XTestSwapFakeInput(ClientPtr client, xReq * req)
|
|||
xEvent sev;
|
||||
EventSwapPtr proc;
|
||||
|
||||
nev = ((client->req_len << 2) - sizeof(xReq)) / sizeof(xEvent);
|
||||
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
|
||||
for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) {
|
||||
int evtype = ev->u.u.type & 0177;
|
||||
/* Swap event */
|
||||
proc = EventSwapVector[evtype];
|
||||
proc = EventSwapVector[ev->u.u.type & 0177];
|
||||
/* no swapping proc; invalid event type? */
|
||||
if (!proc || proc == NotImplemented || evtype == GenericEvent) {
|
||||
if (!proc || proc == NotImplemented) {
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -530,20 +514,31 @@ XTestSwapFakeInput(ClientPtr client, xReq * req)
|
|||
return Success;
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXTestFakeInput(ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
|
||||
REQUEST(xReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
n = XTestSwapFakeInput(client, stuff);
|
||||
if (n != Success)
|
||||
return n;
|
||||
return ProcXTestFakeInput(client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXTestGrabControl(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXTestGrabControlReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
|
||||
return ProcXTestGrabControl(client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXTestDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
|
@ -555,7 +550,7 @@ SProcXTestDispatch(ClientPtr client)
|
|||
case X_XTestFakeInput:
|
||||
return SProcXTestFakeInput(client);
|
||||
case X_XTestGrabControl:
|
||||
return ProcXTestGrabControl(client);
|
||||
return SProcXTestGrabControl(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
|
|
|
|||
209
Xext/xvdisp.c
209
Xext/xvdisp.c
|
|
@ -4,13 +4,13 @@ and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
|
|||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the names of Digital or MIT not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
|
|
@ -21,18 +21,14 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|||
SOFTWARE.
|
||||
******************************************************************/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/extensions/Xv.h>
|
||||
#include <X11/extensions/Xvproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "Xext/xvdix_priv.h"
|
||||
|
||||
#include "misc.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
|
|
@ -41,6 +37,10 @@ SOFTWARE.
|
|||
#include "dixstruct.h"
|
||||
#include "resource.h"
|
||||
#include "opaque.h"
|
||||
|
||||
#include <X11/extensions/Xv.h>
|
||||
#include <X11/extensions/Xvproto.h>
|
||||
#include "xvdix.h"
|
||||
#ifdef MITSHM
|
||||
#include <X11/extensions/shmproto.h>
|
||||
#include "shmint.h"
|
||||
|
|
@ -48,12 +48,12 @@ SOFTWARE.
|
|||
|
||||
#include "xvdisp.h"
|
||||
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
#include "panoramiX.h"
|
||||
#include "panoramiXsrv.h"
|
||||
|
||||
unsigned long XvXRTPort;
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
|
||||
static int
|
||||
SWriteQueryExtensionReply(ClientPtr client, xvQueryExtensionReply * rep)
|
||||
|
|
@ -297,6 +297,9 @@ SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep)
|
|||
if ((_c)->swapped) SWriteImageFormatInfo(_c, _d); \
|
||||
else WriteToClient(_c, sz_xvImageFormatInfo, _d)
|
||||
|
||||
#define _AllocatePort(_i,_p) \
|
||||
((_p)->id != _i) ? (* (_p)->pAdaptor->ddAllocatePort)(_i,_p,&_p) : Success
|
||||
|
||||
static int
|
||||
ProcXvQueryExtension(ClientPtr client)
|
||||
{
|
||||
|
|
@ -353,6 +356,8 @@ ProcXvQueryAdaptors(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
(*pxvs->ddQueryAdaptors) (pScreen, &pxvs->pAdaptors, &pxvs->nAdaptors);
|
||||
|
||||
rep = (xvQueryAdaptorsReply) {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
|
|
@ -417,12 +422,18 @@ ProcXvQueryEncodings(ClientPtr client)
|
|||
XvPortPtr pPort;
|
||||
int ne;
|
||||
XvEncodingPtr pe;
|
||||
int status;
|
||||
|
||||
REQUEST(xvQueryEncodingsReq);
|
||||
REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
|
||||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
rep = (xvQueryEncodingsReply) {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
|
|
@ -474,6 +485,11 @@ ProcXvPutVideo(ClientPtr client)
|
|||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!(pPort->pAdaptor->type & XvInputMask) ||
|
||||
!(pPort->pAdaptor->type & XvVideoMask)) {
|
||||
client->errorValue = stuff->port;
|
||||
|
|
@ -504,6 +520,11 @@ ProcXvPutStill(ClientPtr client)
|
|||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!(pPort->pAdaptor->type & XvInputMask) ||
|
||||
!(pPort->pAdaptor->type & XvStillMask)) {
|
||||
client->errorValue = stuff->port;
|
||||
|
|
@ -534,6 +555,11 @@ ProcXvGetVideo(ClientPtr client)
|
|||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!(pPort->pAdaptor->type & XvOutputMask) ||
|
||||
!(pPort->pAdaptor->type & XvVideoMask)) {
|
||||
client->errorValue = stuff->port;
|
||||
|
|
@ -564,6 +590,11 @@ ProcXvGetStill(ClientPtr client)
|
|||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!(pPort->pAdaptor->type & XvOutputMask) ||
|
||||
!(pPort->pAdaptor->type & XvStillMask)) {
|
||||
client->errorValue = stuff->port;
|
||||
|
|
@ -600,6 +631,7 @@ ProcXvSelectVideoNotify(ClientPtr client)
|
|||
static int
|
||||
ProcXvSelectPortNotify(ClientPtr client)
|
||||
{
|
||||
int status;
|
||||
XvPortPtr pPort;
|
||||
|
||||
REQUEST(xvSelectPortNotifyReq);
|
||||
|
|
@ -607,6 +639,11 @@ ProcXvSelectPortNotify(ClientPtr client)
|
|||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
return XvdiSelectPortNotify(client, pPort, stuff->onoff);
|
||||
}
|
||||
|
||||
|
|
@ -622,6 +659,11 @@ ProcXvGrabPort(ClientPtr client)
|
|||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
status = XvdiGrabPort(client, pPort, stuff->time, &result);
|
||||
|
||||
if (status != Success) {
|
||||
|
|
@ -642,6 +684,7 @@ ProcXvGrabPort(ClientPtr client)
|
|||
static int
|
||||
ProcXvUngrabPort(ClientPtr client)
|
||||
{
|
||||
int status;
|
||||
XvPortPtr pPort;
|
||||
|
||||
REQUEST(xvGrabPortReq);
|
||||
|
|
@ -649,13 +692,18 @@ ProcXvUngrabPort(ClientPtr client)
|
|||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
return XvdiUngrabPort(client, pPort, stuff->time);
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXvStopVideo(ClientPtr client)
|
||||
{
|
||||
int ret;
|
||||
int status, ret;
|
||||
DrawablePtr pDraw;
|
||||
XvPortPtr pPort;
|
||||
|
||||
|
|
@ -664,6 +712,11 @@ ProcXvStopVideo(ClientPtr client)
|
|||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
|
|
@ -682,6 +735,11 @@ ProcXvSetPortAttribute(ClientPtr client)
|
|||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixSetAttrAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!ValidAtom(stuff->attribute)) {
|
||||
client->errorValue = stuff->attribute;
|
||||
return BadAtom;
|
||||
|
|
@ -711,6 +769,11 @@ ProcXvGetPortAttribute(ClientPtr client)
|
|||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!ValidAtom(stuff->attribute)) {
|
||||
client->errorValue = stuff->attribute;
|
||||
return BadAtom;
|
||||
|
|
@ -737,6 +800,7 @@ ProcXvGetPortAttribute(ClientPtr client)
|
|||
static int
|
||||
ProcXvQueryBestSize(ClientPtr client)
|
||||
{
|
||||
int status;
|
||||
unsigned int actual_width, actual_height;
|
||||
XvPortPtr pPort;
|
||||
xvQueryBestSizeReply rep;
|
||||
|
|
@ -746,7 +810,12 @@ ProcXvQueryBestSize(ClientPtr client)
|
|||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
(*pPort->pAdaptor->ddQueryBestSize) (pPort, stuff->motion,
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
(*pPort->pAdaptor->ddQueryBestSize) (client, pPort, stuff->motion,
|
||||
stuff->vid_w, stuff->vid_h,
|
||||
stuff->drw_w, stuff->drw_h,
|
||||
&actual_width, &actual_height);
|
||||
|
|
@ -767,7 +836,7 @@ ProcXvQueryBestSize(ClientPtr client)
|
|||
static int
|
||||
ProcXvQueryPortAttributes(ClientPtr client)
|
||||
{
|
||||
int size, i;
|
||||
int status, size, i;
|
||||
XvPortPtr pPort;
|
||||
XvAttributePtr pAtt;
|
||||
xvQueryPortAttributesReply rep;
|
||||
|
|
@ -778,6 +847,11 @@ ProcXvQueryPortAttributes(ClientPtr client)
|
|||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
rep = (xvQueryPortAttributesReply) {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
|
|
@ -828,6 +902,11 @@ ProcXvPutImage(ClientPtr client)
|
|||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!(pPort->pAdaptor->type & XvImageMask) ||
|
||||
!(pPort->pAdaptor->type & XvInputMask)) {
|
||||
client->errorValue = stuff->port;
|
||||
|
|
@ -851,7 +930,8 @@ ProcXvPutImage(ClientPtr client)
|
|||
|
||||
width = stuff->width;
|
||||
height = stuff->height;
|
||||
size = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage, &width,
|
||||
size = (*pPort->pAdaptor->ddQueryImageAttributes) (client,
|
||||
pPort, pImage, &width,
|
||||
&height, NULL, NULL);
|
||||
size += sizeof(xvPutImageReq);
|
||||
size = bytes_to_int32(size);
|
||||
|
|
@ -888,6 +968,11 @@ ProcXvShmPutImage(ClientPtr client)
|
|||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!(pPort->pAdaptor->type & XvImageMask) ||
|
||||
!(pPort->pAdaptor->type & XvInputMask)) {
|
||||
client->errorValue = stuff->port;
|
||||
|
|
@ -916,7 +1001,8 @@ ProcXvShmPutImage(ClientPtr client)
|
|||
|
||||
width = stuff->width;
|
||||
height = stuff->height;
|
||||
size_needed = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage,
|
||||
size_needed = (*pPort->pAdaptor->ddQueryImageAttributes) (client,
|
||||
pPort, pImage,
|
||||
&width, &height,
|
||||
NULL, NULL);
|
||||
if ((size_needed + stuff->offset) > shmdesc->size)
|
||||
|
|
@ -949,6 +1035,7 @@ ProcXvShmPutImage(ClientPtr client)
|
|||
static int
|
||||
ProcXvShmPutImage(ClientPtr client)
|
||||
{
|
||||
SendErrorToClient(client, XvReqCode, xv_ShmPutImage, 0, BadImplementation);
|
||||
return BadImplementation;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -999,7 +1086,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
|
|||
width = stuff->width;
|
||||
height = stuff->height;
|
||||
|
||||
size = (*pPort->pAdaptor->ddQueryImageAttributes) (pPort, pImage,
|
||||
size = (*pPort->pAdaptor->ddQueryImageAttributes) (client, pPort, pImage,
|
||||
&width, &height, offsets,
|
||||
pitches);
|
||||
|
||||
|
|
@ -1107,6 +1194,7 @@ ProcXvDispatch(ClientPtr client)
|
|||
UpdateCurrentTime();
|
||||
|
||||
if (stuff->data >= xvNumRequests) {
|
||||
SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
|
||||
return BadRequest;
|
||||
}
|
||||
|
||||
|
|
@ -1115,49 +1203,63 @@ ProcXvDispatch(ClientPtr client)
|
|||
|
||||
/* Swapped Procs */
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvQueryExtension(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvQueryExtensionReq);
|
||||
REQUEST_SIZE_MATCH(xvQueryExtensionReq);
|
||||
swaps(&stuff->length);
|
||||
return XvProcVector[xv_QueryExtension] (client);
|
||||
}
|
||||
|
||||
static int
|
||||
SProcXvQueryAdaptors(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvQueryAdaptorsReq);
|
||||
REQUEST_SIZE_MATCH(xvQueryAdaptorsReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->window);
|
||||
return XvProcVector[xv_QueryAdaptors] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvQueryEncodings(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvQueryEncodingsReq);
|
||||
REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
return XvProcVector[xv_QueryEncodings] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvGrabPort(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvGrabPortReq);
|
||||
REQUEST_SIZE_MATCH(xvGrabPortReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
swapl(&stuff->time);
|
||||
return XvProcVector[xv_GrabPort] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvUngrabPort(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvUngrabPortReq);
|
||||
REQUEST_SIZE_MATCH(xvUngrabPortReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
swapl(&stuff->time);
|
||||
return XvProcVector[xv_UngrabPort] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvPutVideo(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvPutVideoReq);
|
||||
REQUEST_SIZE_MATCH(xvPutVideoReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
swapl(&stuff->drawable);
|
||||
swapl(&stuff->gc);
|
||||
|
|
@ -1172,11 +1274,12 @@ SProcXvPutVideo(ClientPtr client)
|
|||
return XvProcVector[xv_PutVideo] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvPutStill(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvPutStillReq);
|
||||
REQUEST_SIZE_MATCH(xvPutStillReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
swapl(&stuff->drawable);
|
||||
swapl(&stuff->gc);
|
||||
|
|
@ -1191,11 +1294,12 @@ SProcXvPutStill(ClientPtr client)
|
|||
return XvProcVector[xv_PutStill] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvGetVideo(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvGetVideoReq);
|
||||
REQUEST_SIZE_MATCH(xvGetVideoReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
swapl(&stuff->drawable);
|
||||
swapl(&stuff->gc);
|
||||
|
|
@ -1210,11 +1314,12 @@ SProcXvGetVideo(ClientPtr client)
|
|||
return XvProcVector[xv_GetVideo] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvGetStill(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvGetStillReq);
|
||||
REQUEST_SIZE_MATCH(xvGetStillReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
swapl(&stuff->drawable);
|
||||
swapl(&stuff->gc);
|
||||
|
|
@ -1229,11 +1334,12 @@ SProcXvGetStill(ClientPtr client)
|
|||
return XvProcVector[xv_GetStill] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvPutImage(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvPutImageReq);
|
||||
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
swapl(&stuff->drawable);
|
||||
swapl(&stuff->gc);
|
||||
|
|
@ -1252,11 +1358,12 @@ SProcXvPutImage(ClientPtr client)
|
|||
}
|
||||
|
||||
#ifdef MITSHM
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvShmPutImage(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvShmPutImageReq);
|
||||
REQUEST_SIZE_MATCH(xvShmPutImageReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
swapl(&stuff->drawable);
|
||||
swapl(&stuff->gc);
|
||||
|
|
@ -1279,60 +1386,66 @@ SProcXvShmPutImage(ClientPtr client)
|
|||
#define SProcXvShmPutImage ProcXvShmPutImage
|
||||
#endif
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvSelectVideoNotify(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvSelectVideoNotifyReq);
|
||||
REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->drawable);
|
||||
return XvProcVector[xv_SelectVideoNotify] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvSelectPortNotify(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvSelectPortNotifyReq);
|
||||
REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
return XvProcVector[xv_SelectPortNotify] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvStopVideo(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvStopVideoReq);
|
||||
REQUEST_SIZE_MATCH(xvStopVideoReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
swapl(&stuff->drawable);
|
||||
return XvProcVector[xv_StopVideo] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvSetPortAttribute(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvSetPortAttributeReq);
|
||||
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
swapl(&stuff->attribute);
|
||||
swapl(&stuff->value);
|
||||
return XvProcVector[xv_SetPortAttribute] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvGetPortAttribute(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvGetPortAttributeReq);
|
||||
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
swapl(&stuff->attribute);
|
||||
return XvProcVector[xv_GetPortAttribute] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvQueryBestSize(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvQueryBestSizeReq);
|
||||
REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
swaps(&stuff->vid_w);
|
||||
swaps(&stuff->vid_h);
|
||||
|
|
@ -1341,20 +1454,22 @@ SProcXvQueryBestSize(ClientPtr client)
|
|||
return XvProcVector[xv_QueryBestSize] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvQueryPortAttributes(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvQueryPortAttributesReq);
|
||||
REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
return XvProcVector[xv_QueryPortAttributes] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvQueryImageAttributes(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvQueryImageAttributesReq);
|
||||
REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
swapl(&stuff->id);
|
||||
swaps(&stuff->width);
|
||||
|
|
@ -1362,17 +1477,18 @@ SProcXvQueryImageAttributes(ClientPtr client)
|
|||
return XvProcVector[xv_QueryImageAttributes] (client);
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvListImageFormats(ClientPtr client)
|
||||
{
|
||||
REQUEST(xvListImageFormatsReq);
|
||||
REQUEST_SIZE_MATCH(xvListImageFormatsReq);
|
||||
swaps(&stuff->length);
|
||||
swapl(&stuff->port);
|
||||
return XvProcVector[xv_ListImageFormats] (client);
|
||||
}
|
||||
|
||||
static int (*SXvProcVector[xvNumRequests]) (ClientPtr) = {
|
||||
ProcXvQueryExtension,
|
||||
SProcXvQueryExtension,
|
||||
SProcXvQueryAdaptors,
|
||||
SProcXvQueryEncodings,
|
||||
SProcXvGrabPort,
|
||||
|
|
@ -1391,7 +1507,7 @@ static int (*SXvProcVector[xvNumRequests]) (ClientPtr) = {
|
|||
SProcXvListImageFormats,
|
||||
SProcXvQueryImageAttributes, SProcXvPutImage, SProcXvShmPutImage,};
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXvDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
|
@ -1399,13 +1515,14 @@ SProcXvDispatch(ClientPtr client)
|
|||
UpdateCurrentTime();
|
||||
|
||||
if (stuff->data >= xvNumRequests) {
|
||||
SendErrorToClient(client, XvReqCode, stuff->data, 0, BadRequest);
|
||||
return BadRequest;
|
||||
}
|
||||
|
||||
return SXvProcVector[stuff->data] (client);
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
static int
|
||||
XineramaXvStopVideo(ClientPtr client)
|
||||
{
|
||||
|
|
@ -1465,14 +1582,12 @@ XineramaXvShmPutImage(ClientPtr client)
|
|||
{
|
||||
REQUEST(xvShmPutImageReq);
|
||||
PanoramiXRes *draw, *gc, *port;
|
||||
Bool send_event;
|
||||
Bool send_event = stuff->send_event;
|
||||
Bool isRoot;
|
||||
int result, i, x, y;
|
||||
|
||||
REQUEST_SIZE_MATCH(xvShmPutImageReq);
|
||||
|
||||
send_event = stuff->send_event;
|
||||
|
||||
result = dixLookupResourceByClass((void **) &draw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (result != Success)
|
||||
|
|
@ -1513,7 +1628,7 @@ XineramaXvShmPutImage(ClientPtr client)
|
|||
}
|
||||
#else
|
||||
#define XineramaXvShmPutImage ProcXvShmPutImage
|
||||
#endif /* MITSHM */
|
||||
#endif
|
||||
|
||||
static int
|
||||
XineramaXvPutImage(ClientPtr client)
|
||||
|
|
@ -1768,17 +1883,17 @@ XineramifyXv(void)
|
|||
XvProcVector[xv_PutImage] = XineramaXvPutImage;
|
||||
XvProcVector[xv_ShmPutImage] = XineramaXvShmPutImage;
|
||||
}
|
||||
#endif /* XINERAMA */
|
||||
#endif /* PANORAMIX */
|
||||
|
||||
void
|
||||
XvResetProcVector(void)
|
||||
{
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
XvProcVector[xv_PutVideo] = ProcXvPutVideo;
|
||||
XvProcVector[xv_PutStill] = ProcXvPutStill;
|
||||
XvProcVector[xv_StopVideo] = ProcXvStopVideo;
|
||||
XvProcVector[xv_SetPortAttribute] = ProcXvSetPortAttribute;
|
||||
XvProcVector[xv_PutImage] = ProcXvPutImage;
|
||||
XvProcVector[xv_ShmPutImage] = ProcXvShmPutImage;
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
118
Xext/xvdix.h
118
Xext/xvdix.h
|
|
@ -4,13 +4,13 @@ and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
|
|||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the names of Digital or MIT not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
|
|
@ -25,18 +25,18 @@ SOFTWARE.
|
|||
#ifndef XVDIX_H
|
||||
#define XVDIX_H
|
||||
/*
|
||||
** File:
|
||||
** File:
|
||||
**
|
||||
** xvdix.h --- Xv device independent header file
|
||||
**
|
||||
** Author:
|
||||
** Author:
|
||||
**
|
||||
** David Carver (Digital Workstation Engineering/Project Athena)
|
||||
**
|
||||
** Revisions:
|
||||
**
|
||||
** 29.08.91 Carver
|
||||
** - removed UnrealizeWindow wrapper unrealizing windows no longer
|
||||
** - removed UnrealizeWindow wrapper unrealizing windows no longer
|
||||
** preempts video
|
||||
**
|
||||
** 11.06.91 Carver
|
||||
|
|
@ -55,6 +55,21 @@ SOFTWARE.
|
|||
#include "scrnintstr.h"
|
||||
#include <X11/extensions/Xvproto.h>
|
||||
|
||||
extern _X_EXPORT unsigned long XvExtensionGeneration;
|
||||
extern _X_EXPORT unsigned long XvScreenGeneration;
|
||||
extern _X_EXPORT unsigned long XvResourceGeneration;
|
||||
|
||||
extern _X_EXPORT int XvReqCode;
|
||||
extern _X_EXPORT int XvEventBase;
|
||||
extern _X_EXPORT int XvErrorBase;
|
||||
|
||||
extern _X_EXPORT RESTYPE XvRTPort;
|
||||
extern _X_EXPORT RESTYPE XvRTEncoding;
|
||||
extern _X_EXPORT RESTYPE XvRTGrab;
|
||||
extern _X_EXPORT RESTYPE XvRTVideoNotify;
|
||||
extern _X_EXPORT RESTYPE XvRTVideoNotifyList;
|
||||
extern _X_EXPORT RESTYPE XvRTPortNotify;
|
||||
|
||||
typedef struct {
|
||||
int numerator;
|
||||
int denominator;
|
||||
|
|
@ -70,7 +85,18 @@ typedef struct {
|
|||
ClientPtr client;
|
||||
} XvGrabRec, *XvGrabPtr;
|
||||
|
||||
typedef struct _XvPortNotifyRec *XvPortNotifyPtr;
|
||||
typedef struct _XvVideoNotifyRec {
|
||||
struct _XvVideoNotifyRec *next;
|
||||
ClientPtr client;
|
||||
unsigned long id;
|
||||
unsigned long mask;
|
||||
} XvVideoNotifyRec, *XvVideoNotifyPtr;
|
||||
|
||||
typedef struct _XvPortNotifyRec {
|
||||
struct _XvPortNotifyRec *next;
|
||||
ClientPtr client;
|
||||
unsigned long id;
|
||||
} XvPortNotifyRec, *XvPortNotifyPtr;
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
|
|
@ -131,29 +157,32 @@ typedef struct {
|
|||
int nPorts;
|
||||
struct _XvPortRec *pPorts;
|
||||
ScreenPtr pScreen;
|
||||
int (*ddPutVideo) (DrawablePtr, struct _XvPortRec *, GCPtr,
|
||||
int (*ddAllocatePort) (unsigned long, struct _XvPortRec *,
|
||||
struct _XvPortRec **);
|
||||
int (*ddFreePort) (struct _XvPortRec *);
|
||||
int (*ddPutVideo) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
INT16, INT16, CARD16, CARD16);
|
||||
int (*ddPutStill) (DrawablePtr, struct _XvPortRec *, GCPtr,
|
||||
int (*ddPutStill) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
INT16, INT16, CARD16, CARD16);
|
||||
int (*ddGetVideo) (DrawablePtr, struct _XvPortRec *, GCPtr,
|
||||
int (*ddGetVideo) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
INT16, INT16, CARD16, CARD16);
|
||||
int (*ddGetStill) (DrawablePtr, struct _XvPortRec *, GCPtr,
|
||||
int (*ddGetStill) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
INT16, INT16, CARD16, CARD16);
|
||||
int (*ddStopVideo) (struct _XvPortRec *, DrawablePtr);
|
||||
int (*ddSetPortAttribute) (struct _XvPortRec *, Atom, INT32);
|
||||
int (*ddGetPortAttribute) (struct _XvPortRec *, Atom, INT32 *);
|
||||
int (*ddQueryBestSize) (struct _XvPortRec *, CARD8,
|
||||
int (*ddStopVideo) (ClientPtr, struct _XvPortRec *, DrawablePtr);
|
||||
int (*ddSetPortAttribute) (ClientPtr, struct _XvPortRec *, Atom, INT32);
|
||||
int (*ddGetPortAttribute) (ClientPtr, struct _XvPortRec *, Atom, INT32 *);
|
||||
int (*ddQueryBestSize) (ClientPtr, struct _XvPortRec *, CARD8,
|
||||
CARD16, CARD16, CARD16, CARD16,
|
||||
unsigned int *, unsigned int *);
|
||||
int (*ddPutImage) (DrawablePtr, struct _XvPortRec *, GCPtr,
|
||||
int (*ddPutImage) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
XvImagePtr, unsigned char *, Bool, CARD16, CARD16);
|
||||
int (*ddQueryImageAttributes) (struct _XvPortRec *, XvImagePtr,
|
||||
int (*ddQueryImageAttributes) (ClientPtr, struct _XvPortRec *, XvImagePtr,
|
||||
CARD16 *, CARD16 *, int *, int *);
|
||||
DevUnion devPriv;
|
||||
} XvAdaptorRec, *XvAdaptorPtr;
|
||||
|
|
@ -169,6 +198,14 @@ typedef struct _XvPortRec {
|
|||
DevUnion devPriv;
|
||||
} XvPortRec, *XvPortPtr;
|
||||
|
||||
#define VALIDATE_XV_PORT(portID, pPort, mode)\
|
||||
{\
|
||||
int rc = dixLookupResourceByType((void **)&(pPort), portID,\
|
||||
XvRTPort, client, mode);\
|
||||
if (rc != Success)\
|
||||
return rc;\
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int version, revision;
|
||||
int nAdaptors;
|
||||
|
|
@ -176,10 +213,55 @@ typedef struct {
|
|||
DestroyWindowProcPtr DestroyWindow;
|
||||
DestroyPixmapProcPtr DestroyPixmap;
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
Bool (*ddCloseScreen) (ScreenPtr);
|
||||
int (*ddQueryAdaptors) (ScreenPtr, XvAdaptorPtr *, int *);
|
||||
DevUnion devPriv;
|
||||
} XvScreenRec, *XvScreenPtr;
|
||||
|
||||
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
|
||||
dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
|
||||
|
||||
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
|
||||
((pScreen)->field = wrapper)
|
||||
|
||||
/* Errors */
|
||||
|
||||
#define _XvBadPort (XvBadPort+XvErrorBase)
|
||||
#define _XvBadEncoding (XvBadEncoding+XvErrorBase)
|
||||
|
||||
extern _X_EXPORT int ProcXvDispatch(ClientPtr);
|
||||
extern _X_EXPORT int SProcXvDispatch(ClientPtr);
|
||||
|
||||
extern _X_EXPORT int XvScreenInit(ScreenPtr);
|
||||
extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
|
||||
extern _X_EXPORT unsigned long XvGetRTPort(void);
|
||||
extern _X_EXPORT int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
|
||||
extern _X_EXPORT int XvdiVideoStopped(XvPortPtr, int);
|
||||
|
||||
extern _X_EXPORT int XvdiPutVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
INT16, INT16, CARD16, CARD16);
|
||||
extern _X_EXPORT int XvdiPutStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
INT16, INT16, CARD16, CARD16);
|
||||
extern _X_EXPORT int XvdiGetVideo(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
INT16, INT16, CARD16, CARD16);
|
||||
extern _X_EXPORT int XvdiGetStill(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
INT16, INT16, CARD16, CARD16);
|
||||
extern _X_EXPORT int XvdiPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
XvImagePtr, unsigned char *, Bool,
|
||||
CARD16, CARD16);
|
||||
extern _X_EXPORT int XvdiSelectVideoNotify(ClientPtr, DrawablePtr, BOOL);
|
||||
extern _X_EXPORT int XvdiSelectPortNotify(ClientPtr, XvPortPtr, BOOL);
|
||||
extern _X_EXPORT int XvdiSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
|
||||
extern _X_EXPORT int XvdiGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *);
|
||||
extern _X_EXPORT int XvdiStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
|
||||
extern _X_EXPORT int XvdiPreemptVideo(ClientPtr, XvPortPtr, DrawablePtr);
|
||||
extern _X_EXPORT int XvdiMatchPort(XvPortPtr, DrawablePtr);
|
||||
extern _X_EXPORT int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *);
|
||||
extern _X_EXPORT int XvdiUngrabPort(ClientPtr, XvPortPtr, Time);
|
||||
#endif /* XVDIX_H */
|
||||
|
|
|
|||
|
|
@ -1,84 +0,0 @@
|
|||
/* SPDX-License-Identifier: MIT OR X11
|
||||
*
|
||||
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
|
||||
*/
|
||||
#ifndef _XORG_XVDIX_PRIV_H
|
||||
|
||||
#include <X11/Xdefs.h>
|
||||
|
||||
#include "include/pixmap.h"
|
||||
#include "include/regionstr.h"
|
||||
#include "Xext/xvdix.h"
|
||||
|
||||
#define VALIDATE_XV_PORT(portID, pPort, mode)\
|
||||
{\
|
||||
int rc = dixLookupResourceByType((void **)&(pPort), portID,\
|
||||
XvRTPort, client, mode);\
|
||||
if (rc != Success)\
|
||||
return rc;\
|
||||
}
|
||||
|
||||
/* Errors */
|
||||
|
||||
#define _XvBadPort (XvBadPort+XvErrorBase)
|
||||
|
||||
typedef struct _XvPortNotifyRec {
|
||||
struct _XvPortNotifyRec *next;
|
||||
ClientPtr client;
|
||||
unsigned long id;
|
||||
} XvPortNotifyRec, *XvPortNotifyPtr;
|
||||
|
||||
extern int XvReqCode;
|
||||
extern int XvErrorBase;
|
||||
|
||||
extern RESTYPE XvRTPort;
|
||||
|
||||
/* dispatch functions */
|
||||
int ProcXvDispatch(ClientPtr);
|
||||
int SProcXvDispatch(ClientPtr);
|
||||
|
||||
void XvFreeAdaptor(XvAdaptorPtr pAdaptor);
|
||||
|
||||
void XvFillColorKey(DrawablePtr pDraw, CARD32 key, RegionPtr region);
|
||||
|
||||
int XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff);
|
||||
int XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff);
|
||||
|
||||
int XvdiPutVideo(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
|
||||
GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w,
|
||||
CARD16 wid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
|
||||
CARD16 drw_h);
|
||||
int XvdiPutStill(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
|
||||
GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w,
|
||||
CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
|
||||
CARD16 drw_h);
|
||||
int XvdiPutImage(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
|
||||
GCPtr pGC, INT16 src_x, INT16 src_y, CARD16 src_w,
|
||||
CARD16 src_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
|
||||
CARD16 drw_h, XvImagePtr image, unsigned char *data,
|
||||
Bool sync, CARD16 width, CARD16 height);
|
||||
|
||||
int XvdiGetVideo(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
|
||||
GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w,
|
||||
CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
|
||||
CARD16 drw_h);
|
||||
int XvdiGetStill(ClientPtr client, DrawablePtr pDraw, XvPortPtr pPort,
|
||||
GCPtr pGC, INT16 vid_x, INT16 vid_y, CARD16 vid_w,
|
||||
CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w,
|
||||
CARD16 drw_h);
|
||||
|
||||
int XvdiSetPortAttribute(ClientPtr client, XvPortPtr pPort, Atom attribute,
|
||||
INT32 value);
|
||||
int XvdiGetPortAttribute(ClientPtr client, XvPortPtr pPort, Atom attribute,
|
||||
INT32 *p_value);
|
||||
|
||||
int XvdiStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw);
|
||||
|
||||
int XvdiMatchPort(XvPortPtr pPort, DrawablePtr pDraw);
|
||||
|
||||
int XvdiGrabPort(ClientPtr client, XvPortPtr pPort, Time ctime, int *p_result);
|
||||
int XvdiUngrabPort(ClientPtr client, XvPortPtr pPort, Time ctime);
|
||||
|
||||
XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
|
||||
|
||||
#endif /* _XORG_XVDIX_PRIV_H */
|
||||
329
Xext/xvmain.c
329
Xext/xvmain.c
|
|
@ -4,13 +4,13 @@ and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
|
|||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the names of Digital or MIT not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
|
|
@ -23,11 +23,11 @@ SOFTWARE.
|
|||
******************************************************************/
|
||||
|
||||
/*
|
||||
** File:
|
||||
** File:
|
||||
**
|
||||
** xvmain.c --- Xv server extension main device independent module.
|
||||
**
|
||||
** Author:
|
||||
**
|
||||
** Author:
|
||||
**
|
||||
** David Carver (Digital Workstation Engineering/Project Athena)
|
||||
**
|
||||
|
|
@ -58,7 +58,7 @@ SOFTWARE.
|
|||
**
|
||||
** 24.01.91 Carver
|
||||
** - version 1.4 upgrade
|
||||
**
|
||||
**
|
||||
** Notes:
|
||||
**
|
||||
** Port structures reference client structures in a two different
|
||||
|
|
@ -73,67 +73,56 @@ SOFTWARE.
|
|||
**
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/extensions/Xv.h>
|
||||
#include <X11/extensions/Xvproto.h>
|
||||
|
||||
#include "Xext/xvdix_priv.h"
|
||||
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "gc.h"
|
||||
#include "extnsionst.h"
|
||||
#include "extinit_priv.h"
|
||||
#include "extinit.h"
|
||||
#include "dixstruct.h"
|
||||
#include "resource.h"
|
||||
#include "opaque.h"
|
||||
#include "input.h"
|
||||
|
||||
#ifdef XINERAMA
|
||||
#define GLOBAL
|
||||
|
||||
#include <X11/extensions/Xv.h>
|
||||
#include <X11/extensions/Xvproto.h>
|
||||
#include "xvdix.h"
|
||||
|
||||
#ifdef PANORAMIX
|
||||
#include "panoramiX.h"
|
||||
#include "panoramiXsrv.h"
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
#include "xvdisp.h"
|
||||
|
||||
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
|
||||
dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
|
||||
|
||||
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
|
||||
((pScreen)->field = wrapper)
|
||||
|
||||
typedef struct _XvVideoNotifyRec {
|
||||
struct _XvVideoNotifyRec *next;
|
||||
ClientPtr client;
|
||||
unsigned long id;
|
||||
unsigned long mask;
|
||||
} XvVideoNotifyRec, *XvVideoNotifyPtr;
|
||||
|
||||
static DevPrivateKeyRec XvScreenKeyRec;
|
||||
|
||||
Bool noXvExtension = FALSE;
|
||||
|
||||
#define XvScreenKey (&XvScreenKeyRec)
|
||||
static unsigned long XvExtensionGeneration = 0;
|
||||
static unsigned long XvScreenGeneration = 0;
|
||||
static unsigned long XvResourceGeneration = 0;
|
||||
unsigned long XvExtensionGeneration = 0;
|
||||
unsigned long XvScreenGeneration = 0;
|
||||
unsigned long XvResourceGeneration = 0;
|
||||
|
||||
int XvReqCode;
|
||||
static int XvEventBase;
|
||||
int XvEventBase;
|
||||
int XvErrorBase;
|
||||
|
||||
RESTYPE XvRTPort;
|
||||
static RESTYPE XvRTEncoding;
|
||||
static RESTYPE XvRTGrab;
|
||||
static RESTYPE XvRTVideoNotify;
|
||||
static RESTYPE XvRTVideoNotifyList;
|
||||
static RESTYPE XvRTPortNotify;
|
||||
RESTYPE XvRTEncoding;
|
||||
RESTYPE XvRTGrab;
|
||||
RESTYPE XvRTVideoNotify;
|
||||
RESTYPE XvRTVideoNotifyList;
|
||||
RESTYPE XvRTPortNotify;
|
||||
|
||||
/* EXTERNAL */
|
||||
|
||||
|
|
@ -174,9 +163,9 @@ XvExtensionInit(void)
|
|||
ErrorF("XvExtensionInit: Unable to allocate resource types\n");
|
||||
return;
|
||||
}
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
XineramaRegisterConnectionBlockCallback(XineramifyXv);
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
XvScreenGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
|
|
@ -267,9 +256,9 @@ XvScreenInit(ScreenPtr pScreen)
|
|||
ErrorF("XvScreenInit: Unable to allocate resource types\n");
|
||||
return BadAlloc;
|
||||
}
|
||||
#ifdef XINERAMA
|
||||
#ifdef PANORAMIX
|
||||
XineramaRegisterConnectionBlockCallback(XineramifyXv);
|
||||
#endif /* XINERAMA */
|
||||
#endif
|
||||
XvScreenGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
|
|
@ -313,6 +302,8 @@ XvCloseScreen(ScreenPtr pScreen)
|
|||
pScreen->DestroyWindow = pxvs->DestroyWindow;
|
||||
pScreen->CloseScreen = pxvs->CloseScreen;
|
||||
|
||||
(*pxvs->ddCloseScreen) (pScreen);
|
||||
|
||||
free(pxvs);
|
||||
|
||||
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
|
||||
|
|
@ -338,24 +329,36 @@ XvGetRTPort(void)
|
|||
return XvRTPort;
|
||||
}
|
||||
|
||||
static void
|
||||
XvStopAdaptors(DrawablePtr pDrawable)
|
||||
static Bool
|
||||
XvDestroyPixmap(PixmapPtr pPix)
|
||||
{
|
||||
ScreenPtr pScreen = pDrawable->pScreen;
|
||||
XvScreenPtr pxvs = dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
|
||||
XvAdaptorPtr pa = pxvs->pAdaptors;
|
||||
int na = pxvs->nAdaptors;
|
||||
Bool status;
|
||||
ScreenPtr pScreen;
|
||||
XvScreenPtr pxvs;
|
||||
XvAdaptorPtr pa;
|
||||
int na;
|
||||
XvPortPtr pp;
|
||||
int np;
|
||||
|
||||
pScreen = pPix->drawable.pScreen;
|
||||
|
||||
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
|
||||
|
||||
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
|
||||
|
||||
/* CHECK TO SEE IF THIS PORT IS IN USE */
|
||||
|
||||
pa = pxvs->pAdaptors;
|
||||
na = pxvs->nAdaptors;
|
||||
while (na--) {
|
||||
XvPortPtr pp = pa->pPorts;
|
||||
int np = pa->nPorts;
|
||||
np = pa->nPorts;
|
||||
pp = pa->pPorts;
|
||||
|
||||
while (np--) {
|
||||
if (pp->pDraw == pDrawable) {
|
||||
XvdiSendVideoNotify(pp, pDrawable, XvPreempted);
|
||||
if (pp->pDraw == (DrawablePtr) pPix) {
|
||||
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
|
||||
|
||||
(void) (*pp->pAdaptor->ddStopVideo) (pp, pDrawable);
|
||||
(void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
|
||||
|
||||
pp->pDraw = NULL;
|
||||
pp->client = NULL;
|
||||
|
|
@ -365,20 +368,9 @@ XvStopAdaptors(DrawablePtr pDrawable)
|
|||
}
|
||||
pa++;
|
||||
}
|
||||
}
|
||||
|
||||
static Bool
|
||||
XvDestroyPixmap(PixmapPtr pPix)
|
||||
{
|
||||
ScreenPtr pScreen = pPix->drawable.pScreen;
|
||||
Bool status = TRUE;
|
||||
status = (*pScreen->DestroyPixmap) (pPix);
|
||||
|
||||
if (pPix->refcnt == 1)
|
||||
XvStopAdaptors(&pPix->drawable);
|
||||
|
||||
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
|
||||
if (pScreen->DestroyPixmap)
|
||||
status = pScreen->DestroyPixmap(pPix);
|
||||
SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
|
||||
|
||||
return status;
|
||||
|
|
@ -388,23 +380,79 @@ XvDestroyPixmap(PixmapPtr pPix)
|
|||
static Bool
|
||||
XvDestroyWindow(WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
Bool status;
|
||||
ScreenPtr pScreen;
|
||||
XvScreenPtr pxvs;
|
||||
XvAdaptorPtr pa;
|
||||
int na;
|
||||
XvPortPtr pp;
|
||||
int np;
|
||||
|
||||
XvStopAdaptors(&pWin->drawable);
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
|
||||
SCREEN_PROLOGUE(pScreen, DestroyWindow);
|
||||
|
||||
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
|
||||
|
||||
/* CHECK TO SEE IF THIS PORT IS IN USE */
|
||||
|
||||
pa = pxvs->pAdaptors;
|
||||
na = pxvs->nAdaptors;
|
||||
while (na--) {
|
||||
np = pa->nPorts;
|
||||
pp = pa->pPorts;
|
||||
|
||||
while (np--) {
|
||||
if (pp->pDraw == (DrawablePtr) pWin) {
|
||||
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
|
||||
|
||||
(void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
|
||||
|
||||
pp->pDraw = NULL;
|
||||
pp->client = NULL;
|
||||
pp->time = currentTime;
|
||||
}
|
||||
pp++;
|
||||
}
|
||||
pa++;
|
||||
}
|
||||
|
||||
status = (*pScreen->DestroyWindow) (pWin);
|
||||
|
||||
SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
|
||||
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
/* The XvdiVideoStopped procedure is a hook for the device dependent layer.
|
||||
It provides a way for the dd layer to inform the di layer that video has
|
||||
stopped in a port for reasons that the di layer had no control over; note
|
||||
that it doesn't call back into the dd layer */
|
||||
|
||||
int
|
||||
XvdiVideoStopped(XvPortPtr pPort, int reason)
|
||||
{
|
||||
|
||||
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
|
||||
|
||||
if (!pPort->pDraw)
|
||||
return Success;
|
||||
|
||||
XvdiSendVideoNotify(pPort, pPort->pDraw, reason);
|
||||
|
||||
pPort->pDraw = NULL;
|
||||
pPort->client = NULL;
|
||||
pPort->time = currentTime;
|
||||
|
||||
return Success;
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
XvdiDestroyPort(void *pPort, XID id)
|
||||
{
|
||||
return Success;
|
||||
return (*((XvPortPtr) pPort)->pAdaptor->ddFreePort) (pPort);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
@ -437,7 +485,7 @@ XvdiDestroyVideoNotifyList(void *pn, XID id)
|
|||
{
|
||||
XvVideoNotifyPtr npn, cpn;
|
||||
|
||||
/* ACTUALLY DESTROY THE NOTIFY LIST */
|
||||
/* ACTUALLY DESTROY THE NOTITY LIST */
|
||||
|
||||
cpn = (XvVideoNotifyPtr) pn;
|
||||
|
||||
|
|
@ -481,7 +529,7 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
|
|||
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
XvdiSendPortNotify(XvPortPtr pPort, Atom attribute, INT32 value)
|
||||
{
|
||||
XvPortNotifyPtr pn;
|
||||
|
|
@ -544,7 +592,7 @@ XvdiPutVideo(ClientPtr client,
|
|||
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
|
||||
}
|
||||
|
||||
(void) (*pPort->pAdaptor->ddPutVideo) (pDraw, pPort, pGC,
|
||||
(void) (*pPort->pAdaptor->ddPutVideo) (client, pDraw, pPort, pGC,
|
||||
vid_x, vid_y, vid_w, vid_h,
|
||||
drw_x, drw_y, drw_w, drw_h);
|
||||
|
||||
|
|
@ -586,7 +634,7 @@ XvdiPutStill(ClientPtr client,
|
|||
|
||||
pPort->time = currentTime;
|
||||
|
||||
status = (*pPort->pAdaptor->ddPutStill) (pDraw, pPort, pGC,
|
||||
status = (*pPort->pAdaptor->ddPutStill) (client, pDraw, pPort, pGC,
|
||||
vid_x, vid_y, vid_w, vid_h,
|
||||
drw_x, drw_y, drw_w, drw_h);
|
||||
|
||||
|
|
@ -622,7 +670,7 @@ XvdiPutImage(ClientPtr client,
|
|||
|
||||
pPort->time = currentTime;
|
||||
|
||||
return (*pPort->pAdaptor->ddPutImage) (pDraw, pPort, pGC,
|
||||
return (*pPort->pAdaptor->ddPutImage) (client, pDraw, pPort, pGC,
|
||||
src_x, src_y, src_w, src_h,
|
||||
drw_x, drw_y, drw_w, drw_h,
|
||||
image, data, sync, width, height);
|
||||
|
|
@ -661,7 +709,7 @@ XvdiGetVideo(ClientPtr client,
|
|||
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
|
||||
}
|
||||
|
||||
(void) (*pPort->pAdaptor->ddGetVideo) (pDraw, pPort, pGC,
|
||||
(void) (*pPort->pAdaptor->ddGetVideo) (client, pDraw, pPort, pGC,
|
||||
vid_x, vid_y, vid_w, vid_h,
|
||||
drw_x, drw_y, drw_w, drw_h);
|
||||
|
||||
|
|
@ -701,7 +749,7 @@ XvdiGetStill(ClientPtr client,
|
|||
return Success;
|
||||
}
|
||||
|
||||
status = (*pPort->pAdaptor->ddGetStill) (pDraw, pPort, pGC,
|
||||
status = (*pPort->pAdaptor->ddGetStill) (client, pDraw, pPort, pGC,
|
||||
vid_x, vid_y, vid_w, vid_h,
|
||||
drw_x, drw_y, drw_w, drw_h);
|
||||
|
||||
|
|
@ -812,9 +860,10 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
|
|||
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
|
||||
return BadAlloc;
|
||||
tpn->next = NULL;
|
||||
tpn->client = NULL;
|
||||
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
|
||||
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn)) {
|
||||
free(tpn);
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* LOOK TO SEE IF ENTRY ALREADY EXISTS */
|
||||
|
|
@ -823,10 +872,8 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
|
|||
tpn = pn;
|
||||
while (tpn) {
|
||||
if (tpn->client == client) {
|
||||
if (!onoff) {
|
||||
if (!onoff)
|
||||
tpn->client = NULL;
|
||||
FreeResource(tpn->id, XvRTVideoNotify);
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
if (!tpn->client)
|
||||
|
|
@ -834,7 +881,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
|
|||
tpn = tpn->next;
|
||||
}
|
||||
|
||||
/* IF TURNING OFF, THEN JUST RETURN */
|
||||
/* IF TUNNING OFF, THEN JUST RETURN */
|
||||
|
||||
if (!onoff)
|
||||
return Success;
|
||||
|
|
@ -857,8 +904,7 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
|
|||
|
||||
tpn->client = NULL;
|
||||
tpn->id = FakeClientID(client->index);
|
||||
if (!AddResource(tpn->id, XvRTVideoNotify, tpn))
|
||||
return BadAlloc;
|
||||
AddResource(tpn->id, XvRTVideoNotify, tpn);
|
||||
|
||||
tpn->client = client;
|
||||
return Success;
|
||||
|
|
@ -895,7 +941,7 @@ XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff)
|
|||
return Success;
|
||||
}
|
||||
|
||||
/* DIDN'T FIND IT; SO REUSE LIST ELEMENT IF ONE IS FREE OTHERWISE
|
||||
/* DIDN'T FIND IT; SO REUSE LIST ELEMENT IF ONE IS FREE OTHERWISE
|
||||
CREATE A NEW ONE AND ADD IT TO THE BEGINNING OF THE LIST */
|
||||
|
||||
if (!tpn) {
|
||||
|
|
@ -907,8 +953,7 @@ XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff)
|
|||
|
||||
tpn->client = client;
|
||||
tpn->id = FakeClientID(client->index);
|
||||
if (!AddResource(tpn->id, XvRTPortNotify, tpn))
|
||||
return BadAlloc;
|
||||
AddResource(tpn->id, XvRTPortNotify, tpn);
|
||||
|
||||
return Success;
|
||||
|
||||
|
|
@ -936,7 +981,29 @@ XvdiStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
|
|||
|
||||
XvdiSendVideoNotify(pPort, pDraw, XvStopped);
|
||||
|
||||
status = (*pPort->pAdaptor->ddStopVideo) (pPort, pDraw);
|
||||
status = (*pPort->pAdaptor->ddStopVideo) (client, pPort, pDraw);
|
||||
|
||||
pPort->pDraw = NULL;
|
||||
pPort->client = (ClientPtr) client;
|
||||
pPort->time = currentTime;
|
||||
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
XvdiPreemptVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
|
||||
{
|
||||
int status;
|
||||
|
||||
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
|
||||
|
||||
if (!pPort->pDraw || (pPort->pDraw != pDraw))
|
||||
return Success;
|
||||
|
||||
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
|
||||
|
||||
status = (*pPort->pAdaptor->ddStopVideo) (client, pPort, pPort->pDraw);
|
||||
|
||||
pPort->pDraw = NULL;
|
||||
pPort->client = (ClientPtr) client;
|
||||
|
|
@ -979,7 +1046,7 @@ XvdiSetPortAttribute(ClientPtr client,
|
|||
int status;
|
||||
|
||||
status =
|
||||
(*pPort->pAdaptor->ddSetPortAttribute) (pPort, attribute,
|
||||
(*pPort->pAdaptor->ddSetPortAttribute) (client, pPort, attribute,
|
||||
value);
|
||||
if (status == Success)
|
||||
XvdiSendPortNotify(pPort, attribute, value);
|
||||
|
|
@ -993,12 +1060,12 @@ XvdiGetPortAttribute(ClientPtr client,
|
|||
{
|
||||
|
||||
return
|
||||
(*pPort->pAdaptor->ddGetPortAttribute) (pPort, attribute,
|
||||
(*pPort->pAdaptor->ddGetPortAttribute) (client, pPort, attribute,
|
||||
p_value);
|
||||
|
||||
}
|
||||
|
||||
static void _X_COLD
|
||||
static void
|
||||
WriteSwappedVideoNotifyEvent(xvEvent * from, xvEvent * to)
|
||||
{
|
||||
|
||||
|
|
@ -1012,7 +1079,7 @@ WriteSwappedVideoNotifyEvent(xvEvent * from, xvEvent * to)
|
|||
|
||||
}
|
||||
|
||||
static void _X_COLD
|
||||
static void
|
||||
WriteSwappedPortNotifyEvent(xvEvent * from, xvEvent * to)
|
||||
{
|
||||
|
||||
|
|
@ -1024,77 +1091,3 @@ WriteSwappedPortNotifyEvent(xvEvent * from, xvEvent * to)
|
|||
cpswapl(from->u.portNotify.value, to->u.portNotify.value);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
XvFreeAdaptor(XvAdaptorPtr pAdaptor)
|
||||
{
|
||||
int i;
|
||||
|
||||
free(pAdaptor->name);
|
||||
pAdaptor->name = NULL;
|
||||
|
||||
if (pAdaptor->pEncodings) {
|
||||
XvEncodingPtr pEncode = pAdaptor->pEncodings;
|
||||
|
||||
for (i = 0; i < pAdaptor->nEncodings; i++, pEncode++)
|
||||
free(pEncode->name);
|
||||
free(pAdaptor->pEncodings);
|
||||
pAdaptor->pEncodings = NULL;
|
||||
}
|
||||
|
||||
free(pAdaptor->pFormats);
|
||||
pAdaptor->pFormats = NULL;
|
||||
|
||||
free(pAdaptor->pPorts);
|
||||
pAdaptor->pPorts = NULL;
|
||||
|
||||
if (pAdaptor->pAttributes) {
|
||||
XvAttributePtr pAttribute = pAdaptor->pAttributes;
|
||||
|
||||
for (i = 0; i < pAdaptor->nAttributes; i++, pAttribute++)
|
||||
free(pAttribute->name);
|
||||
free(pAdaptor->pAttributes);
|
||||
pAdaptor->pAttributes = NULL;
|
||||
}
|
||||
|
||||
free(pAdaptor->pImages);
|
||||
pAdaptor->pImages = NULL;
|
||||
|
||||
free(pAdaptor->devPriv.ptr);
|
||||
pAdaptor->devPriv.ptr = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
XvFillColorKey(DrawablePtr pDraw, CARD32 key, RegionPtr region)
|
||||
{
|
||||
ScreenPtr pScreen = pDraw->pScreen;
|
||||
ChangeGCVal pval[2];
|
||||
BoxPtr pbox = RegionRects(region);
|
||||
int i, nbox = RegionNumRects(region);
|
||||
xRectangle *rects;
|
||||
GCPtr gc;
|
||||
|
||||
gc = GetScratchGC(pDraw->depth, pScreen);
|
||||
if (!gc)
|
||||
return;
|
||||
|
||||
pval[0].val = key;
|
||||
pval[1].val = IncludeInferiors;
|
||||
(void) ChangeGC(NullClient, gc, GCForeground | GCSubwindowMode, pval);
|
||||
ValidateGC(pDraw, gc);
|
||||
|
||||
rects = xallocarray(nbox, sizeof(xRectangle));
|
||||
if (rects) {
|
||||
for (i = 0; i < nbox; i++, pbox++) {
|
||||
rects[i].x = pbox->x1 - pDraw->x;
|
||||
rects[i].y = pbox->y1 - pDraw->y;
|
||||
rects[i].width = pbox->x2 - pbox->x1;
|
||||
rects[i].height = pbox->y2 - pbox->y1;
|
||||
}
|
||||
|
||||
(*gc->ops->PolyFillRect) (pDraw, gc, nbox, rects);
|
||||
|
||||
free(rects);
|
||||
}
|
||||
FreeScratchGC(gc);
|
||||
}
|
||||
|
|
|
|||
36
Xext/xvmc.c
36
Xext/xvmc.c
|
|
@ -1,21 +1,22 @@
|
|||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
|
||||
#include "Xext/xvdix_priv.h"
|
||||
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "dixstruct.h"
|
||||
#include "resource.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "extnsionst.h"
|
||||
#include "extinit_priv.h"
|
||||
#include "extinit.h"
|
||||
#include "servermd.h"
|
||||
#include <X11/Xfuncproto.h>
|
||||
#include "xvdix.h"
|
||||
#include <X11/extensions/XvMC.h>
|
||||
#include <X11/extensions/Xvproto.h>
|
||||
#include <X11/extensions/XvMCproto.h>
|
||||
|
|
@ -43,6 +44,8 @@ static RESTYPE XvMCRTContext;
|
|||
static RESTYPE XvMCRTSurface;
|
||||
static RESTYPE XvMCRTSubpicture;
|
||||
|
||||
int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = NULL;
|
||||
|
||||
typedef struct {
|
||||
int num_adaptors;
|
||||
XvMCAdaptorPtr adaptors;
|
||||
|
|
@ -250,10 +253,6 @@ ProcXvMCCreateContext(ClientPtr client)
|
|||
free(pContext);
|
||||
return result;
|
||||
}
|
||||
if (!AddResource(pContext->context_id, XvMCRTContext, pContext)) {
|
||||
free(data);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
rep = (xvmcCreateContextReply) {
|
||||
.type = X_Reply,
|
||||
|
|
@ -267,6 +266,7 @@ ProcXvMCCreateContext(ClientPtr client)
|
|||
WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
|
||||
if (dwords)
|
||||
WriteToClient(client, dwords << 2, data);
|
||||
AddResource(pContext->context_id, XvMCRTContext, pContext);
|
||||
|
||||
free(data);
|
||||
|
||||
|
|
@ -287,7 +287,7 @@ ProcXvMCDestroyContext(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
FreeResource(stuff->context_id, X11_RESTYPE_NONE);
|
||||
FreeResource(stuff->context_id, RT_NONE);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -329,11 +329,6 @@ ProcXvMCCreateSurface(ClientPtr client)
|
|||
free(pSurface);
|
||||
return result;
|
||||
}
|
||||
if (!AddResource(pSurface->surface_id, XvMCRTSurface, pSurface)) {
|
||||
free(data);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
rep = (xvmcCreateSurfaceReply) {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
|
|
@ -343,6 +338,7 @@ ProcXvMCCreateSurface(ClientPtr client)
|
|||
WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
|
||||
if (dwords)
|
||||
WriteToClient(client, dwords << 2, data);
|
||||
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
|
||||
|
||||
free(data);
|
||||
|
||||
|
|
@ -365,7 +361,7 @@ ProcXvMCDestroySurface(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
FreeResource(stuff->surface_id, X11_RESTYPE_NONE);
|
||||
FreeResource(stuff->surface_id, RT_NONE);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -449,11 +445,6 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
|||
free(pSubpicture);
|
||||
return result;
|
||||
}
|
||||
if (!AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture)) {
|
||||
free(data);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
rep = (xvmcCreateSubpictureReply) {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
|
|
@ -471,6 +462,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
|||
WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
|
||||
if (dwords)
|
||||
WriteToClient(client, dwords << 2, data);
|
||||
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
|
||||
|
||||
free(data);
|
||||
|
||||
|
|
@ -493,7 +485,7 @@ ProcXvMCDestroySubpicture(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
FreeResource(stuff->subpicture_id, X11_RESTYPE_NONE);
|
||||
FreeResource(stuff->subpicture_id, RT_NONE);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -687,7 +679,7 @@ ProcXvMCDispatch(ClientPtr client)
|
|||
return BadRequest;
|
||||
}
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcXvMCDispatch(ClientPtr client)
|
||||
{
|
||||
/* We only support local */
|
||||
|
|
|
|||
|
|
@ -84,9 +84,13 @@ typedef struct {
|
|||
XvMCDestroySubpictureProcPtr DestroySubpicture;
|
||||
} XvMCAdaptorRec, *XvMCAdaptorPtr;
|
||||
|
||||
extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr);
|
||||
|
||||
extern _X_EXPORT int XvMCScreenInit(ScreenPtr pScreen,
|
||||
int num, XvMCAdaptorPtr adapt);
|
||||
|
||||
extern _X_EXPORT XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
|
||||
|
||||
extern _X_EXPORT int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, const char *name,
|
||||
const char *busID, int major, int minor,
|
||||
int patchLevel);
|
||||
|
|
|
|||
111
Xi/Makefile.am
Normal file
111
Xi/Makefile.am
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
noinst_LTLIBRARIES = libXi.la libXistubs.la
|
||||
|
||||
AM_CFLAGS = $(DIX_CFLAGS)
|
||||
|
||||
libXi_la_SOURCES = \
|
||||
allowev.c \
|
||||
allowev.h \
|
||||
chgdctl.c \
|
||||
chgdctl.h \
|
||||
chgfctl.c \
|
||||
chgfctl.h \
|
||||
chgkbd.c \
|
||||
chgkbd.h \
|
||||
chgkmap.c \
|
||||
chgkmap.h \
|
||||
chgprop.c \
|
||||
chgprop.h \
|
||||
chgptr.c \
|
||||
chgptr.h \
|
||||
closedev.c \
|
||||
closedev.h \
|
||||
devbell.c \
|
||||
devbell.h \
|
||||
exevents.c \
|
||||
exglobals.h \
|
||||
extinit.c \
|
||||
getbmap.c \
|
||||
getbmap.h \
|
||||
getdctl.c \
|
||||
getdctl.h \
|
||||
getfctl.c \
|
||||
getfctl.h \
|
||||
getfocus.c \
|
||||
getfocus.h \
|
||||
getkmap.c \
|
||||
getkmap.h \
|
||||
getmmap.c \
|
||||
getmmap.h \
|
||||
getprop.c \
|
||||
getprop.h \
|
||||
getselev.c \
|
||||
getselev.h \
|
||||
getvers.c \
|
||||
getvers.h \
|
||||
grabdev.c \
|
||||
grabdev.h \
|
||||
grabdevb.c \
|
||||
grabdevb.h \
|
||||
grabdevk.c \
|
||||
grabdevk.h \
|
||||
gtmotion.c \
|
||||
gtmotion.h \
|
||||
listdev.c \
|
||||
listdev.h \
|
||||
opendev.c \
|
||||
opendev.h \
|
||||
queryst.c \
|
||||
queryst.h \
|
||||
selectev.c \
|
||||
selectev.h \
|
||||
sendexev.c \
|
||||
sendexev.h \
|
||||
setbmap.c \
|
||||
setbmap.h \
|
||||
setdval.c \
|
||||
setdval.h \
|
||||
setfocus.c \
|
||||
setfocus.h \
|
||||
setmmap.c \
|
||||
setmmap.h \
|
||||
setmode.c \
|
||||
setmode.h \
|
||||
ungrdev.c \
|
||||
ungrdev.h \
|
||||
ungrdevb.c \
|
||||
ungrdevb.h \
|
||||
ungrdevk.c \
|
||||
ungrdevk.h \
|
||||
xiallowev.c \
|
||||
xiallowev.h \
|
||||
xibarriers.c \
|
||||
xibarriers.h \
|
||||
xichangecursor.c \
|
||||
xichangecursor.h \
|
||||
xichangehierarchy.c \
|
||||
xichangehierarchy.h \
|
||||
xigetclientpointer.c \
|
||||
xigetclientpointer.h \
|
||||
xigrabdev.c \
|
||||
xigrabdev.h \
|
||||
xipassivegrab.h \
|
||||
xipassivegrab.c \
|
||||
xiproperty.c \
|
||||
xiproperty.h \
|
||||
xiquerydevice.c \
|
||||
xiquerydevice.h \
|
||||
xiquerypointer.c \
|
||||
xiquerypointer.h \
|
||||
xiqueryversion.c \
|
||||
xiqueryversion.h \
|
||||
xiselectev.c \
|
||||
xiselectev.h \
|
||||
xisetclientpointer.c \
|
||||
xisetclientpointer.h \
|
||||
xisetdevfocus.c \
|
||||
xisetdevfocus.h \
|
||||
xiwarppointer.c \
|
||||
xiwarppointer.h
|
||||
|
||||
libXistubs_la_SOURCES = \
|
||||
stubs.c
|
||||
20
Xi/allowev.c
20
Xi/allowev.c
|
|
@ -50,15 +50,14 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "dix/input_priv.h"
|
||||
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "allowev.h"
|
||||
|
|
@ -70,10 +69,11 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXAllowDeviceEvents(ClientPtr client)
|
||||
{
|
||||
REQUEST(xAllowDeviceEventsReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
|
||||
swapl(&stuff->time);
|
||||
return (ProcXAllowDeviceEvents(client));
|
||||
|
|
@ -102,22 +102,22 @@ ProcXAllowDeviceEvents(ClientPtr client)
|
|||
|
||||
switch (stuff->mode) {
|
||||
case ReplayThisDevice:
|
||||
AllowSome(client, time, thisdev, GRAB_STATE_NOT_GRABBED);
|
||||
AllowSome(client, time, thisdev, NOT_GRABBED);
|
||||
break;
|
||||
case SyncThisDevice:
|
||||
AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_NEXT_EVENT);
|
||||
AllowSome(client, time, thisdev, FREEZE_NEXT_EVENT);
|
||||
break;
|
||||
case AsyncThisDevice:
|
||||
AllowSome(client, time, thisdev, GRAB_STATE_THAWED);
|
||||
AllowSome(client, time, thisdev, THAWED);
|
||||
break;
|
||||
case AsyncOtherDevices:
|
||||
AllowSome(client, time, thisdev, GRAB_STATE_THAW_OTHERS);
|
||||
AllowSome(client, time, thisdev, THAW_OTHERS);
|
||||
break;
|
||||
case SyncAll:
|
||||
AllowSome(client, time, thisdev, GRAB_STATE_FREEZE_BOTH_NEXT_EVENT);
|
||||
AllowSome(client, time, thisdev, FREEZE_BOTH_NEXT_EVENT);
|
||||
break;
|
||||
case AsyncAll:
|
||||
AllowSome(client, time, thisdev, GRAB_STATE_THAWED_BOTH);
|
||||
AllowSome(client, time, thisdev, THAWED_BOTH);
|
||||
break;
|
||||
default:
|
||||
client->errorValue = stuff->mode;
|
||||
|
|
|
|||
20
Xi/chgdctl.c
20
Xi/chgdctl.c
|
|
@ -50,17 +50,18 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h> /* control constants */
|
||||
|
||||
#include "dix/exevents_priv.h"
|
||||
#include "dix/input_priv.h"
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h> /* control constants */
|
||||
#include "XIstubs.h"
|
||||
|
||||
#include "exglobals.h"
|
||||
#include "exevents.h"
|
||||
|
||||
#include "chgdctl.h"
|
||||
|
||||
/***********************************************************************
|
||||
|
|
@ -70,12 +71,13 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXChangeDeviceControl(ClientPtr client)
|
||||
{
|
||||
xDeviceCtl *ctl;
|
||||
|
||||
REQUEST(xChangeDeviceControlReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
|
||||
swaps(&stuff->control);
|
||||
ctl = (xDeviceCtl *) &stuff[1];
|
||||
|
|
@ -115,7 +117,7 @@ ProcXChangeDeviceControl(ClientPtr client)
|
|||
REQUEST(xChangeDeviceControlReq);
|
||||
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
|
||||
|
||||
len = client->req_len - bytes_to_int32(sizeof(xChangeDeviceControlReq));
|
||||
len = stuff->length - bytes_to_int32(sizeof(xChangeDeviceControlReq));
|
||||
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
|
||||
if (ret != Success)
|
||||
goto out;
|
||||
|
|
@ -245,7 +247,7 @@ ProcXChangeDeviceControl(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXChangeDeviceControl(ClientPtr client, int size,
|
||||
xChangeDeviceControlReply * rep)
|
||||
{
|
||||
|
|
|
|||
12
Xi/chgfctl.c
12
Xi/chgfctl.c
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
|
|
@ -69,10 +71,11 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXChangeFeedbackControl(ClientPtr client)
|
||||
{
|
||||
REQUEST(xChangeFeedbackControlReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
|
||||
swapl(&stuff->mask);
|
||||
return (ProcXChangeFeedbackControl(client));
|
||||
|
|
@ -435,7 +438,7 @@ ProcXChangeFeedbackControl(ClientPtr client)
|
|||
REQUEST(xChangeFeedbackControlReq);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
|
||||
|
||||
len = client->req_len - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
|
||||
len = stuff->length - bytes_to_int32(sizeof(xChangeFeedbackControlReq));
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
|
@ -461,11 +464,8 @@ ProcXChangeFeedbackControl(ClientPtr client)
|
|||
break;
|
||||
case StringFeedbackClass:
|
||||
{
|
||||
xStringFeedbackCtl *f;
|
||||
xStringFeedbackCtl *f = ((xStringFeedbackCtl *) &stuff[1]);
|
||||
|
||||
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeFeedbackControlReq,
|
||||
sizeof(xStringFeedbackCtl));
|
||||
f = ((xStringFeedbackCtl *) &stuff[1]);
|
||||
if (client->swapped) {
|
||||
if (len < bytes_to_int32(sizeof(xStringFeedbackCtl)))
|
||||
return BadLength;
|
||||
|
|
|
|||
19
Xi/chgkbd.c
19
Xi/chgkbd.c
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
|
|
@ -69,6 +71,23 @@ SOFTWARE.
|
|||
* This procedure changes the keyboard device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXChangeKeyboardDevice(ClientPtr client)
|
||||
{
|
||||
REQUEST(xChangeKeyboardDeviceReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
|
||||
return (ProcXChangeKeyboardDevice(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure is invoked to swap the request bytes if the server and
|
||||
* client have a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
ProcXChangeKeyboardDevice(ClientPtr client)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef CHGKBD_H
|
||||
#define CHGKBD_H 1
|
||||
|
||||
int SProcXChangeKeyboardDevice(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXChangeKeyboardDevice(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
15
Xi/chgkmap.c
15
Xi/chgkmap.c
|
|
@ -50,14 +50,14 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/exevents_priv.h"
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "chgkmap.h"
|
||||
|
|
@ -69,12 +69,13 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXChangeDeviceKeyMapping(ClientPtr client)
|
||||
{
|
||||
unsigned int count;
|
||||
|
||||
REQUEST(xChangeDeviceKeyMappingReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
|
||||
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
|
||||
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
|
||||
|
|
@ -105,7 +106,7 @@ ProcXChangeDeviceKeyMapping(ClientPtr client)
|
|||
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
len = client->req_len - bytes_to_int32(sizeof(xChangeDeviceKeyMappingReq));
|
||||
len = stuff->length - bytes_to_int32(sizeof(xChangeDeviceKeyMappingReq));
|
||||
|
||||
ret = ChangeKeyMapping(client, dev, len, DeviceMappingNotify,
|
||||
stuff->firstKeyCode, stuff->keyCodes,
|
||||
|
|
|
|||
17
Xi/chgprop.c
17
Xi/chgprop.c
|
|
@ -50,18 +50,18 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "dix/exevents_priv.h"
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h"
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "chgprop.h"
|
||||
#include "grabdev.h"
|
||||
|
||||
|
|
@ -71,10 +71,11 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXChangeDeviceDontPropagateList(ClientPtr client)
|
||||
{
|
||||
REQUEST(xChangeDeviceDontPropagateListReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
|
||||
swapl(&stuff->window);
|
||||
swaps(&stuff->count);
|
||||
|
|
@ -101,7 +102,7 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
|
|||
REQUEST(xChangeDeviceDontPropagateListReq);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
|
||||
|
||||
if (client->req_len !=
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xChangeDeviceDontPropagateListReq)) +
|
||||
stuff->count)
|
||||
return BadLength;
|
||||
|
|
|
|||
18
Xi/chgptr.c
18
Xi/chgptr.c
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
|
|
@ -65,6 +67,22 @@ SOFTWARE.
|
|||
|
||||
#include "chgptr.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure is invoked to swap the request bytes if the server and
|
||||
* client have a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXChangePointerDevice(ClientPtr client)
|
||||
{
|
||||
REQUEST(xChangePointerDeviceReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
|
||||
return (ProcXChangePointerDevice(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure changes the device used as the X pointer.
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef CHGPTR_H
|
||||
#define CHGPTR_H 1
|
||||
|
||||
int SProcXChangePointerDevice(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXChangePointerDevice(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
|
|
@ -62,6 +64,21 @@ SOFTWARE.
|
|||
|
||||
#include "closedev.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure closes an input device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXCloseDevice(ClientPtr client)
|
||||
{
|
||||
REQUEST(xCloseDeviceReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xCloseDeviceReq);
|
||||
return (ProcXCloseDevice(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Clear out event selections and passive grabs from a window for the
|
||||
|
|
@ -85,13 +102,13 @@ DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
|
|||
next = grab->next;
|
||||
if ((grab->device == dev) &&
|
||||
(client->clientAsMask == CLIENT_BITS(grab->resource)))
|
||||
FreeResource(grab->resource, X11_RESTYPE_NONE);
|
||||
FreeResource(grab->resource, RT_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Walk through the window tree, deleting event selections for this client
|
||||
* Walk througth the window tree, deleting event selections for this client
|
||||
* from this device from all windows.
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef CLOSEDEV_H
|
||||
#define CLOSEDEV_H 1
|
||||
|
||||
int SProcXCloseDevice(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXCloseDevice(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
17
Xi/devbell.c
17
Xi/devbell.c
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
|
|
@ -59,6 +61,21 @@ SOFTWARE.
|
|||
|
||||
#include "devbell.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure is invoked to swap the request bytes if the server and
|
||||
* client have a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXDeviceBell(ClientPtr client)
|
||||
{
|
||||
REQUEST(xDeviceBellReq);
|
||||
swaps(&stuff->length);
|
||||
return (ProcXDeviceBell(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure rings a bell on an extension device.
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef DEVBELL_H
|
||||
#define DEVBELL_H 1
|
||||
|
||||
int SProcXDeviceBell(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXDeviceBell(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
533
Xi/exevents.c
533
Xi/exevents.c
|
|
@ -78,37 +78,35 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h"
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/extensions/geproto.h>
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include <X11/extensions/XI2proto.h>
|
||||
#include <X11/extensions/XKBproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "dix/dixgrabs_priv.h"
|
||||
#include "dix/eventconvert.h"
|
||||
#include "dix/exevents_priv.h"
|
||||
#include "dix/input_priv.h"
|
||||
|
||||
#include "inputstr.h"
|
||||
#include <X11/extensions/geproto.h>
|
||||
#include "windowstr.h"
|
||||
#include "miscstruct.h"
|
||||
#include "region.h"
|
||||
#include "exevents.h"
|
||||
#include "extnsionst.h"
|
||||
#include "exglobals.h"
|
||||
#include "eventstr.h"
|
||||
#include "dixevents.h" /* DeliverFocusedEvent */
|
||||
#include "dixgrabs.h" /* CreateGrab() */
|
||||
#include "scrnintstr.h"
|
||||
#include "listdev.h" /* for CopySwapXXXClass */
|
||||
#include "xace.h"
|
||||
#include "xiquerydevice.h" /* For List*Info */
|
||||
#include "eventconvert.h"
|
||||
#include "eventstr.h"
|
||||
#include "inpututils.h"
|
||||
#include "mi.h"
|
||||
|
||||
#include <X11/extensions/XKBproto.h>
|
||||
#include "xkbsrv.h"
|
||||
|
||||
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
|
||||
|
|
@ -170,49 +168,6 @@ IsTouchEvent(InternalEvent *event)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
Bool
|
||||
IsGestureEvent(InternalEvent *event)
|
||||
{
|
||||
switch (event->any.type) {
|
||||
case ET_GesturePinchBegin:
|
||||
case ET_GesturePinchUpdate:
|
||||
case ET_GesturePinchEnd:
|
||||
case ET_GestureSwipeBegin:
|
||||
case ET_GestureSwipeUpdate:
|
||||
case ET_GestureSwipeEnd:
|
||||
return TRUE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bool
|
||||
IsGestureBeginEvent(InternalEvent *event)
|
||||
{
|
||||
switch (event->any.type) {
|
||||
case ET_GesturePinchBegin:
|
||||
case ET_GestureSwipeBegin:
|
||||
return TRUE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bool
|
||||
IsGestureEndEvent(InternalEvent *event)
|
||||
{
|
||||
switch (event->any.type) {
|
||||
case ET_GesturePinchEnd:
|
||||
case ET_GestureSwipeEnd:
|
||||
return TRUE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the device matching the deviceid of the device set in the event, or
|
||||
* NULL if the event is not an XInput event.
|
||||
|
|
@ -516,9 +471,9 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
|
|||
|
||||
oldTrace = to->focus->trace;
|
||||
memcpy(to->focus, from->focus, sizeof(FocusClassRec));
|
||||
to->focus->trace = reallocarray(oldTrace,
|
||||
to->focus->traceSize,
|
||||
sizeof(WindowPtr));
|
||||
to->focus->trace = realloc(oldTrace,
|
||||
to->focus->traceSize *
|
||||
sizeof(WindowPtr));
|
||||
if (!to->focus->trace && to->focus->traceSize)
|
||||
FatalError("[Xi] no memory for trace.\n");
|
||||
memcpy(to->focus->trace, from->focus->trace,
|
||||
|
|
@ -606,25 +561,22 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
|
|||
to->button = calloc(1, sizeof(ButtonClassRec));
|
||||
if (!to->button)
|
||||
FatalError("[Xi] no memory for class shift.\n");
|
||||
to->button->numButtons = from->button->numButtons;
|
||||
}
|
||||
else
|
||||
classes->button = NULL;
|
||||
}
|
||||
|
||||
if (from->button->xkb_acts) {
|
||||
size_t maxbuttons = max(to->button->numButtons, from->button->numButtons);
|
||||
to->button->xkb_acts = XNFreallocarray(to->button->xkb_acts,
|
||||
maxbuttons,
|
||||
sizeof(XkbAction));
|
||||
memset(to->button->xkb_acts, 0, maxbuttons * sizeof(XkbAction));
|
||||
if (!to->button->xkb_acts) {
|
||||
to->button->xkb_acts = calloc(1, sizeof(XkbAction));
|
||||
if (!to->button->xkb_acts)
|
||||
FatalError("[Xi] not enough memory for xkb_acts.\n");
|
||||
}
|
||||
memcpy(to->button->xkb_acts, from->button->xkb_acts,
|
||||
from->button->numButtons * sizeof(XkbAction));
|
||||
sizeof(XkbAction));
|
||||
}
|
||||
else {
|
||||
else
|
||||
free(to->button->xkb_acts);
|
||||
to->button->xkb_acts = NULL;
|
||||
}
|
||||
|
||||
memcpy(to->button->labels, from->button->labels,
|
||||
from->button->numButtons * sizeof(Atom));
|
||||
|
|
@ -695,32 +647,13 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
|
|||
/* Don't remove touch class if from->touch is non-existent. The to device
|
||||
* may have an active touch grab, so we need to keep the touch class record
|
||||
* around. */
|
||||
|
||||
if (from->gesture) {
|
||||
if (!to->gesture) {
|
||||
classes = to->unused_classes;
|
||||
to->gesture = classes->gesture;
|
||||
if (!to->gesture) {
|
||||
if (!InitGestureClassDeviceStruct(to, from->gesture->max_touches))
|
||||
FatalError("[Xi] no memory for class shift.\n");
|
||||
}
|
||||
else
|
||||
classes->gesture = NULL;
|
||||
}
|
||||
|
||||
to->gesture->sourceid = from->gesture->sourceid;
|
||||
/* to->gesture->gesture is separate on the master, don't copy */
|
||||
}
|
||||
/* Don't remove gesture class if from->gesture is non-existent. The to device
|
||||
* may have an active gesture grab, so we need to keep the gesture class record
|
||||
* around. */
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the CONTENT of the classes of device from into the classes in device
|
||||
* to. From and to are identical after finishing.
|
||||
*
|
||||
* If to does not have classes from currently has, the classes are stored in
|
||||
* If to does not have classes from currenly has, the classes are stored in
|
||||
* to's devPrivates system. Later, we recover it again from there if needed.
|
||||
* Saves a few memory allocations.
|
||||
*/
|
||||
|
|
@ -728,7 +661,7 @@ void
|
|||
DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to,
|
||||
DeviceChangedEvent *dce)
|
||||
{
|
||||
input_lock();
|
||||
OsBlockSIGIO();
|
||||
|
||||
/* generic feedback classes, not tied to pointer and/or keyboard */
|
||||
DeepCopyFeedbackClasses(from, to);
|
||||
|
|
@ -738,7 +671,7 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to,
|
|||
if ((dce->flags & DEVCHANGE_POINTER_EVENT))
|
||||
DeepCopyPointerClasses(from, to);
|
||||
|
||||
input_unlock();
|
||||
OsReleaseSIGIO();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -813,8 +746,9 @@ UpdateDeviceMotionMask(DeviceIntPtr device, unsigned short state,
|
|||
{
|
||||
Mask mask;
|
||||
|
||||
mask = PointerMotionMask | state | motion_mask;
|
||||
mask = DevicePointerMotionMask | state | motion_mask;
|
||||
SetMaskForEvent(device->id, mask, DeviceMotionNotify);
|
||||
mask = PointerMotionMask | state | motion_mask;
|
||||
SetMaskForEvent(device->id, mask, MotionNotify);
|
||||
}
|
||||
|
||||
|
|
@ -1093,7 +1027,7 @@ DeliverOneTouchEvent(ClientPtr client, DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
|
||||
FixUpEventFromWindow(&ti->sprite, xi2, win, child, FALSE);
|
||||
filter = GetEventFilter(dev, xi2);
|
||||
if (XaceHookReceiveAccess(client, win, xi2, 1) != Success)
|
||||
if (XaceHook(XACE_RECEIVE_ACCESS, client, win, xi2, 1) != Success)
|
||||
return FALSE;
|
||||
err = TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
|
||||
free(xi2);
|
||||
|
|
@ -1110,8 +1044,8 @@ ActivateEarlyAccept(DeviceIntPtr dev, TouchPointInfoPtr ti)
|
|||
XID error;
|
||||
GrabPtr grab = ti->listeners[0].grab;
|
||||
|
||||
BUG_RETURN(ti->listeners[0].type != TOUCH_LISTENER_GRAB &&
|
||||
ti->listeners[0].type != TOUCH_LISTENER_POINTER_GRAB);
|
||||
BUG_RETURN(ti->listeners[0].type != LISTENER_GRAB &&
|
||||
ti->listeners[0].type != LISTENER_POINTER_GRAB);
|
||||
BUG_RETURN(!grab);
|
||||
|
||||
client = rClient(grab);
|
||||
|
|
@ -1144,8 +1078,8 @@ FindOldestPointerEmulatedTouch(DeviceIntPtr dev)
|
|||
continue;
|
||||
|
||||
for (j = 0; j < ti->num_listeners; j++) {
|
||||
if (ti->listeners[j].type == TOUCH_LISTENER_POINTER_GRAB ||
|
||||
ti->listeners[j].type == TOUCH_LISTENER_POINTER_REGULAR)
|
||||
if (ti->listeners[j].type == LISTENER_POINTER_GRAB ||
|
||||
ti->listeners[j].type == LISTENER_POINTER_REGULAR)
|
||||
break;
|
||||
}
|
||||
if (j == ti->num_listeners)
|
||||
|
|
@ -1172,17 +1106,17 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
TouchOwnershipEvent *ev)
|
||||
{
|
||||
TouchListener *listener = &ti->listeners[0]; /* new owner */
|
||||
int accepted_early = listener->state == TOUCH_LISTENER_EARLY_ACCEPT;
|
||||
int accepted_early = listener->state == LISTENER_EARLY_ACCEPT;
|
||||
|
||||
/* Deliver the ownership */
|
||||
if (listener->state == TOUCH_LISTENER_AWAITING_OWNER || accepted_early)
|
||||
if (listener->state == LISTENER_AWAITING_OWNER || accepted_early)
|
||||
DeliverTouchEvents(dev, ti, (InternalEvent *) ev,
|
||||
listener->listener);
|
||||
else if (listener->state == TOUCH_LISTENER_AWAITING_BEGIN) {
|
||||
else if (listener->state == LISTENER_AWAITING_BEGIN) {
|
||||
/* We can't punt to a pointer listener unless all older pointer
|
||||
* emulated touches have been seen already. */
|
||||
if ((listener->type == TOUCH_LISTENER_POINTER_GRAB ||
|
||||
listener->type == TOUCH_LISTENER_POINTER_REGULAR) &&
|
||||
if ((listener->type == LISTENER_POINTER_GRAB ||
|
||||
listener->type == LISTENER_POINTER_REGULAR) &&
|
||||
ti != FindOldestPointerEmulatedTouch(dev))
|
||||
return;
|
||||
|
||||
|
|
@ -1225,7 +1159,7 @@ CheckOldestTouch(DeviceIntPtr dev)
|
|||
{
|
||||
TouchPointInfoPtr oldest = FindOldestPointerEmulatedTouch(dev);
|
||||
|
||||
if (oldest && oldest->listeners[0].state == TOUCH_LISTENER_AWAITING_BEGIN)
|
||||
if (oldest && oldest->listeners[0].state == LISTENER_AWAITING_BEGIN)
|
||||
TouchPuntToNextOwner(dev, oldest, NULL);
|
||||
}
|
||||
|
||||
|
|
@ -1249,7 +1183,7 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
|
|||
* haven't received one yet already */
|
||||
for (i = 0; i < ti->num_listeners; i++) {
|
||||
if (ti->listeners[i].listener == resource) {
|
||||
if (ti->listeners[i].state != TOUCH_LISTENER_HAS_END)
|
||||
if (ti->listeners[i].state != LISTENER_HAS_END)
|
||||
TouchEmitTouchEnd(sourcedev, ti, TOUCH_REJECT, resource);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1295,12 +1229,12 @@ ProcessTouchOwnershipEvent(TouchOwnershipEvent *ev,
|
|||
|
||||
|
||||
/* For pointer-emulated listeners that ungrabbed the active grab,
|
||||
* the state was forced to TOUCH_LISTENER_HAS_END. Still go
|
||||
* the state was forced to LISTENER_HAS_END. Still go
|
||||
* through the motions of ending the touch if the listener has
|
||||
* already seen the end. This ensures that the touch record is ended in
|
||||
* the server.
|
||||
*/
|
||||
if (ti->listeners[0].state == TOUCH_LISTENER_HAS_END)
|
||||
if (ti->listeners[0].state == LISTENER_HAS_END)
|
||||
TouchEmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[0].listener);
|
||||
|
||||
/* The touch owner has accepted the touch. Send TouchEnd events to
|
||||
|
|
@ -1311,10 +1245,10 @@ ProcessTouchOwnershipEvent(TouchOwnershipEvent *ev,
|
|||
while (ti->num_listeners > 1)
|
||||
TouchRemoveListener(ti, ti->listeners[1].listener);
|
||||
/* Owner accepted after receiving end */
|
||||
if (ti->listeners[0].state == TOUCH_LISTENER_HAS_END)
|
||||
if (ti->listeners[0].state == LISTENER_HAS_END)
|
||||
TouchEndTouch(dev, ti);
|
||||
else
|
||||
ti->listeners[0].state = TOUCH_LISTENER_HAS_ACCEPTED;
|
||||
ti->listeners[0].state = LISTENER_HAS_ACCEPTED;
|
||||
}
|
||||
else { /* this is the very first ownership event for a grab */
|
||||
DeliverTouchEvents(dev, ti, (InternalEvent *) ev, ev->resource);
|
||||
|
|
@ -1360,8 +1294,9 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
InputClients *iclients = NULL;
|
||||
*mask = NULL;
|
||||
|
||||
if (listener->type == TOUCH_LISTENER_GRAB ||
|
||||
listener->type == TOUCH_LISTENER_POINTER_GRAB) {
|
||||
if (listener->type == LISTENER_GRAB ||
|
||||
listener->type == LISTENER_POINTER_GRAB) {
|
||||
|
||||
*grab = listener->grab;
|
||||
|
||||
BUG_RETURN_VAL(!*grab, FALSE);
|
||||
|
|
@ -1381,12 +1316,11 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
int evtype;
|
||||
|
||||
if (ti->emulate_pointer &&
|
||||
listener->type == TOUCH_LISTENER_POINTER_REGULAR)
|
||||
listener->type == LISTENER_POINTER_REGULAR)
|
||||
evtype = GetXI2Type(TouchGetPointerEventType(ev));
|
||||
else
|
||||
evtype = GetXI2Type(ev->any.type);
|
||||
|
||||
BUG_RETURN_VAL(!wOtherInputMasks(*win), FALSE);
|
||||
nt_list_for_each_entry(iclients,
|
||||
wOtherInputMasks(*win)->inputClients, next)
|
||||
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
|
||||
|
|
@ -1401,7 +1335,6 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
int xi_type = GetXIType(TouchGetPointerEventType(ev));
|
||||
Mask xi_filter = event_get_filter_from_type(dev, xi_type);
|
||||
|
||||
BUG_RETURN_VAL(!wOtherInputMasks(*win), FALSE);
|
||||
nt_list_for_each_entry(iclients,
|
||||
wOtherInputMasks(*win)->inputClients, next)
|
||||
if (iclients->mask[dev->id] & xi_filter)
|
||||
|
|
@ -1442,32 +1375,13 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
int nevents;
|
||||
DeviceIntPtr kbd;
|
||||
|
||||
/* There may be a pointer grab on the device */
|
||||
if (!grab) {
|
||||
grab = dev->deviceGrab.grab;
|
||||
if (grab) {
|
||||
win = grab->window;
|
||||
xi2mask = grab->xi2mask;
|
||||
client = rClient(grab);
|
||||
}
|
||||
}
|
||||
|
||||
/* We don't deliver pointer events to non-owners */
|
||||
if (!TouchResourceIsOwner(ti, listener->listener))
|
||||
return !Success;
|
||||
|
||||
if (!ti->emulate_pointer)
|
||||
return !Success;
|
||||
|
||||
nevents = TouchConvertToPointerEvent(ev, &motion, &button);
|
||||
BUG_RETURN_VAL(nevents == 0, BadValue);
|
||||
|
||||
/* Note that here we deliver only part of the events that are generated by the touch event:
|
||||
*
|
||||
* TouchBegin results in ButtonPress (motion is handled in DeliverEmulatedMotionEvent)
|
||||
* TouchUpdate results in Motion
|
||||
* TouchEnd results in ButtonRelease (motion is handled in DeliverEmulatedMotionEvent)
|
||||
*/
|
||||
if (nevents > 1)
|
||||
ptrev = &button;
|
||||
|
||||
|
|
@ -1489,7 +1403,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
|
||||
if (grab->ownerEvents) {
|
||||
WindowPtr focus = NullWindow;
|
||||
WindowPtr sprite_win = DeepestSpriteWin(dev->spriteInfo->sprite);
|
||||
WindowPtr sprite_win = dev->spriteInfo->sprite->win;
|
||||
|
||||
deliveries = DeliverDeviceEvents(sprite_win, ptrev, grab, focus, dev);
|
||||
}
|
||||
|
|
@ -1515,9 +1429,8 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
}
|
||||
else {
|
||||
GrabPtr devgrab = dev->deviceGrab.grab;
|
||||
WindowPtr sprite_win = DeepestSpriteWin(dev->spriteInfo->sprite);
|
||||
|
||||
DeliverDeviceEvents(sprite_win, ptrev, grab, win, dev);
|
||||
DeliverDeviceEvents(win, ptrev, grab, win, dev);
|
||||
/* FIXME: bad hack
|
||||
* Implicit passive grab activated in response to this event. Store
|
||||
* the event.
|
||||
|
|
@ -1530,7 +1443,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
g = AllocGrab(devgrab);
|
||||
BUG_WARN(!g);
|
||||
|
||||
CopyPartialInternalEvent(dev->deviceGrab.sync.event, ev);
|
||||
*dev->deviceGrab.sync.event = ev->device_event;
|
||||
|
||||
/* The listener array has a sequence of grabs and then one event
|
||||
* selection. Implicit grab activation occurs through delivering an
|
||||
|
|
@ -1539,19 +1452,19 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
l = &ti->listeners[ti->num_listeners - 1];
|
||||
l->listener = g->resource;
|
||||
l->grab = g;
|
||||
//l->resource_type = X11_RESTYPE_NONE;
|
||||
//l->resource_type = RT_NONE;
|
||||
|
||||
if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin)
|
||||
l->type = TOUCH_LISTENER_POINTER_GRAB;
|
||||
l->type = LISTENER_POINTER_GRAB;
|
||||
else
|
||||
l->type = TOUCH_LISTENER_GRAB;
|
||||
l->type = LISTENER_GRAB;
|
||||
}
|
||||
|
||||
}
|
||||
if (ev->any.type == ET_TouchBegin)
|
||||
listener->state = TOUCH_LISTENER_IS_OWNER;
|
||||
listener->state = LISTENER_IS_OWNER;
|
||||
else if (ev->any.type == ET_TouchEnd)
|
||||
listener->state = TOUCH_LISTENER_HAS_END;
|
||||
listener->state = LISTENER_HAS_END;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -1568,8 +1481,8 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
GrabPtr grab;
|
||||
XI2Mask *mask;
|
||||
|
||||
if (ti->listeners[0].type != TOUCH_LISTENER_POINTER_REGULAR &&
|
||||
ti->listeners[0].type != TOUCH_LISTENER_POINTER_GRAB)
|
||||
if (ti->listeners[0].type != LISTENER_POINTER_REGULAR &&
|
||||
ti->listeners[0].type != LISTENER_POINTER_GRAB)
|
||||
return;
|
||||
|
||||
motion = ev->device_event;
|
||||
|
|
@ -1581,6 +1494,16 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
&mask))
|
||||
return;
|
||||
|
||||
/* There may be a pointer grab on the device */
|
||||
if (!grab) {
|
||||
grab = dev->deviceGrab.grab;
|
||||
if (grab) {
|
||||
win = grab->window;
|
||||
mask = grab->xi2mask;
|
||||
client = rClient(grab);
|
||||
}
|
||||
}
|
||||
|
||||
DeliverTouchEmulatedEvent(dev, ti, (InternalEvent*)&motion, &ti->listeners[0], client,
|
||||
win, grab, mask);
|
||||
}
|
||||
|
|
@ -1666,14 +1589,13 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
|
|||
if (!ti) {
|
||||
DebugF("[Xi] %s: Failed to get event %d for touchpoint %d\n",
|
||||
dev->name, type, touchid);
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
|
||||
/* if emulate_pointer is set, emulate the motion event right
|
||||
* here, so we can ignore it for button event emulation. TouchUpdate
|
||||
* events which _only_ emulate motion just work normally */
|
||||
if (emulate_pointer && (ev->any.type == ET_TouchBegin ||
|
||||
(ev->any.type == ET_TouchEnd && ti->num_listeners > 0)))
|
||||
if (emulate_pointer && ev->any.type != ET_TouchUpdate)
|
||||
DeliverEmulatedMotionEvent(dev, ti, ev);
|
||||
|
||||
if (emulate_pointer && IsMaster(dev))
|
||||
|
|
@ -1701,7 +1623,6 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
|
|||
if (ev->any.type == ET_TouchEnd)
|
||||
TouchEndTouch(dev, ti);
|
||||
|
||||
out:
|
||||
if (emulate_pointer)
|
||||
UpdateDeviceState(dev, &ev->device_event);
|
||||
}
|
||||
|
|
@ -1749,72 +1670,6 @@ ProcessBarrierEvent(InternalEvent *e, DeviceIntPtr dev)
|
|||
free(ev);
|
||||
}
|
||||
|
||||
static BOOL
|
||||
IsAnotherGestureActiveOnMaster(DeviceIntPtr dev, InternalEvent* ev)
|
||||
{
|
||||
GestureClassPtr g = dev->gesture;
|
||||
if (g->gesture.active && g->gesture.sourceid != ev->gesture_event.sourceid) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes and delivers a Gesture{Pinch,Swipe}{Begin,Update,End}.
|
||||
*
|
||||
* Due to having rather different delivery semantics (see the Xi 2.4 protocol
|
||||
* spec for more information), this implements its own grab and event-selection
|
||||
* delivery logic.
|
||||
*/
|
||||
void
|
||||
ProcessGestureEvent(InternalEvent *ev, DeviceIntPtr dev)
|
||||
{
|
||||
GestureInfoPtr gi;
|
||||
DeviceIntPtr kbd;
|
||||
Bool deactivateGestureGrab = FALSE;
|
||||
Bool delivered = FALSE;
|
||||
|
||||
if (!dev->gesture)
|
||||
return;
|
||||
|
||||
if (IsMaster(dev) && IsAnotherGestureActiveOnMaster(dev, ev))
|
||||
return;
|
||||
|
||||
if (IsGestureBeginEvent(ev))
|
||||
gi = GestureBeginGesture(dev, ev);
|
||||
else
|
||||
gi = GestureFindActiveByEventType(dev, ev->any.type);
|
||||
|
||||
if (!gi) {
|
||||
/* This may happen if gesture is no longer active or was never started. */
|
||||
return;
|
||||
}
|
||||
|
||||
kbd = GetMaster(dev, KEYBOARD_OR_FLOAT);
|
||||
event_set_state_gesture(kbd, &ev->gesture_event);
|
||||
|
||||
if (IsGestureBeginEvent(ev))
|
||||
GestureSetupListener(dev, gi, ev);
|
||||
|
||||
if (IsGestureEndEvent(ev) &&
|
||||
dev->deviceGrab.grab &&
|
||||
dev->deviceGrab.fromPassiveGrab &&
|
||||
GrabIsGestureGrab(dev->deviceGrab.grab))
|
||||
deactivateGestureGrab = TRUE;
|
||||
|
||||
delivered = DeliverGestureEventToOwner(dev, gi, ev);
|
||||
|
||||
if (delivered && !deactivateGestureGrab &&
|
||||
(IsGestureBeginEvent(ev) || IsGestureEndEvent(ev)))
|
||||
FreezeThisEventIfNeededForSyncGrab(dev, ev);
|
||||
|
||||
if (IsGestureEndEvent(ev))
|
||||
GestureEndGesture(gi);
|
||||
|
||||
if (deactivateGestureGrab)
|
||||
(*dev->deviceGrab.DeactivateGrab) (dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process DeviceEvents and DeviceChangedEvents.
|
||||
*/
|
||||
|
|
@ -1874,18 +1729,6 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
|
|||
break;
|
||||
}
|
||||
|
||||
/* send KeyPress and KeyRelease events to XACE plugins */
|
||||
if (XaceHookIsSet(XACE_KEY_AVAIL) &&
|
||||
(event->type == ET_KeyPress || event->type == ET_KeyRelease)) {
|
||||
xEvent *core;
|
||||
int count;
|
||||
|
||||
if (EventToCore(ev, &core, &count) == Success && count > 0) {
|
||||
XaceHookKeyAvail(core, device, 0);
|
||||
free(core);
|
||||
}
|
||||
}
|
||||
|
||||
if (DeviceEventCallback && !syncEvents.playingEvents) {
|
||||
DeviceEventInfoRec eventinfo;
|
||||
SpritePtr pSprite = device->spriteInfo->sprite;
|
||||
|
|
@ -1903,11 +1746,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
|
|||
|
||||
switch (event->type) {
|
||||
case ET_KeyPress:
|
||||
/* Don't deliver focus events (e.g. from KeymapNotify when running
|
||||
* nested) to clients. */
|
||||
if (event->source_type == EVENT_SOURCE_FOCUS)
|
||||
return;
|
||||
if (!grab && CheckDeviceGrabs(device, ev, 0))
|
||||
if (!grab && CheckDeviceGrabs(device, event, 0))
|
||||
return;
|
||||
break;
|
||||
case ET_KeyRelease:
|
||||
|
|
@ -1920,7 +1759,7 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
|
|||
if (b->map[key] == 0) /* there's no button 0 */
|
||||
return;
|
||||
event->detail.button = b->map[key];
|
||||
if (!grab && CheckDeviceGrabs(device, ev, 0)) {
|
||||
if (!grab && CheckDeviceGrabs(device, event, 0)) {
|
||||
/* if a passive grab was activated, the event has been sent
|
||||
* already */
|
||||
return;
|
||||
|
|
@ -1938,19 +1777,15 @@ ProcessDeviceEvent(InternalEvent *ev, DeviceIntPtr device)
|
|||
break;
|
||||
}
|
||||
|
||||
/* Don't deliver focus events (e.g. from KeymapNotify when running
|
||||
* nested) to clients. */
|
||||
if (event->source_type != EVENT_SOURCE_FOCUS) {
|
||||
if (grab)
|
||||
DeliverGrabbedEvent((InternalEvent *) event, device,
|
||||
deactivateDeviceGrab);
|
||||
else if (device->focus && !IsPointerEvent(ev))
|
||||
DeliverFocusedEvent(device, (InternalEvent *) event,
|
||||
GetSpriteWindow(device));
|
||||
else
|
||||
DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent *) event,
|
||||
NullGrab, NullWindow, device);
|
||||
}
|
||||
if (grab)
|
||||
DeliverGrabbedEvent((InternalEvent *) event, device,
|
||||
deactivateDeviceGrab);
|
||||
else if (device->focus && !IsPointerEvent(ev))
|
||||
DeliverFocusedEvent(device, (InternalEvent *) event,
|
||||
GetSpriteWindow(device));
|
||||
else
|
||||
DeliverDeviceEvents(GetSpriteWindow(device), (InternalEvent *) event,
|
||||
NullGrab, NullWindow, device);
|
||||
|
||||
if (deactivateDeviceGrab == TRUE) {
|
||||
(*device->deviceGrab.DeactivateGrab) (device);
|
||||
|
|
@ -2009,14 +1844,6 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
|
|||
case ET_BarrierLeave:
|
||||
ProcessBarrierEvent(ev, device);
|
||||
break;
|
||||
case ET_GesturePinchBegin:
|
||||
case ET_GesturePinchUpdate:
|
||||
case ET_GesturePinchEnd:
|
||||
case ET_GestureSwipeBegin:
|
||||
case ET_GestureSwipeUpdate:
|
||||
case ET_GestureSwipeEnd:
|
||||
ProcessGestureEvent(ev, device);
|
||||
break;
|
||||
default:
|
||||
ProcessDeviceEvent(ev, device);
|
||||
break;
|
||||
|
|
@ -2033,14 +1860,14 @@ DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
int rc = Success;
|
||||
Bool has_ownershipmask;
|
||||
|
||||
if (listener->type == TOUCH_LISTENER_POINTER_REGULAR ||
|
||||
listener->type == TOUCH_LISTENER_POINTER_GRAB) {
|
||||
if (listener->type == LISTENER_POINTER_REGULAR ||
|
||||
listener->type == LISTENER_POINTER_GRAB) {
|
||||
rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
|
||||
grab, xi2mask);
|
||||
if (rc == Success) {
|
||||
listener->state = TOUCH_LISTENER_IS_OWNER;
|
||||
listener->state = LISTENER_IS_OWNER;
|
||||
/* async grabs cannot replay, so automatically accept this touch */
|
||||
if (listener->type == TOUCH_LISTENER_POINTER_GRAB &&
|
||||
if (listener->type == LISTENER_POINTER_GRAB &&
|
||||
dev->deviceGrab.grab &&
|
||||
dev->deviceGrab.fromPassiveGrab &&
|
||||
dev->deviceGrab.grab->pointerMode == GrabModeAsync)
|
||||
|
|
@ -2055,18 +1882,18 @@ DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
|
||||
if (!TouchResourceIsOwner(ti, listener->listener)) {
|
||||
if (has_ownershipmask)
|
||||
state = TOUCH_LISTENER_AWAITING_OWNER;
|
||||
state = LISTENER_AWAITING_OWNER;
|
||||
else
|
||||
state = TOUCH_LISTENER_AWAITING_BEGIN;
|
||||
state = LISTENER_AWAITING_BEGIN;
|
||||
}
|
||||
else {
|
||||
if (has_ownershipmask)
|
||||
TouchSendOwnershipEvent(dev, ti, 0, listener->listener);
|
||||
|
||||
if (listener->type == TOUCH_LISTENER_REGULAR)
|
||||
state = TOUCH_LISTENER_HAS_ACCEPTED;
|
||||
if (listener->type == LISTENER_REGULAR)
|
||||
state = LISTENER_HAS_ACCEPTED;
|
||||
else
|
||||
state = TOUCH_LISTENER_IS_OWNER;
|
||||
state = LISTENER_IS_OWNER;
|
||||
}
|
||||
listener->state = state;
|
||||
|
||||
|
|
@ -2081,14 +1908,14 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
|
|||
{
|
||||
int rc = Success;
|
||||
|
||||
if (listener->type == TOUCH_LISTENER_POINTER_REGULAR ||
|
||||
listener->type == TOUCH_LISTENER_POINTER_GRAB) {
|
||||
if (listener->type == LISTENER_POINTER_REGULAR ||
|
||||
listener->type == LISTENER_POINTER_GRAB) {
|
||||
/* Note: If the active grab was ungrabbed, we already changed the
|
||||
* state to TOUCH_LISTENER_HAS_END but still get here. So we mustn't
|
||||
* state to LISTENER_HAS_END but still get here. So we mustn't
|
||||
* actually send the event.
|
||||
* This is part two of the hack in DeactivatePointerGrab
|
||||
*/
|
||||
if (listener->state != TOUCH_LISTENER_HAS_END) {
|
||||
if (listener->state != LISTENER_HAS_END) {
|
||||
rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
|
||||
grab, xi2mask);
|
||||
|
||||
|
|
@ -2098,14 +1925,14 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
|
|||
* and we can continue.
|
||||
*/
|
||||
if (rc == Success)
|
||||
listener->state = TOUCH_LISTENER_HAS_END;
|
||||
listener->state = LISTENER_HAS_END;
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* A client is waiting for the begin, don't give it a TouchEnd */
|
||||
if (listener->state == TOUCH_LISTENER_AWAITING_BEGIN) {
|
||||
listener->state = TOUCH_LISTENER_HAS_END;
|
||||
if (listener->state == LISTENER_AWAITING_BEGIN) {
|
||||
listener->state = LISTENER_HAS_END;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
@ -2113,19 +1940,19 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
|
|||
if (ev->device_event.flags & TOUCH_REJECT ||
|
||||
(ev->device_event.flags & TOUCH_ACCEPT && !TouchResourceIsOwner(ti, listener->listener))) {
|
||||
/* Touch has been rejected, or accepted by its owner which is not this listener */
|
||||
if (listener->state != TOUCH_LISTENER_HAS_END)
|
||||
if (listener->state != LISTENER_HAS_END)
|
||||
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
|
||||
listener->state = TOUCH_LISTENER_HAS_END;
|
||||
listener->state = LISTENER_HAS_END;
|
||||
}
|
||||
else if (TouchResourceIsOwner(ti, listener->listener)) {
|
||||
Bool normal_end = !(ev->device_event.flags & TOUCH_ACCEPT);
|
||||
|
||||
/* FIXME: what about early acceptance */
|
||||
if (normal_end && listener->state != TOUCH_LISTENER_HAS_END)
|
||||
if (normal_end && listener->state != LISTENER_HAS_END)
|
||||
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
|
||||
|
||||
if ((ti->num_listeners > 1 ||
|
||||
(ti->num_grabs > 0 && listener->state != TOUCH_LISTENER_HAS_ACCEPTED)) &&
|
||||
(ti->num_grabs > 0 && listener->state != LISTENER_HAS_ACCEPTED)) &&
|
||||
(ev->device_event.flags & (TOUCH_ACCEPT | TOUCH_REJECT)) == 0) {
|
||||
ev->any.type = ET_TouchUpdate;
|
||||
ev->device_event.flags |= TOUCH_PENDING_END;
|
||||
|
|
@ -2133,7 +1960,7 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
|
|||
}
|
||||
|
||||
if (normal_end)
|
||||
listener->state = TOUCH_LISTENER_HAS_END;
|
||||
listener->state = LISTENER_HAS_END;
|
||||
}
|
||||
|
||||
out:
|
||||
|
|
@ -2156,7 +1983,7 @@ DeliverTouchEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
|
|||
if (!TouchResourceIsOwner(ti, listener->listener))
|
||||
goto out;
|
||||
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
|
||||
listener->state = TOUCH_LISTENER_IS_OWNER;
|
||||
listener->state = LISTENER_IS_OWNER;
|
||||
}
|
||||
else
|
||||
ev->device_event.deviceid = dev->id;
|
||||
|
|
@ -2166,8 +1993,8 @@ DeliverTouchEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
|
|||
xi2mask);
|
||||
}
|
||||
else if (ev->any.type == ET_TouchUpdate) {
|
||||
if (listener->type == TOUCH_LISTENER_POINTER_REGULAR ||
|
||||
listener->type == TOUCH_LISTENER_POINTER_GRAB)
|
||||
if (listener->type == LISTENER_POINTER_REGULAR ||
|
||||
listener->type == LISTENER_POINTER_GRAB)
|
||||
DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win, grab,
|
||||
xi2mask);
|
||||
else if (TouchResourceIsOwner(ti, listener->listener) ||
|
||||
|
|
@ -2221,112 +2048,6 @@ DeliverTouchEvents(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to deliver a gesture event to the given client.
|
||||
*/
|
||||
static Bool
|
||||
DeliverOneGestureEvent(ClientPtr client, DeviceIntPtr dev, GestureInfoPtr gi,
|
||||
GrabPtr grab, WindowPtr win, InternalEvent *ev)
|
||||
{
|
||||
int err;
|
||||
xEvent *xi2;
|
||||
Mask filter;
|
||||
Window child = DeepestSpriteWin(&gi->sprite)->drawable.id;
|
||||
|
||||
/* If we fail here, we're going to leave a client hanging. */
|
||||
err = EventToXI2(ev, &xi2);
|
||||
if (err != Success)
|
||||
FatalError("[Xi] %s: XI2 conversion failed in %s"
|
||||
" (%d)\n", dev->name, __func__, err);
|
||||
|
||||
FixUpEventFromWindow(&gi->sprite, xi2, win, child, FALSE);
|
||||
filter = GetEventFilter(dev, xi2);
|
||||
if (XaceHookReceiveAccess(client, win, xi2, 1) != Success)
|
||||
return FALSE;
|
||||
err = TryClientEvents(client, dev, xi2, 1, filter, filter, NullGrab);
|
||||
free(xi2);
|
||||
|
||||
/* Returning the value from TryClientEvents isn't useful, since all our
|
||||
* resource-gone cleanups will update the delivery list anyway. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a gesture event and a potential listener, retrieve info needed for processing the event.
|
||||
*
|
||||
* @param dev The device generating the gesture event.
|
||||
* @param ev The gesture event to process.
|
||||
* @param listener The gesture event listener that may receive the gesture event.
|
||||
* @param[out] client The client that should receive the gesture event.
|
||||
* @param[out] win The window to deliver the event on.
|
||||
* @param[out] grab The grab to deliver the event through, if any.
|
||||
* @return TRUE if an event should be delivered to the listener, FALSE
|
||||
* otherwise.
|
||||
*/
|
||||
static Bool
|
||||
RetrieveGestureDeliveryData(DeviceIntPtr dev, InternalEvent *ev, GestureListener* listener,
|
||||
ClientPtr *client, WindowPtr *win, GrabPtr *grab)
|
||||
{
|
||||
int rc;
|
||||
int evtype;
|
||||
InputClients *iclients = NULL;
|
||||
*grab = NULL;
|
||||
|
||||
if (listener->type == GESTURE_LISTENER_GRAB ||
|
||||
listener->type == GESTURE_LISTENER_NONGESTURE_GRAB) {
|
||||
*grab = listener->grab;
|
||||
|
||||
BUG_RETURN_VAL(!*grab, FALSE);
|
||||
|
||||
*client = rClient(*grab);
|
||||
*win = (*grab)->window;
|
||||
}
|
||||
else {
|
||||
rc = dixLookupResourceByType((void **) win, listener->listener, listener->resource_type,
|
||||
serverClient, DixSendAccess);
|
||||
if (rc != Success)
|
||||
return FALSE;
|
||||
|
||||
/* note that we only will have XI2 listeners as
|
||||
listener->type == GESTURE_LISTENER_REGULAR */
|
||||
evtype = GetXI2Type(ev->any.type);
|
||||
|
||||
BUG_RETURN_VAL(!wOtherInputMasks(*win), FALSE);
|
||||
nt_list_for_each_entry(iclients, wOtherInputMasks(*win)->inputClients, next)
|
||||
if (xi2mask_isset(iclients->xi2mask, dev, evtype))
|
||||
break;
|
||||
|
||||
BUG_RETURN_VAL(!iclients, FALSE);
|
||||
|
||||
*client = rClient(iclients);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delivers a gesture to the owner, if possible and needed. Returns whether
|
||||
* an event was delivered.
|
||||
*/
|
||||
Bool
|
||||
DeliverGestureEventToOwner(DeviceIntPtr dev, GestureInfoPtr gi, InternalEvent *ev)
|
||||
{
|
||||
GrabPtr grab = NULL;
|
||||
ClientPtr client;
|
||||
WindowPtr win;
|
||||
|
||||
if (!gi->has_listener || gi->listener.type == GESTURE_LISTENER_NONGESTURE_GRAB) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!RetrieveGestureDeliveryData(dev, ev, &gi->listener, &client, &win, &grab))
|
||||
return 0;
|
||||
|
||||
ev->gesture_event.deviceid = dev->id;
|
||||
|
||||
return DeliverOneGestureEvent(client, dev, gi, grab, win, ev);
|
||||
}
|
||||
|
||||
int
|
||||
InitProximityClassDeviceStruct(DeviceIntPtr dev)
|
||||
{
|
||||
|
|
@ -2506,7 +2227,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
|
|||
cursor = NullCursor;
|
||||
else {
|
||||
rc = dixLookupResourceByType((void **) &cursor, param->cursor,
|
||||
X11_RESTYPE_CURSOR, client, DixUseAccess);
|
||||
RT_CURSOR, client, DixUseAccess);
|
||||
if (rc != Success) {
|
||||
client->errorValue = param->cursor;
|
||||
return rc;
|
||||
|
|
@ -2516,7 +2237,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
|
|||
if (param->this_device_mode == GrabModeSync ||
|
||||
param->other_devices_mode == GrabModeSync)
|
||||
access_mode |= DixFreezeAccess;
|
||||
rc = XaceHookDeviceAccess(client, dev, access_mode);
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
|
||||
|
|
@ -2572,7 +2293,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
|
|||
if (param->this_device_mode == GrabModeSync ||
|
||||
param->other_devices_mode == GrabModeSync)
|
||||
access_mode |= DixFreezeAccess;
|
||||
rc = XaceHookDeviceAccess(client, dev, access_mode);
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
|
@ -2605,7 +2326,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
|
|||
cursor = NullCursor;
|
||||
else {
|
||||
rc = dixLookupResourceByType((void **) &cursor, param->cursor,
|
||||
X11_RESTYPE_CURSOR, client, DixUseAccess);
|
||||
RT_CURSOR, client, DixUseAccess);
|
||||
if (rc != Success) {
|
||||
client->errorValue = param->cursor;
|
||||
return rc;
|
||||
|
|
@ -2615,7 +2336,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
|
|||
if (param->this_device_mode == GrabModeSync ||
|
||||
param->other_devices_mode == GrabModeSync)
|
||||
access_mode |= DixFreezeAccess;
|
||||
rc = XaceHookDeviceAccess(client, dev, access_mode);
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
|
@ -2632,8 +2353,8 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
|
|||
|
||||
/* Touch grab */
|
||||
int
|
||||
GrabTouchOrGesture(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
|
||||
int type, GrabParameters *param, GrabMask *mask)
|
||||
GrabTouch(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
|
||||
GrabParameters *param, GrabMask *mask)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
GrabPtr grab;
|
||||
|
|
@ -2646,12 +2367,12 @@ GrabTouchOrGesture(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
|
|||
rc = dixLookupWindow(&pWin, param->grabWindow, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
rc = XaceHookDeviceAccess(client, dev, DixGrabAccess);
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixGrabAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
grab = CreateGrab(client->index, dev, mod_dev, pWin, XI2,
|
||||
mask, param, type, 0, NullWindow, NullCursor);
|
||||
mask, param, XI_TouchBegin, 0, NullWindow, NullCursor);
|
||||
if (!grab)
|
||||
return BadAlloc;
|
||||
|
||||
|
|
@ -2693,7 +2414,7 @@ SelectForWindow(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client,
|
|||
if (i == EMASKSIZE) {
|
||||
RecalculateDeviceDeliverableEvents(pWin);
|
||||
if (ShouldFreeInputMasks(pWin, FALSE))
|
||||
FreeResource(others->resource, X11_RESTYPE_NONE);
|
||||
FreeResource(others->resource, RT_NONE);
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
|
|
@ -2781,12 +2502,6 @@ FreeInputMask(OtherInputMasks ** imask)
|
|||
*imask = NULL;
|
||||
}
|
||||
|
||||
#define XIPropagateMask (KeyPressMask | \
|
||||
KeyReleaseMask | \
|
||||
ButtonPressMask | \
|
||||
ButtonReleaseMask | \
|
||||
PointerMotionMask)
|
||||
|
||||
void
|
||||
RecalculateDeviceDeliverableEvents(WindowPtr pWin)
|
||||
{
|
||||
|
|
@ -2813,7 +2528,7 @@ RecalculateDeviceDeliverableEvents(WindowPtr pWin)
|
|||
inputMasks->deliverableEvents[i] |=
|
||||
(wOtherInputMasks(tmp)->deliverableEvents[i]
|
||||
& ~inputMasks->dontPropagateMask[i] &
|
||||
XIPropagateMask);
|
||||
PropagateMask[i]);
|
||||
}
|
||||
if (pChild->firstChild) {
|
||||
pChild = pChild->firstChild;
|
||||
|
|
@ -2927,7 +2642,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
|
|||
return Success;
|
||||
|
||||
/* If the input focus is PointerRootWin, send the event to where
|
||||
* the pointer is if possible, then perhaps propagate up to root. */
|
||||
* the pointer is if possible, then perhaps propogate up to root. */
|
||||
if (inputFocus == PointerRootWin)
|
||||
inputFocus = GetCurrentRootWindow(d);
|
||||
|
||||
|
|
@ -2959,7 +2674,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate,
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (!XaceHookSendAccess(client, NULL, pWin, ev, count))
|
||||
else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, ev, count))
|
||||
DeliverEventsToWindow(d, pWin, ev, count, mask, NullGrab);
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -3120,7 +2835,7 @@ DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources)
|
|||
ic = inputMasks->inputClients;
|
||||
for (i = 0; i < EMASKSIZE; i++)
|
||||
inputMasks->dontPropagateMask[i] = 0;
|
||||
FreeResource(ic->resource, X11_RESTYPE_NONE);
|
||||
FreeResource(ic->resource, RT_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3226,7 +2941,7 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask,
|
|||
{
|
||||
struct _OtherInputMasks *inputMasks = wOtherInputMasks(pWin);
|
||||
|
||||
if (mask & ~XIPropagateMask) {
|
||||
if (mask & ~PropagateMask[maskndx]) {
|
||||
client->errorValue = mask;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -3236,19 +2951,14 @@ DeviceEventSuppressForWindow(WindowPtr pWin, ClientPtr client, Mask mask,
|
|||
inputMasks->dontPropagateMask[maskndx] = mask;
|
||||
}
|
||||
else {
|
||||
if (!inputMasks) {
|
||||
int ret = AddExtensionClient(pWin, client, 0, 0);
|
||||
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
inputMasks = wOtherInputMasks(pWin);
|
||||
BUG_RETURN_VAL(!inputMasks, BadAlloc);
|
||||
}
|
||||
if (!inputMasks)
|
||||
AddExtensionClient(pWin, client, 0, 0);
|
||||
inputMasks = wOtherInputMasks(pWin);
|
||||
inputMasks->dontPropagateMask[maskndx] = mask;
|
||||
}
|
||||
RecalculateDeviceDeliverableEvents(pWin);
|
||||
if (inputMasks && ShouldFreeInputMasks(pWin, FALSE))
|
||||
FreeResource(inputMasks->inputClients->resource, X11_RESTYPE_NONE);
|
||||
if (ShouldFreeInputMasks(pWin, FALSE))
|
||||
FreeResource(inputMasks->inputClients->resource, RT_NONE);
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
@ -3342,7 +3052,6 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
|
|||
if (len && !others) {
|
||||
if (AddExtensionClient(win, client, 0, 0) != Success)
|
||||
return BadAlloc;
|
||||
BUG_RETURN_VAL(!wOtherInputMasks(win), BadAlloc);
|
||||
others = wOtherInputMasks(win)->inputClients;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ extern int DeviceBusy;
|
|||
extern int BadClass;
|
||||
|
||||
/* Note: only the ones needed in files other than extinit.c are declared */
|
||||
extern const Mask DevicePointerMotionMask;
|
||||
extern const Mask DevicePointerMotionHintMask;
|
||||
extern const Mask DeviceFocusChangeMask;
|
||||
extern const Mask DeviceStateNotifyMask;
|
||||
|
|
@ -55,6 +56,8 @@ extern const Mask DevicePresenceNotifyMask;
|
|||
extern const Mask DevicePropertyNotifyMask;
|
||||
extern const Mask XIAllMasks;
|
||||
|
||||
extern Mask PropagateMask[];
|
||||
|
||||
extern int DeviceValuator;
|
||||
extern int DeviceKeyPress;
|
||||
extern int DeviceKeyRelease;
|
||||
|
|
|
|||
217
Xi/extinit.c
217
Xi/extinit.c
|
|
@ -51,7 +51,9 @@ SOFTWARE.
|
|||
*/
|
||||
#define NUMTYPES 15
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h"
|
||||
#include "gcstruct.h" /* pointer for extnsionst.h */
|
||||
|
|
@ -60,17 +62,11 @@ SOFTWARE.
|
|||
#include <X11/extensions/XIproto.h>
|
||||
#include <X11/extensions/XI2proto.h>
|
||||
#include <X11/extensions/geproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "dix/exevents_priv.h"
|
||||
|
||||
#include "inputstr.h"
|
||||
#include "gcstruct.h" /* pointer for extnsionst.h */
|
||||
#include "extnsionst.h" /* extension entry */
|
||||
#include "geext.h" /* extension interfaces for ge */
|
||||
|
||||
#include "dixevents.h"
|
||||
#include "extinit_priv.h"
|
||||
#include "exevents.h"
|
||||
#include "extinit.h"
|
||||
#include "exglobals.h"
|
||||
#include "swaprep.h"
|
||||
#include "privates.h"
|
||||
|
|
@ -133,8 +129,13 @@ SOFTWARE.
|
|||
* breaks down. The device needs the dev->button->motionMask. If DBMM is
|
||||
* the same as BMM, we can ensure that both core and device events can be
|
||||
* delivered, without the need for extra structures in the DeviceIntRec. */
|
||||
const Mask DeviceKeyPressMask = KeyPressMask;
|
||||
const Mask DeviceKeyReleaseMask = KeyReleaseMask;
|
||||
const Mask DeviceButtonPressMask = ButtonPressMask;
|
||||
const Mask DeviceButtonReleaseMask = ButtonReleaseMask;
|
||||
const Mask DeviceProximityMask = (1L << 4);
|
||||
const Mask DeviceStateNotifyMask = (1L << 5);
|
||||
const Mask DevicePointerMotionMask = PointerMotionMask;
|
||||
const Mask DevicePointerMotionHintMask = PointerMotionHintMask;
|
||||
const Mask DeviceButton1MotionMask = Button1MotionMask;
|
||||
const Mask DeviceButton2MotionMask = Button2MotionMask;
|
||||
|
|
@ -152,6 +153,7 @@ const Mask DevicePropertyNotifyMask = (1L << 19);
|
|||
const Mask XIAllMasks = (1L << 20) - 1;
|
||||
|
||||
int ExtEventIndex;
|
||||
Mask ExtExclusiveMasks[EMASKSIZE];
|
||||
|
||||
static struct dev_type {
|
||||
Atom type;
|
||||
|
|
@ -256,19 +258,19 @@ static int (*ProcIVector[]) (ClientPtr) = {
|
|||
|
||||
/* For swapped clients */
|
||||
static int (*SProcIVector[]) (ClientPtr) = {
|
||||
NULL, /* 0 */
|
||||
NULL, /* 0 */
|
||||
SProcXGetExtensionVersion, /* 1 */
|
||||
ProcXListInputDevices, /* 2 */
|
||||
ProcXOpenDevice, /* 3 */
|
||||
ProcXCloseDevice, /* 4 */
|
||||
ProcXSetDeviceMode, /* 5 */
|
||||
SProcXListInputDevices, /* 2 */
|
||||
SProcXOpenDevice, /* 3 */
|
||||
SProcXCloseDevice, /* 4 */
|
||||
SProcXSetDeviceMode, /* 5 */
|
||||
SProcXSelectExtensionEvent, /* 6 */
|
||||
SProcXGetSelectedExtensionEvents, /* 7 */
|
||||
SProcXChangeDeviceDontPropagateList, /* 8 */
|
||||
SProcXGetDeviceDontPropagateList, /* 9 */
|
||||
SProcXGetDeviceMotionEvents, /* 10 */
|
||||
ProcXChangeKeyboardDevice, /* 11 */
|
||||
ProcXChangePointerDevice, /* 12 */
|
||||
SProcXChangeKeyboardDevice, /* 11 */
|
||||
SProcXChangePointerDevice, /* 12 */
|
||||
SProcXGrabDevice, /* 13 */
|
||||
SProcXUngrabDevice, /* 14 */
|
||||
SProcXGrabDeviceKey, /* 15 */
|
||||
|
|
@ -276,30 +278,30 @@ static int (*SProcIVector[]) (ClientPtr) = {
|
|||
SProcXGrabDeviceButton, /* 17 */
|
||||
SProcXUngrabDeviceButton, /* 18 */
|
||||
SProcXAllowDeviceEvents, /* 19 */
|
||||
ProcXGetDeviceFocus, /* 20 */
|
||||
SProcXGetDeviceFocus, /* 20 */
|
||||
SProcXSetDeviceFocus, /* 21 */
|
||||
ProcXGetFeedbackControl, /* 22 */
|
||||
SProcXGetFeedbackControl, /* 22 */
|
||||
SProcXChangeFeedbackControl, /* 23 */
|
||||
ProcXGetDeviceKeyMapping, /* 24 */
|
||||
SProcXGetDeviceKeyMapping, /* 24 */
|
||||
SProcXChangeDeviceKeyMapping, /* 25 */
|
||||
ProcXGetDeviceModifierMapping, /* 26 */
|
||||
ProcXSetDeviceModifierMapping, /* 27 */
|
||||
ProcXGetDeviceButtonMapping, /* 28 */
|
||||
ProcXSetDeviceButtonMapping, /* 29 */
|
||||
ProcXQueryDeviceState, /* 30 */
|
||||
SProcXGetDeviceModifierMapping, /* 26 */
|
||||
SProcXSetDeviceModifierMapping, /* 27 */
|
||||
SProcXGetDeviceButtonMapping, /* 28 */
|
||||
SProcXSetDeviceButtonMapping, /* 29 */
|
||||
SProcXQueryDeviceState, /* 30 */
|
||||
SProcXSendExtensionEvent, /* 31 */
|
||||
ProcXDeviceBell, /* 32 */
|
||||
ProcXSetDeviceValuators, /* 33 */
|
||||
SProcXDeviceBell, /* 32 */
|
||||
SProcXSetDeviceValuators, /* 33 */
|
||||
SProcXGetDeviceControl, /* 34 */
|
||||
SProcXChangeDeviceControl, /* 35 */
|
||||
ProcXListDeviceProperties, /* 36 */
|
||||
SProcXListDeviceProperties, /* 36 */
|
||||
SProcXChangeDeviceProperty, /* 37 */
|
||||
SProcXDeleteDeviceProperty, /* 38 */
|
||||
SProcXGetDeviceProperty, /* 39 */
|
||||
SProcXIQueryPointer, /* 40 */
|
||||
SProcXIWarpPointer, /* 41 */
|
||||
SProcXIChangeCursor, /* 42 */
|
||||
ProcXIChangeHierarchy, /* 43 */
|
||||
SProcXIChangeHierarchy, /* 43 */
|
||||
SProcXISetClientPointer, /* 44 */
|
||||
SProcXIGetClientPointer, /* 45 */
|
||||
SProcXISelectEvents, /* 46 */
|
||||
|
|
@ -362,6 +364,8 @@ RESTYPE RT_INPUTCLIENT;
|
|||
|
||||
extern XExtensionVersion XIVersion;
|
||||
|
||||
Mask PropagateMask[EMASKSIZE];
|
||||
|
||||
/*****************************************************************
|
||||
*
|
||||
* Versioning support
|
||||
|
|
@ -376,6 +380,18 @@ DevPrivateKeyRec XIClientPrivateKeyRec;
|
|||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
XIClientCallback(CallbackListPtr *list, void *closure, void *data)
|
||||
{
|
||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
||||
ClientPtr pClient = clientinfo->client;
|
||||
XIClientPtr pXIClient;
|
||||
|
||||
pXIClient = dixLookupPrivate(&pClient->devPrivates, XIClientPrivateKey);
|
||||
pXIClient->major_version = 0;
|
||||
pXIClient->minor_version = 0;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* ProcIDispatch - main dispatch routine for requests to this extension.
|
||||
|
|
@ -390,7 +406,6 @@ ProcIDispatch(ClientPtr client)
|
|||
if (stuff->data >= ARRAY_SIZE(ProcIVector) || !ProcIVector[stuff->data])
|
||||
return BadRequest;
|
||||
|
||||
UpdateCurrentTimeIf();
|
||||
return (*ProcIVector[stuff->data]) (client);
|
||||
}
|
||||
|
||||
|
|
@ -403,14 +418,13 @@ ProcIDispatch(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
static int _X_COLD
|
||||
static int
|
||||
SProcIDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
if (stuff->data >= ARRAY_SIZE(SProcIVector) || !SProcIVector[stuff->data])
|
||||
return BadRequest;
|
||||
|
||||
UpdateCurrentTimeIf();
|
||||
return (*SProcIVector[stuff->data]) (client);
|
||||
}
|
||||
|
||||
|
|
@ -421,7 +435,7 @@ SProcIDispatch(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
static void _X_COLD
|
||||
static void
|
||||
SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
|
||||
{
|
||||
/* All we look at is the type field */
|
||||
|
|
@ -516,7 +530,7 @@ static void
|
|||
SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
|
||||
{
|
||||
int i;
|
||||
INT32 *ip;
|
||||
INT32 *ip B32;
|
||||
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber);
|
||||
|
|
@ -540,7 +554,7 @@ static void
|
|||
SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
|
||||
{
|
||||
int i;
|
||||
INT32 *ip;
|
||||
INT32 *ip B32;
|
||||
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber);
|
||||
|
|
@ -854,76 +868,8 @@ SBarrierEvent(xXIBarrierEvent * from,
|
|||
swapl(&to->eventid);
|
||||
}
|
||||
|
||||
static void
|
||||
SGesturePinchEvent(xXIGesturePinchEvent* from,
|
||||
xXIGesturePinchEvent* to)
|
||||
{
|
||||
*to = *from;
|
||||
|
||||
swaps(&to->sequenceNumber);
|
||||
swapl(&to->length);
|
||||
swaps(&to->evtype);
|
||||
swaps(&to->deviceid);
|
||||
swapl(&to->time);
|
||||
swapl(&to->detail);
|
||||
swapl(&to->root);
|
||||
swapl(&to->event);
|
||||
swapl(&to->child);
|
||||
swapl(&to->root_x);
|
||||
swapl(&to->root_y);
|
||||
swapl(&to->event_x);
|
||||
swapl(&to->event_y);
|
||||
|
||||
swapl(&to->delta_x);
|
||||
swapl(&to->delta_y);
|
||||
swapl(&to->delta_unaccel_x);
|
||||
swapl(&to->delta_unaccel_y);
|
||||
swapl(&to->scale);
|
||||
swapl(&to->delta_angle);
|
||||
swaps(&to->sourceid);
|
||||
|
||||
swapl(&to->mods.base_mods);
|
||||
swapl(&to->mods.latched_mods);
|
||||
swapl(&to->mods.locked_mods);
|
||||
swapl(&to->mods.effective_mods);
|
||||
swapl(&to->flags);
|
||||
}
|
||||
|
||||
static void
|
||||
SGestureSwipeEvent(xXIGestureSwipeEvent* from,
|
||||
xXIGestureSwipeEvent* to)
|
||||
{
|
||||
*to = *from;
|
||||
|
||||
swaps(&to->sequenceNumber);
|
||||
swapl(&to->length);
|
||||
swaps(&to->evtype);
|
||||
swaps(&to->deviceid);
|
||||
swapl(&to->time);
|
||||
swapl(&to->detail);
|
||||
swapl(&to->root);
|
||||
swapl(&to->event);
|
||||
swapl(&to->child);
|
||||
swapl(&to->root_x);
|
||||
swapl(&to->root_y);
|
||||
swapl(&to->event_x);
|
||||
swapl(&to->event_y);
|
||||
|
||||
swapl(&to->delta_x);
|
||||
swapl(&to->delta_y);
|
||||
swapl(&to->delta_unaccel_x);
|
||||
swapl(&to->delta_unaccel_y);
|
||||
swaps(&to->sourceid);
|
||||
|
||||
swapl(&to->mods.base_mods);
|
||||
swapl(&to->mods.latched_mods);
|
||||
swapl(&to->mods.locked_mods);
|
||||
swapl(&to->mods.effective_mods);
|
||||
swapl(&to->flags);
|
||||
}
|
||||
|
||||
/** Event swapping function for XI2 events. */
|
||||
void _X_COLD
|
||||
void
|
||||
XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
|
||||
{
|
||||
switch (from->evtype) {
|
||||
|
|
@ -973,24 +919,28 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
|
|||
SBarrierEvent((xXIBarrierEvent *) from,
|
||||
(xXIBarrierEvent *) to);
|
||||
break;
|
||||
case XI_GesturePinchBegin:
|
||||
case XI_GesturePinchUpdate:
|
||||
case XI_GesturePinchEnd:
|
||||
SGesturePinchEvent((xXIGesturePinchEvent*) from,
|
||||
(xXIGesturePinchEvent*) to);
|
||||
break;
|
||||
case XI_GestureSwipeBegin:
|
||||
case XI_GestureSwipeUpdate:
|
||||
case XI_GestureSwipeEnd:
|
||||
SGestureSwipeEvent((xXIGestureSwipeEvent*) from,
|
||||
(xXIGestureSwipeEvent*) to);
|
||||
break;
|
||||
default:
|
||||
ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Allow the specified event to have its propagation suppressed.
|
||||
* The default is to not allow suppression of propagation.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
AllowPropagateSuppress(Mask mask)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAXDEVICES; i++)
|
||||
PropagateMask[i] |= mask;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Record an event mask where there is no unique corresponding event type.
|
||||
|
|
@ -1011,6 +961,23 @@ SetEventInfo(Mask mask, int constant)
|
|||
EventInfo[ExtEventIndex++].type = constant;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Allow the specified event to be restricted to being selected by one
|
||||
* client at a time.
|
||||
* The default is to allow more than one client to select the event.
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
SetExclusiveAccess(Mask mask)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAXDEVICES; i++)
|
||||
ExtExclusiveMasks[i] |= mask;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Assign the specified mask to the specified event.
|
||||
|
|
@ -1072,16 +1039,20 @@ FixExtensionEvents(ExtensionEntry * extEntry)
|
|||
DeviceBusy += extEntry->errorBase;
|
||||
BadClass += extEntry->errorBase;
|
||||
|
||||
SetMaskForExtEvent(KeyPressMask, DeviceKeyPress);
|
||||
SetMaskForExtEvent(DeviceKeyPressMask, DeviceKeyPress);
|
||||
AllowPropagateSuppress(DeviceKeyPressMask);
|
||||
SetCriticalEvent(DeviceKeyPress);
|
||||
|
||||
SetMaskForExtEvent(KeyReleaseMask, DeviceKeyRelease);
|
||||
SetMaskForExtEvent(DeviceKeyReleaseMask, DeviceKeyRelease);
|
||||
AllowPropagateSuppress(DeviceKeyReleaseMask);
|
||||
SetCriticalEvent(DeviceKeyRelease);
|
||||
|
||||
SetMaskForExtEvent(ButtonPressMask, DeviceButtonPress);
|
||||
SetMaskForExtEvent(DeviceButtonPressMask, DeviceButtonPress);
|
||||
AllowPropagateSuppress(DeviceButtonPressMask);
|
||||
SetCriticalEvent(DeviceButtonPress);
|
||||
|
||||
SetMaskForExtEvent(ButtonReleaseMask, DeviceButtonRelease);
|
||||
SetMaskForExtEvent(DeviceButtonReleaseMask, DeviceButtonRelease);
|
||||
AllowPropagateSuppress(DeviceButtonReleaseMask);
|
||||
SetCriticalEvent(DeviceButtonRelease);
|
||||
|
||||
SetMaskForExtEvent(DeviceProximityMask, ProximityIn);
|
||||
|
|
@ -1089,7 +1060,8 @@ FixExtensionEvents(ExtensionEntry * extEntry)
|
|||
|
||||
SetMaskForExtEvent(DeviceStateNotifyMask, DeviceStateNotify);
|
||||
|
||||
SetMaskForExtEvent(PointerMotionMask, DeviceMotionNotify);
|
||||
SetMaskForExtEvent(DevicePointerMotionMask, DeviceMotionNotify);
|
||||
AllowPropagateSuppress(DevicePointerMotionMask);
|
||||
SetCriticalEvent(DeviceMotionNotify);
|
||||
|
||||
SetEventInfo(DevicePointerMotionHintMask, _devicePointerMotionHint);
|
||||
|
|
@ -1107,6 +1079,8 @@ FixExtensionEvents(ExtensionEntry * extEntry)
|
|||
SetMaskForExtEvent(ChangeDeviceNotifyMask, ChangeDeviceNotify);
|
||||
|
||||
SetEventInfo(DeviceButtonGrabMask, _deviceButtonGrab);
|
||||
SetExclusiveAccess(DeviceButtonGrabMask);
|
||||
|
||||
SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
|
||||
SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
|
||||
SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify);
|
||||
|
|
@ -1238,7 +1212,7 @@ MakeDeviceTypeAtoms(void)
|
|||
*/
|
||||
#define DO_SWAP(func,type) func ((type *)from, (type *)to)
|
||||
|
||||
static void _X_COLD
|
||||
static void
|
||||
SEventIDispatch(xEvent *from, xEvent *to)
|
||||
{
|
||||
int type = from->u.u.type & 0177;
|
||||
|
|
@ -1322,6 +1296,9 @@ XInputExtensionInit(void)
|
|||
(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
|
||||
FatalError("Cannot request private for XI.\n");
|
||||
|
||||
if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
|
||||
FatalError("Failed to add callback to XI.\n");
|
||||
|
||||
if (!XIBarrierInit())
|
||||
FatalError("Could not initialize barriers.\n");
|
||||
|
||||
|
|
|
|||
18
Xi/getbmap.c
18
Xi/getbmap.c
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
|
|
@ -59,6 +61,20 @@ SOFTWARE.
|
|||
|
||||
#include "getbmap.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the button mapping for the specified device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetDeviceButtonMapping(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGetDeviceButtonMappingReq);
|
||||
swaps(&stuff->length);
|
||||
return (ProcXGetDeviceButtonMapping(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the button mapping for the specified device.
|
||||
|
|
@ -106,7 +122,7 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXGetDeviceButtonMapping(ClientPtr client, int size,
|
||||
xGetDeviceButtonMappingReply * rep)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef GETBMAP_H
|
||||
#define GETBMAP_H 1
|
||||
|
||||
int SProcXGetDeviceButtonMapping(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXGetDeviceButtonMapping(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
|
|
@ -66,10 +68,11 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXGetDeviceControl(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGetDeviceControlReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
|
||||
swaps(&stuff->control);
|
||||
return (ProcXGetDeviceControl(client));
|
||||
|
|
@ -150,7 +153,7 @@ CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
|
|
|
|||
20
Xi/getfctl.c
20
Xi/getfctl.c
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
|
|
@ -59,6 +61,21 @@ SOFTWARE.
|
|||
|
||||
#include "getfctl.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the control attributes for an extension device,
|
||||
* for clients on machines with a different byte ordering than the server.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetFeedbackControl(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGetFeedbackControlReq);
|
||||
swaps(&stuff->length);
|
||||
return (ProcXGetFeedbackControl(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure copies KbdFeedbackClass data, swapping if necessary.
|
||||
|
|
@ -80,7 +97,6 @@ CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
|
|||
k2->pitch = k->ctrl.bell_pitch;
|
||||
k2->duration = k->ctrl.bell_duration;
|
||||
k2->led_mask = k->ctrl.leds;
|
||||
k2->led_values = k->ctrl.leds;
|
||||
k2->global_auto_repeat = k->ctrl.autoRepeat;
|
||||
for (i = 0; i < 32; i++)
|
||||
k2->auto_repeats[i] = k->ctrl.autoRepeats[i];
|
||||
|
|
@ -242,7 +258,7 @@ CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXGetFeedbackControl(ClientPtr client, int size,
|
||||
xGetFeedbackControlReply * rep)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef GETFCTL_H
|
||||
#define GETFCTL_H 1
|
||||
|
||||
int SProcXGetFeedbackControl(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXGetFeedbackControl(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "windowstr.h" /* focus struct */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
|
|
@ -60,6 +62,20 @@ SOFTWARE.
|
|||
|
||||
#include "getfocus.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the focus for a device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetDeviceFocus(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGetDeviceFocusReq);
|
||||
swaps(&stuff->length);
|
||||
return (ProcXGetDeviceFocus(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the focus for a device.
|
||||
|
|
@ -114,7 +130,7 @@ ProcXGetDeviceFocus(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXGetDeviceFocus(ClientPtr client, int size, xGetDeviceFocusReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef GETFOCUS_H
|
||||
#define GETFOCUS_H 1
|
||||
|
||||
int SProcXGetDeviceFocus(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXGetDeviceFocus(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
19
Xi/getkmap.c
19
Xi/getkmap.c
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
|
|
@ -62,6 +64,21 @@ SOFTWARE.
|
|||
|
||||
#include "getkmap.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the key mapping for an extension device,
|
||||
* for clients on machines with a different byte ordering than the server.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetDeviceKeyMapping(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGetDeviceKeyMappingReq);
|
||||
swaps(&stuff->length);
|
||||
return (ProcXGetDeviceKeyMapping(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Get the device key mapping.
|
||||
|
|
@ -129,7 +146,7 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXGetDeviceKeyMapping(ClientPtr client, int size,
|
||||
xGetDeviceKeyMappingReply * rep)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef GETKMAP_H
|
||||
#define GETKMAP_H 1
|
||||
|
||||
int SProcXGetDeviceKeyMapping(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXGetDeviceKeyMapping(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
19
Xi/getmmap.c
19
Xi/getmmap.c
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
|
|
@ -59,6 +61,21 @@ SOFTWARE.
|
|||
|
||||
#include "getmmap.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure gets the modifier mapping for an extension device,
|
||||
* for clients on machines with a different byte ordering than the server.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXGetDeviceModifierMapping(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGetDeviceModifierMappingReq);
|
||||
swaps(&stuff->length);
|
||||
return (ProcXGetDeviceModifierMapping(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Get the device Modifier mapping.
|
||||
|
|
@ -108,7 +125,7 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXGetDeviceModifierMapping(ClientPtr client, int size,
|
||||
xGetDeviceModifierMappingReply * rep)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef GETMMAP_H
|
||||
#define GETMMAP_H 1
|
||||
|
||||
int SProcXGetDeviceModifierMapping(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXGetDeviceModifierMapping(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
19
Xi/getprop.c
19
Xi/getprop.c
|
|
@ -50,17 +50,17 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structs */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exglobals.h"
|
||||
#include "swaprep.h"
|
||||
|
||||
#include "getprop.h"
|
||||
|
||||
extern XExtEventInfo EventInfo[];
|
||||
|
|
@ -72,10 +72,11 @@ extern int ExtEventIndex;
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXGetDeviceDontPropagateList(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGetDeviceDontPropagateListReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
|
||||
swapl(&stuff->window);
|
||||
return (ProcXGetDeviceDontPropagateList(client));
|
||||
|
|
@ -117,9 +118,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
|
|||
ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT);
|
||||
if (count) {
|
||||
rep.count = count;
|
||||
buf = xallocarray(rep.count, sizeof(XEventClass));
|
||||
if (buf == NULL)
|
||||
return BadAlloc;
|
||||
buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass));
|
||||
rep.length = bytes_to_int32(rep.count * sizeof(XEventClass));
|
||||
|
||||
tbuf = buf;
|
||||
|
|
@ -174,7 +173,7 @@ XEventClass
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXGetDeviceDontPropagateList(ClientPtr client, int size,
|
||||
xGetDeviceDontPropagateListReply * rep)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,17 +50,17 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window struct */
|
||||
#include "exglobals.h"
|
||||
#include "swaprep.h"
|
||||
|
||||
#include "getprop.h"
|
||||
#include "getselev.h"
|
||||
|
||||
|
|
@ -70,10 +70,11 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXGetSelectedExtensionEvents(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGetSelectedExtensionEventsReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
|
||||
swapl(&stuff->window);
|
||||
return (ProcXGetSelectedExtensionEvents(client));
|
||||
|
|
@ -163,7 +164,7 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXGetSelectedExtensionEvents(ClientPtr client, int size,
|
||||
xGetSelectedExtensionEventsReply * rep)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
|
|
@ -68,10 +70,11 @@ XExtensionVersion XIVersion;
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXGetExtensionVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGetExtensionVersionReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
|
||||
swaps(&stuff->nbytes);
|
||||
return (ProcXGetExtensionVersion(client));
|
||||
|
|
@ -91,7 +94,7 @@ ProcXGetExtensionVersion(ClientPtr client)
|
|||
REQUEST(xGetExtensionVersionReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
|
||||
|
||||
if (client->req_len != bytes_to_int32(sizeof(xGetExtensionVersionReq) +
|
||||
if (stuff->length != bytes_to_int32(sizeof(xGetExtensionVersionReq) +
|
||||
stuff->nbytes))
|
||||
return BadLength;
|
||||
|
||||
|
|
@ -117,7 +120,7 @@ ProcXGetExtensionVersion(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXGetExtensionVersion(ClientPtr client, int size,
|
||||
xGetExtensionVersionReply * rep)
|
||||
{
|
||||
|
|
|
|||
14
Xi/grabdev.c
14
Xi/grabdev.c
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
|
|
@ -70,17 +72,17 @@ extern int ExtEventIndex;
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXGrabDevice(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGrabDeviceReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
|
||||
|
||||
swapl(&stuff->grabWindow);
|
||||
swapl(&stuff->time);
|
||||
swaps(&stuff->event_count);
|
||||
|
||||
if (client->req_len !=
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
|
||||
return BadLength;
|
||||
|
||||
|
|
@ -107,7 +109,7 @@ ProcXGrabDevice(ClientPtr client)
|
|||
REQUEST(xGrabDeviceReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
|
||||
|
||||
if (client->req_len !=
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
|
||||
return BadLength;
|
||||
|
||||
|
|
@ -151,7 +153,7 @@ ProcXGrabDevice(ClientPtr client)
|
|||
* set when XI starts up) and binary OR's the device's mask to whatever the
|
||||
* event mask for the given event type was.
|
||||
* If an error occurs, it is sent to the client. Errors are generated if
|
||||
* - if the device given in the event class is invalid
|
||||
* - if the device given in the event classs is invalid
|
||||
* - if the device in the class list is not the device given as parameter (no
|
||||
* error if parameter is NULL)
|
||||
*
|
||||
|
|
@ -203,7 +205,7 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXGrabDevice(ClientPtr client, int size, xGrabDeviceReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
|
|
|
|||
|
|
@ -50,17 +50,18 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/exevents_priv.h"
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
#include "xace.h"
|
||||
|
||||
#include "grabdev.h"
|
||||
#include "grabdevb.h"
|
||||
|
||||
|
|
@ -70,10 +71,11 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXGrabDeviceButton(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGrabDeviceButtonReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
|
||||
swapl(&stuff->grabWindow);
|
||||
swaps(&stuff->modifiers);
|
||||
|
|
@ -105,7 +107,7 @@ ProcXGrabDeviceButton(ClientPtr client)
|
|||
REQUEST(xGrabDeviceButtonReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
|
||||
|
||||
if (client->req_len !=
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xGrabDeviceButtonReq)) + stuff->event_count)
|
||||
return BadLength;
|
||||
|
||||
|
|
@ -123,7 +125,7 @@ ProcXGrabDeviceButton(ClientPtr client)
|
|||
}
|
||||
else {
|
||||
mdev = PickKeyboard(client);
|
||||
ret = XaceHookDeviceAccess(client, mdev, DixUseAccess);
|
||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,17 +50,18 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/exevents_priv.h"
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
#include "xace.h"
|
||||
|
||||
#include "grabdev.h"
|
||||
#include "grabdevk.h"
|
||||
|
||||
|
|
@ -70,10 +71,11 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXGrabDeviceKey(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGrabDeviceKeyReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
|
||||
swapl(&stuff->grabWindow);
|
||||
swaps(&stuff->modifiers);
|
||||
|
|
@ -103,7 +105,7 @@ ProcXGrabDeviceKey(ClientPtr client)
|
|||
REQUEST(xGrabDeviceKeyReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
|
||||
|
||||
if (client->req_len !=
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xGrabDeviceKeyReq)) + stuff->event_count)
|
||||
return BadLength;
|
||||
|
||||
|
|
@ -121,7 +123,7 @@ ProcXGrabDeviceKey(ClientPtr client)
|
|||
}
|
||||
else {
|
||||
mdev = PickKeyboard(client);
|
||||
ret = XaceHookDeviceAccess(client, mdev, DixUseAccess);
|
||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,15 +50,16 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/exevents_priv.h"
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "gtmotion.h"
|
||||
|
||||
/***********************************************************************
|
||||
|
|
@ -67,10 +68,11 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXGetDeviceMotionEvents(ClientPtr client)
|
||||
{
|
||||
REQUEST(xGetDeviceMotionEventsReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
|
||||
swapl(&stuff->start);
|
||||
swapl(&stuff->stop);
|
||||
|
|
@ -160,7 +162,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXGetDeviceMotionEvents(ClientPtr client, int size,
|
||||
xGetDeviceMotionEventsReply * rep)
|
||||
{
|
||||
|
|
|
|||
32
Xi/listdev.c
32
Xi/listdev.c
|
|
@ -50,24 +50,38 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/X.h> /* for inputstr.h */
|
||||
#include <X11/Xproto.h> /* Request macro */
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/input_priv.h"
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "XIstubs.h"
|
||||
#include "extnsionst.h"
|
||||
#include "exevents.h"
|
||||
#include "xace.h"
|
||||
#include "xkbsrv.h"
|
||||
#include "xkbstr.h"
|
||||
|
||||
#include "listdev.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists the input devices available to the server.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXListInputDevices(ClientPtr client)
|
||||
{
|
||||
REQUEST(xListInputDevicesReq);
|
||||
swaps(&stuff->length);
|
||||
return (ProcXListInputDevices(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure calculates the size of the information to be returned
|
||||
|
|
@ -295,7 +309,7 @@ ShouldSkipDevice(ClientPtr client, DeviceIntPtr d)
|
|||
{
|
||||
/* don't send master devices other than VCP/VCK */
|
||||
if (!IsMaster(d) || d == inputInfo.pointer ||d == inputInfo.keyboard) {
|
||||
int rc = XaceHookDeviceAccess(client, d, DixGetAttrAccess);
|
||||
int rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
|
||||
|
||||
if (rc == Success)
|
||||
return FALSE;
|
||||
|
|
@ -336,7 +350,7 @@ ProcXListInputDevices(ClientPtr client)
|
|||
};
|
||||
|
||||
/* allocate space for saving skip value */
|
||||
skip = calloc(inputInfo.numDevices, sizeof(Bool));
|
||||
skip = calloc(sizeof(Bool), inputInfo.numDevices);
|
||||
if (!skip)
|
||||
return BadAlloc;
|
||||
|
||||
|
|
@ -363,10 +377,6 @@ ProcXListInputDevices(ClientPtr client)
|
|||
/* allocate space for reply */
|
||||
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
|
||||
devbuf = (char *) calloc(1, total_length);
|
||||
if (!devbuf) {
|
||||
free(skip);
|
||||
return BadAlloc;
|
||||
}
|
||||
classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
|
||||
namebuf = classbuf + size;
|
||||
savbuf = devbuf;
|
||||
|
|
@ -403,7 +413,7 @@ ProcXListInputDevices(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
|
||||
#define VPC 20 /* Max # valuators per chunk */
|
||||
|
||||
int SProcXListInputDevices(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXListInputDevices(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,67 +0,0 @@
|
|||
srcs_xi = [
|
||||
'allowev.c',
|
||||
'chgdctl.c',
|
||||
'chgfctl.c',
|
||||
'chgkbd.c',
|
||||
'chgkmap.c',
|
||||
'chgprop.c',
|
||||
'chgptr.c',
|
||||
'closedev.c',
|
||||
'devbell.c',
|
||||
'exevents.c',
|
||||
'extinit.c',
|
||||
'getbmap.c',
|
||||
'getdctl.c',
|
||||
'getfctl.c',
|
||||
'getfocus.c',
|
||||
'getkmap.c',
|
||||
'getmmap.c',
|
||||
'getprop.c',
|
||||
'getselev.c',
|
||||
'getvers.c',
|
||||
'grabdev.c',
|
||||
'grabdevb.c',
|
||||
'grabdevk.c',
|
||||
'gtmotion.c',
|
||||
'listdev.c',
|
||||
'opendev.c',
|
||||
'queryst.c',
|
||||
'selectev.c',
|
||||
'sendexev.c',
|
||||
'setbmap.c',
|
||||
'setdval.c',
|
||||
'setfocus.c',
|
||||
'setmmap.c',
|
||||
'setmode.c',
|
||||
'ungrdev.c',
|
||||
'ungrdevb.c',
|
||||
'ungrdevk.c',
|
||||
'xiallowev.c',
|
||||
'xibarriers.c',
|
||||
'xichangecursor.c',
|
||||
'xichangehierarchy.c',
|
||||
'xigetclientpointer.c',
|
||||
'xigrabdev.c',
|
||||
'xipassivegrab.c',
|
||||
'xiproperty.c',
|
||||
'xiquerydevice.c',
|
||||
'xiquerypointer.c',
|
||||
'xiqueryversion.c',
|
||||
'xiselectev.c',
|
||||
'xisetclientpointer.c',
|
||||
'xisetdevfocus.c',
|
||||
'xiwarppointer.c',
|
||||
]
|
||||
|
||||
libxserver_xi = static_library('libxserver_xi',
|
||||
srcs_xi,
|
||||
include_directories: inc,
|
||||
dependencies: common_dep,
|
||||
)
|
||||
|
||||
srcs_xi_stubs = ['stubs.c']
|
||||
libxserver_xi_stubs = static_library('libxserver_xi_stubs',
|
||||
srcs_xi_stubs,
|
||||
include_directories: inc,
|
||||
dependencies: common_dep,
|
||||
)
|
||||
19
Xi/opendev.c
19
Xi/opendev.c
|
|
@ -50,7 +50,9 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
|
|
@ -64,6 +66,21 @@ SOFTWARE.
|
|||
|
||||
extern CARD8 event_base[];
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure swaps the request if the server and client have different
|
||||
* byte orderings.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXOpenDevice(ClientPtr client)
|
||||
{
|
||||
REQUEST(xOpenDeviceReq);
|
||||
swaps(&stuff->length);
|
||||
return (ProcXOpenDevice(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure causes the server to open an input device.
|
||||
|
|
@ -146,7 +163,7 @@ ProcXOpenDevice(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXOpenDevice(ClientPtr client, int size, xOpenDeviceReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef OPENDEV_H
|
||||
#define OPENDEV_H 1
|
||||
|
||||
int SProcXOpenDevice(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXOpenDevice(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
28
Xi/queryst.c
28
Xi/queryst.c
|
|
@ -32,21 +32,35 @@ from The Open Group.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/exevents_priv.h"
|
||||
#include "dix/input_priv.h"
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
#include "xkbsrv.h"
|
||||
#include "xkbstr.h"
|
||||
|
||||
#include "queryst.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure allows a client to query the state of a device.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXQueryDeviceState(ClientPtr client)
|
||||
{
|
||||
REQUEST(xQueryDeviceStateReq);
|
||||
swaps(&stuff->length);
|
||||
return (ProcXQueryDeviceState(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure allows frozen events to be routed.
|
||||
|
|
@ -165,7 +179,7 @@ ProcXQueryDeviceState(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXQueryDeviceState(ClientPtr client, int size, xQueryDeviceStateReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef QUERYST_H
|
||||
#define QUERYST_H 1
|
||||
|
||||
int SProcXQueryDeviceState(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXQueryDeviceState(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,21 +50,23 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XI2.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "dix/exevents_priv.h"
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* window structure */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XI2.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "grabdev.h"
|
||||
#include "selectev.h"
|
||||
|
||||
extern Mask ExtExclusiveMasks[];
|
||||
|
||||
static int
|
||||
HandleDevicePresenceMask(ClientPtr client, WindowPtr win,
|
||||
XEventClass * cls, CARD16 *count)
|
||||
|
|
@ -117,10 +119,11 @@ HandleDevicePresenceMask(ClientPtr client, WindowPtr win,
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXSelectExtensionEvent(ClientPtr client)
|
||||
{
|
||||
REQUEST(xSelectExtensionEventReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
|
||||
swapl(&stuff->window);
|
||||
swaps(&stuff->count);
|
||||
|
|
@ -147,7 +150,7 @@ ProcXSelectExtensionEvent(ClientPtr client)
|
|||
REQUEST(xSelectExtensionEventReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
|
||||
|
||||
if (client->req_len !=
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xSelectExtensionEventReq)) + stuff->count)
|
||||
return BadLength;
|
||||
|
||||
|
|
@ -172,7 +175,7 @@ ProcXSelectExtensionEvent(ClientPtr client)
|
|||
}
|
||||
if ((ret =
|
||||
SelectForWindow((DeviceIntPtr) tmp[i].dev, pWin, client,
|
||||
tmp[i].mask, DeviceButtonGrabMask)) != Success)
|
||||
tmp[i].mask, ExtExclusiveMasks[i])) != Success)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,17 +50,18 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/exevents_priv.h"
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include "windowstr.h" /* Window */
|
||||
#include "extnsionst.h" /* EventSwapPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "grabdev.h"
|
||||
#include "sendexev.h"
|
||||
|
||||
|
|
@ -72,38 +73,31 @@ extern int lastEvent; /* Defined in extension.c */
|
|||
*
|
||||
*/
|
||||
|
||||
int _X_COLD
|
||||
int
|
||||
SProcXSendExtensionEvent(ClientPtr client)
|
||||
{
|
||||
CARD32 *p;
|
||||
int i;
|
||||
xEvent eventT = { .u.u.type = 0 };
|
||||
xEvent eventT;
|
||||
xEvent *eventP;
|
||||
EventSwapPtr proc;
|
||||
|
||||
REQUEST(xSendExtensionEventReq);
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
|
||||
swapl(&stuff->destination);
|
||||
swaps(&stuff->count);
|
||||
|
||||
if (client->req_len !=
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
|
||||
bytes_to_int32(stuff->num_events * sizeof(xEvent)))
|
||||
return BadLength;
|
||||
|
||||
eventP = (xEvent *) &stuff[1];
|
||||
for (i = 0; i < stuff->num_events; i++, eventP++) {
|
||||
if (eventP->u.u.type == GenericEvent) {
|
||||
client->errorValue = eventP->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
proc = EventSwapVector[eventP->u.u.type & 0177];
|
||||
/* no swapping proc; invalid event type? */
|
||||
if (proc == NotImplemented) {
|
||||
client->errorValue = eventP->u.u.type;
|
||||
if (proc == NotImplemented) /* no swapping proc; invalid event type? */
|
||||
return BadValue;
|
||||
}
|
||||
(*proc) (eventP, &eventT);
|
||||
*eventP = eventT;
|
||||
}
|
||||
|
|
@ -123,7 +117,7 @@ SProcXSendExtensionEvent(ClientPtr client)
|
|||
int
|
||||
ProcXSendExtensionEvent(ClientPtr client)
|
||||
{
|
||||
int ret, i;
|
||||
int ret;
|
||||
DeviceIntPtr dev;
|
||||
xEvent *first;
|
||||
XEventClass *list;
|
||||
|
|
@ -132,7 +126,7 @@ ProcXSendExtensionEvent(ClientPtr client)
|
|||
REQUEST(xSendExtensionEventReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
|
||||
|
||||
if (client->req_len !=
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
|
||||
(stuff->num_events * bytes_to_int32(sizeof(xEvent))))
|
||||
return BadLength;
|
||||
|
|
@ -147,12 +141,10 @@ ProcXSendExtensionEvent(ClientPtr client)
|
|||
/* The client's event type must be one defined by an extension. */
|
||||
|
||||
first = ((xEvent *) &stuff[1]);
|
||||
for (i = 0; i < stuff->num_events; i++) {
|
||||
if (!((EXTENSION_EVENT_BASE <= first[i].u.u.type) &&
|
||||
(first[i].u.u.type < lastEvent))) {
|
||||
client->errorValue = first[i].u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
|
||||
(first->u.u.type < lastEvent))) {
|
||||
client->errorValue = first->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
list = (XEventClass *) (first + stuff->num_events);
|
||||
|
|
|
|||
28
Xi/setbmap.c
28
Xi/setbmap.c
|
|
@ -50,18 +50,32 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/input_priv.h"
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "setbmap.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure changes the button mapping.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXSetDeviceButtonMapping(ClientPtr client)
|
||||
{
|
||||
REQUEST(xSetDeviceButtonMappingReq);
|
||||
swaps(&stuff->length);
|
||||
return (ProcXSetDeviceButtonMapping(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists the input devices available to the server.
|
||||
|
|
@ -78,7 +92,7 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
|
|||
REQUEST(xSetDeviceButtonMappingReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSetDeviceButtonMappingReq);
|
||||
|
||||
if (client->req_len !=
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xSetDeviceButtonMappingReq) + stuff->map_length))
|
||||
return BadLength;
|
||||
|
||||
|
|
@ -116,7 +130,7 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXSetDeviceButtonMapping(ClientPtr client, int size,
|
||||
xSetDeviceButtonMappingReply * rep)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef SETBMAP_H
|
||||
#define SETBMAP_H 1
|
||||
|
||||
int SProcXSetDeviceButtonMapping(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXSetDeviceButtonMapping(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
28
Xi/setdval.c
28
Xi/setdval.c
|
|
@ -50,18 +50,32 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
|
||||
#include "dix/input_priv.h"
|
||||
#endif
|
||||
|
||||
#include "inputstr.h" /* DeviceIntPtr */
|
||||
#include <X11/extensions/XI.h>
|
||||
#include <X11/extensions/XIproto.h>
|
||||
#include "XIstubs.h"
|
||||
#include "exglobals.h"
|
||||
|
||||
#include "setdval.h"
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Handle a request from a client with a different byte order.
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
SProcXSetDeviceValuators(ClientPtr client)
|
||||
{
|
||||
REQUEST(xSetDeviceValuatorsReq);
|
||||
swaps(&stuff->length);
|
||||
return (ProcXSetDeviceValuators(client));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure sets the value of valuators on an extension input device.
|
||||
|
|
@ -86,7 +100,7 @@ ProcXSetDeviceValuators(ClientPtr client)
|
|||
.status = Success
|
||||
};
|
||||
|
||||
if (client->req_len != bytes_to_int32(sizeof(xSetDeviceValuatorsReq)) +
|
||||
if (stuff->length != bytes_to_int32(sizeof(xSetDeviceValuatorsReq)) +
|
||||
stuff->num_valuators)
|
||||
return BadLength;
|
||||
|
||||
|
|
@ -123,7 +137,7 @@ ProcXSetDeviceValuators(ClientPtr client)
|
|||
*
|
||||
*/
|
||||
|
||||
void _X_COLD
|
||||
void
|
||||
SRepXSetDeviceValuators(ClientPtr client, int size,
|
||||
xSetDeviceValuatorsReply * rep)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#ifndef SETDVAL_H
|
||||
#define SETDVAL_H 1
|
||||
|
||||
int SProcXSetDeviceValuators(ClientPtr /* client */
|
||||
);
|
||||
|
||||
int ProcXSetDeviceValuators(ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue