aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-03-22 09:17:19 +0000
committermarha <marha@users.sourceforge.net>2010-03-22 09:17:19 +0000
commit348130c450be8b5c4abcb03272b326434e3f5022 (patch)
tree413685260aa63ea6b530af4898603a40f441b768 /xorg-server
parent4f736752bbdf3bbf1a6325af7ad470198aa5a82a (diff)
downloadvcxsrv-348130c450be8b5c4abcb03272b326434e3f5022.tar.gz
vcxsrv-348130c450be8b5c4abcb03272b326434e3f5022.tar.bz2
vcxsrv-348130c450be8b5c4abcb03272b326434e3f5022.zip
Updated to xorg-server-1.7.99.902
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/ChangeLog1032
-rw-r--r--xorg-server/Makefile.in3
-rw-r--r--xorg-server/Xext/Makefile.am4
-rw-r--r--xorg-server/Xext/Makefile.in30
-rw-r--r--xorg-server/Xi/Makefile.in3
-rw-r--r--xorg-server/aclocal.m4409
-rw-r--r--xorg-server/composite/Makefile.in3
-rw-r--r--xorg-server/config/Makefile.in3
-rw-r--r--xorg-server/configure283
-rw-r--r--xorg-server/configure.ac10
-rw-r--r--xorg-server/damageext/Makefile.in3
-rw-r--r--xorg-server/dbe/Makefile.in3
-rw-r--r--xorg-server/dix/Makefile.in3
-rw-r--r--xorg-server/dix/cursor.c17
-rw-r--r--xorg-server/dix/events.c36
-rw-r--r--xorg-server/dix/registry.c672
-rw-r--r--xorg-server/dix/window.c7775
-rw-r--r--xorg-server/doc/Makefile.in3
-rw-r--r--xorg-server/exa/Makefile.in3
-rw-r--r--xorg-server/exa/exa.c4
-rw-r--r--xorg-server/fb/Makefile.in3
-rw-r--r--xorg-server/fb/fbscreen.c4
-rw-r--r--xorg-server/glx/Makefile.in3
-rw-r--r--xorg-server/hw/Makefile.in3
-rw-r--r--xorg-server/hw/dmx/Makefile.in3
-rw-r--r--xorg-server/hw/dmx/config/Makefile.in3
-rw-r--r--xorg-server/hw/dmx/doc/Makefile.in3
-rw-r--r--xorg-server/hw/dmx/examples/Makefile.in3
-rw-r--r--xorg-server/hw/dmx/examples/xinput.c2
-rw-r--r--xorg-server/hw/dmx/glxProxy/Makefile.in3
-rw-r--r--xorg-server/hw/dmx/input/Makefile.in3
-rw-r--r--xorg-server/hw/kdrive/Makefile.in3
-rw-r--r--xorg-server/hw/kdrive/ephyr/Makefile.in3
-rw-r--r--xorg-server/hw/kdrive/fake/Makefile.in3
-rw-r--r--xorg-server/hw/kdrive/fbdev/Makefile.in3
-rw-r--r--xorg-server/hw/kdrive/linux/Makefile.in3
-rw-r--r--xorg-server/hw/kdrive/src/Makefile.in3
-rw-r--r--xorg-server/hw/vfb/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/common/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c26
-rw-r--r--xorg-server/hw/xfree86/common/xf86Configure.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86cmap.c2337
-rw-r--r--xorg-server/hw/xfree86/ddc/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/dixmods/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/dixmods/extmod/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/doc/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/doc/devel/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/doc/man/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/doc/sgml/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/dri/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/dri2/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.c1872
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2ext.c2
-rw-r--r--xorg-server/hw/xfree86/exa/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/fbdevhw/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/i2c/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/int10/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/loader/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/loader/sdksyms.c3
-rw-r--r--xorg-server/hw/xfree86/modes/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c22
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.h26
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Cursors.c4
-rw-r--r--xorg-server/hw/xfree86/modes/xf86RandR12.c14
-rw-r--r--xorg-server/hw/xfree86/os-support/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/os-support/bsd/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/os-support/bus/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/os-support/hurd/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/os-support/misc/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/os-support/sco/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/os-support/solaris/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/os-support/sysv/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/parser/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/ramdac/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86Cursor.c6
-rw-r--r--xorg-server/hw/xfree86/shadowfb/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/utils/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/utils/cvt/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/utils/gtf/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/vbe/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/vgahw/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/x86emu/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/x86emu/sys.c236
-rw-r--r--xorg-server/hw/xfree86/xaa/Makefile.in3
-rw-r--r--xorg-server/hw/xfree86/xf8_16bpp/Makefile.in3
-rw-r--r--xorg-server/hw/xnest/Makefile.in3
-rw-r--r--xorg-server/hw/xquartz/GL/Makefile.am2
-rw-r--r--xorg-server/hw/xquartz/GL/Makefile.in5
-rw-r--r--xorg-server/hw/xquartz/GL/capabilities.c4
-rw-r--r--xorg-server/hw/xquartz/GL/indirect.c2
-rw-r--r--xorg-server/hw/xquartz/Makefile.am4
-rw-r--r--xorg-server/hw/xquartz/Makefile.in7
-rw-r--r--xorg-server/hw/xquartz/bundle/Makefile.in3
-rw-r--r--xorg-server/hw/xquartz/darwin.c1822
-rw-r--r--xorg-server/hw/xquartz/doc/Makefile.in3
-rw-r--r--xorg-server/hw/xquartz/mach-startup/Makefile.am2
-rw-r--r--xorg-server/hw/xquartz/mach-startup/Makefile.in5
-rw-r--r--xorg-server/hw/xquartz/pbproxy/Makefile.in3
-rw-r--r--xorg-server/hw/xquartz/quartzKeyboard.c16
-rw-r--r--xorg-server/hw/xquartz/xpr/Makefile.am2
-rw-r--r--xorg-server/hw/xquartz/xpr/Makefile.in5
-rw-r--r--xorg-server/hw/xwin/Makefile.in10
-rw-r--r--xorg-server/include/Makefile.am1
-rw-r--r--xorg-server/include/Makefile.in16
-rw-r--r--xorg-server/include/do-not-use-config.h.in779
-rw-r--r--xorg-server/include/list.h97
-rw-r--r--xorg-server/include/scrnintstr.h10
-rw-r--r--xorg-server/include/xwin-config.h.in2
-rw-r--r--xorg-server/mi/Makefile.in3
-rw-r--r--xorg-server/miext/Makefile.in3
-rw-r--r--xorg-server/miext/cw/Makefile.in3
-rw-r--r--xorg-server/miext/damage/Makefile.in3
-rw-r--r--xorg-server/miext/rootless/Makefile.in3
-rw-r--r--xorg-server/miext/shadow/Makefile.in3
-rw-r--r--xorg-server/os/Makefile.in3
-rw-r--r--xorg-server/randr/Makefile.in3
-rw-r--r--xorg-server/record/Makefile.in3
-rw-r--r--xorg-server/render/Makefile.in3
-rw-r--r--xorg-server/test/Makefile.in3
-rw-r--r--xorg-server/test/xi2/Makefile.in3
-rw-r--r--xorg-server/xfixes/Makefile.in3
-rw-r--r--xorg-server/xkb/Makefile.in3
124 files changed, 10208 insertions, 7651 deletions
diff --git a/xorg-server/ChangeLog b/xorg-server/ChangeLog
index feded28c8..aae0cafee 100644
--- a/xorg-server/ChangeLog
+++ b/xorg-server/ChangeLog
@@ -1,3 +1,1035 @@
+commit 13c007f9224ad871193e40466e64df1477ed26b0
+Author: Keith Packard <keithp@keithp.com>
+Date: Sun Mar 21 17:23:46 2010 -0700
+
+ Bump to 1.7.99.902 -- 1.8 RC2
+
+commit 235fa5030428084368e5be57fca695647b7b79c4
+Merge: 1c612ac fa5103a
+Author: Keith Packard <keithp@keithp.com>
+Date: Sun Mar 21 15:38:40 2010 -0700
+
+ Merge commit 'fa5103a02bd509e4a102afdad2ab26cb22210367'
+
+commit 1c612acca8568fcdf9761d23f112adaf4d496f1b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Wed Mar 17 14:32:38 2010 +1000
+
+ dix: if owner-events is true for passive grabs, add the window mask (#25400)
+
+ A client requesting a GrabModeSync button grab, owner-events true, with only
+ the ButtonRelease mask set would never receive the press event even if the
+ grab window had the ButtonPress mask set.
+
+ The protocol requires that if owner-events is true, then the delivery mask
+ is the combination of the grab mask + the window event mask.
+
+ X.Org Bug 25400 <http://bugs.freedesktop.org/show_bug.cgi?id=25400>
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Tested-by: Jim Ramsay <i.am@jimramsay.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 95ca39b981624df5338a16b506289014c431ae82
+Merge: e7ff956 bf18191
+Author: Keith Packard <keithp@keithp.com>
+Date: Sun Mar 21 15:24:06 2010 -0700
+
+ Merge remote branch 'jturney/master'
+
+commit e7ff956638780dc1c6f160a1fd041b92cebff9ac
+Author: Oliver McFadden <oliver.mcfadden@nokia.com>
+Date: Mon Mar 15 23:46:36 2010 +0200
+
+ common: xf86Configure: alloc_strlen: Allocated memory does not have space for the terminating NUL of the string
+
+ buffer_alloc: Called allocating function "realloc" which allocated memory dictated by parameter "len + strlen(displaySize_string)"
+ alloc_strlen: Allocated memory does not have space for the terminating NUL of the string
+ var_assign: Assigned "ptr->mon_comment" to storage allocated by "realloc(ptr->mon_comment, len + strlen(displaySize_string))"
+
+ Signed-off-by: Oliver McFadden <oliver.mcfadden@nokia.com>
+ Reviewed-by: Matt Turner <mattst88@gmail.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit aeae6637b52b042cf8b07c6943abcd5d31968d49
+Author: Oliver McFadden <oliver.mcfadden@nokia.com>
+Date: Mon Mar 15 23:46:34 2010 +0200
+
+ fb: fbFinishScreenInit: leaked_storage: Variable "(visuals|depths)" goes out of scope
+
+ Signed-off-by: Oliver McFadden <oliver.mcfadden@nokia.com>
+ Reviewed-by: Matt Turner <mattst88@gmail.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit d9ee31ab05efbd2d598cc93a41a8834f84d30803
+Author: Oliver McFadden <oliver.mcfadden@nokia.com>
+Date: Mon Mar 15 23:46:33 2010 +0200
+
+ exa: exaFinishAccess: Overrun of static array "pExaScr->access" of size 6 at position 6 with index variable "i"
+
+ Signed-off-by: Oliver McFadden <oliver.mcfadden@nokia.com>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit bf181915e103b0659c5a0bc3b2f6bccb18c9ec36
+Author: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
+Date: Mon Feb 1 17:11:51 2010 +0000
+
+ Cygwin/X: Allow the default log location to be configurable
+
+ Allow the default log location to be configurable (e.g. /var/log),
+ and use separate logs for each display instance (e.g. XWin.0.log).
+
+ Make the type of g_pszLogFile const char*, per os/log.c:LogInit().
+
+ Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
+ Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
+
+commit cca4952d750779a4c58a11fe08a53336042930bb
+Author: Colin Harrison <colin.harrison@virgin.net>
+Date: Fri Feb 26 14:40:30 2010 +0000
+
+ Xming: Warning fixes
+
+ Fix warnings due to prototypes not specifying function arguments
+ Fix warning with RegQueryValueEx()
+ Tidy up an include
+
+ Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
+ Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
+
+commit b8cf4153f84404b2a1b62a247d5d36d24bf481da
+Author: Colin Harrison <colin.harrison@virgin.net>
+Date: Fri Feb 26 14:41:00 2010 +0000
+
+ Xming: Dead code removal
+
+ Remove some dead code, mostly code made obsolete by mandatory XKB
+
+ Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
+ Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
+
+commit 9b18f7ac0ba9aadb8c86bc2717cbdff75e951b69
+Author: Jon TURNEY <jon.turney@dronecode.org.uk>
+Date: Fri Feb 26 14:22:57 2010 +0000
+
+ Cygwin/X: Tidy up some cosmetic issues in log strings
+
+ Tidy up some cosmetic issues in log strings:
+ - Add missing '\n'
+ - Fix some strings starting with '\n'
+ - Remove '\f' from some log strings
+
+ These all just look daft in a log with timestamps.
+
+ Also clarify log message about screen origin coordinates
+
+ Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
+ Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
+
+commit 178e830378c3514b9c53a5b1c6d2d5f930c3779b
+Author: Jon TURNEY <jon.turney@dronecode.org.uk>
+Date: Mon Feb 22 19:13:30 2010 +0000
+
+ Cygwin/X: Fix thinko in mount option checking
+
+ Fix a thinko in mount option checking.
+ Use symbolic names for values assigned to binary flag for clarity.
+
+ Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
+ Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
+
+commit fa5103a02bd509e4a102afdad2ab26cb22210367
+Author: Francisco Jerez <currojerez@riseup.net>
+Date: Wed Feb 24 23:18:01 2010 +0100
+
+ dri2: No need to blit from front on DRI2GetBuffers if they're just being reused.
+
+ It can be quite an expensive operation, so we're better off not doing
+ it unless it's totally required.
+
+ Signed-off-by: Francisco Jerez <currojerez@riseup.net>
+ Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
+ Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
+
+commit e38e01081af42825bb7b44d18aa35845318f8556
+Author: Francisco Jerez <currojerez@riseup.net>
+Date: Wed Feb 24 23:18:00 2010 +0100
+
+ Import linked list helpers from the intel DDX.
+
+ Borrowed from i830.h, except for list_for_each_entry().
+
+ Signed-off-by: Francisco Jerez <currojerez@riseup.net>
+ Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
+ Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
+
+commit b8a3be5f34016b745e38cd53825a4e398c6127bc
+Author: Francisco Jerez <currojerez@riseup.net>
+Date: Wed Feb 24 23:17:59 2010 +0100
+
+ Add a ConfigNotify hook.
+
+ Executed from the ConfigureWindow request, right before sending
+ ConfigureNotify to the clients.
+
+ This commit breaks the ScreenRec ABI.
+
+ Signed-off-by: Francisco Jerez <currojerez@riseup.net>
+ Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
+ Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
+
+commit 67a8c659f25218904bae64aac6e98e326c90330b
+Author: Roland Scheidegger <sroland@vmware.com>
+Date: Fri Mar 12 16:53:30 2010 +0100
+
+ hw/xfree86: move reference counting out of the UseHWCursor[ARGB] functions
+
+ The problem is that the xf86_use_hw_cursor(_argb) functions may get this
+ correctly now, some drivers will replace these generic versions with their
+ own functions. It is pretty insane to expect them to do reference counting
+ of the cursor (as an example, look at driver/xf86-video-vmware to see how
+ that looks like as a workaround). There are even places in xserver itself
+ which replace these two functions.
+ The segfaults if no reference counting is done are caused because the
+ reference count of the cursor reached zero, hence the cursor was freed,
+ however xf86CursorEnableDisableFBAccess() brought it back to life from
+ the dead (from the SavedCursor).
+ This patch hence adds reference counting in xf86CursorSetCursor. As per Michel
+ Daenzer's suggestion, also free the cursor upon xf86CursorCloseScreen.
+ In theory with this it should be possible to remove the reference
+ counting in the UseHwCursor functions I think, though it should also be
+ safe to keep them.
+
+ Signed-off-by: Roland Scheidegger <sroland@vmware.com>
+ Reviewed-by: Michel Dänzer <michel@daenzer.net>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 75efb46a14fe45ffe73faff637b1fa6d017e1e52
+Author: Roland Scheidegger <sroland@vmware.com>
+Date: Fri Mar 12 16:52:56 2010 +0100
+
+ hw/xfree86: fix refcounting in xf86_use_hw_cursor
+
+ This is the same fix as was done in
+ fcdc1d78cca3b8bb6b77d53eda7e21d649df6943 for xf86_use_hw_cursor_argb.
+
+ Signed-off-by: Roland Scheidegger <sroland@vmware.com>
+ Reviewed-by: Michel Dänzer <michel@daenzer.net>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit df9b6f16b27398545cd4cff8a56dd59a3813351d
+Merge: 5f169f5 5172253
+Author: Keith Packard <keithp@keithp.com>
+Date: Mon Mar 15 08:26:58 2010 -0700
+
+ Merge remote branch 'jeremyhu/master'
+
+commit 5f169f54936c9868ad0f3778cb95c1f35eef41ea
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Fri Mar 5 10:35:54 2010 -0500
+
+ XQuartz: remove undefined XSERVER_CFLAGS variable
+
+ This is a variable local to configure.ac which is not AC_SUBST()
+ It is undefined in any generated Makefile.
+
+ Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+ Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 5172253bae3b9867118c6717434e73c173acd5e9
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Wed Feb 10 15:52:14 2010 -0800
+
+ XQuartz: Use an empty xkb keymap by default
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit b117bc7a441bec8f61610fb384d747112f73d236
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Thu Mar 11 00:06:01 2010 -0800
+
+ XQuartz: Include os.h for OsAbort()
+
+ Fixes regression from 5b9a52be7e975e59e0bbc6b43539ecaff96b2ecd
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit b7a16117c6d87a9d33a5f682b592b4507f2c065e
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Thu Mar 11 00:03:08 2010 -0800
+
+ XQuartz: GLX: Fix prototype for swapBuffers
+
+ This was a regression introduced by 04a54f69a8085ab3fe11a8713bd8b6b16ed1db27
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit 178da6534fe7ab4b99fb87925c04e6f963c88583
+Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
+Date: Mon Mar 8 16:33:37 2010 -0500
+
+ Xext: Link to external libraries when necessary.
+
+ Although the DDX should be linked to the necessary libraries, we may
+ also need to pull them in directly to the module to ensure the symbols
+ are resolved at runtime. Should fix this bug with XSELINUX:
+
+ /usr/bin/X: symbol lookup error:
+ /usr/lib64/xorg/modules/extensions/libextmod.so: undefined symbol:
+ is_selinux_enabled
+
+ -v2: use _LIBADD instead of _LIBS; remove SELINUX_LIBS from
+ XSERVER_SYS_LIBS as it should only be needed in extmod.
+
+ Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
+ Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit a2ea8c2f2cc53607d57d60f41c879380ea70cd02
+Author: Daniel Stone <daniel@fooishbar.org>
+Date: Thu Mar 11 14:19:04 2010 +0200
+
+ Record: Avoid duplicates from replaying frozen events
+
+ Reintroduce a check which used to be there in the old
+ ProcessKeyboardEvent/ProcessPointerEvent codepath, which avoids us
+ recording events subject to a grab twice: once when it's first processed
+ in EnqueueEvent, and then again when it's thawed and being replayed.
+
+ This required a tiny amount of code motion to expose syncEvents.
+
+ Signed-off-by: Daniel Stone <daniel@fooishbar.org>
+ Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit f2eacb4646beb25d055de22868f93e6b24f229b6
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Wed Mar 10 09:39:05 2010 +1000
+
+ Revert "dix: Use DeliverGrabbedEvent for implicit passive grabs (#25400)"
+
+ Several users have pointed out that this commit introduces regressions, most
+ notably perhaps fluxbox which essentially stops working after a few clicks.
+
+ This reverts commit cf72b5437d2d620521279077a29c5df6d0fbb576.
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit df9f3273041c6c3e0da2d2254e8c156cd582e296
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Wed Mar 10 09:24:32 2010 +1000
+
+ xfree86: fix xf86Config.c build error in --enable-debug mode. (#26971)
+
+ xf86Config.c: In function 'configInputDevices':
+ xf86Config.c:1514: error: request for member 'lay_identifier' in something
+ not a structure or union
+ make[5]: *** [xf86Config.lo] Error 1
+
+ Introduced with e1165632bdfbd720889ed1adf5f7ab338032c0ee.
+
+ X.Org Bug 26971 <http://bugs.freedesktop.org/show_bug.cgi?id=26971>
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Acked-by: Dan Nicholson <dbn.lists@gmail.com>
+
+commit 116068103282924ef1476231d13d54719a797252
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Tue Mar 9 09:35:23 2010 +1000
+
+ xfree86: don't warn about nonexisting core pointer/keyboard in config.
+
+ In the vast majority of cases there is no xorg.conf that specifies a core
+ pointer/keyboard. Skip this warning, since we'll get another notification
+ about how the server relies on the config backend for input devices anyway.
+
+ Leave the warning in for the error case (AEI off).
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
+ Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
+
+commit c39c8ece9bd3ce025549f4bac7794f5a62266f4a
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Wed Feb 10 15:06:52 2010 +1000
+
+ os: remove INTERNAL_MALLOC define.
+
+ There doesn't seem to be anything that defines it and given that the
+ counterpart (the X internal malloc) was removed in
+ 01cfba75229f4b9bf1e4fe80814931acdacde14c it's unlikely to work anyway.
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 9f462ff9082634719e64d2d8d4dbd09ec7deaf2e
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Fri Feb 26 14:02:09 2010 +1000
+
+ dix: Clip only into axis ranges if we're in absolute mode. (#26543)
+
+ An absolute device in relative mode may provide valuators outside of the
+ axis range. Clipping back into the range prevents screen crossings in a
+ multi-screen (Xinerama) setup as the required screen edge for crossing is
+ never met: miPointerSetPosition crosses the screen conditional to the X
+ coordinate being equal to the screen width or _less than_ 0. While the
+ former can be met when clipping into the coordinate range and scaling, the
+ latter cannot, resulting in a mouse pointer that gets stuck on the rightmost
+ screen.
+
+ This patch only applies axis clipping for valuators in mode Absolute. If
+ relative, we allow the values to get above/below the axis ranges. Doesn't
+ matter, miPointerSetPosition will reset the values to the allowed range even
+ if no screen was crossed.
+ This leads to interesting values provided to clients, the valuator range of
+ the device resets once a screen is crossed and essentially reflects
+ the position of the cursor on the screen - scaled into the valuator range.
+ The values themselves are valid given the range though.
+
+ In theory, the XI1 specs require that a relative device has a min/max range
+ of 0/0. This doesn't really go well with devices that actually can switch
+ mode between relative and absolute since they would have to reset their axis
+ range when switching. If multiple XI clients are in use, we have no method
+ of notifying them about the changes, so other clients may continue to use
+ the wrong axis ranges (note: XI1 wasn't really designed to have multiple
+ clients use a device). Expecting all relative devices to have this min/max
+ of 0 is unrealistic at this point.
+
+ So pick what is possibly the lesser of all evils, pass the beer and despair.
+
+ X.Org Bug 26543 <http://bugs.freedesktop.org/show_bug.cgi?id=26543>
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Daniel Stone <daniel@fooishbar.org>
+
+commit bbae92795c7eab062e6722c42fa7915e0cee5d69
+Author: Matt Turner <mattst88@gmail.com>
+Date: Mon Feb 15 20:08:09 2010 -0500
+
+ Replace assembly with generic unaligned access code
+
+ Removes Alpha assembly, and probably works around unaligned accesses on
+ other sensitive platforms.
+
+ Signed-off-by: Matt Turner <mattst88@gmail.com>
+ Acked-by: Adam Jackson <ajax@redhat.com>
+ Compiled-by: Tiago Vignatti <tiago.vignatti@nokia.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 1c2abec479cfbac9aeadc121af0825d368317658
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Fri Feb 26 11:44:17 2010 +1000
+
+ configure: move SELINUX_LIBS to XSERVER_SYS_LIBS
+
+ All ddxs require linking against selinux if enabled.
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
+ Reviewed-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit cab99b947c66a42dbf8a906bdb02e23aa7cab519
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Fri Feb 26 11:41:38 2010 +1000
+
+ configure: move libselinux requirement up to the common section.
+
+ Let's have all version-specific requirements in one block.
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
+ Reviewed-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 9e7b6e565f6e69f20002bf03ed05fe8b63f86924
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Fri Feb 26 10:14:00 2010 +1000
+
+ dmx: fix OsAbort()-related build error in examples/xinput.c
+
+ 5b9a52be7e975e59e0bbc6b43539ecaff96b2ecd changed the server to use OsAbort()
+ instead of abort(). xinput in dmx is a client program though and fails to
+ link if it tries to use OsAbort(). Switch it back to using abort().
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
+ Reviewed-by: Julien Cristau <jcristau@debian.org>
+ Reviewed-by: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit cf72b5437d2d620521279077a29c5df6d0fbb576
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu Feb 25 12:49:21 2010 +1000
+
+ dix: Use DeliverGrabbedEvent for implicit passive grabs (#25400)
+
+ A client requesting a GrabModeSync button grab, owner-events true, with only
+ the ButtonRelease mask set would never receive the press event even if the
+ grab window had the ButtonPress mask set.
+
+ The protocol requires that if owner-events is true, then the delivery mask
+ is the combination of the grab mask + the window event mask.
+
+ DeliverGrabbedEvents does this already for us, checking first the delivery
+ based on owner_events and then based on the grab mask. AFAICT, the device
+ cannot enter the states FREEZE_BOTH_NEXT_EVENT or FREEZE_NEXT_EVENT that
+ would be handled by DGE in any possible path here.
+
+ Bonus point - CheckPassiveGrabsOnWindows suddenly becomes a lot lesss
+ complicated.
+
+ X.Org Bug 25400 <http://bugs.freedesktop.org/show_bug.cgi?id=25400>
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit de86a3a3448f0a55c1cd99aee9ea80070a589877
+Author: Keith Packard <keithp@keithp.com>
+Date: Thu Feb 25 11:37:05 2010 -0800
+
+ Allow for missing or disabled compat_output
+
+ When the compat output is missing (I don't think this is actually
+ possible), or is disabled (and hence has no crtc), we would like to
+ avoid dereferencing NULL pointers. This patch creates inline functions
+ to extract the current compat output, crtc or associated RandR crtc
+ structure, carefully checking for NULL pointers everywhere.
+
+ Reviewed-by: Adam Jackson <ajax@redhat.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit fbbadca7e88391e81ab0f470290f5eec36aa9ce7
+Author: Keith Packard <keithp@keithp.com>
+Date: Thu Feb 25 11:35:03 2010 -0800
+
+ Share enum definition for det_monrec_parameter sync_source
+
+ There were two separate enum definitions, one inside
+ det_monrec_parameter struct and one for a local variable (which was then
+ stored inside the struct). Sharing a single definition makes the
+ code more obviously correct while making the compiler happier.
+
+ Reviewed-by: Adam Jackson <ajax@redhat.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 4b55b2cf8a52c39b53bae11cd1bc7314481d4c86
+Author: Robert Bragg <bob@o-hand.com>
+Date: Wed Jan 27 20:38:38 2010 +0000
+
+ DRI2: initialize event->drawable in DRI2SwapEvent
+
+ We weren't initialising the drawable in the event structure so the
+ client side DRI2WireToEvent used for translating the event into a GLX
+ event wouldn't be able to lookup up the corresponding GLXDrawable before
+ passing the event on.
+
+ Signed-off-by: Robert Bragg <robert@linux.intel.com>
+ Reviewed-by: Eric Anholt <eric@anholt.net>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 780c95caf9888fa4548dfe4c1c78a7e7ce99a9ed
+Merge: 018b177 758f697
+Author: Keith Packard <keithp@keithp.com>
+Date: Wed Feb 24 09:59:19 2010 -0800
+
+ Merge remote branch 'whot/for-keith'
+
+commit 018b177591c9fade6d065e31858cc6e054d33eff
+Author: Kristian Høgsberg <krh@bitplanet.net>
+Date: Wed Feb 24 10:37:26 2010 -0500
+
+ glx: Compile fix to let server compile with new and old mesa
+
+ We broke the __DRI2_FLUSH API since it was never released, but since it's
+ taking a little longer than expected to get the X server side of the changes
+ ready, fix things up so it compiles.
+
+ Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 758f6971750ed507e64eee817d720a77181439f2
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Mon Feb 15 16:32:16 2010 +1000
+
+ dix: try to ring the bell even if the current device doesn't have one. (#24503)
+
+ Evdev devices do not have the bell proc set, but XTEST devices do. By
+ exiting early, the bell only rings if the last keyboard used was the XTEST
+ keyboard and hence the bell proc is still set on the master but not if an
+ evdev keyboard was used last.
+
+ The better approach here is to try to ring the bell on all devices attached
+ to this master device in case one or more actually do produce an audible
+ sound. That's also XKB's behaviour if XkbUseCoreKbd is specified as device
+ identifier.
+
+ X.Org Bug 24503 <http://bugs.freedesktop.org/show_bug.cgi?id=24503>
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Adam Jackson <ajax@redhat.com>
+
+commit c0d941913199ed251fceab62fcf65437f6f9bd31
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu Feb 18 16:00:15 2010 +1000
+
+ dix: remove now-erroneous comment about frozen slave devices.
+
+ A direct grab on a slave device through XI2 detaches it, regardless of
+ whether the grab is sync or async. So this comment doesn't apply to XI2
+ anyway.
+
+ For XI1, aside from your life being miserable already, it doesn't matter as
+ XI1 does not have a concept of attachment. You can freeze a device and if
+ you don't freeze _all_ other devices at the same time, the master device can
+ still happily send events to the client.
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Acked-by: Adam Jackson <ajax@redhat.com>
+
+commit db4f676f25c6d8e58263d5151942be730592d444
+Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
+Date: Wed Feb 3 15:40:47 2010 -0500
+
+ xselinux: Bump extension minor version.
+
+ Changes introduced in this version:
+ - 3 window-related requests now handle pixmaps also.
+
+ Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+
+commit a6cbcf6e782e65f3d4d14202ed0b7a8f65b33c9d
+Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
+Date: Wed Feb 3 15:38:57 2010 -0500
+
+ xselinux: Rename window-related requests that now support pixmaps.
+
+ Renamed requests:
+ SetWindowCreateContext -> SetDrawableCreateContext
+ GetWindowCreateContext -> GetDrawableCreateContext
+ GetWindowContext -> GetDrawableContext
+
+ Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+
+commit ab68c707fd02613d9359120ba6402639dd8bd89e
+Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
+Date: Wed Feb 3 15:08:40 2010 -0500
+
+ xselinux: Allow GetWindowContext to be used for pixmaps as well.
+
+ Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+
+commit eb9210097efea81065c301e5b6b4da7a566deb4a
+Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
+Date: Wed Jan 6 12:52:51 2010 -0500
+
+ xselinux: Remove reference counting calls for SID objects.
+
+ Starting with libselinux 2.0.86, SID objects are no longer
+ reference counted and the sidput() and sidget() calls are no-ops.
+
+ Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+
+commit 0c4b75a08922416050bb73d2e279ce938d3823e7
+Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
+Date: Wed Oct 21 21:59:01 2009 -0400
+
+ Don't print a failure message when XACE denies an input event delivery.
+
+ A denial is normal and the behavior should be to drop the event.
+ Having the log message creates excessive log spam.
+
+ Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+
+commit e687e11b1248494a45b9a4e4c321675526808703
+Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
+Date: Wed Oct 21 21:46:50 2009 -0400
+
+ Revert "Remove some debug messages that trigger on XACE event delivery failure."
+
+ The log messages still need to be there for non-XACE failures.
+
+ This reverts commit 4be354c4c2da5168b302601b91bd80cfaca7e193.
+
+ Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+
+commit 2ecb9f7d86117f212d7845741a3e155553954a85
+Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
+Date: Wed Oct 21 19:28:26 2009 -0400
+
+ libselinux now has a pkgconfig file. Use it.
+
+ Also remove HAVE_NETLINK_AVC_ACQUIRE_FD tests, because we now
+ require a version of libselinux that has it.
+
+ Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+
+commit 9fc6b59d46382e949526dc10c3f5bfddbe2acb92
+Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
+Date: Thu Oct 15 17:32:21 2009 -0400
+
+ xselinux: Allow SetWindowCreateContext to be used for pixmaps as well.
+
+ Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+
+commit 93ff1bc5884cdfca1132af7fbc06c48e06f218c8
+Author: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
+Date: Mon Feb 15 14:18:00 2010 +0200
+
+ Always enable outputs that have been forced on in the configuration file
+
+ If the user has gone to the effort of manually enabling an output in
+ the configuration file assume that they know what they're doing.
+
+ X.org Bug 14611 <http://bugs.freedesktop.org/show_bug.cgi?id=14611>
+
+ Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
+ Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit ca9c2472d74c7107ccc117e2c9c723c168d2eccf
+Merge: e40ba57 02d1116
+Author: Keith Packard <keithp@keithp.com>
+Date: Mon Feb 22 13:26:06 2010 -0800
+
+ Merge remote branch 'whot/for-keith'
+
+commit e40ba5798c367bec584f6437b23d2c5f801fd013
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu Feb 18 15:49:09 2010 +1000
+
+ Xi: assume BadMode for non-BadMatch errors returned from SetDeviceMode.
+
+ The XI protocol spec only allows for two errors on the SetDeviceMode
+ requests: BadMatch or BadMode. BadMode however is a dynamically assigned
+ extension error and the driver doesn't have access to the actual error
+ number. Hence, if a SetDeviceMode driver returns an error other than
+ BadMatch, assume BadMode.
+
+ The two exceptions are BadAlloc and BadImplementations, pass these on to the
+ client (any request is allowed to return either of those).
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 02d1116e7eb84068fa32477f1640d29b0a81b638
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Mon Jan 11 16:35:36 2010 +1000
+
+ Xi: assume BadMode for non-BadMatch errors returned from SetDeviceMode.
+
+ The XI protocol spec only allows for two errors on the SetDeviceMode
+ requests: BadMatch or BadMode. BadMode however is a dynamically assigned
+ extension error and the driver doesn't have access to the actual error
+ number. Hence, if a SetDeviceMode driver returns an error other than
+ BadMatch, assume BadMode.
+
+ The two exceptions are BadAlloc and BadImplementations, pass these on to the
+ client (any request is allowed to return either of those).
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
+
+commit 122fc0e7a0712df4ec2bd9ca6773f90bcd2095cf
+Author: Chris Dekter <cdekter@gmail.com>
+Date: Thu Feb 11 16:34:09 2010 +1000
+
+ Re-enable RECORD extension.
+
+ RECORD was disabled during the switch to internal events. This patch
+ modifies the record callback to work with internal events instead of
+ xEvents. The InternalEvents are converted to core/Xi events as needed.
+
+ Since record is a loadable extension, the EventTo* calls must be externed.
+
+ Signed-off-by: Chris Dekter <cdekter@gmail.com>
+ Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Adam Jackson <ajax@redhat.com>
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 03ef00ae79687046dc9f9987857062a16ff2c2e0
+Author: Michel Dänzer <daenzer@vmware.com>
+Date: Wed Feb 17 11:40:44 2010 +0100
+
+ EXA/mixed: Clean up exaPrepareAccessReg_mixed() a little.
+
+ Signed-off-by: Michel Dänzer <daenzer@vmware.com>
+ Acked-by: Maarten Maathuis <madman2003@gmail.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 9623daad7c864d46b0dfcbb6e689820b96cc8115
+Author: Maarten Maathuis <madman2003@gmail.com>
+Date: Wed Feb 17 11:40:43 2010 +0100
+
+ exa/mixed: fix gnome-panel corruption
+
+ - A mapped pixmap can't be used for acceleration, any decent memory manager
+ will refuse this.
+ - Source pixmaps migrated with a bounding region are incomplete (from the
+ gpu point of view), so do the upload unconditionally, instead of just for
+ deferred destination pixmaps.
+ - Fixes fd.o bug #26076.
+
+ Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
+ Acked-by: Michel Dänzer <michel@daenzer.net>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 5b9a52be7e975e59e0bbc6b43539ecaff96b2ecd
+Author: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
+Date: Thu Jan 28 11:08:34 2010 +0200
+
+ os: Prevent core dump from being truncated.
+
+ The problem fixed by this patch can be reproduced on Linux with the
+ following steps.
+ - Access NULL pointer intentionally in ProcessOtherEvent on key press.
+ - Instead of saving core dump to a file, write it into a pipe.
+ echo "|/usr/sbin/my-core-dumper" > /proc/sys/kernel/core_pattern
+ - Dump the core by pressing a key.
+
+ While the core is being dumped into the pipe, the smart schedule timer
+ will cause a pending SIGALRM. Linux kernel stops writing data to the
+ pipe when there are pending signals. This causes the core dump to be
+ truncated. On my system I'm expecting a 6 MB dump but the size will be
+ 60 kB instead. The problem is solved if we block the SIGALRM caused by
+ expired smart schedule timer.
+
+ I haven't been able to reproduce this problem in the following cases.
+ - Save core dump to a file instead of a pipe.
+ - kill -SEGV `pidof Xorg`
+ - Press a key to dump core while gdb is attached to Xorg.
+ - Give option -dumbSched to Xorg.
+
+ Also note that the fix works only when NoTrapSignals has the default
+ value FALSE. The problem can still be reproduced if error signals
+ aren't trapped. In addition to pending SIGALRM, there is a similar
+ problem with pending SIGIO from the keyboard driver during core dump.
+
+ Signed-off-by: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit ca364ca82a760d8e5347a6f9f79636c9a5e4e03f
+Author: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
+Date: Thu Jan 28 11:08:33 2010 +0200
+
+ os: Introduce OsAbort for proper core dumps.
+
+ Signed-off-by: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 031f92bf9ab15226df410012a0d1c9c390efc36d
+Author: Oliver McFadden <oliver.mcfadden@nokia.com>
+Date: Wed Feb 3 10:05:20 2010 +0200
+
+ parser: corrected xf86getBoolValue to use case insensitive compare
+
+ commit c6e8637e29e0ca11dfb35c02da7ca6002ac8c597 introduced this
+ regression; it can cause existing config files to be parsed incorrectly.
+
+ Acked-by: Julien Cristau <jcristau@debian.org>
+ Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
+ Signed-off-by: Oliver McFadden <oliver.mcfadden@nokia.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit be96fb2f02c13a6ee8aba40f7d4c3f9141f06cea
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date: Mon Feb 15 17:42:11 2010 -0800
+
+ Solaris xf86OSRingBell() off-by-one error in filling iov[] array
+
+ When generating sound buffers for /dev/audio bells, insert waveform
+ for beep *or* silence, but not both, so we don't write one entry past
+ the end of the iov buffer when the final bit of soundwave ends up in
+ the final entry allocated in the iov array.
+
+ Fixes OpenSolaris bug 6894890:
+ http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6894890
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+ Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Acked-by: Adam Jackson <ajax@redhat.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 2d40f22d1ec970a84b23aa42b1feca4feedeb4bb
+Author: Matt Turner <mattst88@gmail.com>
+Date: Mon Feb 15 20:05:24 2010 -0500
+
+ Use C-style comments in x86emu
+
+ Signed-off-by: Matt Turner <mattst88@gmail.com>
+ Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 4e8bf12b13690afa6d9fee0e339d3819ef16fb3f
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Mon Feb 15 16:46:21 2010 -0800
+
+ XQuartz: Fix a possible buffer overrun in quartzAudio
+
+ Also dropped deprecated API while there
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit 4127e8e5be5c366eb752bbb8d7f0ff5b519e641b
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Wed Feb 10 17:56:30 2010 -0800
+
+ XQuartz: clang static analysis fixes
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit c686c5cbdc5f35744407af5f9aabbd18cc17714b
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Mon Feb 15 15:03:01 2010 -0800
+
+ XQuartz: Fix linking (CloseInput())
+
+ Fixes regresison from d33adcdf03c69407d151e732fa0cf9947151eb19
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit 84905007702da2c05a4f7446b3fc5ff52be49655
+Author: Thomas Jaeger <ThJaeger@gmail.com>
+Date: Mon Jan 4 15:00:49 2010 -0500
+
+ udev: Don't filter subsystem "input"
+
+ This allows serial wacom devices to work, whose subsystem is "tty".
+
+ Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
+ Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 8736d112afb0dd61dfdaadd6378eafd200b2ef5f
+Author: Dan Nicholson <dbn.lists@gmail.com>
+Date: Sat Feb 13 10:40:40 2010 -0800
+
+ xfree86: Reorder InputClass option priorities
+
+ Currently the config and InputClasses are merged together so that the
+ options from the config backend have the highest priority. This is bad
+ since it means options such as a default XKB layout set by the backend
+ cannot be changed by the user.
+
+ This patch changes order of precedence to be:
+
+ 1. xorg.conf
+ 2. xorg.conf.d (later files have higher priority)
+ 3. config backend
+
+ In order to allow this ordering, the config parsing has been changed to
+ read the xorg.conf.d files before xorg.conf. This has the consequence
+ that the core device picking which looks for the first InputDevice may
+ not find it in xorg.conf.
+
+ Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
+ Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 48f7298657f91843db36566b8d66d6c4c18dbd4c
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Wed Jan 13 15:03:45 2010 +1000
+
+ Xi: reset the sli pointers after copying device classes. (#25640)
+
+ If the indicator flags have the XkbSLI_IsDefault bit set, the indicator map
+ and names aren't their own bit of memory but rather point into the
+ device->key->xkbInfo->desc structure. XkbCopySrvLedInfo knows about this and
+ leaves the pointers alone.
+
+ When copying the classes from the slave to the master, these pointers are
+ copied and still point to the dev->key class of the slave device. If the
+ slave device is removed, the memory becomes invalid and a call to modify
+ this data (e.g. XkbSetIndicators) may cause a deadlock.
+
+ The copying of dev->key relies on dev->kbdfeed to be already set up. Hence
+ the pointers need to be reset once _both_ kbdfeed and key have been copied
+ into the master device.
+
+ X.Org Bug 25640 <http://bugs.freedesktop.org/show_bug.cgi?id=25640>
+ Fedora Bug 540584 <https://bugzilla.redhat.com/show_bug.cgi?id=540584>
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Keith Packard <keithp@keithp.com>
+
+commit d33adcdf03c69407d151e732fa0cf9947151eb19
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Fri Jan 15 15:22:02 2010 +1000
+
+ dix: move config_init into the DDX.
+
+ The only DDX currently using hotplugging is the xfree86 one and it looks
+ like it'll stay that way for a bit. Move the initialization to the DDX,
+ since Xephyr, Xnest, and friends don't need HAL or udev notifications.
+
+ Add CloseInput (counterpart to InitInput) to be able to clean up the config
+ initialization from the DDX as well.
+
+ Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+ Reviewed-by: Julien Cristau <jcristau@debian.org>
+ Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
+
+commit 001ce71dc11287dc94cc2fbc5d35677c046e6c04
+Author: Julien Cristau <jcristau@debian.org>
+Date: Fri Feb 12 23:34:57 2010 +0100
+
+ dix: restore lastDeviceEventTime update in dixSaveScreens
+
+ This was removed in 6b5978dcf1f7ac3ecc2f22df06f7000f360e2066 (Do not
+ reset lastDeviceEventTime when we do dixSaveScreens), but caused a
+ regression for XResetScreenSaver. Add the lastDeviceEventTime update
+ back, but restrict it to that case.
+
+ X.Org bug#25855 <http://bugs.freedesktop.org/25855>
+
+ Reported-by: Lubos Lunak <l.lunak@suse.cz>
+ Tested-by: Lubos Lunak <l.lunak@suse.cz>
+ Signed-off-by: Julien Cristau <jcristau@debian.org>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 97b03037f4d99fcebc7603011f41c3aff9871ce2
+Author: Peter Harris <pharris@opentext.com>
+Date: Fri Feb 12 15:36:30 2010 -0500
+
+ Don't double-swap the RandR PropertyNotify event
+
+ The event is already swapped in randr.c/SRROutputPropertyNotifyEvent, so
+ it should not be swapped here.
+
+ X.Org Bugzilla #26511: http://bugs.freedesktop.org/show_bug.cgi?id=26511
+
+ Tested-by: Leonardo Chiquitto <leonardo@ngdn.org>
+ Acked-by: Adam Jackson <ajax at redhat.com>
+ Reviewed-by: Julien Cristau <jcristau at debian.org>
+ Signed-off-by: Peter Harris <pharris@opentext.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
+commit 0b73f98cbd1803b82c2faf1a40f1a0037673d712
+Author: Soeren Sandmann <sandmann@daimi.au.dk>
+Date: Fri Feb 12 20:04:53 2010 +0100
+
+ xfree86: Add qxl driver to the autoconfig logic
+
+ The qxl driver is for the QXL virtualized graphics device.
+
+ Signed-off-by: Søren Sandmann Pedersen <ssp@redhat.com>
+ Reviewed-by: Adam Jackson <ajax@redhat.com>
+ Signed-off-by: Keith Packard <keithp@keithp.com>
+
commit 9c5bb550a2234e4bee2a144417d74c6bdf160e89
Author: Keith Packard <keithp@keithp.com>
Date: Fri Feb 12 13:46:03 2010 -0800
diff --git a/xorg-server/Makefile.in b/xorg-server/Makefile.in
index f1b650c1a..da4e6d13e 100644
--- a/xorg-server/Makefile.in
+++ b/xorg-server/Makefile.in
@@ -178,6 +178,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -309,6 +310,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/Xext/Makefile.am b/xorg-server/Xext/Makefile.am
index 7287c4a62..193d6e5cb 100644
--- a/xorg-server/Xext/Makefile.am
+++ b/xorg-server/Xext/Makefile.am
@@ -32,6 +32,7 @@ BUILTIN_SRCS = \
# Sources always included in libXextmodule.la & libXext.la. That's right, zero.
MODULE_SRCS =
+MODULE_LIBS =
# Optional sources included if extension enabled by configure.ac rules
@@ -83,6 +84,7 @@ endif
XSELINUX_SRCS = xselinux_ext.c xselinux_hooks.c xselinux_label.c xselinux.h xselinuxint.h
if XSELINUX
MODULE_SRCS += $(XSELINUX_SRCS)
+MODULE_LIBS += $(SELINUX_LIBS)
endif
# Security extension: multi-level security to protect clients from each other
@@ -119,11 +121,13 @@ endif
# Now take all of the above, mix well, bake for 10 minutes and get libXext*.la
libXext_la_SOURCES = $(BUILTIN_SRCS) $(MODULE_SRCS)
+libXext_la_LIBADD = $(MODULE_LIBS)
if XORG
libXextbuiltin_la_SOURCES = $(BUILTIN_SRCS)
libXextmodule_la_SOURCES = $(MODULE_SRCS)
+libXextmodule_la_LIBADD = $(MODULE_LIBS)
endif
EXTRA_DIST = \
diff --git a/xorg-server/Xext/Makefile.in b/xorg-server/Xext/Makefile.in
index 93f7908c5..4293b8f98 100644
--- a/xorg-server/Xext/Makefile.in
+++ b/xorg-server/Xext/Makefile.in
@@ -44,11 +44,12 @@ host_triplet = @host@
@XACE_TRUE@am__append_7 = $(XACE_SRCS)
@XACE_TRUE@@XORG_TRUE@am__append_8 = xace.h xacestr.h
@XSELINUX_TRUE@am__append_9 = $(XSELINUX_SRCS)
-@XCSECURITY_TRUE@am__append_10 = $(XCSECURITY_SRCS)
-@XCALIBRATE_TRUE@am__append_11 = $(XCALIBRATE_SRCS)
-@MULTIBUFFER_TRUE@am__append_12 = $(MULTIBUFFER_SRCS)
-@XF86BIGFONT_TRUE@am__append_13 = $(BIGFONT_SRCS)
-@DPMSExtension_TRUE@am__append_14 = $(DPMS_SRCS)
+@XSELINUX_TRUE@am__append_10 = $(SELINUX_LIBS)
+@XCSECURITY_TRUE@am__append_11 = $(XCSECURITY_SRCS)
+@XCALIBRATE_TRUE@am__append_12 = $(XCALIBRATE_SRCS)
+@MULTIBUFFER_TRUE@am__append_13 = $(MULTIBUFFER_SRCS)
+@XF86BIGFONT_TRUE@am__append_14 = $(BIGFONT_SRCS)
+@DPMSExtension_TRUE@am__append_15 = $(DPMS_SRCS)
subdir = Xext
DIST_COMMON = $(am__sdk_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
@@ -72,7 +73,10 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
-libXext_la_LIBADD =
+am__DEPENDENCIES_1 =
+@XSELINUX_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2)
+libXext_la_DEPENDENCIES = $(am__DEPENDENCIES_3)
am__libXext_la_SOURCES_DIST = bigreq.c geext.c shape.c sleepuntil.c \
sleepuntil.h sync.c syncsrv.h xcmisc.c xtest.c shm.c shmint.h \
panoramiX.c panoramiX.h panoramiXh.h panoramiXsrv.h \
@@ -127,7 +131,7 @@ am__libXextbuiltin_la_SOURCES_DIST = bigreq.c geext.c shape.c \
@XORG_TRUE@am_libXextbuiltin_la_OBJECTS = $(am__objects_13)
libXextbuiltin_la_OBJECTS = $(am_libXextbuiltin_la_OBJECTS)
@XORG_TRUE@am_libXextbuiltin_la_rpath =
-libXextmodule_la_LIBADD =
+@XORG_TRUE@libXextmodule_la_DEPENDENCIES = $(am__DEPENDENCIES_3)
am__libXextmodule_la_SOURCES_DIST = xvmain.c xvdisp.c xvmc.c xvdix.h \
xvmcext.h xvdisp.h xres.c saver.c xselinux_ext.c \
xselinux_hooks.c xselinux_label.c xselinux.h xselinuxint.h \
@@ -225,6 +229,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -356,6 +361,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
@@ -509,12 +516,13 @@ AM_CFLAGS = $(DIX_CFLAGS)
# Sources always included in libXextbuiltin.la & libXext.la
BUILTIN_SRCS = bigreq.c geext.c shape.c sleepuntil.c sleepuntil.h \
sync.c syncsrv.h xcmisc.c xtest.c $(am__append_1) \
- $(am__append_5) $(am__append_7) $(am__append_10) \
- $(am__append_11) $(am__append_13)
+ $(am__append_5) $(am__append_7) $(am__append_11) \
+ $(am__append_12) $(am__append_14)
# Sources always included in libXextmodule.la & libXext.la. That's right, zero.
MODULE_SRCS = $(am__append_2) $(am__append_3) $(am__append_4) \
- $(am__append_9) $(am__append_12) $(am__append_14)
+ $(am__append_9) $(am__append_13) $(am__append_15)
+MODULE_LIBS = $(am__append_10)
# Optional sources included if extension enabled by configure.ac rules
@@ -558,8 +566,10 @@ DPMS_SRCS = dpms.c dpmsproc.h
# Now take all of the above, mix well, bake for 10 minutes and get libXext*.la
libXext_la_SOURCES = $(BUILTIN_SRCS) $(MODULE_SRCS)
+libXext_la_LIBADD = $(MODULE_LIBS)
@XORG_TRUE@libXextbuiltin_la_SOURCES = $(BUILTIN_SRCS)
@XORG_TRUE@libXextmodule_la_SOURCES = $(MODULE_SRCS)
+@XORG_TRUE@libXextmodule_la_LIBADD = $(MODULE_LIBS)
EXTRA_DIST = \
$(MITSHM_SRCS) \
$(XV_SRCS) \
diff --git a/xorg-server/Xi/Makefile.in b/xorg-server/Xi/Makefile.in
index 1671df270..a6860518e 100644
--- a/xorg-server/Xi/Makefile.in
+++ b/xorg-server/Xi/Makefile.in
@@ -135,6 +135,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -266,6 +267,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/aclocal.m4 b/xorg-server/aclocal.m4
index 4cfcbacec..36535a451 100644
--- a/xorg-server/aclocal.m4
+++ b/xorg-server/aclocal.m4
@@ -1567,7 +1567,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what
# version you require.
m4_defun([XORG_MACROS_VERSION],[
-m4_define([vers_have], [1.5.0])
+m4_define([vers_have], [1.6.1])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,,
@@ -1731,7 +1731,7 @@ fi
AC_PATH_PROG(LINUXDOC, linuxdoc)
AC_PATH_PROG(PS2PDF, ps2pdf)
-AC_MSG_CHECKING([Whether to build documentation])
+AC_MSG_CHECKING([whether to build documentation])
if test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then
BUILDDOC=yes
@@ -1743,7 +1743,7 @@ AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes])
AC_MSG_RESULT([$BUILDDOC])
-AC_MSG_CHECKING([Whether to build pdf documentation])
+AC_MSG_CHECKING([whether to build pdf documentation])
if test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then
BUILDPDFDOC=yes
@@ -1791,7 +1791,7 @@ AC_PATH_PROG(DOCBOOKPDF, docbook2pdf)
AC_PATH_PROG(DOCBOOKHTML, docbook2html)
AC_PATH_PROG(DOCBOOKTXT, docbook2txt)
-AC_MSG_CHECKING([Whether to build text documentation])
+AC_MSG_CHECKING([whether to build text documentation])
if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKTXT != x &&
test x$BUILD_TXTDOC != xno; then
BUILDTXTDOC=yes
@@ -1799,7 +1799,7 @@ fi
AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes])
AC_MSG_RESULT([$BUILDTXTDOC])
-AC_MSG_CHECKING([Whether to build PDF documentation])
+AC_MSG_CHECKING([whether to build PDF documentation])
if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPDF != x &&
test x$BUILD_PDFDOC != xno; then
BUILDPDFDOC=yes
@@ -1807,7 +1807,7 @@ fi
AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes])
AC_MSG_RESULT([$BUILDPDFDOC])
-AC_MSG_CHECKING([Whether to build PostScript documentation])
+AC_MSG_CHECKING([whether to build PostScript documentation])
if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKPS != x &&
test x$BUILD_PSDOC != xno; then
BUILDPSDOC=yes
@@ -1815,7 +1815,7 @@ fi
AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes])
AC_MSG_RESULT([$BUILDPSDOC])
-AC_MSG_CHECKING([Whether to build HTML documentation])
+AC_MSG_CHECKING([whether to build HTML documentation])
if test x$HAVE_DEFS_ENT != x && test x$DOCBOOKHTML != x &&
test x$BUILD_HTMLDOC != xno; then
BUILDHTMLDOC=yes
@@ -1834,7 +1834,7 @@ AC_SUBST(MAKE_PDF)
AC_SUBST(MAKE_HTML)
]) # XORG_CHECK_DOCBOOK
-# XORG_WITH_XMLTO
+# XORG_WITH_XMLTO([MIN-VERSION])
# ----------------
# Minimum version: 1.5.0
#
@@ -1882,10 +1882,24 @@ elif test "x$use_xmlto" = x"no" ; then
else
AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no'])
fi
+m4_ifval([$1],
+[if test "$have_xmlto" = yes; then
+ # scrape the xmlto version
+ AC_MSG_CHECKING([the xmlto version])
+ xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3`
+ AC_MSG_RESULT([$xmlto_version])
+ AS_VERSION_COMPARE([$xmlto_version], [$1],
+ [if test "x$use_xmlto" = xauto; then
+ AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed])
+ have_xmlto=no
+ else
+ AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed])
+ fi])
+fi])
AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
-]) # XORG_CHECK_XMLTO
+]) # XORG_WITH_XMLTO
-# XORG_WITH_ASCIIDOC
+# XORG_WITH_ASCIIDOC([MIN-VERSION])
# ----------------
# Minimum version: 1.5.0
#
@@ -1933,11 +1947,25 @@ elif test "x$use_asciidoc" = x"no" ; then
else
AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no'])
fi
+m4_ifval([$1],
+[if test "$have_asciidoc" = yes; then
+ # scrape the asciidoc version
+ AC_MSG_CHECKING([the asciidoc version])
+ asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2`
+ AC_MSG_RESULT([$asciidoc_version])
+ AS_VERSION_COMPARE([$asciidoc_version], [$1],
+ [if test "x$use_asciidoc" = xauto; then
+ AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed])
+ have_asciidoc=no
+ else
+ AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed])
+ fi])
+fi])
AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
-]) # XORG_CHECK_ASCIIDOC
+]) # XORG_WITH_ASCIIDOC
-# XORG_WITH_DOXYGEN
-# ----------------
+# XORG_WITH_DOXYGEN([MIN-VERSION])
+# --------------------------------
# Minimum version: 1.5.0
#
# Documentation tools are not always available on all platforms and sometimes
@@ -1984,8 +2012,311 @@ elif test "x$use_doxygen" = x"no" ; then
else
AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no'])
fi
+m4_ifval([$1],
+[if test "$have_doxygen" = yes; then
+ # scrape the doxygen version
+ AC_MSG_CHECKING([the doxygen version])
+ doxygen_version=`$DOXYGEN --version 2>/dev/null`
+ AC_MSG_RESULT([$doxygen_version])
+ AS_VERSION_COMPARE([$doxygen_version], [$1],
+ [if test "x$use_doxygen" = xauto; then
+ AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed])
+ have_doxygen=no
+ else
+ AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
+ fi])
+fi])
AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
-]) # XORG_CHECK_DOXYGEN
+]) # XORG_WITH_DOXYGEN
+
+# XORG_WITH_GROFF
+# ----------------
+# Minimum version: 1.6.0
+#
+# Documentation tools are not always available on all platforms and sometimes
+# not at the appropriate level. This macro enables a module to test for the
+# presence of the tool and obtain it's path in separate variables. Coupled with
+# the --with-groff option, it allows maximum flexibilty in making decisions
+# as whether or not to use the groff package.
+#
+# Interface to module:
+# HAVE_GROFF: used in makefiles to conditionally generate documentation
+# HAVE_GROFF_MM: the memorandum macros (-mm) package
+# HAVE_GROFF_MS: the -ms macros package
+# GROFF: returns the path of the groff program found
+# returns the path set by the user in the environment
+# --with-groff: 'yes' user instructs the module to use groff
+# 'no' user instructs the module not to use groff
+#
+# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path.
+#
+# OS and distros often splits groff in a basic and full package, the former
+# having the groff program and the later having devices, fonts and macros
+# Checking for the groff executable is not enough.
+#
+# If macros are missing, we cannot assume that groff is useless, so we don't
+# unset HAVE_GROFF or GROFF env variables.
+# HAVE_GROFF_?? can never be true while HAVE_GROFF is false.
+#
+AC_DEFUN([XORG_WITH_GROFF],[
+AC_ARG_VAR([GROFF], [Path to groff command])
+AC_ARG_WITH(groff,
+ AS_HELP_STRING([--with-groff],
+ [Use groff to regenerate documentation (default: yes, if installed)]),
+ [use_groff=$withval], [use_groff=auto])
+
+if test "x$use_groff" = x"auto"; then
+ AC_PATH_PROG([GROFF], [groff])
+ if test "x$GROFF" = "x"; then
+ AC_MSG_WARN([groff not found - documentation targets will be skipped])
+ have_groff=no
+ else
+ have_groff=yes
+ fi
+elif test "x$use_groff" = x"yes" ; then
+ AC_PATH_PROG([GROFF], [groff])
+ if test "x$GROFF" = "x"; then
+ AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH])
+ fi
+ have_groff=yes
+elif test "x$use_groff" = x"no" ; then
+ if test "x$GROFF" != "x"; then
+ AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified])
+ fi
+ have_groff=no
+else
+ AC_MSG_ERROR([--with-groff expects 'yes' or 'no'])
+fi
+# We have groff, test for the presence of the macro packages
+if test "x$have_groff" = x"yes"; then
+ AC_MSG_CHECKING([for ${GROFF} -ms macros])
+ if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then
+ groff_ms_works=yes
+ else
+ groff_ms_works=no
+ fi
+ AC_MSG_RESULT([$groff_ms_works])
+ AC_MSG_CHECKING([for ${GROFF} -mm macros])
+ if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then
+ groff_mm_works=yes
+ else
+ groff_mm_works=no
+ fi
+ AC_MSG_RESULT([$groff_mm_works])
+fi
+AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes])
+AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes])
+AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes])
+]) # XORG_WITH_GROFF
+
+# XORG_WITH_FOP
+# ----------------
+# Minimum version: 1.6.0
+#
+# Documentation tools are not always available on all platforms and sometimes
+# not at the appropriate level. This macro enables a module to test for the
+# presence of the tool and obtain it's path in separate variables. Coupled with
+# the --with-fop option, it allows maximum flexibilty in making decisions
+# as whether or not to use the fop package.
+#
+# Interface to module:
+# HAVE_FOP: used in makefiles to conditionally generate documentation
+# FOP: returns the path of the fop program found
+# returns the path set by the user in the environment
+# --with-fop: 'yes' user instructs the module to use fop
+# 'no' user instructs the module not to use fop
+#
+# If the user sets the value of FOP, AC_PATH_PROG skips testing the path.
+#
+AC_DEFUN([XORG_WITH_FOP],[
+AC_ARG_VAR([FOP], [Path to fop command])
+AC_ARG_WITH(fop,
+ AS_HELP_STRING([--with-fop],
+ [Use fop to regenerate documentation (default: yes, if installed)]),
+ [use_fop=$withval], [use_fop=auto])
+
+if test "x$use_fop" = x"auto"; then
+ AC_PATH_PROG([FOP], [fop])
+ if test "x$FOP" = "x"; then
+ AC_MSG_WARN([fop not found - documentation targets will be skipped])
+ have_fop=no
+ else
+ have_fop=yes
+ fi
+elif test "x$use_fop" = x"yes" ; then
+ AC_PATH_PROG([FOP], [fop])
+ if test "x$FOP" = "x"; then
+ AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH])
+ fi
+ have_fop=yes
+elif test "x$use_fop" = x"no" ; then
+ if test "x$FOP" != "x"; then
+ AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified])
+ fi
+ have_fop=no
+else
+ AC_MSG_ERROR([--with-fop expects 'yes' or 'no'])
+fi
+AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
+]) # XORG_WITH_FOP
+
+# XORG_WITH_PS2PDF
+# ----------------
+# Minimum version: 1.6.0
+#
+# Documentation tools are not always available on all platforms and sometimes
+# not at the appropriate level. This macro enables a module to test for the
+# presence of the tool and obtain it's path in separate variables. Coupled with
+# the --with-ps2pdf option, it allows maximum flexibilty in making decisions
+# as whether or not to use the ps2pdf package.
+#
+# Interface to module:
+# HAVE_PS2PDF: used in makefiles to conditionally generate documentation
+# PS2PDF: returns the path of the ps2pdf program found
+# returns the path set by the user in the environment
+# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf
+# 'no' user instructs the module not to use ps2pdf
+#
+# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path.
+#
+AC_DEFUN([XORG_WITH_PS2PDF],[
+AC_ARG_VAR([PS2PDF], [Path to ps2pdf command])
+AC_ARG_WITH(ps2pdf,
+ AS_HELP_STRING([--with-ps2pdf],
+ [Use ps2pdf to regenerate documentation (default: yes, if installed)]),
+ [use_ps2pdf=$withval], [use_ps2pdf=auto])
+
+if test "x$use_ps2pdf" = x"auto"; then
+ AC_PATH_PROG([PS2PDF], [ps2pdf])
+ if test "x$PS2PDF" = "x"; then
+ AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped])
+ have_ps2pdf=no
+ else
+ have_ps2pdf=yes
+ fi
+elif test "x$use_ps2pdf" = x"yes" ; then
+ AC_PATH_PROG([PS2PDF], [ps2pdf])
+ if test "x$PS2PDF" = "x"; then
+ AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH])
+ fi
+ have_ps2pdf=yes
+elif test "x$use_ps2pdf" = x"no" ; then
+ if test "x$PS2PDF" != "x"; then
+ AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified])
+ fi
+ have_ps2pdf=no
+else
+ AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no'])
+fi
+AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes])
+]) # XORG_WITH_PS2PDF
+
+# XORG_ENABLE_DOCS (enable_docs=yes)
+# ----------------
+# Minimum version: 1.6.0
+#
+# Documentation tools are not always available on all platforms and sometimes
+# not at the appropriate level. This macro enables a builder to skip all
+# documentation targets except traditional man pages.
+# Combined with the specific tool checking macros XORG_WITH_*, it provides
+# maximum flexibilty in controlling documentation building.
+# Refer to:
+# XORG_WITH_XMLTO --with-xmlto
+# XORG_WITH_ASCIIDOC --with-asciidoc
+# XORG_WITH_DOXYGEN --with-doxygen
+# XORG_WITH_FOP --with-fop
+# XORG_WITH_GROFF --with-groff
+# XORG_WITH_PS2PDF --with-ps2pdf
+#
+# Interface to module:
+# ENABLE_DOCS: used in makefiles to conditionally generate documentation
+# --enable-docs: 'yes' user instructs the module to generate docs
+# 'no' user instructs the module not to generate docs
+# parm1: specify the default value, yes or no.
+#
+AC_DEFUN([XORG_ENABLE_DOCS],[
+default=$1
+if test "x$default" = x ; then
+ default="yes"
+fi
+AC_ARG_ENABLE(docs,
+ AS_HELP_STRING([--enable-docs],
+ [Enable building the documentation (default: yes)]),
+ [build_docs=$enableval], [build_docs=$default])
+AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes])
+AC_MSG_CHECKING([whether to build documentation])
+AC_MSG_RESULT([$build_docs])
+]) # XORG_ENABLE_DOCS
+
+# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes)
+# ----------------
+# Minimum version: 1.6.0
+#
+# This macro enables a builder to skip all developer documentation.
+# Combined with the specific tool checking macros XORG_WITH_*, it provides
+# maximum flexibilty in controlling documentation building.
+# Refer to:
+# XORG_WITH_XMLTO --with-xmlto
+# XORG_WITH_ASCIIDOC --with-asciidoc
+# XORG_WITH_DOXYGEN --with-doxygen
+# XORG_WITH_FOP --with-fop
+# XORG_WITH_GROFF --with-groff
+# XORG_WITH_PS2PDF --with-ps2pdf
+#
+# Interface to module:
+# ENABLE_DEVEL_DOCS: used in makefiles to conditionally generate developer docs
+# --enable-devel-docs: 'yes' user instructs the module to generate developer docs
+# 'no' user instructs the module not to generate developer docs
+# parm1: specify the default value, yes or no.
+#
+AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[
+devel_default=$1
+if test "x$devel_default" = x ; then
+ devel_default="yes"
+fi
+AC_ARG_ENABLE(devel-docs,
+ AS_HELP_STRING([--enable-devel-docs],
+ [Enable building the developer documentation (default: yes)]),
+ [build_devel_docs=$enableval], [build_devel_docs=$devel_default])
+AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes])
+AC_MSG_CHECKING([whether to build developer documentation])
+AC_MSG_RESULT([$build_devel_docs])
+]) # XORG_ENABLE_DEVEL_DOCS
+
+# XORG_ENABLE_SPECS (enable_specs=yes)
+# ----------------
+# Minimum version: 1.6.0
+#
+# This macro enables a builder to skip all functional specification targets.
+# Combined with the specific tool checking macros XORG_WITH_*, it provides
+# maximum flexibilty in controlling documentation building.
+# Refer to:
+# XORG_WITH_XMLTO --with-xmlto
+# XORG_WITH_ASCIIDOC --with-asciidoc
+# XORG_WITH_DOXYGEN --with-doxygen
+# XORG_WITH_FOP --with-fop
+# XORG_WITH_GROFF --with-groff
+# XORG_WITH_PS2PDF --with-ps2pdf
+#
+# Interface to module:
+# ENABLE_SPECS: used in makefiles to conditionally generate specs
+# --enable-specs: 'yes' user instructs the module to generate specs
+# 'no' user instructs the module not to generate specs
+# parm1: specify the default value, yes or no.
+#
+AC_DEFUN([XORG_ENABLE_SPECS],[
+spec_default=$1
+if test "x$spec_default" = x ; then
+ spec_default="yes"
+fi
+AC_ARG_ENABLE(specs,
+ AS_HELP_STRING([--enable-specs],
+ [Enable building the specs (default: yes)]),
+ [build_specs=$enableval], [build_specs=$spec_default])
+AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes])
+AC_MSG_CHECKING([whether to build functional specifications])
+AC_MSG_RESULT([$build_specs])
+]) # XORG_ENABLE_SPECS
# XORG_CHECK_MALLOC_ZERO
# ----------------------
@@ -2119,7 +2450,7 @@ AC_REQUIRE([AC_PROG_CC])
if test "x$GCC" = xyes ; then
CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
--Wbad-function-cast"
+-Wbad-function-cast -Wformat=2"
case `$CC -dumpversion` in
3.4.* | 4.*)
CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
@@ -2132,7 +2463,6 @@ else
fi
fi
AC_SUBST(CWARNFLAGS)
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
]) # XORG_CWARNFLAGS
# XORG_STRICT_OPTION
@@ -2177,6 +2507,8 @@ XORG_RELEASE_VERSION
XORG_CHANGELOG
XORG_INSTALL
XORG_MANPAGE_SECTIONS
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
+ [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
]) # XORG_DEFAULT_OPTIONS
# XORG_INSTALL()
@@ -2276,28 +2608,25 @@ AC_SUBST([CHANGELOG_CMD])
dnl $XdotOrg: lib/xtrans/xtrans.m4,v 1.6 2005/07/26 18:59:11 alanc Exp $
dnl
dnl Copyright 2005 Sun Microsystems, Inc. All rights reserved.
-dnl
-dnl Permission to use, copy, modify, distribute, and sell this software and its
-dnl documentation for any purpose is hereby granted without fee, provided that
-dnl the above copyright notice appear in all copies and that both that
-dnl copyright notice and this permission notice appear in supporting
-dnl documentation.
-dnl
-dnl The above copyright notice and this permission notice shall be included
-dnl in all copies or substantial portions of the Software.
-dnl
-dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-dnl OTHER DEALINGS IN THE SOFTWARE.
-dnl
-dnl Except as contained in this notice, the name of the copyright holders shall
-dnl not be used in advertising or otherwise to promote the sale, use or
-dnl other dealings in this Software without prior written authorization
-dnl from the copyright holders.
+dnl
+dnl Permission is hereby granted, free of charge, to any person obtaining a
+dnl copy of this software and associated documentation files (the "Software"),
+dnl to deal in the Software without restriction, including without limitation
+dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
+dnl and/or sell copies of the Software, and to permit persons to whom the
+dnl Software is furnished to do so, subject to the following conditions:
+dnl
+dnl The above copyright notice and this permission notice (including the next
+dnl paragraph) shall be included in all copies or substantial portions of the
+dnl Software.
+dnl
+dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+dnl DEALINGS IN THE SOFTWARE.
dnl
# XTRANS_TCP_FLAGS()
@@ -2307,7 +2636,9 @@ AC_DEFUN([XTRANS_TCP_FLAGS],[
# SVR4 hides these in libraries other than libc
AC_SEARCH_LIBS(socket, [socket])
AC_SEARCH_LIBS(gethostbyname, [nsl])
- AC_HAVE_LIBRARY([ws2_32])
+ if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
+ AC_HAVE_LIBRARY([ws2_32])
+ fi
# Needs to come after above checks for libsocket & libnsl for SVR4 systems
AC_ARG_ENABLE(ipv6,
diff --git a/xorg-server/composite/Makefile.in b/xorg-server/composite/Makefile.in
index e7590e0fa..07610bc01 100644
--- a/xorg-server/composite/Makefile.in
+++ b/xorg-server/composite/Makefile.in
@@ -151,6 +151,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -282,6 +283,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/config/Makefile.in b/xorg-server/config/Makefile.in
index e368a312b..65a7586a7 100644
--- a/xorg-server/config/Makefile.in
+++ b/xorg-server/config/Makefile.in
@@ -169,6 +169,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -300,6 +301,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/configure b/xorg-server/configure
index 30c44d599..74af775ac 100644
--- a/xorg-server/configure
+++ b/xorg-server/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for xorg-server 1.7.99.901.
+# Generated by GNU Autoconf 2.65 for xorg-server 1.7.99.902.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>.
#
@@ -702,8 +702,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='xorg-server'
PACKAGE_TARNAME='xorg-server'
-PACKAGE_VERSION='1.7.99.901'
-PACKAGE_STRING='xorg-server 1.7.99.901'
+PACKAGE_VERSION='1.7.99.902'
+PACKAGE_STRING='xorg-server 1.7.99.902'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg'
PACKAGE_URL=''
@@ -848,6 +848,7 @@ XWIN_LIBS
XWINMODULES_LIBS
XWINMODULES_CFLAGS
WINDRES
+DEFAULT_LOGDIR
SYSCONFDIR
XF86VIDMODE_FALSE
XF86VIDMODE_TRUE
@@ -973,6 +974,8 @@ MULTIBUFFER_FALSE
MULTIBUFFER_TRUE
XCSECURITY_FALSE
XCSECURITY_TRUE
+SELINUX_LIBS
+SELINUX_CFLAGS
XSELINUX_FALSE
XSELINUX_TRUE
XACE_FALSE
@@ -1140,6 +1143,8 @@ CCAS
HAVE_DOXYGEN_FALSE
HAVE_DOXYGEN_TRUE
DOXYGEN
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
ADMIN_MAN_DIR
DRIVER_MAN_DIR
MISC_MAN_DIR
@@ -1163,8 +1168,6 @@ build
INSTALL_CMD
PKG_CONFIG
CHANGELOG_CMD
-AM_BACKSLASH
-AM_DEFAULT_VERBOSITY
CWARNFLAGS
EGREP
GREP
@@ -1254,9 +1257,9 @@ ac_user_opts='
enable_option_checking
enable_maintainer_mode
enable_dependency_tracking
-enable_silent_rules
enable_strict_compilation
with_release_version
+enable_silent_rules
with_doxygen
enable_static
enable_shared
@@ -1396,6 +1399,8 @@ DRI2PROTO_CFLAGS
DRI2PROTO_LIBS
LIBDRM_CFLAGS
LIBDRM_LIBS
+SELINUX_CFLAGS
+SELINUX_LIBS
XDMCP_CFLAGS
XDMCP_LIBS
GLIB_CFLAGS
@@ -1981,7 +1986,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures xorg-server 1.7.99.901 to adapt to many kinds of systems.
+\`configure' configures xorg-server 1.7.99.902 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -2051,7 +2056,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of xorg-server 1.7.99.901:";;
+ short | recursive ) echo "Configuration of xorg-server 1.7.99.902:";;
esac
cat <<\_ACEOF
@@ -2063,11 +2068,11 @@ Optional Features:
(and sometimes confusing) to the casual installer
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
- --enable-silent-rules less verbose build output (undo: `make V=1')
- --disable-silent-rules verbose build output (undo: `make V=0')
--enable-strict-compilation
Enable all warnings from compiler and make them
errors (default: disabled)
+ --enable-silent-rules less verbose build output (undo: `make V=1')
+ --disable-silent-rules verbose build output (undo: `make V=0')
--enable-static[=PKGS] build static libraries [default=no]
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-fast-install[=PKGS]
@@ -2263,6 +2268,10 @@ Some influential environment variables:
LIBDRM_CFLAGS
C compiler flags for LIBDRM, overriding pkg-config
LIBDRM_LIBS linker flags for LIBDRM, overriding pkg-config
+ SELINUX_CFLAGS
+ C compiler flags for SELINUX, overriding pkg-config
+ SELINUX_LIBS
+ linker flags for SELINUX, overriding pkg-config
XDMCP_CFLAGS
C compiler flags for XDMCP, overriding pkg-config
XDMCP_LIBS linker flags for XDMCP, overriding pkg-config
@@ -2411,7 +2420,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-xorg-server configure 1.7.99.901
+xorg-server configure 1.7.99.902
generated by GNU Autoconf 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
@@ -3110,7 +3119,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by xorg-server $as_me 1.7.99.901, which was
+It was created by xorg-server $as_me 1.7.99.902, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ $0 $@
@@ -3457,7 +3466,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-RELEASE_DATE="2010-02-12"
+RELEASE_DATE="2010-03-21"
am__api_version='1.11'
@@ -3920,7 +3929,7 @@ fi
# Define the identity of the package.
PACKAGE='xorg-server'
- VERSION='1.7.99.901'
+ VERSION='1.7.99.902'
cat >>confdefs.h <<_ACEOF
@@ -5745,7 +5754,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
if test "x$GCC" = xyes ; then
CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
-Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
--Wbad-function-cast"
+-Wbad-function-cast -Wformat=2"
case `$CC -dumpversion` in
3.4.* | 4.*)
CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
@@ -5764,18 +5773,6 @@ fi
fi
fi
-# Check whether --enable-silent-rules was given.
-if test "${enable_silent_rules+set}" = set; then :
- enableval=$enable_silent_rules;
-fi
-
-case $enable_silent_rules in
-yes) AM_DEFAULT_VERBOSITY=0;;
-no) AM_DEFAULT_VERBOSITY=1;;
-*) AM_DEFAULT_VERBOSITY=0;;
-esac
-AM_BACKSLASH='\'
-
@@ -5941,6 +5938,18 @@ fi
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+ enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in
+yes) AM_DEFAULT_VERBOSITY=0;;
+no) AM_DEFAULT_VERBOSITY=1;;
+*) AM_DEFAULT_VERBOSITY=0;;
+esac
+AM_BACKSLASH='\'
+
@@ -6055,6 +6064,7 @@ $as_echo "$as_me: WARNING: ignoring DOXYGEN environment variable since --with-do
else
as_fn_error "--with-doxygen expects 'yes' or 'no'" "$LINENO" 5
fi
+
if test "$have_doxygen" = yes; then
HAVE_DOXYGEN_TRUE=
HAVE_DOXYGEN_FALSE='#'
@@ -7718,13 +7728,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:7721: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:7731: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:7724: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:7734: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:7727: output\"" >&5)
+ (eval echo "\"\$as_me:7737: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -8915,7 +8925,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 8918 "configure"' > conftest.$ac_ext
+ echo '#line 8928 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -10145,11 +10155,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10148: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10158: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:10152: \$? = $ac_status" >&5
+ echo "$as_me:10162: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -10484,11 +10494,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10487: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10497: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:10491: \$? = $ac_status" >&5
+ echo "$as_me:10501: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -10589,11 +10599,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10592: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10602: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:10596: \$? = $ac_status" >&5
+ echo "$as_me:10606: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -10644,11 +10654,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10647: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10657: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:10651: \$? = $ac_status" >&5
+ echo "$as_me:10661: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -13028,7 +13038,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 13031 "configure"
+#line 13041 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13124,7 +13134,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 13127 "configure"
+#line 13137 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -17022,7 +17032,8 @@ if test "$ac_res" != no; then :
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lws2_32" >&5
+ if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lws2_32" >&5
$as_echo_n "checking for main in -lws2_32... " >&6; }
if test "${ac_cv_lib_ws2_32_main+set}" = set; then :
$as_echo_n "(cached) " >&6
@@ -17062,6 +17073,7 @@ _ACEOF
fi
ac_cv_lib_ws2_32=ac_cv_lib_ws2_32_main
+ fi
# Needs to come after above checks for libsocket & libnsl for SVR4 systems
# Check whether --enable-ipv6 was given.
@@ -17414,8 +17426,8 @@ fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Whether to build documentation" >&5
-$as_echo_n "checking Whether to build documentation... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build documentation" >&5
+$as_echo_n "checking whether to build documentation... " >&6; }
if test x$HAVE_DEFS_ENT != x && test x$LINUXDOC != x ; then
BUILDDOC=yes
@@ -17435,8 +17447,8 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILDDOC" >&5
$as_echo "$BUILDDOC" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Whether to build pdf documentation" >&5
-$as_echo_n "checking Whether to build pdf documentation... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build pdf documentation" >&5
+$as_echo_n "checking whether to build pdf documentation... " >&6; }
if test x$PS2PDF != x && test x$BUILD_PDFDOC != xno; then
BUILDPDFDOC=yes
@@ -17561,6 +17573,7 @@ LIBXTST="xtst >= 1.0.99.2"
LIBPCIACCESS="pciaccess >= 0.8.0"
LIBGLIB="glib-2.0 >= 2.16"
LIBUDEV="libudev >= 143"
+LIBSELINUX="libselinux >= 2.0.86"
if test "x$CONFIG_UDEV" = xyes &&
{ test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
@@ -18836,69 +18849,6 @@ if test "x$XSELINUX" = xyes; then
if test "x$XACE" != xyes; then
as_fn_error "cannot build SELinux extension without X-ACE" "$LINENO" 5
fi
- for ac_header in selinux/selinux.h selinux/avc.h
-do :
- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-else
- as_fn_error "SELinux include files not found" "$LINENO" 5
-fi
-
-done
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for avc_init in -lselinux" >&5
-$as_echo_n "checking for avc_init in -lselinux... " >&6; }
-if test "${ac_cv_lib_selinux_avc_init+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lselinux $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char avc_init ();
-int
-main ()
-{
-return avc_init ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_selinux_avc_init=yes
-else
- ac_cv_lib_selinux_avc_init=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_avc_init" >&5
-$as_echo "$ac_cv_lib_selinux_avc_init" >&6; }
-if test "x$ac_cv_lib_selinux_avc_init" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBSELINUX 1
-_ACEOF
-
- LIBS="-lselinux $LIBS"
-
-else
- as_fn_error "SELinux library not found" "$LINENO" 5
-fi
-
for ac_header in libaudit.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "libaudit.h" "ac_cv_header_libaudit_h" "$ac_includes_default"
@@ -18960,18 +18910,100 @@ else
as_fn_error "SELinux extension requires audit system library" "$LINENO" 5
fi
- ac_fn_c_check_decl "$LINENO" "avc_netlink_acquire_fd" "ac_cv_have_decl_avc_netlink_acquire_fd" "#include <selinux/avc.h>
-"
-if test "x$ac_cv_have_decl_avc_netlink_acquire_fd" = x""yes; then :
-$as_echo "#define HAVE_AVC_NETLINK_ACQUIRE_FD 1" >>confdefs.h
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SELINUX" >&5
+$as_echo_n "checking for SELINUX... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+ if test -n "$SELINUX_CFLAGS"; then
+ pkg_cv_SELINUX_CFLAGS="$SELINUX_CFLAGS"
+ else
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$LIBSELINUX\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "$LIBSELINUX") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_SELINUX_CFLAGS=`$PKG_CONFIG --cflags "$LIBSELINUX" 2>/dev/null`
+else
+ pkg_failed=yes
+fi
+ fi
+else
+ pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+ if test -n "$SELINUX_LIBS"; then
+ pkg_cv_SELINUX_LIBS="$SELINUX_LIBS"
+ else
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$LIBSELINUX\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "$LIBSELINUX") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_SELINUX_LIBS=`$PKG_CONFIG --libs "$LIBSELINUX" 2>/dev/null`
+else
+ pkg_failed=yes
+fi
+ fi
+else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
fi
+ if test $_pkg_short_errors_supported = yes; then
+ SELINUX_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$LIBSELINUX"`
+ else
+ SELINUX_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$LIBSELINUX"`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$SELINUX_PKG_ERRORS" >&5
+
+ as_fn_error "Package requirements ($LIBSELINUX) were not met:
+
+$SELINUX_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables SELINUX_CFLAGS
+and SELINUX_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+" "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+Alternatively, you may set the environment variables SELINUX_CFLAGS
+and SELINUX_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details." "$LINENO" 5; }
+else
+ SELINUX_CFLAGS=$pkg_cv_SELINUX_CFLAGS
+ SELINUX_LIBS=$pkg_cv_SELINUX_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ :
+fi
+ SELINUX_LIBS="$SELINUX_LIBS -laudit"
$as_echo "#define XSELINUX 1" >>confdefs.h
- SELINUX_LIB="-lselinux -laudit"
fi
if test "x$XCSECURITY" = xyes; then
@@ -20716,7 +20748,7 @@ done
LIBS=$SAVE_LIBS
CFLAGS=$SAVE_CFLAGS
- XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $SELINUX_LIB"
+ XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS"
XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
case $host_os in
@@ -21683,6 +21715,23 @@ _ACEOF
test "$exec_prefix_NONE" && exec_prefix=NONE
+ prefix_NONE=
+ exec_prefix_NONE=
+ test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
+ test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
+ eval ac_define_dir="\"$logdir\""
+ eval ac_define_dir="\"$ac_define_dir\""
+ DEFAULT_LOGDIR="$ac_define_dir"
+
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LOGDIR "$ac_define_dir"
+_ACEOF
+
+ test "$prefix_NONE" && prefix=NONE
+ test "$exec_prefix_NONE" && exec_prefix=NONE
+
+
cat >>confdefs.h <<_ACEOF
#define XORG_VERSION_CURRENT $VENDOR_RELEASE
_ACEOF
@@ -24603,7 +24652,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by xorg-server $as_me 1.7.99.901, which was
+This file was extended by xorg-server $as_me 1.7.99.902, which was
generated by GNU Autoconf 2.65. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -24669,7 +24718,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-xorg-server config.status 1.7.99.901
+xorg-server config.status 1.7.99.902
configured by $0, generated by GNU Autoconf 2.65,
with options \\"\$ac_cs_config\\"
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index b9c75742a..e497e76b4 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -26,8 +26,8 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.7.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2010-02-12"
+AC_INIT([xorg-server], 1.7.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2010-03-21"
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
@@ -786,6 +786,7 @@ LIBXTST="xtst >= 1.0.99.2"
LIBPCIACCESS="pciaccess >= 0.8.0"
LIBGLIB="glib-2.0 >= 2.16"
LIBUDEV="libudev >= 143"
+LIBSELINUX="libselinux >= 2.0.86"
if test "x$CONFIG_UDEV" = xyes &&
{ test "x$CONFIG_DBUS_API" = xyes || test "x$CONFIG_HAL" = xyes; }; then
@@ -1058,7 +1059,7 @@ if test "x$XSELINUX" = xyes; then
fi
AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension requires audit system headers]))
AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library]))
- PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.0.86])
+ PKG_CHECK_MODULES([SELINUX], $LIBSELINUX)
SELINUX_LIBS="$SELINUX_LIBS -laudit"
AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
fi
@@ -1579,7 +1580,7 @@ if test "x$XORG" = xyes; then
AC_CHECK_FUNCS([pci_device_vgaarb_init])
LIBS=$SAVE_LIBS
CFLAGS=$SAVE_CFLAGS
- XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $SELINUX_LIBS"
+ XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS"
XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
case $host_os in
@@ -1828,6 +1829,7 @@ AC_MSG_RESULT([$XWIN])
if test "x$XWIN" = xyes; then
PKG_CHECK_EXISTS($WINDOWSWMPROTO, [WINDOWSWM=yes], [WINDOWSWM=no])
AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [Location of system.XWinrc])
+ AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
AC_CHECK_TOOL(WINDRES, windres)
diff --git a/xorg-server/damageext/Makefile.in b/xorg-server/damageext/Makefile.in
index c60341edd..6dde55e35 100644
--- a/xorg-server/damageext/Makefile.in
+++ b/xorg-server/damageext/Makefile.in
@@ -124,6 +124,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -255,6 +256,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/dbe/Makefile.in b/xorg-server/dbe/Makefile.in
index 138f1a226..860193f21 100644
--- a/xorg-server/dbe/Makefile.in
+++ b/xorg-server/dbe/Makefile.in
@@ -150,6 +150,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -281,6 +282,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/dix/Makefile.in b/xorg-server/dix/Makefile.in
index 04342e387..0ec876086 100644
--- a/xorg-server/dix/Makefile.in
+++ b/xorg-server/dix/Makefile.in
@@ -164,6 +164,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -295,6 +296,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/dix/cursor.c b/xorg-server/dix/cursor.c
index 324d73345..5d9c8b080 100644
--- a/xorg-server/dix/cursor.c
+++ b/xorg-server/dix/cursor.c
@@ -487,26 +487,10 @@ CursorPtr
CreateRootCursor(char *unused1, unsigned int unused2)
{
CursorPtr curs;
-#ifdef NULL_ROOT_CURSOR
- CursorMetricRec cm;
-#else
FontPtr cursorfont;
int err;
XID fontID;
-#endif
-
-#ifdef NULL_ROOT_CURSOR
- cm.width = 0;
- cm.height = 0;
- cm.xhot = 0;
- cm.yhot = 0;
- AllocARGBCursor(NULL, NULL, NULL, &cm, 0, 0, 0, 0, 0, 0,
- &curs, serverClient, (XID)0);
-
- if (curs == NullCursor)
- return NullCursor;
-#else
fontID = FakeClientID(0);
err = OpenFont(serverClient, fontID, FontLoadAll | FontOpenSync,
(unsigned)strlen(defaultCursorFont), defaultCursorFont);
@@ -520,7 +504,6 @@ CreateRootCursor(char *unused1, unsigned int unused2)
if (AllocGlyphCursor(fontID, 0, fontID, 1, 0, 0, 0, ~0, ~0, ~0,
&curs, serverClient, (XID)0) != Success)
return NullCursor;
-#endif
if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer)curs))
return NullCursor;
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 0e9bc3131..654165251 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -3552,6 +3552,8 @@ CheckPassiveGrabsOnWindow(
xE = &core;
count = 1;
mask = grab->eventMask;
+ if (grab->ownerEvents)
+ mask |= pWin->eventMask;
} else if (match & XI2_MATCH)
{
rc = EventToXI2((InternalEvent*)event, &xE);
@@ -3573,6 +3575,24 @@ CheckPassiveGrabsOnWindow(
mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8];
else if (event->type == XI_Enter || event->type == XI_FocusIn)
mask = grab->xi2mask[device->id][event->type/8];
+
+ if (grab->ownerEvents && wOtherInputMasks(grab->window))
+ {
+ InputClientsPtr icp =
+ wOtherInputMasks(grab->window)->inputClients;
+
+ while(icp)
+ {
+ if (rClient(icp) == rClient(grab))
+ {
+ int evtype = (xE) ? ((xGenericEvent*)xE)->evtype : event->type;
+ mask |= icp->xi2mask[device->id][evtype/8];
+ break;
+ }
+
+ icp = icp->next;
+ }
+ }
} else
{
rc = EventToXI((InternalEvent*)event, &xE, &count);
@@ -3584,6 +3604,22 @@ CheckPassiveGrabsOnWindow(
continue;
}
mask = grab->eventMask;
+ if (grab->ownerEvents && wOtherInputMasks(grab->window))
+ {
+ InputClientsPtr icp =
+ wOtherInputMasks(grab->window)->inputClients;
+
+ while(icp)
+ {
+ if (rClient(icp) == rClient(grab))
+ {
+ mask |= icp->mask[device->id];
+ break;
+ }
+
+ icp = icp->next;
+ }
+ }
}
(*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
diff --git a/xorg-server/dix/registry.c b/xorg-server/dix/registry.c
index fde2800f2..1381a3dcd 100644
--- a/xorg-server/dix/registry.c
+++ b/xorg-server/dix/registry.c
@@ -1,336 +1,336 @@
-/************************************************************
-
-Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-this permission notice appear in supporting documentation. 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 THE
-AUTHOR 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.
-
-********************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifdef XREGISTRY
-
-#include <stdlib.h>
-#include <string.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "resource.h"
-#include "registry.h"
-
-#define BASE_SIZE 16
-#define CORE "X11"
-#define FILENAME SERVER_MISC_CONFIG_PATH "/protocol.txt"
-
-#define PROT_COMMENT '#'
-#define PROT_REQUEST 'R'
-#define PROT_EVENT 'V'
-#define PROT_ERROR 'E'
-
-static FILE *fh;
-
-static char ***requests, **events, **errors, **resources;
-static unsigned nmajor, *nminor, nevent, nerror, nresource;
-
-/*
- * File parsing routines
- */
-static int double_size(void *p, unsigned n, unsigned size)
-{
- char **ptr = (char **)p;
- unsigned s, f;
-
- if (n) {
- s = n * size;
- n *= 2 * size;
- f = n;
- } else {
- s = 0;
- n = f = BASE_SIZE * size;
- }
-
- *ptr = xrealloc(*ptr, n);
- if (!*ptr) {
- dixResetRegistry();
- return FALSE;
- }
- memset(*ptr + s, 0, f - s);
- return TRUE;
-}
-
-static void
-RegisterRequestName(unsigned major, unsigned minor, char *name)
-{
- while (major >= nmajor) {
- if (!double_size(&requests, nmajor, sizeof(char **)))
- return;
- if (!double_size(&nminor, nmajor, sizeof(unsigned)))
- return;
- nmajor = nmajor ? nmajor * 2 : BASE_SIZE;
- }
- while (minor >= nminor[major]) {
- if (!double_size(requests+major, nminor[major], sizeof(char *)))
- return;
- nminor[major] = nminor[major] ? nminor[major] * 2 : BASE_SIZE;
- }
-
- free(requests[major][minor]);
- requests[major][minor] = name;
-}
-
-static void
-RegisterEventName(unsigned event, char *name) {
- while (event >= nevent) {
- if (!double_size(&events, nevent, sizeof(char *)))
- return;
- nevent = nevent ? nevent * 2 : BASE_SIZE;
- }
-
- free(events[event]);
- events[event] = name;
-}
-
-static void
-RegisterErrorName(unsigned error, char *name) {
- while (error >= nerror) {
- if (!double_size(&errors, nerror, sizeof(char *)))
- return;
- nerror = nerror ? nerror * 2 : BASE_SIZE;
- }
-
- free(errors[error]);
- errors[error] = name;
-}
-
-void
-RegisterExtensionNames(ExtensionEntry *extEntry)
-{
- char buf[256], *lineobj, *ptr;
- unsigned offset;
-
- if (fh == NULL)
- return;
-
- rewind(fh);
-
- while (fgets(buf, sizeof(buf), fh)) {
- lineobj = NULL;
- ptr = strchr(buf, '\n');
- if (ptr)
- *ptr = 0;
-
- /* Check for comments or empty lines */
- switch (buf[0]) {
- case PROT_REQUEST:
- case PROT_EVENT:
- case PROT_ERROR:
- break;
- case PROT_COMMENT:
- case '\0':
- continue;
- default:
- goto invalid;
- }
-
- /* Check for space character in the fifth position */
- ptr = strchr(buf, ' ');
- if (!ptr || ptr != buf + 4)
- goto invalid;
-
- /* Duplicate the string after the space */
- lineobj = strdup(ptr + 1);
- if (!lineobj)
- continue;
-
- /* Check for a colon somewhere on the line */
- ptr = strchr(buf, ':');
- if (!ptr)
- goto invalid;
-
- /* Compare the part before colon with the target extension name */
- *ptr = 0;
- if (strcmp(buf + 5, extEntry->name))
- goto skip;
-
- /* Get the opcode for the request, event, or error */
- offset = strtol(buf + 1, &ptr, 10);
- if (offset == 0 && ptr == buf + 1)
- goto invalid;
-
- /* Save the strdup result in the registry */
- switch(buf[0]) {
- case PROT_REQUEST:
- if (extEntry->base)
- RegisterRequestName(extEntry->base, offset, lineobj);
- else
- RegisterRequestName(offset, 0, lineobj);
- continue;
- case PROT_EVENT:
- RegisterEventName(extEntry->eventBase + offset, lineobj);
- continue;
- case PROT_ERROR:
- RegisterErrorName(extEntry->errorBase + offset, lineobj);
- continue;
- }
-
- invalid:
- LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n");
- skip:
- free(lineobj);
- }
-}
-
-/*
- * Registration functions
- */
-
-void
-RegisterResourceName(RESTYPE resource, char *name)
-{
- resource &= TypeMask;
-
- while (resource >= nresource) {
- if (!double_size(&resources, nresource, sizeof(char *)))
- return;
- nresource = nresource ? nresource * 2 : BASE_SIZE;
- }
-
- resources[resource] = name;
-}
-
-/*
- * Lookup functions
- */
-
-const char *
-LookupRequestName(int major, int minor)
-{
- if (major >= nmajor)
- return XREGISTRY_UNKNOWN;
- if (minor >= nminor[major])
- return XREGISTRY_UNKNOWN;
-
- return requests[major][minor] ? requests[major][minor] : XREGISTRY_UNKNOWN;
-}
-
-const char *
-LookupMajorName(int major)
-{
- if (major < 128) {
- const char *retval;
-
- if (major >= nmajor)
- return XREGISTRY_UNKNOWN;
- if (0 >= nminor[major])
- return XREGISTRY_UNKNOWN;
-
- retval = requests[major][0];
- return retval ? retval + sizeof(CORE) : XREGISTRY_UNKNOWN;
- } else {
- ExtensionEntry *extEntry = GetExtensionEntry(major);
- return extEntry ? extEntry->name : XREGISTRY_UNKNOWN;
- }
-}
-
-const char *
-LookupEventName(int event)
-{
- event &= 127;
- if (event >= nevent)
- return XREGISTRY_UNKNOWN;
-
- return events[event] ? events[event] : XREGISTRY_UNKNOWN;
-}
-
-const char *
-LookupErrorName(int error)
-{
- if (error >= nerror)
- return XREGISTRY_UNKNOWN;
-
- return errors[error] ? errors[error] : XREGISTRY_UNKNOWN;
-}
-
-const char *
-LookupResourceName(RESTYPE resource)
-{
- resource &= TypeMask;
- if (resource >= nresource)
- return XREGISTRY_UNKNOWN;
-
- return resources[resource] ? resources[resource] : XREGISTRY_UNKNOWN;
-}
-
-/*
- * Setup and teardown
- */
-void
-dixResetRegistry(void)
-{
- ExtensionEntry extEntry;
-
- /* Free all memory */
- while (nmajor--) {
- while (nminor[nmajor])
- free(requests[nmajor][--nminor[nmajor]]);
- xfree(requests[nmajor]);
- }
- xfree(requests);
- xfree(nminor);
-
- while (nevent--)
- free(events[nevent]);
- xfree(events);
-
- while (nerror--)
- free(errors[nerror]);
- xfree(errors);
-
- xfree(resources);
-
- requests = NULL;
- nminor = NULL;
- events = NULL;
- errors = NULL;
- resources = NULL;
-
- nmajor = nevent = nerror = nresource = 0;
-
- /* Open the protocol file */
- if (fh)
- fclose(fh);
- fh = fopen(FILENAME, "r");
- if (!fh)
- LogMessage(X_WARNING, "Failed to open protocol names file " FILENAME "\n");
-
- /* Add built-in resources */
- RegisterResourceName(RT_NONE, "NONE");
- RegisterResourceName(RT_WINDOW, "WINDOW");
- RegisterResourceName(RT_PIXMAP, "PIXMAP");
- RegisterResourceName(RT_GC, "GC");
- RegisterResourceName(RT_FONT, "FONT");
- RegisterResourceName(RT_CURSOR, "CURSOR");
- RegisterResourceName(RT_COLORMAP, "COLORMAP");
- RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY");
- RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT");
- RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB");
-
- /* Add the core protocol */
- memset(&extEntry, 0, sizeof(extEntry));
- extEntry.name = CORE;
- RegisterExtensionNames(&extEntry);
-}
-
-#endif /* XREGISTRY */
+/************************************************************
+
+Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+this permission notice appear in supporting documentation. 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 THE
+AUTHOR 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.
+
+********************************************************/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef XREGISTRY
+
+#include <stdlib.h>
+#include <string.h>
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "resource.h"
+#include "registry.h"
+
+#define BASE_SIZE 16
+#define CORE "X11"
+#define FILENAME SERVER_MISC_CONFIG_PATH "/protocol.txt"
+
+#define PROT_COMMENT '#'
+#define PROT_REQUEST 'R'
+#define PROT_EVENT 'V'
+#define PROT_ERROR 'E'
+
+static FILE *fh;
+
+static char ***requests, **events, **errors, **resources;
+static unsigned nmajor, *nminor, nevent, nerror, nresource;
+
+/*
+ * File parsing routines
+ */
+static int double_size(void *p, unsigned n, unsigned size)
+{
+ char **ptr = (char **)p;
+ unsigned s, f;
+
+ if (n) {
+ s = n * size;
+ n *= 2 * size;
+ f = n;
+ } else {
+ s = 0;
+ n = f = BASE_SIZE * size;
+ }
+
+ *ptr = xrealloc(*ptr, n);
+ if (!*ptr) {
+ dixResetRegistry();
+ return FALSE;
+ }
+ memset(*ptr + s, 0, f - s);
+ return TRUE;
+}
+
+static void
+RegisterRequestName(unsigned major, unsigned minor, char *name)
+{
+ while (major >= nmajor) {
+ if (!double_size(&requests, nmajor, sizeof(char **)))
+ return;
+ if (!double_size(&nminor, nmajor, sizeof(unsigned)))
+ return;
+ nmajor = nmajor ? nmajor * 2 : BASE_SIZE;
+ }
+ while (minor >= nminor[major]) {
+ if (!double_size(requests+major, nminor[major], sizeof(char *)))
+ return;
+ nminor[major] = nminor[major] ? nminor[major] * 2 : BASE_SIZE;
+ }
+
+ free(requests[major][minor]);
+ requests[major][minor] = name;
+}
+
+static void
+RegisterEventName(unsigned event, char *name) {
+ while (event >= nevent) {
+ if (!double_size(&events, nevent, sizeof(char *)))
+ return;
+ nevent = nevent ? nevent * 2 : BASE_SIZE;
+ }
+
+ free(events[event]);
+ events[event] = name;
+}
+
+static void
+RegisterErrorName(unsigned error, char *name) {
+ while (error >= nerror) {
+ if (!double_size(&errors, nerror, sizeof(char *)))
+ return;
+ nerror = nerror ? nerror * 2 : BASE_SIZE;
+ }
+
+ free(errors[error]);
+ errors[error] = name;
+}
+
+void
+RegisterExtensionNames(ExtensionEntry *extEntry)
+{
+ char buf[256], *lineobj, *ptr;
+ unsigned offset;
+
+ if (fh == NULL)
+ return;
+
+ rewind(fh);
+
+ while (fgets(buf, sizeof(buf), fh)) {
+ lineobj = NULL;
+ ptr = strchr(buf, '\n');
+ if (ptr)
+ *ptr = 0;
+
+ /* Check for comments or empty lines */
+ switch (buf[0]) {
+ case PROT_REQUEST:
+ case PROT_EVENT:
+ case PROT_ERROR:
+ break;
+ case PROT_COMMENT:
+ case '\0':
+ continue;
+ default:
+ goto invalid;
+ }
+
+ /* Check for space character in the fifth position */
+ ptr = strchr(buf, ' ');
+ if (!ptr || ptr != buf + 4)
+ goto invalid;
+
+ /* Duplicate the string after the space */
+ lineobj = strdup(ptr + 1);
+ if (!lineobj)
+ continue;
+
+ /* Check for a colon somewhere on the line */
+ ptr = strchr(buf, ':');
+ if (!ptr)
+ goto invalid;
+
+ /* Compare the part before colon with the target extension name */
+ *ptr = 0;
+ if (strcmp(buf + 5, extEntry->name))
+ goto skip;
+
+ /* Get the opcode for the request, event, or error */
+ offset = strtol(buf + 1, &ptr, 10);
+ if (offset == 0 && ptr == buf + 1)
+ goto invalid;
+
+ /* Save the strdup result in the registry */
+ switch(buf[0]) {
+ case PROT_REQUEST:
+ if (extEntry->base)
+ RegisterRequestName(extEntry->base, offset, lineobj);
+ else
+ RegisterRequestName(offset, 0, lineobj);
+ continue;
+ case PROT_EVENT:
+ RegisterEventName(extEntry->eventBase + offset, lineobj);
+ continue;
+ case PROT_ERROR:
+ RegisterErrorName(extEntry->errorBase + offset, lineobj);
+ continue;
+ }
+
+ invalid:
+ LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n");
+ skip:
+ free(lineobj);
+ }
+}
+
+/*
+ * Registration functions
+ */
+
+void
+RegisterResourceName(RESTYPE resource, char *name)
+{
+ resource &= TypeMask;
+
+ while (resource >= nresource) {
+ if (!double_size(&resources, nresource, sizeof(char *)))
+ return;
+ nresource = nresource ? nresource * 2 : BASE_SIZE;
+ }
+
+ resources[resource] = name;
+}
+
+/*
+ * Lookup functions
+ */
+
+const char *
+LookupRequestName(int major, int minor)
+{
+ if (major >= nmajor)
+ return XREGISTRY_UNKNOWN;
+ if (minor >= nminor[major])
+ return XREGISTRY_UNKNOWN;
+
+ return requests[major][minor] ? requests[major][minor] : XREGISTRY_UNKNOWN;
+}
+
+const char *
+LookupMajorName(int major)
+{
+ if (major < 128) {
+ const char *retval;
+
+ if (major >= nmajor)
+ return XREGISTRY_UNKNOWN;
+ if (0 >= nminor[major])
+ return XREGISTRY_UNKNOWN;
+
+ retval = requests[major][0];
+ return retval ? retval + sizeof(CORE) : XREGISTRY_UNKNOWN;
+ } else {
+ ExtensionEntry *extEntry = GetExtensionEntry(major);
+ return extEntry ? extEntry->name : XREGISTRY_UNKNOWN;
+ }
+}
+
+const char *
+LookupEventName(int event)
+{
+ event &= 127;
+ if (event >= nevent)
+ return XREGISTRY_UNKNOWN;
+
+ return events[event] ? events[event] : XREGISTRY_UNKNOWN;
+}
+
+const char *
+LookupErrorName(int error)
+{
+ if (error >= nerror)
+ return XREGISTRY_UNKNOWN;
+
+ return errors[error] ? errors[error] : XREGISTRY_UNKNOWN;
+}
+
+const char *
+LookupResourceName(RESTYPE resource)
+{
+ resource &= TypeMask;
+ if (resource >= nresource)
+ return XREGISTRY_UNKNOWN;
+
+ return resources[resource] ? resources[resource] : XREGISTRY_UNKNOWN;
+}
+
+/*
+ * Setup and teardown
+ */
+void
+dixResetRegistry(void)
+{
+ ExtensionEntry extEntry;
+
+ /* Free all memory */
+ while (nmajor--) {
+ while (nminor[nmajor])
+ free(requests[nmajor][--nminor[nmajor]]);
+ xfree(requests[nmajor]);
+ }
+ xfree(requests);
+ xfree(nminor);
+
+ while (nevent--)
+ free(events[nevent]);
+ xfree(events);
+
+ while (nerror--)
+ free(errors[nerror]);
+ xfree(errors);
+
+ xfree(resources);
+
+ requests = NULL;
+ nminor = NULL;
+ events = NULL;
+ errors = NULL;
+ resources = NULL;
+
+ nmajor = nevent = nerror = nresource = 0;
+
+ /* Open the protocol file */
+ if (fh)
+ fclose(fh);
+ fh = fopen(FILENAME, "r");
+ if (!fh)
+ LogMessage(X_WARNING, "Failed to open protocol names file " FILENAME "\n");
+
+ /* Add built-in resources */
+ RegisterResourceName(RT_NONE, "NONE");
+ RegisterResourceName(RT_WINDOW, "WINDOW");
+ RegisterResourceName(RT_PIXMAP, "PIXMAP");
+ RegisterResourceName(RT_GC, "GC");
+ RegisterResourceName(RT_FONT, "FONT");
+ RegisterResourceName(RT_CURSOR, "CURSOR");
+ RegisterResourceName(RT_COLORMAP, "COLORMAP");
+ RegisterResourceName(RT_CMAPENTRY, "COLORMAP ENTRY");
+ RegisterResourceName(RT_OTHERCLIENT, "OTHER CLIENT");
+ RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB");
+
+ /* Add the core protocol */
+ memset(&extEntry, 0, sizeof(extEntry));
+ extEntry.name = CORE;
+ RegisterExtensionNames(&extEntry);
+}
+
+#endif /* XREGISTRY */
diff --git a/xorg-server/dix/window.c b/xorg-server/dix/window.c
index 87502a9d0..c7201df09 100644
--- a/xorg-server/dix/window.c
+++ b/xorg-server/dix/window.c
@@ -1,3886 +1,3889 @@
-/*
-
-Copyright (c) 2006, Red Hat, Inc.
-
-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, 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 NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS 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 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-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 THE OPEN GROUP 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.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, 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,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-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
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-*/
-
-/* The panoramix components contained the following notice */
-/*****************************************************************
-
-Copyright (c) 1991, 1997 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 "misc.h"
-#include "scrnintstr.h"
-#include "os.h"
-#include "regionstr.h"
-#include "validate.h"
-#include "windowstr.h"
-#include "input.h"
-#include "inputstr.h"
-#include "resource.h"
-#include "colormapst.h"
-#include "cursorstr.h"
-#include "dixstruct.h"
-#include "gcstruct.h"
-#include "servermd.h"
-#ifdef PANORAMIX
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
-#endif
-#include "dixevents.h"
-#include "globals.h"
-#include "mi.h" /* miPaintWindow */
-
-#include "privates.h"
-#include "xace.h"
-
-/******
- * Window stuff for server
- *
- * CreateRootWindow, CreateWindow, ChangeWindowAttributes,
- * GetWindowAttributes, DeleteWindow, DestroySubWindows,
- * HandleSaveSet, ReparentWindow, MapWindow, MapSubWindows,
- * UnmapWindow, UnmapSubWindows, ConfigureWindow, CirculateWindow,
- * ChangeWindowDeviceCursor
- ******/
-
-static unsigned char _back_lsb[4] = {0x88, 0x22, 0x44, 0x11};
-static unsigned char _back_msb[4] = {0x11, 0x44, 0x22, 0x88};
-
-static Bool WindowParentHasDeviceCursor(WindowPtr pWin,
- DeviceIntPtr pDev,
- CursorPtr pCurs);
-static Bool
-WindowSeekDeviceCursor(WindowPtr pWin,
- DeviceIntPtr pDev,
- DevCursNodePtr* pNode,
- DevCursNodePtr* pPrev);
-
-int screenIsSaved = SCREEN_SAVER_OFF;
-
-ScreenSaverStuffRec savedScreenInfo[MAXSCREENS];
-
-static int FocusPrivatesKeyIndex;
-DevPrivateKey FocusPrivatesKey = &FocusPrivatesKeyIndex;
-
-static Bool TileScreenSaver(int i, int kind);
-
-
-#define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \
- CWDontPropagate | CWOverrideRedirect | CWCursor )
-
-#define BOXES_OVERLAP(b1, b2) \
- (!( ((b1)->x2 <= (b2)->x1) || \
- ( ((b1)->x1 >= (b2)->x2)) || \
- ( ((b1)->y2 <= (b2)->y1)) || \
- ( ((b1)->y1 >= (b2)->y2)) ) )
-
-#define RedirectSend(pWin) \
- ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureRedirectMask)
-
-#define SubSend(pWin) \
- ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureNotifyMask)
-
-#define StrSend(pWin) \
- ((pWin->eventMask|wOtherEventMasks(pWin)) & StructureNotifyMask)
-
-#define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent))
-
-#ifdef DEBUG
-/******
- * PrintWindowTree
- * For debugging only
- ******/
-
-static void
-PrintChildren(WindowPtr p1, int indent)
-{
- WindowPtr p2;
- int i;
-
- while (p1)
- {
- p2 = p1->firstChild;
- ErrorF("[dix] ");
- for (i=0; i<indent; i++) ErrorF(" ");
- ErrorF("%lx\n", p1->drawable.id);
- miPrintRegion(&p1->clipList);
- PrintChildren(p2, indent+4);
- p1 = p1->nextSib;
- }
-}
-
-static void
-PrintWindowTree(void)
-{
- int i;
- WindowPtr pWin, p1;
-
- for (i=0; i<screenInfo.numScreens; i++)
- {
- ErrorF("[dix] WINDOW %d\n", i);
- pWin = WindowTable[i];
- miPrintRegion(&pWin->clipList);
- p1 = pWin->firstChild;
- PrintChildren(p1, 4);
- }
-}
-#endif
-
-int
-TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, pointer data)
-{
- int result;
- WindowPtr pChild;
-
- if (!(pChild = pWin))
- return(WT_NOMATCH);
- while (1)
- {
- result = (* func)(pChild, data);
- if (result == WT_STOPWALKING)
- return(WT_STOPWALKING);
- if ((result == WT_WALKCHILDREN) && pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- while (!pChild->nextSib && (pChild != pWin))
- pChild = pChild->parent;
- if (pChild == pWin)
- break;
- pChild = pChild->nextSib;
- }
- return(WT_NOMATCH);
-}
-
-/*****
- * WalkTree
- * Walk the window tree, for SCREEN, preforming FUNC(pWin, data) on
- * each window. If FUNC returns WT_WALKCHILDREN, traverse the children,
- * if it returns WT_DONTWALKCHILDREN, dont. If it returns WT_STOPWALKING
- * exit WalkTree. Does depth-first traverse.
- *****/
-
-int
-WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, pointer data)
-{
- return(TraverseTree(WindowTable[pScreen->myNum], func, data));
-}
-
-/* hack for forcing backing store on all windows */
-int defaultBackingStore = NotUseful;
-/* hack to force no backing store */
-Bool disableBackingStore = FALSE;
-Bool enableBackingStore = FALSE;
-
-static void
-SetWindowToDefaults(WindowPtr pWin)
-{
- pWin->prevSib = NullWindow;
- pWin->firstChild = NullWindow;
- pWin->lastChild = NullWindow;
-
- pWin->valdata = (ValidatePtr)NULL;
- pWin->optional = (WindowOptPtr)NULL;
- pWin->cursorIsNone = TRUE;
-
- pWin->backingStore = NotUseful;
- pWin->DIXsaveUnder = FALSE;
- pWin->backStorage = (pointer) NULL;
-
- pWin->mapped = FALSE; /* off */
- pWin->realized = FALSE; /* off */
- pWin->viewable = FALSE;
- pWin->visibility = VisibilityNotViewable;
- pWin->overrideRedirect = FALSE;
- pWin->saveUnder = FALSE;
-
- pWin->bitGravity = ForgetGravity;
- pWin->winGravity = NorthWestGravity;
-
- pWin->eventMask = 0;
- pWin->deliverableEvents = 0;
- pWin->dontPropagate = 0;
- pWin->forcedBS = FALSE;
- pWin->redirectDraw = RedirectDrawNone;
- pWin->forcedBG = FALSE;
-
-#ifdef ROOTLESS
- pWin->rootlessUnhittable = FALSE;
-#endif
-}
-
-static void
-MakeRootTile(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- GCPtr pGC;
- unsigned char back[128];
- int len = BitmapBytePad(sizeof(long));
- unsigned char *from, *to;
- int i, j;
-
- pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4,
- pScreen->rootDepth, 0);
-
- pWin->backgroundState = BackgroundPixmap;
- pGC = GetScratchGC(pScreen->rootDepth, pScreen);
- if (!pWin->background.pixmap || !pGC)
- FatalError("could not create root tile");
-
- {
- CARD32 attributes[2];
-
- attributes[0] = pScreen->whitePixel;
- attributes[1] = pScreen->blackPixel;
-
- (void)ChangeGC(pGC, GCForeground | GCBackground, attributes);
- }
-
- ValidateGC((DrawablePtr)pWin->background.pixmap, pGC);
-
- from = (screenInfo.bitmapBitOrder == LSBFirst) ? _back_lsb : _back_msb;
- to = back;
-
- for (i = 4; i > 0; i--, from++)
- for (j = len; j > 0; j--)
- *to++ = *from;
-
- (*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap, pGC, 1,
- 0, 0, len, 4, 0, XYBitmap, (char *)back);
-
- FreeScratchGC(pGC);
-
-}
-
-/*****
- * CreateRootWindow
- * Makes a window at initialization time for specified screen
- *****/
-
-Bool
-CreateRootWindow(ScreenPtr pScreen)
-{
- WindowPtr pWin;
- BoxRec box;
- PixmapFormatRec *format;
-
- pWin = xalloc(sizeof(WindowRec));
- if (!pWin)
- return FALSE;
-
- savedScreenInfo[pScreen->myNum].pWindow = NULL;
- savedScreenInfo[pScreen->myNum].wid = FakeClientID(0);
- savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL;
- screenIsSaved = SCREEN_SAVER_OFF;
-
- WindowTable[pScreen->myNum] = pWin;
-
- pWin->drawable.pScreen = pScreen;
- pWin->drawable.type = DRAWABLE_WINDOW;
- pWin->devPrivates = NULL;
-
- pWin->drawable.depth = pScreen->rootDepth;
- for (format = screenInfo.formats;
- format->depth != pScreen->rootDepth;
- format++)
- ;
- pWin->drawable.bitsPerPixel = format->bitsPerPixel;
-
- pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
- pWin->parent = NullWindow;
- SetWindowToDefaults(pWin);
-
- pWin->optional = xalloc (sizeof (WindowOptRec));
- if (!pWin->optional)
- return FALSE;
-
- pWin->optional->dontPropagateMask = 0;
- pWin->optional->otherEventMasks = 0;
- pWin->optional->otherClients = NULL;
- pWin->optional->passiveGrabs = NULL;
- pWin->optional->userProps = NULL;
- pWin->optional->backingBitPlanes = ~0L;
- pWin->optional->backingPixel = 0;
- pWin->optional->boundingShape = NULL;
- pWin->optional->clipShape = NULL;
- pWin->optional->inputShape = NULL;
- pWin->optional->inputMasks = NULL;
- pWin->optional->deviceCursors = NULL;
- pWin->optional->colormap = pScreen->defColormap;
- pWin->optional->visual = pScreen->rootVisual;
-
- pWin->nextSib = NullWindow;
-
- pWin->drawable.id = FakeClientID(0);
-
- pWin->origin.x = pWin->origin.y = 0;
- pWin->drawable.height = pScreen->height;
- pWin->drawable.width = pScreen->width;
- pWin->drawable.x = pWin->drawable.y = 0;
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
- REGION_INIT(pScreen, &pWin->clipList, &box, 1);
- REGION_INIT(pScreen, &pWin->winSize, &box, 1);
- REGION_INIT(pScreen, &pWin->borderSize, &box, 1);
- REGION_INIT(pScreen, &pWin->borderClip, &box, 1);
-
- pWin->drawable.class = InputOutput;
- pWin->optional->visual = pScreen->rootVisual;
-
- pWin->backgroundState = BackgroundPixel;
- pWin->background.pixel = pScreen->whitePixel;
-
- pWin->borderIsPixel = TRUE;
- pWin->border.pixel = pScreen->blackPixel;
- pWin->borderWidth = 0;
-
- /* security creation/labeling check
- */
- if (XaceHook(XACE_RESOURCE_ACCESS, serverClient, pWin->drawable.id,
- RT_WINDOW, pWin, RT_NONE, NULL, DixCreateAccess))
- return FALSE;
-
- if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin))
- return FALSE;
-
- if (disableBackingStore)
- pScreen->backingStoreSupport = NotUseful;
- if (enableBackingStore)
- pScreen->backingStoreSupport = Always;
-
- pScreen->saveUnderSupport = NotUseful;
-
- return TRUE;
-}
-
-void
-InitRootWindow(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- int backFlag = CWBorderPixel | CWCursor | CWBackingStore;
-
- if (!(*pScreen->CreateWindow)(pWin))
- return; /* XXX */
- (*pScreen->PositionWindow)(pWin, 0, 0);
-
- pWin->cursorIsNone = FALSE;
- pWin->optional->cursor = rootCursor;
- rootCursor->refcnt++;
-
-
- if (party_like_its_1989) {
- MakeRootTile(pWin);
- backFlag |= CWBackPixmap;
- } else {
- if (whiteRoot)
- pWin->background.pixel = pScreen->whitePixel;
- else
- pWin->background.pixel = pScreen->blackPixel;
- backFlag |= CWBackPixel;
- }
-
- pWin->backingStore = defaultBackingStore;
- pWin->forcedBS = (defaultBackingStore != NotUseful);
- /* We SHOULD check for an error value here XXX */
- (*pScreen->ChangeWindowAttributes)(pWin, backFlag);
-
- MapWindow(pWin, serverClient);
-}
-
-/* Set the region to the intersection of the rectangle and the
- * window's winSize. The window is typically the parent of the
- * window from which the region came.
- */
-
-static void
-ClippedRegionFromBox(WindowPtr pWin, RegionPtr Rgn,
- int x, int y,
- int w, int h)
-{
- ScreenPtr pScreen;
- BoxRec box;
-
- pScreen = pWin->drawable.pScreen;
-
- box = *(REGION_EXTENTS(pScreen, &pWin->winSize));
- /* we do these calculations to avoid overflows */
- if (x > box.x1)
- box.x1 = x;
- if (y > box.y1)
- box.y1 = y;
- x += w;
- if (x < box.x2)
- box.x2 = x;
- y += h;
- if (y < box.y2)
- box.y2 = y;
- if (box.x1 > box.x2)
- box.x2 = box.x1;
- if (box.y1 > box.y2)
- box.y2 = box.y1;
- REGION_RESET(pScreen, Rgn, &box);
- REGION_INTERSECT(pScreen, Rgn, Rgn, &pWin->winSize);
-}
-
-static RealChildHeadProc realChildHeadProc = NULL;
-
-void
-RegisterRealChildHeadProc (RealChildHeadProc proc)
-{
- realChildHeadProc = proc;
-}
-
-
-WindowPtr
-RealChildHead(WindowPtr pWin)
-{
- if (realChildHeadProc) {
- return realChildHeadProc (pWin);
- }
-
- if (!pWin->parent &&
- (screenIsSaved == SCREEN_SAVER_ON) &&
- (HasSaverWindow (pWin->drawable.pScreen->myNum)))
- return (pWin->firstChild);
- else
- return (NullWindow);
-}
-
-/*****
- * CreateWindow
- * Makes a window in response to client request
- *****/
-
-WindowPtr
-CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
- unsigned h, unsigned bw, unsigned class, Mask vmask, XID *vlist,
- int depth, ClientPtr client, VisualID visual, int *error)
-{
- WindowPtr pWin;
- WindowPtr pHead;
- ScreenPtr pScreen;
- xEvent event;
- int idepth, ivisual;
- Bool fOK;
- DepthPtr pDepth;
- PixmapFormatRec *format;
- WindowOptPtr ancwopt;
-
- if (class == CopyFromParent)
- class = pParent->drawable.class;
-
- if ((class != InputOutput) && (class != InputOnly))
- {
- *error = BadValue;
- client->errorValue = class;
- return NullWindow;
- }
-
- if ((class != InputOnly) && (pParent->drawable.class == InputOnly))
- {
- *error = BadMatch;
- return NullWindow;
- }
-
- if ((class == InputOnly) && ((bw != 0) || (depth != 0)))
- {
- *error = BadMatch;
- return NullWindow;
- }
-
- pScreen = pParent->drawable.pScreen;
- if ((class == InputOutput) && (depth == 0))
- depth = pParent->drawable.depth;
- ancwopt = pParent->optional;
- if (!ancwopt)
- ancwopt = FindWindowWithOptional(pParent)->optional;
- if (visual == CopyFromParent) {
- visual = ancwopt->visual;
- }
-
- /* Find out if the depth and visual are acceptable for this Screen */
- if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth))
- {
- fOK = FALSE;
- for(idepth = 0; idepth < pScreen->numDepths; idepth++)
- {
- pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
- if ((depth == pDepth->depth) || (depth == 0))
- {
- for (ivisual = 0; ivisual < pDepth->numVids; ivisual++)
- {
- if (visual == pDepth->vids[ivisual])
- {
- fOK = TRUE;
- break;
- }
- }
- }
- }
- if (fOK == FALSE)
- {
- *error = BadMatch;
- return NullWindow;
- }
- }
-
- if (((vmask & (CWBorderPixmap | CWBorderPixel)) == 0) &&
- (class != InputOnly) &&
- (depth != pParent->drawable.depth))
- {
- *error = BadMatch;
- return NullWindow;
- }
-
- if (((vmask & CWColormap) == 0) &&
- (class != InputOnly) &&
- ((visual != ancwopt->visual) || (ancwopt->colormap == None)))
- {
- *error = BadMatch;
- return NullWindow;
- }
-
- pWin = xalloc(sizeof(WindowRec));
- if (!pWin)
- {
- *error = BadAlloc;
- return NullWindow;
- }
- pWin->drawable = pParent->drawable;
- pWin->devPrivates = NULL;
- pWin->drawable.depth = depth;
- if (depth == pParent->drawable.depth)
- pWin->drawable.bitsPerPixel = pParent->drawable.bitsPerPixel;
- else
- {
- for (format = screenInfo.formats; format->depth != depth; format++)
- ;
- pWin->drawable.bitsPerPixel = format->bitsPerPixel;
- }
- if (class == InputOnly)
- pWin->drawable.type = (short) UNDRAWABLE_WINDOW;
- pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
- pWin->drawable.id = wid;
- pWin->drawable.class = class;
-
- pWin->parent = pParent;
- SetWindowToDefaults(pWin);
-
- if (visual != ancwopt->visual)
- {
- if (!MakeWindowOptional (pWin))
- {
- xfree (pWin);
- *error = BadAlloc;
- return NullWindow;
- }
- pWin->optional->visual = visual;
- pWin->optional->colormap = None;
- }
-
- pWin->borderWidth = bw;
-
- /* security creation/labeling check
- */
- *error = XaceHook(XACE_RESOURCE_ACCESS, client, wid, RT_WINDOW, pWin,
- RT_WINDOW, pWin->parent, DixCreateAccess|DixSetAttrAccess);
- if (*error != Success) {
- xfree(pWin);
- return NullWindow;
- }
-
- pWin->backgroundState = XaceBackgroundNoneState(pWin);
- pWin->background.pixel = pScreen->whitePixel;
-
- pWin->borderIsPixel = pParent->borderIsPixel;
- pWin->border = pParent->border;
- if (pWin->borderIsPixel == FALSE)
- pWin->border.pixmap->refcnt++;
-
- pWin->origin.x = x + (int)bw;
- pWin->origin.y = y + (int)bw;
- pWin->drawable.width = w;
- pWin->drawable.height = h;
- pWin->drawable.x = pParent->drawable.x + x + (int)bw;
- pWin->drawable.y = pParent->drawable.y + y + (int)bw;
-
- /* set up clip list correctly for unobscured WindowPtr */
- REGION_NULL(pScreen, &pWin->clipList);
- REGION_NULL(pScreen, &pWin->borderClip);
- REGION_NULL(pScreen, &pWin->winSize);
- REGION_NULL(pScreen, &pWin->borderSize);
-
- pHead = RealChildHead(pParent);
- if (pHead)
- {
- pWin->nextSib = pHead->nextSib;
- if (pHead->nextSib)
- pHead->nextSib->prevSib = pWin;
- else
- pParent->lastChild = pWin;
- pHead->nextSib = pWin;
- pWin->prevSib = pHead;
- }
- else
- {
- pWin->nextSib = pParent->firstChild;
- if (pParent->firstChild)
- pParent->firstChild->prevSib = pWin;
- else
- pParent->lastChild = pWin;
- pParent->firstChild = pWin;
- }
-
- SetWinSize (pWin);
- SetBorderSize (pWin);
-
- /* We SHOULD check for an error value here XXX */
- if (!(*pScreen->CreateWindow)(pWin))
- {
- *error = BadAlloc;
- DeleteWindow(pWin, None);
- return NullWindow;
- }
- /* We SHOULD check for an error value here XXX */
- (*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y);
-
- if (!(vmask & CWEventMask))
- RecalculateDeliverableEvents(pWin);
-
- if (vmask)
- *error = ChangeWindowAttributes(pWin, vmask, vlist, wClient (pWin));
- else
- *error = Success;
-
- if (*error != Success)
- {
- DeleteWindow(pWin, None);
- return NullWindow;
- }
- if (!(vmask & CWBackingStore) && (defaultBackingStore != NotUseful))
- {
- XID value = defaultBackingStore;
- (void)ChangeWindowAttributes(pWin, CWBackingStore, &value, wClient (pWin));
- pWin->forcedBS = TRUE;
- }
-
- if (SubSend(pParent))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = CreateNotify;
- event.u.createNotify.window = wid;
- event.u.createNotify.parent = pParent->drawable.id;
- event.u.createNotify.x = x;
- event.u.createNotify.y = y;
- event.u.createNotify.width = w;
- event.u.createNotify.height = h;
- event.u.createNotify.borderWidth = bw;
- event.u.createNotify.override = pWin->overrideRedirect;
- DeliverEvents(pParent, &event, 1, NullWindow);
- }
- return pWin;
-}
-
-static void
-DisposeWindowOptional (WindowPtr pWin)
-{
- if (!pWin->optional)
- return;
- /*
- * everything is peachy. Delete the optional record
- * and clean up
- */
- if (pWin->optional->cursor)
- {
- FreeCursor (pWin->optional->cursor, (Cursor)0);
- pWin->cursorIsNone = FALSE;
- }
- else
- pWin->cursorIsNone = TRUE;
-
- if (pWin->optional->deviceCursors)
- {
- DevCursorList pList;
- DevCursorList pPrev;
- pList = pWin->optional->deviceCursors;
- while(pList)
- {
- if (pList->cursor)
- FreeCursor(pList->cursor, (XID)0);
- pPrev = pList;
- pList = pList->next;
- xfree(pPrev);
- }
- pWin->optional->deviceCursors = NULL;
- }
-
- xfree (pWin->optional);
- pWin->optional = NULL;
-}
-
-static void
-FreeWindowResources(WindowPtr pWin)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- DeleteWindowFromAnySaveSet(pWin);
- DeleteWindowFromAnySelections(pWin);
- DeleteWindowFromAnyEvents(pWin, TRUE);
- REGION_UNINIT(pScreen, &pWin->clipList);
- REGION_UNINIT(pScreen, &pWin->winSize);
- REGION_UNINIT(pScreen, &pWin->borderClip);
- REGION_UNINIT(pScreen, &pWin->borderSize);
- if (wBoundingShape (pWin))
- REGION_DESTROY(pScreen, wBoundingShape (pWin));
- if (wClipShape (pWin))
- REGION_DESTROY(pScreen, wClipShape (pWin));
- if (wInputShape (pWin))
- REGION_DESTROY(pScreen, wInputShape (pWin));
- if (pWin->borderIsPixel == FALSE)
- (*pScreen->DestroyPixmap)(pWin->border.pixmap);
- if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
-
- DeleteAllWindowProperties(pWin);
- /* We SHOULD check for an error value here XXX */
- (*pScreen->DestroyWindow)(pWin);
- DisposeWindowOptional (pWin);
-}
-
-static void
-CrushTree(WindowPtr pWin)
-{
- WindowPtr pChild, pSib, pParent;
- UnrealizeWindowProcPtr UnrealizeWindow;
- xEvent event;
-
- if (!(pChild = pWin->firstChild))
- return;
- UnrealizeWindow = pWin->drawable.pScreen->UnrealizeWindow;
- while (1)
- {
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- while (1)
- {
- pParent = pChild->parent;
- if (SubStrSend(pChild, pParent))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = DestroyNotify;
- event.u.destroyNotify.window = pChild->drawable.id;
- DeliverEvents(pChild, &event, 1, NullWindow);
- }
- FreeResource(pChild->drawable.id, RT_WINDOW);
- pSib = pChild->nextSib;
- pChild->viewable = FALSE;
- if (pChild->realized)
- {
- pChild->realized = FALSE;
- (*UnrealizeWindow)(pChild);
- }
- FreeWindowResources(pChild);
- dixFreePrivates(pChild->devPrivates);
- xfree(pChild);
- if ( (pChild = pSib) )
- break;
- pChild = pParent;
- pChild->firstChild = NullWindow;
- pChild->lastChild = NullWindow;
- if (pChild == pWin)
- return;
- }
- }
-}
-
-/*****
- * DeleteWindow
- * Deletes child of window then window itself
- * If wid is None, don't send any events
- *****/
-
-int
-DeleteWindow(pointer value, XID wid)
- {
- WindowPtr pParent;
- WindowPtr pWin = (WindowPtr)value;
- xEvent event;
-
- UnmapWindow(pWin, FALSE);
-
- CrushTree(pWin);
-
- pParent = pWin->parent;
- if (wid && pParent && SubStrSend(pWin, pParent))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = DestroyNotify;
- event.u.destroyNotify.window = pWin->drawable.id;
- DeliverEvents(pWin, &event, 1, NullWindow);
- }
-
- FreeWindowResources(pWin);
- if (pParent)
- {
- if (pParent->firstChild == pWin)
- pParent->firstChild = pWin->nextSib;
- if (pParent->lastChild == pWin)
- pParent->lastChild = pWin->prevSib;
- if (pWin->nextSib)
- pWin->nextSib->prevSib = pWin->prevSib;
- if (pWin->prevSib)
- pWin->prevSib->nextSib = pWin->nextSib;
- }
- xfree(dixLookupPrivate(&pWin->devPrivates, FocusPrivatesKey));
- dixFreePrivates(pWin->devPrivates);
- xfree(pWin);
- return Success;
-}
-
-int
-DestroySubwindows(WindowPtr pWin, ClientPtr client)
-{
- /* XXX
- * The protocol is quite clear that each window should be
- * destroyed in turn, however, unmapping all of the first
- * eliminates most of the calls to ValidateTree. So,
- * this implementation is incorrect in that all of the
- * UnmapNotifies occur before all of the DestroyNotifies.
- * If you care, simply delete the call to UnmapSubwindows.
- */
- UnmapSubwindows(pWin);
- while (pWin->lastChild) {
- int rc = XaceHook(XACE_RESOURCE_ACCESS, client,
- pWin->lastChild->drawable.id, RT_WINDOW,
- pWin->lastChild, RT_NONE, NULL, DixDestroyAccess);
- if (rc != Success)
- return rc;
- FreeResource(pWin->lastChild->drawable.id, RT_NONE);
- }
- return Success;
-}
-
-/*****
- * ChangeWindowAttributes
- *
- * The value-mask specifies which attributes are to be changed; the
- * value-list contains one value for each one bit in the mask, from least
- * to most significant bit in the mask.
- *****/
-
-int
-ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
-{
- XID *pVlist;
- PixmapPtr pPixmap;
- Pixmap pixID;
- CursorPtr pCursor, pOldCursor;
- Cursor cursorID;
- WindowPtr pChild;
- Colormap cmap;
- ColormapPtr pCmap;
- xEvent xE;
- int error, rc;
- ScreenPtr pScreen;
- Mask index2, tmask, vmaskCopy = 0;
- unsigned int val;
- Bool checkOptional = FALSE, borderRelative = FALSE;
-
- if ((pWin->drawable.class == InputOnly) && (vmask & (~INPUTONLY_LEGAL_MASK)))
- return BadMatch;
-
- error = Success;
- pScreen = pWin->drawable.pScreen;
- pVlist = vlist;
- tmask = vmask;
- while (tmask)
- {
- index2 = (Mask) lowbit (tmask);
- tmask &= ~index2;
- switch (index2)
- {
- case CWBackPixmap:
- pixID = (Pixmap )*pVlist;
- pVlist++;
- if (pWin->backgroundState == ParentRelative)
- borderRelative = TRUE;
- if (pixID == None)
- {
- if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
- if (!pWin->parent)
- MakeRootTile(pWin);
- else {
- pWin->backgroundState = XaceBackgroundNoneState(pWin);
- pWin->background.pixel = pScreen->whitePixel;
- }
- }
- else if (pixID == ParentRelative)
- {
- if (pWin->parent &&
- pWin->drawable.depth != pWin->parent->drawable.depth)
- {
- error = BadMatch;
- goto PatchUp;
- }
- if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
- if (!pWin->parent)
- MakeRootTile(pWin);
- else
- pWin->backgroundState = ParentRelative;
- borderRelative = TRUE;
- /* Note that the parent's backgroundTile's refcnt is NOT
- * incremented. */
- }
- else
- {
- rc = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
- client, DixReadAccess);
- if (rc == Success)
- {
- if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
- (pPixmap->drawable.pScreen != pScreen))
- {
- error = BadMatch;
- goto PatchUp;
- }
- if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
- pWin->backgroundState = BackgroundPixmap;
- pWin->background.pixmap = pPixmap;
- pPixmap->refcnt++;
- }
- else
- {
- error = (rc == BadValue) ? BadPixmap : rc;
- client->errorValue = pixID;
- goto PatchUp;
- }
- }
- break;
- case CWBackPixel:
- if (pWin->backgroundState == ParentRelative)
- borderRelative = TRUE;
- if (pWin->backgroundState == BackgroundPixmap)
- (*pScreen->DestroyPixmap)(pWin->background.pixmap);
- pWin->backgroundState = BackgroundPixel;
- pWin->background.pixel = (CARD32 ) *pVlist;
- /* background pixel overrides background pixmap,
- so don't let the ddx layer see both bits */
- vmaskCopy &= ~CWBackPixmap;
- pVlist++;
- break;
- case CWBorderPixmap:
- pixID = (Pixmap ) *pVlist;
- pVlist++;
- if (pixID == CopyFromParent)
- {
- if (!pWin->parent ||
- (pWin->drawable.depth != pWin->parent->drawable.depth))
- {
- error = BadMatch;
- goto PatchUp;
- }
- if (pWin->parent->borderIsPixel == TRUE) {
- if (pWin->borderIsPixel == FALSE)
- (*pScreen->DestroyPixmap)(pWin->border.pixmap);
- pWin->border = pWin->parent->border;
- pWin->borderIsPixel = TRUE;
- index2 = CWBorderPixel;
- break;
- }
- else
- {
- pixID = pWin->parent->border.pixmap->drawable.id;
- }
- }
- rc = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
- client, DixReadAccess);
- if (rc == Success)
- {
- if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
- (pPixmap->drawable.pScreen != pScreen))
- {
- error = BadMatch;
- goto PatchUp;
- }
- if (pWin->borderIsPixel == FALSE)
- (*pScreen->DestroyPixmap)(pWin->border.pixmap);
- pWin->borderIsPixel = FALSE;
- pWin->border.pixmap = pPixmap;
- pPixmap->refcnt++;
- }
- else
- {
- error = (rc == BadValue) ? BadPixmap : rc;
- client->errorValue = pixID;
- goto PatchUp;
- }
- break;
- case CWBorderPixel:
- if (pWin->borderIsPixel == FALSE)
- (*pScreen->DestroyPixmap)(pWin->border.pixmap);
- pWin->borderIsPixel = TRUE;
- pWin->border.pixel = (CARD32) *pVlist;
- /* border pixel overrides border pixmap,
- so don't let the ddx layer see both bits */
- vmaskCopy &= ~CWBorderPixmap;
- pVlist++;
- break;
- case CWBitGravity:
- val = (CARD8 )*pVlist;
- pVlist++;
- if (val > StaticGravity)
- {
- error = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- pWin->bitGravity = val;
- break;
- case CWWinGravity:
- val = (CARD8 )*pVlist;
- pVlist++;
- if (val > StaticGravity)
- {
- error = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- pWin->winGravity = val;
- break;
- case CWBackingStore:
- val = (CARD8 )*pVlist;
- pVlist++;
- if ((val != NotUseful) && (val != WhenMapped) && (val != Always))
- {
- error = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- pWin->backingStore = val;
- pWin->forcedBS = FALSE;
- break;
- case CWBackingPlanes:
- if (pWin->optional || ((CARD32)*pVlist != (CARD32)~0L)) {
- if (!pWin->optional && !MakeWindowOptional (pWin))
- {
- error = BadAlloc;
- goto PatchUp;
- }
- pWin->optional->backingBitPlanes = (CARD32) *pVlist;
- if ((CARD32)*pVlist == (CARD32)~0L)
- checkOptional = TRUE;
- }
- pVlist++;
- break;
- case CWBackingPixel:
- if (pWin->optional || (CARD32) *pVlist) {
- if (!pWin->optional && !MakeWindowOptional (pWin))
- {
- error = BadAlloc;
- goto PatchUp;
- }
- pWin->optional->backingPixel = (CARD32) *pVlist;
- if (!*pVlist)
- checkOptional = TRUE;
- }
- pVlist++;
- break;
- case CWSaveUnder:
- val = (BOOL) *pVlist;
- pVlist++;
- if ((val != xTrue) && (val != xFalse))
- {
- error = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- pWin->saveUnder = val;
- break;
- case CWEventMask:
- rc = EventSelectForWindow(pWin, client, (Mask )*pVlist);
- if (rc)
- {
- error = rc;
- goto PatchUp;
- }
- pVlist++;
- break;
- case CWDontPropagate:
- rc = EventSuppressForWindow(pWin, client, (Mask )*pVlist,
- &checkOptional);
- if (rc)
- {
- error = rc;
- goto PatchUp;
- }
- pVlist++;
- break;
- case CWOverrideRedirect:
- val = (BOOL ) *pVlist;
- pVlist++;
- if ((val != xTrue) && (val != xFalse))
- {
- error = BadValue;
- client->errorValue = val;
- goto PatchUp;
- }
- if (val == xTrue) {
- rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id,
- RT_WINDOW, pWin, RT_NONE, NULL, DixGrabAccess);
- if (rc != Success) {
- error = rc;
- client->errorValue = pWin->drawable.id;
- goto PatchUp;
- }
- }
- pWin->overrideRedirect = val;
- break;
- case CWColormap:
- cmap = (Colormap) *pVlist;
- pVlist++;
- if (cmap == CopyFromParent)
- {
- if (pWin->parent &&
- (!pWin->optional ||
- pWin->optional->visual == wVisual (pWin->parent)))
- {
- cmap = wColormap (pWin->parent);
- }
- else
- cmap = None;
- }
- if (cmap == None)
- {
- error = BadMatch;
- goto PatchUp;
- }
- rc = dixLookupResourceByType((pointer *)&pCmap, cmap, RT_COLORMAP,
- client, DixUseAccess);
- if (rc != Success)
- {
- error = (rc == BadValue) ? BadColor : rc;
- client->errorValue = cmap;
- goto PatchUp;
- }
- if (pCmap->pVisual->vid != wVisual (pWin) ||
- pCmap->pScreen != pScreen)
- {
- error = BadMatch;
- goto PatchUp;
- }
- if (cmap != wColormap (pWin))
- {
- if (!pWin->optional)
- {
- if (!MakeWindowOptional (pWin))
- {
- error = BadAlloc;
- goto PatchUp;
- }
- }
- else if (pWin->parent && cmap == wColormap (pWin->parent))
- checkOptional = TRUE;
-
- /*
- * propagate the original colormap to any children
- * inheriting it
- */
-
- for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)
- {
- if (!pChild->optional && !MakeWindowOptional (pChild))
- {
- error = BadAlloc;
- goto PatchUp;
- }
- }
-
- pWin->optional->colormap = cmap;
-
- /*
- * check on any children now matching the new colormap
- */
-
- for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)
- {
- if (pChild->optional->colormap == cmap)
- CheckWindowOptionalNeed (pChild);
- }
-
- xE.u.u.type = ColormapNotify;
- xE.u.colormap.window = pWin->drawable.id;
- xE.u.colormap.colormap = cmap;
- xE.u.colormap.new = xTrue;
- xE.u.colormap.state = IsMapInstalled(cmap, pWin);
- DeliverEvents(pWin, &xE, 1, NullWindow);
- }
- break;
- case CWCursor:
- cursorID = (Cursor ) *pVlist;
- pVlist++;
- /*
- * install the new
- */
- if ( cursorID == None)
- {
- if (pWin == WindowTable[pWin->drawable.pScreen->myNum])
- pCursor = rootCursor;
- else
- pCursor = (CursorPtr) None;
- }
- else
- {
- rc = dixLookupResourceByType((pointer *)&pCursor, cursorID,
- RT_CURSOR, client, DixUseAccess);
- if (rc != Success)
- {
- error = (rc == BadValue) ? BadCursor : rc;
- client->errorValue = cursorID;
- goto PatchUp;
- }
- }
-
- if (pCursor != wCursor (pWin))
- {
- /*
- * patch up child windows so they don't lose cursors.
- */
-
- for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)
- {
- if (!pChild->optional && !pChild->cursorIsNone &&
- !MakeWindowOptional (pChild))
- {
- error = BadAlloc;
- goto PatchUp;
- }
- }
-
- pOldCursor = 0;
- if (pCursor == (CursorPtr) None)
- {
- pWin->cursorIsNone = TRUE;
- if (pWin->optional)
- {
- pOldCursor = pWin->optional->cursor;
- pWin->optional->cursor = (CursorPtr) None;
- checkOptional = TRUE;
- }
- } else {
- if (!pWin->optional)
- {
- if (!MakeWindowOptional (pWin))
- {
- error = BadAlloc;
- goto PatchUp;
- }
- }
- else if (pWin->parent && pCursor == wCursor (pWin->parent))
- checkOptional = TRUE;
- pOldCursor = pWin->optional->cursor;
- pWin->optional->cursor = pCursor;
- pCursor->refcnt++;
- pWin->cursorIsNone = FALSE;
- /*
- * check on any children now matching the new cursor
- */
-
- for (pChild=pWin->firstChild; pChild; pChild=pChild->nextSib)
- {
- if (pChild->optional &&
- (pChild->optional->cursor == pCursor))
- CheckWindowOptionalNeed (pChild);
- }
- }
-
- if (pWin->realized)
- WindowHasNewCursor( pWin);
-
- /* Can't free cursor until here - old cursor
- * is needed in WindowHasNewCursor
- */
- if (pOldCursor)
- FreeCursor (pOldCursor, (Cursor)0);
- }
- break;
- default:
- error = BadValue;
- client->errorValue = vmask;
- goto PatchUp;
- }
- vmaskCopy |= index2;
- }
-PatchUp:
- if (checkOptional)
- CheckWindowOptionalNeed (pWin);
-
- /* We SHOULD check for an error value here XXX */
- (*pScreen->ChangeWindowAttributes)(pWin, vmaskCopy);
-
- /*
- If the border contents have changed, redraw the border.
- Note that this has to be done AFTER pScreen->ChangeWindowAttributes
- for the tile to be rotated, and the correct function selected.
- */
- if (((vmaskCopy & (CWBorderPixel | CWBorderPixmap)) || borderRelative)
- && pWin->viewable && HasBorder (pWin))
- {
- RegionRec exposed;
-
- REGION_NULL(pScreen, &exposed);
- REGION_SUBTRACT(pScreen, &exposed, &pWin->borderClip, &pWin->winSize);
- miPaintWindow(pWin, &exposed, PW_BORDER);
- REGION_UNINIT(pScreen, &exposed);
- }
- return error;
-}
-
-
-/*****
- * GetWindowAttributes
- * Notice that this is different than ChangeWindowAttributes
- *****/
-
-void
-GetWindowAttributes(WindowPtr pWin, ClientPtr client, xGetWindowAttributesReply *wa)
-{
- wa->type = X_Reply;
- wa->bitGravity = pWin->bitGravity;
- wa->winGravity = pWin->winGravity;
- if (pWin->forcedBS && pWin->backingStore != Always)
- wa->backingStore = NotUseful;
- else
- wa->backingStore = pWin->backingStore;
- wa->length = bytes_to_int32(sizeof(xGetWindowAttributesReply) -
- sizeof(xGenericReply));
- wa->sequenceNumber = client->sequence;
- wa->backingBitPlanes = wBackingBitPlanes (pWin);
- wa->backingPixel = wBackingPixel (pWin);
- wa->saveUnder = (BOOL)pWin->saveUnder;
- wa->override = pWin->overrideRedirect;
- if (!pWin->mapped)
- wa->mapState = IsUnmapped;
- else if (pWin->realized)
- wa->mapState = IsViewable;
- else
- wa->mapState = IsUnviewable;
-
- wa->colormap = wColormap (pWin);
- wa->mapInstalled = (wa->colormap == None) ? xFalse
- : IsMapInstalled(wa->colormap, pWin);
-
- wa->yourEventMask = EventMaskForClient(pWin, client);
- wa->allEventMasks = pWin->eventMask | wOtherEventMasks (pWin);
- wa->doNotPropagateMask = wDontPropagateMask (pWin);
- wa->class = pWin->drawable.class;
- wa->visualID = wVisual (pWin);
-}
-
-
-WindowPtr
-MoveWindowInStack(WindowPtr pWin, WindowPtr pNextSib)
-{
- WindowPtr pParent = pWin->parent;
- WindowPtr pFirstChange = pWin; /* highest window where list changes */
-
- if (pWin->nextSib != pNextSib)
- {
- WindowPtr pOldNextSib = pWin->nextSib;
-
- if (!pNextSib) /* move to bottom */
- {
- if (pParent->firstChild == pWin)
- pParent->firstChild = pWin->nextSib;
- /* if (pWin->nextSib) */ /* is always True: pNextSib == NULL
- * and pWin->nextSib != pNextSib
- * therefore pWin->nextSib != NULL */
- pFirstChange = pWin->nextSib;
- pWin->nextSib->prevSib = pWin->prevSib;
- if (pWin->prevSib)
- pWin->prevSib->nextSib = pWin->nextSib;
- pParent->lastChild->nextSib = pWin;
- pWin->prevSib = pParent->lastChild;
- pWin->nextSib = NullWindow;
- pParent->lastChild = pWin;
- }
- else if (pParent->firstChild == pNextSib) /* move to top */
- {
- pFirstChange = pWin;
- if (pParent->lastChild == pWin)
- pParent->lastChild = pWin->prevSib;
- if (pWin->nextSib)
- pWin->nextSib->prevSib = pWin->prevSib;
- if (pWin->prevSib)
- pWin->prevSib->nextSib = pWin->nextSib;
- pWin->nextSib = pParent->firstChild;
- pWin->prevSib = (WindowPtr ) NULL;
- pNextSib->prevSib = pWin;
- pParent->firstChild = pWin;
- }
- else /* move in middle of list */
- {
- WindowPtr pOldNext = pWin->nextSib;
-
- pFirstChange = NullWindow;
- if (pParent->firstChild == pWin)
- pFirstChange = pParent->firstChild = pWin->nextSib;
- if (pParent->lastChild == pWin) {
- pFirstChange = pWin;
- pParent->lastChild = pWin->prevSib;
- }
- if (pWin->nextSib)
- pWin->nextSib->prevSib = pWin->prevSib;
- if (pWin->prevSib)
- pWin->prevSib->nextSib = pWin->nextSib;
- pWin->nextSib = pNextSib;
- pWin->prevSib = pNextSib->prevSib;
- if (pNextSib->prevSib)
- pNextSib->prevSib->nextSib = pWin;
- pNextSib->prevSib = pWin;
- if (!pFirstChange) { /* do we know it yet? */
- pFirstChange = pParent->firstChild; /* no, search from top */
- while ((pFirstChange != pWin) && (pFirstChange != pOldNext))
- pFirstChange = pFirstChange->nextSib;
- }
- }
- if(pWin->drawable.pScreen->RestackWindow)
- (*pWin->drawable.pScreen->RestackWindow)(pWin, pOldNextSib);
- }
-
-#ifdef ROOTLESS
- /*
- * In rootless mode we can't optimize away window restacks.
- * There may be non-X windows around, so even if the window
- * is in the correct position from X's point of view,
- * the underlying window system may want to reorder it.
- */
- else if (pWin->drawable.pScreen->RestackWindow)
- (*pWin->drawable.pScreen->RestackWindow)(pWin, pWin->nextSib);
-#endif
-
- return( pFirstChange );
-}
-
-void
-SetWinSize (WindowPtr pWin)
-{
-#ifdef COMPOSITE
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- BoxRec box;
-
- /*
- * Redirected clients get clip list equal to their
- * own geometry, not clipped to their parent
- */
- box.x1 = pWin->drawable.x;
- box.y1 = pWin->drawable.y;
- box.x2 = pWin->drawable.x + pWin->drawable.width;
- box.y2 = pWin->drawable.y + pWin->drawable.height;
- REGION_RESET (pScreen, &pWin->winSize, &box);
- }
- else
-#endif
- ClippedRegionFromBox(pWin->parent, &pWin->winSize,
- pWin->drawable.x, pWin->drawable.y,
- (int)pWin->drawable.width,
- (int)pWin->drawable.height);
- if (wBoundingShape (pWin) || wClipShape (pWin)) {
- ScreenPtr pScreen;
- pScreen = pWin->drawable.pScreen;
-
- REGION_TRANSLATE(pScreen, &pWin->winSize, - pWin->drawable.x,
- - pWin->drawable.y);
- if (wBoundingShape (pWin))
- REGION_INTERSECT(pScreen, &pWin->winSize, &pWin->winSize,
- wBoundingShape (pWin));
- if (wClipShape (pWin))
- REGION_INTERSECT(pScreen, &pWin->winSize, &pWin->winSize,
- wClipShape (pWin));
- REGION_TRANSLATE(pScreen, &pWin->winSize, pWin->drawable.x,
- pWin->drawable.y);
- }
-}
-
-void
-SetBorderSize (WindowPtr pWin)
-{
- int bw;
-
- if (HasBorder (pWin)) {
- bw = wBorderWidth (pWin);
-#ifdef COMPOSITE
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- BoxRec box;
-
- /*
- * Redirected clients get clip list equal to their
- * own geometry, not clipped to their parent
- */
- box.x1 = pWin->drawable.x - bw;
- box.y1 = pWin->drawable.y - bw;
- box.x2 = pWin->drawable.x + pWin->drawable.width + bw;
- box.y2 = pWin->drawable.y + pWin->drawable.height + bw;
- REGION_RESET (pScreen, &pWin->borderSize, &box);
- }
- else
-#endif
- ClippedRegionFromBox(pWin->parent, &pWin->borderSize,
- pWin->drawable.x - bw, pWin->drawable.y - bw,
- (int)(pWin->drawable.width + (bw<<1)),
- (int)(pWin->drawable.height + (bw<<1)));
- if (wBoundingShape (pWin)) {
- ScreenPtr pScreen;
- pScreen = pWin->drawable.pScreen;
-
- REGION_TRANSLATE(pScreen, &pWin->borderSize, - pWin->drawable.x,
- - pWin->drawable.y);
- REGION_INTERSECT(pScreen, &pWin->borderSize, &pWin->borderSize,
- wBoundingShape (pWin));
- REGION_TRANSLATE(pScreen, &pWin->borderSize, pWin->drawable.x,
- pWin->drawable.y);
- REGION_UNION(pScreen, &pWin->borderSize, &pWin->borderSize,
- &pWin->winSize);
- }
- } else {
- REGION_COPY(pWin->drawable.pScreen, &pWin->borderSize,
- &pWin->winSize);
- }
-}
-
-/**
- *
- * \param x,y new window position
- * \param oldx,oldy old window position
- * \param destx,desty position relative to gravity
- */
-
-void
-GravityTranslate (int x, int y, int oldx, int oldy,
- int dw, int dh, unsigned gravity,
- int *destx, int *desty)
-{
- switch (gravity) {
- case NorthGravity:
- *destx = x + dw / 2;
- *desty = y;
- break;
- case NorthEastGravity:
- *destx = x + dw;
- *desty = y;
- break;
- case WestGravity:
- *destx = x;
- *desty = y + dh / 2;
- break;
- case CenterGravity:
- *destx = x + dw / 2;
- *desty = y + dh / 2;
- break;
- case EastGravity:
- *destx = x + dw;
- *desty = y + dh / 2;
- break;
- case SouthWestGravity:
- *destx = x;
- *desty = y + dh;
- break;
- case SouthGravity:
- *destx = x + dw / 2;
- *desty = y + dh;
- break;
- case SouthEastGravity:
- *destx = x + dw;
- *desty = y + dh;
- break;
- case StaticGravity:
- *destx = oldx;
- *desty = oldy;
- break;
- default:
- *destx = x;
- *desty = y;
- break;
- }
-}
-
-/* XXX need to retile border on each window with ParentRelative origin */
-void
-ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
-{
- ScreenPtr pScreen;
- WindowPtr pSib, pChild;
- Bool resized = (dw || dh);
-
- pScreen = pWin->drawable.pScreen;
-
- for (pSib = pWin->firstChild; pSib; pSib = pSib->nextSib)
- {
- if (resized && (pSib->winGravity > NorthWestGravity))
- {
- int cwsx, cwsy;
-
- cwsx = pSib->origin.x;
- cwsy = pSib->origin.y;
- GravityTranslate (cwsx, cwsy, cwsx - dx, cwsy - dy, dw, dh,
- pSib->winGravity, &cwsx, &cwsy);
- if (cwsx != pSib->origin.x || cwsy != pSib->origin.y)
- {
- xEvent event;
-
- event.u.u.type = GravityNotify;
- event.u.gravity.window = pSib->drawable.id;
- event.u.gravity.x = cwsx - wBorderWidth (pSib);
- event.u.gravity.y = cwsy - wBorderWidth (pSib);
- DeliverEvents (pSib, &event, 1, NullWindow);
- pSib->origin.x = cwsx;
- pSib->origin.y = cwsy;
- }
- }
- pSib->drawable.x = pWin->drawable.x + pSib->origin.x;
- pSib->drawable.y = pWin->drawable.y + pSib->origin.y;
- SetWinSize (pSib);
- SetBorderSize (pSib);
- (*pScreen->PositionWindow)(pSib, pSib->drawable.x, pSib->drawable.y);
-
- if ( (pChild = pSib->firstChild) )
- {
- while (1)
- {
- pChild->drawable.x = pChild->parent->drawable.x +
- pChild->origin.x;
- pChild->drawable.y = pChild->parent->drawable.y +
- pChild->origin.y;
- SetWinSize (pChild);
- SetBorderSize (pChild);
- (*pScreen->PositionWindow)(pChild,
- pChild->drawable.x, pChild->drawable.y);
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- while (!pChild->nextSib && (pChild != pSib))
- pChild = pChild->parent;
- if (pChild == pSib)
- break;
- pChild = pChild->nextSib;
- }
- }
- }
-}
-
-#define GET_INT16(m, f) \
- if (m & mask) \
- { \
- f = (INT16) *pVlist;\
- pVlist++; \
- }
-#define GET_CARD16(m, f) \
- if (m & mask) \
- { \
- f = (CARD16) *pVlist;\
- pVlist++;\
- }
-
-#define GET_CARD8(m, f) \
- if (m & mask) \
- { \
- f = (CARD8) *pVlist;\
- pVlist++;\
- }
-
-#define ChangeMask ((Mask)(CWX | CWY | CWWidth | CWHeight))
-
-#define IllegalInputOnlyConfigureMask (CWBorderWidth)
-
-/*
- * IsSiblingAboveMe
- * returns Above if pSib above pMe in stack or Below otherwise
- */
-
-static int
-IsSiblingAboveMe(
- WindowPtr pMe,
- WindowPtr pSib)
-{
- WindowPtr pWin;
-
- pWin = pMe->parent->firstChild;
- while (pWin)
- {
- if (pWin == pSib)
- return(Above);
- else if (pWin == pMe)
- return(Below);
- pWin = pWin->nextSib;
- }
- return(Below);
-}
-
-static BoxPtr
-WindowExtents(
- WindowPtr pWin,
- BoxPtr pBox)
-{
- pBox->x1 = pWin->drawable.x - wBorderWidth (pWin);
- pBox->y1 = pWin->drawable.y - wBorderWidth (pWin);
- pBox->x2 = pWin->drawable.x + (int)pWin->drawable.width
- + wBorderWidth (pWin);
- pBox->y2 = pWin->drawable.y + (int)pWin->drawable.height
- + wBorderWidth (pWin);
- return(pBox);
-}
-
-#define IS_SHAPED(pWin) (wBoundingShape (pWin) != (RegionPtr) NULL)
-
-static RegionPtr
-MakeBoundingRegion (
- WindowPtr pWin,
- BoxPtr pBox)
-{
- RegionPtr pRgn;
- ScreenPtr pScreen;
- pScreen = pWin->drawable.pScreen;
-
- pRgn = REGION_CREATE(pScreen, pBox, 1);
- if (wBoundingShape (pWin)) {
- REGION_TRANSLATE(pScreen, pRgn, -pWin->origin.x,
- -pWin->origin.y);
- REGION_INTERSECT(pScreen, pRgn, pRgn, wBoundingShape (pWin));
- REGION_TRANSLATE(pScreen, pRgn, pWin->origin.x,
- pWin->origin.y);
- }
- return pRgn;
-}
-
-static Bool
-ShapeOverlap (
- WindowPtr pWin,
- BoxPtr pWinBox,
- WindowPtr pSib,
- BoxPtr pSibBox)
-{
- RegionPtr pWinRgn, pSibRgn;
- ScreenPtr pScreen;
- Bool ret;
-
- if (!IS_SHAPED(pWin) && !IS_SHAPED(pSib))
- return TRUE;
- pScreen = pWin->drawable.pScreen;
- pWinRgn = MakeBoundingRegion (pWin, pWinBox);
- pSibRgn = MakeBoundingRegion (pSib, pSibBox);
- REGION_INTERSECT(pScreen, pWinRgn, pWinRgn, pSibRgn);
- ret = REGION_NOTEMPTY(pScreen, pWinRgn);
- REGION_DESTROY(pScreen, pWinRgn);
- REGION_DESTROY(pScreen, pSibRgn);
- return ret;
-}
-
-static Bool
-AnyWindowOverlapsMe(
- WindowPtr pWin,
- WindowPtr pHead,
- BoxPtr box)
-{
- WindowPtr pSib;
- BoxRec sboxrec;
- BoxPtr sbox;
-
- for (pSib = pWin->prevSib; pSib != pHead; pSib = pSib->prevSib)
- {
- if (pSib->mapped)
- {
- sbox = WindowExtents(pSib, &sboxrec);
- if (BOXES_OVERLAP(sbox, box)
- && ShapeOverlap (pWin, box, pSib, sbox)
- )
- return(TRUE);
- }
- }
- return(FALSE);
-}
-
-static Bool
-IOverlapAnyWindow(
- WindowPtr pWin,
- BoxPtr box)
-{
- WindowPtr pSib;
- BoxRec sboxrec;
- BoxPtr sbox;
-
- for (pSib = pWin->nextSib; pSib; pSib = pSib->nextSib)
- {
- if (pSib->mapped)
- {
- sbox = WindowExtents(pSib, &sboxrec);
- if (BOXES_OVERLAP(sbox, box)
- && ShapeOverlap (pWin, box, pSib, sbox)
- )
- return(TRUE);
- }
- }
- return(FALSE);
-}
-
-/*
- * WhereDoIGoInTheStack()
- * Given pWin and pSib and the relationshipe smode, return
- * the window that pWin should go ABOVE.
- * If a pSib is specified:
- * Above: pWin is placed just above pSib
- * Below: pWin is placed just below pSib
- * TopIf: if pSib occludes pWin, then pWin is placed
- * at the top of the stack
- * BottomIf: if pWin occludes pSib, then pWin is
- * placed at the bottom of the stack
- * Opposite: if pSib occludes pWin, then pWin is placed at the
- * top of the stack, else if pWin occludes pSib, then
- * pWin is placed at the bottom of the stack
- *
- * If pSib is NULL:
- * Above: pWin is placed at the top of the stack
- * Below: pWin is placed at the bottom of the stack
- * TopIf: if any sibling occludes pWin, then pWin is placed at
- * the top of the stack
- * BottomIf: if pWin occludes any sibline, then pWin is placed at
- * the bottom of the stack
- * Opposite: if any sibling occludes pWin, then pWin is placed at
- * the top of the stack, else if pWin occludes any
- * sibling, then pWin is placed at the bottom of the stack
- *
- */
-
-static WindowPtr
-WhereDoIGoInTheStack(
- WindowPtr pWin,
- WindowPtr pSib,
- short x,
- short y,
- unsigned short w,
- unsigned short h,
- int smode)
-{
- BoxRec box;
- ScreenPtr pScreen;
- WindowPtr pHead, pFirst;
-
- if ((pWin == pWin->parent->firstChild) &&
- (pWin == pWin->parent->lastChild))
- return((WindowPtr ) NULL);
- pHead = RealChildHead(pWin->parent);
- pFirst = pHead ? pHead->nextSib : pWin->parent->firstChild;
- pScreen = pWin->drawable.pScreen;
- box.x1 = x;
- box.y1 = y;
- box.x2 = x + (int)w;
- box.y2 = y + (int)h;
- switch (smode)
- {
- case Above:
- if (pSib)
- return(pSib);
- else if (pWin == pFirst)
- return(pWin->nextSib);
- else
- return(pFirst);
- case Below:
- if (pSib)
- if (pSib->nextSib != pWin)
- return(pSib->nextSib);
- else
- return(pWin->nextSib);
- else
- return NullWindow;
- case TopIf:
- if ((!pWin->mapped || (pSib && !pSib->mapped)))
- return(pWin->nextSib);
- else if (pSib)
- {
- if ((IsSiblingAboveMe(pWin, pSib) == Above) &&
- (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT))
- return(pFirst);
- else
- return(pWin->nextSib);
- }
- else if (AnyWindowOverlapsMe(pWin, pHead, &box))
- return(pFirst);
- else
- return(pWin->nextSib);
- case BottomIf:
- if ((!pWin->mapped || (pSib && !pSib->mapped)))
- return(pWin->nextSib);
- else if (pSib)
- {
- if ((IsSiblingAboveMe(pWin, pSib) == Below) &&
- (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT))
- return NullWindow;
- else
- return(pWin->nextSib);
- }
- else if (IOverlapAnyWindow(pWin, &box))
- return NullWindow;
- else
- return(pWin->nextSib);
- case Opposite:
- if ((!pWin->mapped || (pSib && !pSib->mapped)))
- return(pWin->nextSib);
- else if (pSib)
- {
- if (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT)
- {
- if (IsSiblingAboveMe(pWin, pSib) == Above)
- return(pFirst);
- else
- return NullWindow;
- }
- else
- return(pWin->nextSib);
- }
- else if (AnyWindowOverlapsMe(pWin, pHead, &box))
- {
- /* If I'm occluded, I can't possibly be the first child
- * if (pWin == pWin->parent->firstChild)
- * return pWin->nextSib;
- */
- return(pFirst);
- }
- else if (IOverlapAnyWindow(pWin, &box))
- return NullWindow;
- else
- return pWin->nextSib;
- default:
- {
- /* should never happen; make something up. */
- return pWin->nextSib;
- }
- }
-}
-
-static void
-ReflectStackChange(
- WindowPtr pWin,
- WindowPtr pSib,
- VTKind kind)
-{
-/* Note that pSib might be NULL */
-
- Bool WasViewable = (Bool)pWin->viewable;
- Bool anyMarked;
- WindowPtr pFirstChange;
- WindowPtr pLayerWin;
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- /* if this is a root window, can't be restacked */
- if (!pWin->parent)
- return;
-
- pFirstChange = MoveWindowInStack(pWin, pSib);
-
- if (WasViewable)
- {
- anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange,
- &pLayerWin);
- if (pLayerWin != pWin) pFirstChange = pLayerWin;
- if (anyMarked)
- {
- (*pScreen->ValidateTree)(pLayerWin->parent, pFirstChange, kind);
- (*pScreen->HandleExposures)(pLayerWin->parent);
- }
- if (anyMarked && pWin->drawable.pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstChange, kind);
- }
- if (pWin->realized)
- WindowsRestructured ();
-}
-
-/*****
- * ConfigureWindow
- *****/
-
-int
-ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
-{
-#define RESTACK_WIN 0
-#define MOVE_WIN 1
-#define RESIZE_WIN 2
-#define REBORDER_WIN 3
- WindowPtr pSib = NullWindow;
- WindowPtr pParent = pWin->parent;
- Window sibwid = 0;
- Mask index2, tmask;
- XID *pVlist;
- short x, y, beforeX, beforeY;
- unsigned short w = pWin->drawable.width,
- h = pWin->drawable.height,
- bw = pWin->borderWidth;
- int rc, action, smode = Above;
- xEvent event;
-
- if ((pWin->drawable.class == InputOnly) && (mask & IllegalInputOnlyConfigureMask))
- return(BadMatch);
-
- if ((mask & CWSibling) && !(mask & CWStackMode))
- return(BadMatch);
-
- pVlist = vlist;
-
- if (pParent)
- {
- x = pWin->drawable.x - pParent->drawable.x - (int)bw;
- y = pWin->drawable.y - pParent->drawable.y - (int)bw;
- }
- else
- {
- x = pWin->drawable.x;
- y = pWin->drawable.y;
- }
- beforeX = x;
- beforeY = y;
- action = RESTACK_WIN;
- if ((mask & (CWX | CWY)) && (!(mask & (CWHeight | CWWidth))))
- {
- GET_INT16(CWX, x);
- GET_INT16(CWY, y);
- action = MOVE_WIN;
- }
- /* or should be resized */
- else if (mask & (CWX | CWY | CWWidth | CWHeight))
- {
- GET_INT16(CWX, x);
- GET_INT16(CWY, y);
- GET_CARD16(CWWidth, w);
- GET_CARD16 (CWHeight, h);
- if (!w || !h)
- {
- client->errorValue = 0;
- return BadValue;
- }
- action = RESIZE_WIN;
- }
- tmask = mask & ~ChangeMask;
- while (tmask)
- {
- index2 = (Mask)lowbit (tmask);
- tmask &= ~index2;
- switch (index2)
- {
- case CWBorderWidth:
- GET_CARD16(CWBorderWidth, bw);
- break;
- case CWSibling:
- sibwid = (Window ) *pVlist;
- pVlist++;
- rc = dixLookupWindow(&pSib, sibwid, client, DixGetAttrAccess);
- if (rc != Success)
- {
- client->errorValue = sibwid;
- return rc;
- }
- if (pSib->parent != pParent)
- return(BadMatch);
- if (pSib == pWin)
- return(BadMatch);
- break;
- case CWStackMode:
- GET_CARD8(CWStackMode, smode);
- if ((smode != TopIf) && (smode != BottomIf) &&
- (smode != Opposite) && (smode != Above) && (smode != Below))
- {
- client->errorValue = smode;
- return(BadValue);
- }
- break;
- default:
- client->errorValue = mask;
- return(BadValue);
- }
- }
- /* root really can't be reconfigured, so just return */
- if (!pParent)
- return Success;
-
- /* Figure out if the window should be moved. Doesnt
- make the changes to the window if event sent */
-
- if (mask & CWStackMode)
- pSib = WhereDoIGoInTheStack(pWin, pSib, pParent->drawable.x + x,
- pParent->drawable.y + y,
- w + (bw << 1), h + (bw << 1), smode);
- else
- pSib = pWin->nextSib;
-
-
- if ((!pWin->overrideRedirect) &&
- (RedirectSend(pParent)
- ))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = ConfigureRequest;
- event.u.configureRequest.window = pWin->drawable.id;
- if (mask & CWSibling)
- event.u.configureRequest.sibling = sibwid;
- else
- event.u.configureRequest.sibling = None;
- if (mask & CWStackMode)
- event.u.u.detail = smode;
- else
- event.u.u.detail = Above;
- event.u.configureRequest.x = x;
- event.u.configureRequest.y = y;
-#ifdef PANORAMIX
- if(!noPanoramiXExtension && (!pParent || !pParent->parent)) {
- event.u.configureRequest.x += panoramiXdataPtr[0].x;
- event.u.configureRequest.y += panoramiXdataPtr[0].y;
- }
-#endif
- event.u.configureRequest.width = w;
- event.u.configureRequest.height = h;
- event.u.configureRequest.borderWidth = bw;
- event.u.configureRequest.valueMask = mask;
- event.u.configureRequest.parent = pParent->drawable.id;
- if (MaybeDeliverEventsToClient(pParent, &event, 1,
- SubstructureRedirectMask, client) == 1)
- return(Success);
- }
- if (action == RESIZE_WIN)
- {
- Bool size_change = (w != pWin->drawable.width)
- || (h != pWin->drawable.height);
- if (size_change && ((pWin->eventMask|wOtherEventMasks(pWin)) & ResizeRedirectMask))
- {
- xEvent eventT;
- memset(&eventT, 0, sizeof(xEvent));
- eventT.u.u.type = ResizeRequest;
- eventT.u.resizeRequest.window = pWin->drawable.id;
- eventT.u.resizeRequest.width = w;
- eventT.u.resizeRequest.height = h;
- if (MaybeDeliverEventsToClient(pWin, &eventT, 1,
- ResizeRedirectMask, client) == 1)
- {
- /* if event is delivered, leave the actual size alone. */
- w = pWin->drawable.width;
- h = pWin->drawable.height;
- size_change = FALSE;
- }
- }
- if (!size_change)
- {
- if (mask & (CWX | CWY))
- action = MOVE_WIN;
- else if (mask & (CWStackMode | CWBorderWidth))
- action = RESTACK_WIN;
- else /* really nothing to do */
- return(Success) ;
- }
- }
-
- if (action == RESIZE_WIN)
- /* we've already checked whether there's really a size change */
- goto ActuallyDoSomething;
- if ((mask & CWX) && (x != beforeX))
- goto ActuallyDoSomething;
- if ((mask & CWY) && (y != beforeY))
- goto ActuallyDoSomething;
- if ((mask & CWBorderWidth) && (bw != wBorderWidth (pWin)))
- goto ActuallyDoSomething;
- if (mask & CWStackMode)
- {
-#ifndef ROOTLESS
- /* See above for why we always reorder in rootless mode. */
- if (pWin->nextSib != pSib)
-#endif
- goto ActuallyDoSomething;
- }
- return(Success);
-
-ActuallyDoSomething:
- if (SubStrSend(pWin, pParent))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = ConfigureNotify;
- event.u.configureNotify.window = pWin->drawable.id;
- if (pSib)
- event.u.configureNotify.aboveSibling = pSib->drawable.id;
- else
- event.u.configureNotify.aboveSibling = None;
- event.u.configureNotify.x = x;
- event.u.configureNotify.y = y;
-#ifdef PANORAMIX
- if(!noPanoramiXExtension && (!pParent || !pParent->parent)) {
- event.u.configureNotify.x += panoramiXdataPtr[0].x;
- event.u.configureNotify.y += panoramiXdataPtr[0].y;
- }
-#endif
- event.u.configureNotify.width = w;
- event.u.configureNotify.height = h;
- event.u.configureNotify.borderWidth = bw;
- event.u.configureNotify.override = pWin->overrideRedirect;
- DeliverEvents(pWin, &event, 1, NullWindow);
- }
- if (mask & CWBorderWidth)
- {
- if (action == RESTACK_WIN)
- {
- action = MOVE_WIN;
- pWin->borderWidth = bw;
- }
- else if ((action == MOVE_WIN) &&
- (beforeX + wBorderWidth (pWin) == x + (int)bw) &&
- (beforeY + wBorderWidth (pWin) == y + (int)bw))
- {
- action = REBORDER_WIN;
- (*pWin->drawable.pScreen->ChangeBorderWidth)(pWin, bw);
- }
- else
- pWin->borderWidth = bw;
- }
- if (action == MOVE_WIN)
- (*pWin->drawable.pScreen->MoveWindow)(pWin, x, y, pSib,
- (mask & CWBorderWidth) ? VTOther : VTMove);
- else if (action == RESIZE_WIN)
- (*pWin->drawable.pScreen->ResizeWindow)(pWin, x, y, w, h, pSib);
- else if (mask & CWStackMode)
- ReflectStackChange(pWin, pSib, VTOther);
-
- if (action != RESTACK_WIN)
- CheckCursorConfinement(pWin);
- return(Success);
-#undef RESTACK_WIN
-#undef MOVE_WIN
-#undef RESIZE_WIN
-#undef REBORDER_WIN
-}
-
-
-/******
- *
- * CirculateWindow
- * For RaiseLowest, raises the lowest mapped child (if any) that is
- * obscured by another child to the top of the stack. For LowerHighest,
- * lowers the highest mapped child (if any) that is obscuring another
- * child to the bottom of the stack. Exposure processing is performed
- *
- ******/
-
-int
-CirculateWindow(WindowPtr pParent, int direction, ClientPtr client)
-{
- WindowPtr pWin, pHead, pFirst;
- xEvent event;
- BoxRec box;
-
- pHead = RealChildHead(pParent);
- pFirst = pHead ? pHead->nextSib : pParent->firstChild;
- if (direction == RaiseLowest)
- {
- for (pWin = pParent->lastChild;
- (pWin != pHead) &&
- !(pWin->mapped &&
- AnyWindowOverlapsMe(pWin, pHead, WindowExtents(pWin, &box)));
- pWin = pWin->prevSib) ;
- if (pWin == pHead)
- return Success;
- }
- else
- {
- for (pWin = pFirst;
- pWin &&
- !(pWin->mapped &&
- IOverlapAnyWindow(pWin, WindowExtents(pWin, &box)));
- pWin = pWin->nextSib) ;
- if (!pWin)
- return Success;
- }
-
- event.u.circulate.window = pWin->drawable.id;
- event.u.circulate.parent = pParent->drawable.id;
- event.u.circulate.event = pParent->drawable.id;
- if (direction == RaiseLowest)
- event.u.circulate.place = PlaceOnTop;
- else
- event.u.circulate.place = PlaceOnBottom;
-
- if (RedirectSend(pParent))
- {
- event.u.u.type = CirculateRequest;
- if (MaybeDeliverEventsToClient(pParent, &event, 1,
- SubstructureRedirectMask, client) == 1)
- return(Success);
- }
-
- event.u.u.type = CirculateNotify;
- DeliverEvents(pWin, &event, 1, NullWindow);
- ReflectStackChange(pWin,
- (direction == RaiseLowest) ? pFirst : NullWindow,
- VTStack);
-
- return(Success);
-}
-
-static int
-CompareWIDs(
- WindowPtr pWin,
- pointer value) /* must conform to VisitWindowProcPtr */
-{
- Window *wid = (Window *)value;
-
- if (pWin->drawable.id == *wid)
- return(WT_STOPWALKING);
- else
- return(WT_WALKCHILDREN);
-}
-
-/*****
- * ReparentWindow
- *****/
-
-int
-ReparentWindow(WindowPtr pWin, WindowPtr pParent,
- int x, int y, ClientPtr client)
-{
- WindowPtr pPrev, pPriorParent;
- Bool WasMapped = (Bool)(pWin->mapped);
- xEvent event;
- int bw = wBorderWidth (pWin);
- ScreenPtr pScreen;
-
- pScreen = pWin->drawable.pScreen;
- if (TraverseTree(pWin, CompareWIDs, (pointer)&pParent->drawable.id) == WT_STOPWALKING)
- return(BadMatch);
- if (!MakeWindowOptional(pWin))
- return(BadAlloc);
-
- if (WasMapped)
- UnmapWindow(pWin, FALSE);
-
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = ReparentNotify;
- event.u.reparent.window = pWin->drawable.id;
- event.u.reparent.parent = pParent->drawable.id;
- event.u.reparent.x = x;
- event.u.reparent.y = y;
-#ifdef PANORAMIX
- if(!noPanoramiXExtension && !pParent->parent) {
- event.u.reparent.x += panoramiXdataPtr[0].x;
- event.u.reparent.y += panoramiXdataPtr[0].y;
- }
-#endif
- event.u.reparent.override = pWin->overrideRedirect;
- DeliverEvents(pWin, &event, 1, pParent);
-
- /* take out of sibling chain */
-
- pPriorParent = pPrev = pWin->parent;
- if (pPrev->firstChild == pWin)
- pPrev->firstChild = pWin->nextSib;
- if (pPrev->lastChild == pWin)
- pPrev->lastChild = pWin->prevSib;
-
- if (pWin->nextSib)
- pWin->nextSib->prevSib = pWin->prevSib;
- if (pWin->prevSib)
- pWin->prevSib->nextSib = pWin->nextSib;
-
- /* insert at begining of pParent */
- pWin->parent = pParent;
- pPrev = RealChildHead(pParent);
- if (pPrev)
- {
- pWin->nextSib = pPrev->nextSib;
- if (pPrev->nextSib)
- pPrev->nextSib->prevSib = pWin;
- else
- pParent->lastChild = pWin;
- pPrev->nextSib = pWin;
- pWin->prevSib = pPrev;
- }
- else
- {
- pWin->nextSib = pParent->firstChild;
- pWin->prevSib = NullWindow;
- if (pParent->firstChild)
- pParent->firstChild->prevSib = pWin;
- else
- pParent->lastChild = pWin;
- pParent->firstChild = pWin;
- }
-
- pWin->origin.x = x + bw;
- pWin->origin.y = y + bw;
- pWin->drawable.x = x + bw + pParent->drawable.x;
- pWin->drawable.y = y + bw + pParent->drawable.y;
-
- /* clip to parent */
- SetWinSize (pWin);
- SetBorderSize (pWin);
-
- if (pScreen->ReparentWindow)
- (*pScreen->ReparentWindow)(pWin, pPriorParent);
- (*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y);
- ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
-
- CheckWindowOptionalNeed(pWin);
-
- if (WasMapped)
- MapWindow(pWin, client);
- RecalculateDeliverableEvents(pWin);
- return(Success);
-}
-
-static void
-RealizeTree(WindowPtr pWin)
-{
- WindowPtr pChild;
- RealizeWindowProcPtr Realize;
-
- Realize = pWin->drawable.pScreen->RealizeWindow;
- pChild = pWin;
- while (1)
- {
- if (pChild->mapped)
- {
- pChild->realized = TRUE;
- pChild->viewable = (pChild->drawable.class == InputOutput);
- (* Realize)(pChild);
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pWin))
- pChild = pChild->parent;
- if (pChild == pWin)
- return;
- pChild = pChild->nextSib;
- }
-}
-
-static WindowPtr windowDisableMapUnmapEvents;
-
-void
-DisableMapUnmapEvents(WindowPtr pWin)
-{
- assert (windowDisableMapUnmapEvents == NULL);
-
- windowDisableMapUnmapEvents = pWin;
-}
-
-void
-EnableMapUnmapEvents(WindowPtr pWin)
-{
- assert (windowDisableMapUnmapEvents != NULL);
-
- windowDisableMapUnmapEvents = NULL;
-}
-
-static Bool
-MapUnmapEventsEnabled(WindowPtr pWin)
-{
- return pWin != windowDisableMapUnmapEvents;
-}
-
-/*****
- * MapWindow
- * If some other client has selected SubStructureReDirect on the parent
- * and override-redirect is xFalse, then a MapRequest event is generated,
- * but the window remains unmapped. Otherwise, the window is mapped and a
- * MapNotify event is generated.
- *****/
-
-int
-MapWindow(WindowPtr pWin, ClientPtr client)
-{
- ScreenPtr pScreen;
-
- WindowPtr pParent;
- WindowPtr pLayerWin;
-
- if (pWin->mapped)
- return(Success);
-
- /* general check for permission to map window */
- if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW,
- pWin, RT_NONE, NULL, DixShowAccess) != Success)
- return Success;
-
- pScreen = pWin->drawable.pScreen;
- if ( (pParent = pWin->parent) )
- {
- xEvent event;
- Bool anyMarked;
-
- if ((!pWin->overrideRedirect) &&
- (RedirectSend(pParent)
- ))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = MapRequest;
- event.u.mapRequest.window = pWin->drawable.id;
- event.u.mapRequest.parent = pParent->drawable.id;
-
- if (MaybeDeliverEventsToClient(pParent, &event, 1,
- SubstructureRedirectMask, client) == 1)
- return(Success);
- }
-
- pWin->mapped = TRUE;
- if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = MapNotify;
- event.u.mapNotify.window = pWin->drawable.id;
- event.u.mapNotify.override = pWin->overrideRedirect;
- DeliverEvents(pWin, &event, 1, NullWindow);
- }
-
- if (!pParent->realized)
- return(Success);
- RealizeTree(pWin);
- if (pWin->viewable)
- {
- anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin,
- &pLayerWin);
- if (anyMarked)
- {
- (*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTMap);
- (*pScreen->HandleExposures)(pLayerWin->parent);
- }
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin, VTMap);
- }
- WindowsRestructured ();
- }
- else
- {
- RegionRec temp;
-
- pWin->mapped = TRUE;
- pWin->realized = TRUE; /* for roots */
- pWin->viewable = pWin->drawable.class == InputOutput;
- /* We SHOULD check for an error value here XXX */
- (*pScreen->RealizeWindow)(pWin);
- if (pScreen->ClipNotify)
- (*pScreen->ClipNotify) (pWin, 0, 0);
- if (pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(NullWindow, pWin, VTMap);
- REGION_NULL(pScreen, &temp);
- REGION_COPY(pScreen, &temp, &pWin->clipList);
- (*pScreen->WindowExposures) (pWin, &temp, NullRegion);
- REGION_UNINIT(pScreen, &temp);
- }
-
- return(Success);
-}
-
-
-/*****
- * MapSubwindows
- * Performs a MapWindow all unmapped children of the window, in top
- * to bottom stacking order.
- *****/
-
-void
-MapSubwindows(WindowPtr pParent, ClientPtr client)
-{
- WindowPtr pWin;
- WindowPtr pFirstMapped = NullWindow;
- ScreenPtr pScreen;
- Mask parentRedirect;
- Mask parentNotify;
- xEvent event;
- Bool anyMarked;
- WindowPtr pLayerWin;
-
- pScreen = pParent->drawable.pScreen;
- parentRedirect = RedirectSend(pParent);
- parentNotify = SubSend(pParent);
- anyMarked = FALSE;
- for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib)
- {
- if (!pWin->mapped)
- {
- if (parentRedirect && !pWin->overrideRedirect)
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = MapRequest;
- event.u.mapRequest.window = pWin->drawable.id;
- event.u.mapRequest.parent = pParent->drawable.id;
-
- if (MaybeDeliverEventsToClient(pParent, &event, 1,
- SubstructureRedirectMask, client) == 1)
- continue;
- }
-
- pWin->mapped = TRUE;
- if (parentNotify || StrSend(pWin))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = MapNotify;
- event.u.mapNotify.window = pWin->drawable.id;
- event.u.mapNotify.override = pWin->overrideRedirect;
- DeliverEvents(pWin, &event, 1, NullWindow);
- }
-
- if (!pFirstMapped)
- pFirstMapped = pWin;
- if (pParent->realized)
- {
- RealizeTree(pWin);
- if (pWin->viewable)
- {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin,
- (WindowPtr *)NULL);
- }
- }
- }
- }
-
- if (pFirstMapped)
- {
- pLayerWin = (*pScreen->GetLayerWindow)(pParent);
- if (pLayerWin->parent != pParent) {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pLayerWin,
- pLayerWin,
- (WindowPtr *)NULL);
- pFirstMapped = pLayerWin;
- }
- if (anyMarked)
- {
- (*pScreen->ValidateTree)(pLayerWin->parent, pFirstMapped, VTMap);
- (*pScreen->HandleExposures)(pLayerWin->parent);
- }
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstMapped,
- VTMap);
- WindowsRestructured ();
- }
-}
-
-static void
-UnrealizeTree(
- WindowPtr pWin,
- Bool fromConfigure)
-{
- WindowPtr pChild;
- UnrealizeWindowProcPtr Unrealize;
- MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
- int rc;
-
- Unrealize = pWin->drawable.pScreen->UnrealizeWindow;
- MarkUnrealizedWindow = pWin->drawable.pScreen->MarkUnrealizedWindow;
- pChild = pWin;
- while (1)
- {
- if (pChild->realized)
- {
- pChild->realized = FALSE;
- pChild->visibility = VisibilityNotViewable;
-#ifdef PANORAMIX
- if(!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) {
- PanoramiXRes *win;
- rc = dixLookupResourceByType((pointer *)&win,
- pChild->drawable.id, XRT_WINDOW,
- serverClient, DixWriteAccess);
- if (rc == Success)
- win->u.win.visibility = VisibilityNotViewable;
- }
-#endif
- (* Unrealize)(pChild);
- if (MapUnmapEventsEnabled(pWin))
- DeleteWindowFromAnyEvents(pChild, FALSE);
- if (pChild->viewable)
- {
- pChild->viewable = FALSE;
- (* MarkUnrealizedWindow)(pChild, pWin, fromConfigure);
- pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- }
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pWin))
- pChild = pChild->parent;
- if (pChild == pWin)
- return;
- pChild = pChild->nextSib;
- }
-}
-
-/*****
- * UnmapWindow
- * If the window is already unmapped, this request has no effect.
- * Otherwise, the window is unmapped and an UnMapNotify event is
- * generated. Cannot unmap a root window.
- *****/
-
-int
-UnmapWindow(WindowPtr pWin, Bool fromConfigure)
-{
- WindowPtr pParent;
- xEvent event;
- Bool wasRealized = (Bool)pWin->realized;
- Bool wasViewable = (Bool)pWin->viewable;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- WindowPtr pLayerWin = pWin;
-
- if ((!pWin->mapped) || (!(pParent = pWin->parent)))
- return(Success);
- if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
- {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = UnmapNotify;
- event.u.unmapNotify.window = pWin->drawable.id;
- event.u.unmapNotify.fromConfigure = fromConfigure;
- DeliverEvents(pWin, &event, 1, NullWindow);
- }
- if (wasViewable && !fromConfigure)
- {
- pWin->valdata = UnmapValData;
- (*pScreen->MarkOverlappedWindows)(pWin, pWin->nextSib, &pLayerWin);
- (*pScreen->MarkWindow)(pLayerWin->parent);
- }
- pWin->mapped = FALSE;
- if (wasRealized)
- UnrealizeTree(pWin, fromConfigure);
- if (wasViewable)
- {
- if (!fromConfigure)
- {
- (*pScreen->ValidateTree)(pLayerWin->parent, pWin, VTUnmap);
- (*pScreen->HandleExposures)(pLayerWin->parent);
- }
- if (!fromConfigure && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pWin, VTUnmap);
- }
- if (wasRealized && !fromConfigure)
- WindowsRestructured ();
- return(Success);
-}
-
-/*****
- * UnmapSubwindows
- * Performs an UnmapWindow request with the specified mode on all mapped
- * children of the window, in bottom to top stacking order.
- *****/
-
-void
-UnmapSubwindows(WindowPtr pWin)
-{
- WindowPtr pChild, pHead;
- xEvent event;
- Bool wasRealized = (Bool)pWin->realized;
- Bool wasViewable = (Bool)pWin->viewable;
- Bool anyMarked = FALSE;
- Mask parentNotify;
- WindowPtr pLayerWin = NULL;
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- if (!pWin->firstChild)
- return;
- parentNotify = SubSend(pWin);
- pHead = RealChildHead(pWin);
-
- if (wasViewable)
- pLayerWin = (*pScreen->GetLayerWindow)(pWin);
-
- for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
- {
- if (pChild->mapped)
- {
- if (parentNotify || StrSend(pChild))
- {
- event.u.u.type = UnmapNotify;
- event.u.unmapNotify.window = pChild->drawable.id;
- event.u.unmapNotify.fromConfigure = xFalse;
- DeliverEvents(pChild, &event, 1, NullWindow);
- }
- if (pChild->viewable)
- {
- pChild->valdata = UnmapValData;
- anyMarked = TRUE;
- }
- pChild->mapped = FALSE;
- if (pChild->realized)
- UnrealizeTree(pChild, FALSE);
- if (wasViewable)
- {
- }
- }
- }
- if (wasViewable)
- {
- if (anyMarked)
- {
- if (pLayerWin->parent == pWin)
- (*pScreen->MarkWindow)(pWin);
- else
- {
- WindowPtr ptmp;
- (*pScreen->MarkOverlappedWindows)(pWin, pLayerWin,
- (WindowPtr *)NULL);
- (*pScreen->MarkWindow)(pLayerWin->parent);
-
- /* Windows between pWin and pLayerWin may not have been marked */
- ptmp = pWin;
-
- while (ptmp != pLayerWin->parent)
- {
- (*pScreen->MarkWindow)(ptmp);
- ptmp = ptmp->parent;
- }
- pHead = pWin->firstChild;
- }
- (*pScreen->ValidateTree)(pLayerWin->parent, pHead, VTUnmap);
- (*pScreen->HandleExposures)(pLayerWin->parent);
- }
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pLayerWin->parent, pHead, VTUnmap);
- }
- if (wasRealized)
- WindowsRestructured ();
-}
-
-
-void
-HandleSaveSet(ClientPtr client)
-{
- WindowPtr pParent, pWin;
- int j;
-
- for (j=0; j<client->numSaved; j++)
- {
- pWin = SaveSetWindow(client->saveSet[j]);
-#ifdef XFIXES
- if (SaveSetToRoot(client->saveSet[j]))
- pParent = WindowTable[pWin->drawable.pScreen->myNum];
- else
-#endif
- {
- pParent = pWin->parent;
- while (pParent && (wClient (pParent) == client))
- pParent = pParent->parent;
- }
- if (pParent)
- {
- if (pParent != pWin->parent)
- {
-#ifdef XFIXES
- /* unmap first so that ReparentWindow doesn't remap */
- if (!SaveSetShouldMap (client->saveSet[j]))
- UnmapWindow(pWin, FALSE);
-#endif
- ReparentWindow(pWin, pParent,
- pWin->drawable.x - wBorderWidth (pWin) - pParent->drawable.x,
- pWin->drawable.y - wBorderWidth (pWin) - pParent->drawable.y,
- client);
- if(!pWin->realized && pWin->mapped)
- pWin->mapped = FALSE;
- }
-#ifdef XFIXES
- if (SaveSetShouldMap (client->saveSet[j]))
-#endif
- MapWindow(pWin, client);
- }
- }
- xfree(client->saveSet);
- client->numSaved = 0;
- client->saveSet = (SaveSetElt *)NULL;
-}
-
-/**
- *
- * \param x,y in root
- */
-Bool
-PointInWindowIsVisible(WindowPtr pWin, int x, int y)
-{
- BoxRec box;
-
- if (!pWin->realized)
- return (FALSE);
- if (POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderClip,
- x, y, &box)
- && (!wInputShape(pWin) ||
- POINT_IN_REGION(pWin->drawable.pScreen,
- wInputShape(pWin),
- x - pWin->drawable.x,
- y - pWin->drawable.y, &box)))
- return(TRUE);
- return(FALSE);
-}
-
-
-RegionPtr
-NotClippedByChildren(WindowPtr pWin)
-{
- ScreenPtr pScreen;
- RegionPtr pReg;
-
- pScreen = pWin->drawable.pScreen;
- pReg = REGION_CREATE(pScreen, NullBox, 1);
- if (pWin->parent ||
- screenIsSaved != SCREEN_SAVER_ON ||
- !HasSaverWindow (pWin->drawable.pScreen->myNum))
- {
- REGION_INTERSECT(pScreen, pReg, &pWin->borderClip, &pWin->winSize);
- }
- return(pReg);
-}
-
-void
-SendVisibilityNotify(WindowPtr pWin)
-{
- xEvent event;
-#ifndef NO_XINERAMA_PORT
- unsigned int visibility = pWin->visibility;
-#endif
- if (!MapUnmapEventsEnabled(pWin))
- return;
-#ifdef PANORAMIX
- /* This is not quite correct yet, but it's close */
- if(!noPanoramiXExtension) {
- PanoramiXRes *win;
- WindowPtr pWin2;
- int rc, i, Scrnum;
-
- Scrnum = pWin->drawable.pScreen->myNum;
-
- win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, Scrnum);
-
- if(!win || (win->u.win.visibility == visibility))
- return;
-
- switch(visibility) {
- case VisibilityUnobscured:
- for(i = 0; i < PanoramiXNumScreens; i++) {
- if(i == Scrnum) continue;
-
- rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient,
- DixWriteAccess);
-
- if (rc == Success) {
- if(pWin2->visibility == VisibilityPartiallyObscured)
- return;
-
- if(!i) pWin = pWin2;
- }
- }
- break;
- case VisibilityPartiallyObscured:
- if(Scrnum) {
- rc = dixLookupWindow(&pWin2, win->info[0].id, serverClient,
- DixWriteAccess);
- if (rc == Success) pWin = pWin2;
- }
- break;
- case VisibilityFullyObscured:
- for(i = 0; i < PanoramiXNumScreens; i++) {
- if(i == Scrnum) continue;
-
- rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient,
- DixWriteAccess);
-
- if (rc == Success) {
- if(pWin2->visibility != VisibilityFullyObscured)
- return;
-
- if(!i) pWin = pWin2;
- }
- }
- break;
- }
-
- win->u.win.visibility = visibility;
- }
-#endif
-
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = VisibilityNotify;
- event.u.visibility.window = pWin->drawable.id;
- event.u.visibility.state = visibility;
- DeliverEvents(pWin, &event, 1, NullWindow);
-}
-
-#define RANDOM_WIDTH 32
-
-#ifndef NOLOGOHACK
-static void DrawLogo(
- WindowPtr pWin
-);
-#endif
-
-int
-dixSaveScreens(ClientPtr client, int on, int mode)
-{
- int rc, i, what, type;
-
- if (on == SCREEN_SAVER_FORCER)
- {
- if (mode == ScreenSaverReset)
- what = SCREEN_SAVER_OFF;
- else
- what = SCREEN_SAVER_ON;
- type = what;
- }
- else
- {
- what = on;
- type = what;
- if (what == screenIsSaved)
- type = SCREEN_SAVER_CYCLE;
- }
-
- for (i = 0; i < screenInfo.numScreens; i++) {
- rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
- DixShowAccess | DixHideAccess);
- if (rc != Success)
- return rc;
- }
- for (i = 0; i < screenInfo.numScreens; i++)
- {
- if (on == SCREEN_SAVER_FORCER)
- (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], on);
- if (savedScreenInfo[i].ExternalScreenSaver)
- {
- if ((*savedScreenInfo[i].ExternalScreenSaver)
- (screenInfo.screens[i], type, on == SCREEN_SAVER_FORCER))
- continue;
- }
- if (type == screenIsSaved)
- continue;
- switch (type) {
- case SCREEN_SAVER_OFF:
- if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED)
- {
- (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i],
- what);
- }
- else if (HasSaverWindow (i))
- {
- savedScreenInfo[i].pWindow = NullWindow;
- FreeResource(savedScreenInfo[i].wid, RT_NONE);
- }
- break;
- case SCREEN_SAVER_CYCLE:
- if (savedScreenInfo[i].blanked == SCREEN_IS_TILED)
- {
- WindowPtr pWin = savedScreenInfo[i].pWindow;
- /* make it look like screen saver is off, so that
- * NotClippedByChildren will compute a clip list
- * for the root window, so miPaintWindow works
- */
- screenIsSaved = SCREEN_SAVER_OFF;
-#ifndef NOLOGOHACK
- if (logoScreenSaver)
- (*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, FALSE);
-#endif
- (*pWin->drawable.pScreen->MoveWindow)(pWin,
- (short)(-(rand() % RANDOM_WIDTH)),
- (short)(-(rand() % RANDOM_WIDTH)),
- pWin->nextSib, VTMove);
-#ifndef NOLOGOHACK
- if (logoScreenSaver)
- DrawLogo(pWin);
-#endif
- screenIsSaved = SCREEN_SAVER_ON;
- }
- /*
- * Call the DDX saver in case it wants to do something
- * at cycle time
- */
- else if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED)
- {
- (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i],
- type);
- }
- break;
- case SCREEN_SAVER_ON:
- if (ScreenSaverBlanking != DontPreferBlanking)
- {
- if ((* screenInfo.screens[i]->SaveScreen)
- (screenInfo.screens[i], what))
- {
- savedScreenInfo[i].blanked = SCREEN_IS_BLANKED;
- continue;
- }
- if ((ScreenSaverAllowExposures != DontAllowExposures) &&
- TileScreenSaver(i, SCREEN_IS_BLACK))
- {
- savedScreenInfo[i].blanked = SCREEN_IS_BLACK;
- continue;
- }
- }
- if ((ScreenSaverAllowExposures != DontAllowExposures) &&
- TileScreenSaver(i, SCREEN_IS_TILED))
- {
- savedScreenInfo[i].blanked = SCREEN_IS_TILED;
- }
- else
- savedScreenInfo[i].blanked = SCREEN_ISNT_SAVED;
- break;
- }
- }
- screenIsSaved = what;
- if (mode == ScreenSaverReset) {
- if (on == SCREEN_SAVER_FORCER) {
- UpdateCurrentTimeIf();
- lastDeviceEventTime = currentTime;
- }
- SetScreenSaverTimer();
- }
- return Success;
-}
-
-int
-SaveScreens(int on, int mode)
-{
- return dixSaveScreens(serverClient, on, mode);
-}
-
-static Bool
-TileScreenSaver(int i, int kind)
-{
- int j;
- int result;
- XID attributes[3];
- Mask mask;
- WindowPtr pWin;
- CursorMetricRec cm;
- unsigned char *srcbits, *mskbits;
- CursorPtr cursor;
- XID cursorID = 0;
- int attri;
-
- mask = 0;
- attri = 0;
- switch (kind) {
- case SCREEN_IS_TILED:
- switch (WindowTable[i]->backgroundState) {
- case BackgroundPixel:
- attributes[attri++] = WindowTable[i]->background.pixel;
- mask |= CWBackPixel;
- break;
- case BackgroundPixmap:
- attributes[attri++] = None;
- mask |= CWBackPixmap;
- break;
- default:
- break;
- }
- break;
- case SCREEN_IS_BLACK:
- attributes[attri++] = WindowTable[i]->drawable.pScreen->blackPixel;
- mask |= CWBackPixel;
- break;
- }
- mask |= CWOverrideRedirect;
- attributes[attri++] = xTrue;
-
- /*
- * create a blank cursor
- */
-
- cm.width=16;
- cm.height=16;
- cm.xhot=8;
- cm.yhot=8;
- srcbits = xalloc( BitmapBytePad(32)*16);
- mskbits = xalloc( BitmapBytePad(32)*16);
- if (!srcbits || !mskbits)
- {
- xfree(srcbits);
- xfree(mskbits);
- cursor = 0;
- }
- else
- {
- for (j=0; j<BitmapBytePad(32)*16; j++)
- srcbits[j] = mskbits[j] = 0x0;
- result = AllocARGBCursor(srcbits, mskbits, NULL, &cm, 0, 0, 0, 0, 0, 0,
- &cursor, serverClient, (XID)0);
- if (cursor)
- {
- cursorID = FakeClientID(0);
- if (AddResource (cursorID, RT_CURSOR, (pointer) cursor))
- {
- attributes[attri] = cursorID;
- mask |= CWCursor;
- }
- else
- cursor = 0;
- }
- else
- {
- xfree (srcbits);
- xfree (mskbits);
- }
- }
-
- pWin = savedScreenInfo[i].pWindow =
- CreateWindow(savedScreenInfo[i].wid,
- WindowTable[i],
- -RANDOM_WIDTH, -RANDOM_WIDTH,
- (unsigned short)screenInfo.screens[i]->width + RANDOM_WIDTH,
- (unsigned short)screenInfo.screens[i]->height + RANDOM_WIDTH,
- 0, InputOutput, mask, attributes, 0, serverClient,
- wVisual (WindowTable[i]), &result);
-
- if (cursor)
- FreeResource (cursorID, RT_NONE);
-
- if (!pWin)
- return FALSE;
-
- if (!AddResource(pWin->drawable.id, RT_WINDOW,
- (pointer)savedScreenInfo[i].pWindow))
- return FALSE;
-
- if (mask & CWBackPixmap)
- {
- MakeRootTile (pWin);
- (*pWin->drawable.pScreen->ChangeWindowAttributes)(pWin, CWBackPixmap);
- }
- MapWindow(pWin, serverClient);
-#ifndef NOLOGOHACK
- if (kind == SCREEN_IS_TILED && logoScreenSaver)
- DrawLogo(pWin);
-#endif
- return TRUE;
-}
-
-/*
- * FindWindowWithOptional
- *
- * search ancestors of the given window for an entry containing
- * a WindowOpt structure. Assumptions: some parent will
- * contain the structure.
- */
-
-WindowPtr
-FindWindowWithOptional (WindowPtr w)
-{
- do
- w = w->parent;
- while (!w->optional);
- return w;
-}
-
-/*
- * CheckWindowOptionalNeed
- *
- * check each optional entry in the given window to see if
- * the value is satisfied by the default rules. If so,
- * release the optional record
- */
-
-void
-CheckWindowOptionalNeed (WindowPtr w)
-{
- WindowOptPtr optional;
- WindowOptPtr parentOptional;
-
- if (!w->parent || !w->optional)
- return;
- optional = w->optional;
- if (optional->dontPropagateMask != DontPropagateMasks[w->dontPropagate])
- return;
- if (optional->otherEventMasks != 0)
- return;
- if (optional->otherClients != NULL)
- return;
- if (optional->passiveGrabs != NULL)
- return;
- if (optional->userProps != NULL)
- return;
- if (optional->backingBitPlanes != ~0L)
- return;
- if (optional->backingPixel != 0)
- return;
- if (optional->boundingShape != NULL)
- return;
- if (optional->clipShape != NULL)
- return;
- if (optional->inputShape != NULL)
- return;
- if (optional->inputMasks != NULL)
- return;
- if (optional->deviceCursors != NULL)
- {
- DevCursNodePtr pNode = optional->deviceCursors;
- while(pNode)
- {
- if (pNode->cursor != None)
- return;
- pNode = pNode->next;
- }
- }
-
- parentOptional = FindWindowWithOptional(w)->optional;
- if (optional->visual != parentOptional->visual)
- return;
- if (optional->cursor != None &&
- (optional->cursor != parentOptional->cursor ||
- w->parent->cursorIsNone))
- return;
- if (optional->colormap != parentOptional->colormap)
- return;
- DisposeWindowOptional (w);
-}
-
-/*
- * MakeWindowOptional
- *
- * create an optional record and initialize it with the default
- * values.
- */
-
-Bool
-MakeWindowOptional (WindowPtr pWin)
-{
- WindowOptPtr optional;
- WindowOptPtr parentOptional;
-
- if (pWin->optional)
- return TRUE;
- optional = xalloc (sizeof (WindowOptRec));
- if (!optional)
- return FALSE;
- optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate];
- optional->otherEventMasks = 0;
- optional->otherClients = NULL;
- optional->passiveGrabs = NULL;
- optional->userProps = NULL;
- optional->backingBitPlanes = ~0L;
- optional->backingPixel = 0;
- optional->boundingShape = NULL;
- optional->clipShape = NULL;
- optional->inputShape = NULL;
- optional->inputMasks = NULL;
- optional->deviceCursors = NULL;
-
- parentOptional = FindWindowWithOptional(pWin)->optional;
- optional->visual = parentOptional->visual;
- if (!pWin->cursorIsNone)
- {
- optional->cursor = parentOptional->cursor;
- optional->cursor->refcnt++;
- }
- else
- {
- optional->cursor = None;
- }
- optional->colormap = parentOptional->colormap;
- pWin->optional = optional;
- return TRUE;
-}
-
-/*
- * Changes the cursor struct for the given device and the given window.
- * A cursor that does not have a device cursor set will use whatever the
- * standard cursor is for the window. If all devices have a cursor set,
- * changing the window cursor (e.g. using XDefineCursor()) will not have any
- * visible effect. Only when one of the device cursors is set to None again,
- * this device's cursor will display the changed standard cursor.
- *
- * CursorIsNone of the window struct is NOT modified if you set a device
- * cursor.
- *
- * Assumption: If there is a node for a device in the list, the device has a
- * cursor. If the cursor is set to None, it is inherited by the parent.
- */
-int
-ChangeWindowDeviceCursor(WindowPtr pWin,
- DeviceIntPtr pDev,
- CursorPtr pCursor)
-{
- DevCursNodePtr pNode, pPrev;
- CursorPtr pOldCursor = NULL;
- ScreenPtr pScreen;
- WindowPtr pChild;
-
- if (!pWin->optional && !MakeWindowOptional(pWin))
- return BadAlloc;
-
- /* 1) Check if window has device cursor set
- * Yes: 1.1) swap cursor with given cursor if parent does not have same
- * cursor, free old cursor
- * 1.2) free old cursor, use parent cursor
- * No: 1.1) add node to beginning of list.
- * 1.2) add cursor to node if parent does not have same cursor
- * 1.3) use parent cursor if parent does not have same cursor
- * 2) Patch up children if child has a devcursor
- * 2.1) if child has cursor None, it inherited from parent, set to old
- * cursor
- * 2.2) if child has same cursor as new cursor, remove and set to None
- */
-
- pScreen = pWin->drawable.pScreen;
-
- if (WindowSeekDeviceCursor(pWin, pDev, &pNode, &pPrev))
- {
- /* has device cursor */
-
- if (pNode->cursor == pCursor)
- return Success;
-
- pOldCursor = pNode->cursor;
-
- if (!pCursor) /* remove from list */
- {
- if(pPrev)
- pPrev->next = pNode->next;
- else
- /* first item in list */
- pWin->optional->deviceCursors = pNode->next;
-
- xfree(pNode);
- goto out;
- }
-
- } else
- {
- /* no device cursor yet */
- DevCursNodePtr pNewNode;
-
- if (!pCursor)
- return Success;
-
- pNewNode = xalloc(sizeof(DevCursNodeRec));
- pNewNode->dev = pDev;
- pNewNode->next = pWin->optional->deviceCursors;
- pWin->optional->deviceCursors = pNewNode;
- pNode = pNewNode;
-
- }
-
- if (pCursor && WindowParentHasDeviceCursor(pWin, pDev, pCursor))
- pNode->cursor = None;
- else
- {
- pNode->cursor = pCursor;
- pCursor->refcnt++;
- }
-
- pNode = pPrev = NULL;
- /* fix up children */
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- if (WindowSeekDeviceCursor(pChild, pDev, &pNode, &pPrev))
- {
- if (pNode->cursor == None) /* inherited from parent */
- {
- pNode->cursor = pOldCursor;
- pOldCursor->refcnt++;
- } else if (pNode->cursor == pCursor)
- {
- pNode->cursor = None;
- FreeCursor(pCursor, (Cursor)0); /* fix up refcnt */
- }
- }
- }
-
-out:
- if (pWin->realized)
- WindowHasNewCursor(pWin);
-
- if (pOldCursor)
- FreeCursor(pOldCursor, (Cursor)0);
-
- /* FIXME: We SHOULD check for an error value here XXX
- (comment taken from ChangeWindowAttributes) */
- (*pScreen->ChangeWindowAttributes)(pWin, CWCursor);
-
- return Success;
-}
-
-/* Get device cursor for given device or None if none is set */
-CursorPtr
-WindowGetDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev)
-{
- DevCursorList pList;
-
- if (!pWin->optional || !pWin->optional->deviceCursors)
- return NULL;
-
- pList = pWin->optional->deviceCursors;
-
- while(pList)
- {
- if (pList->dev == pDev)
- {
- if (pList->cursor == None) /* inherited from parent */
- return WindowGetDeviceCursor(pWin->parent, pDev);
- else
- return pList->cursor;
- }
- pList = pList->next;
- }
- return NULL;
-}
-
-/* Searches for a DevCursorNode for the given window and device. If one is
- * found, return True and set pNode and pPrev to the node and to the node
- * before the node respectively. Otherwise return False.
- * If the device is the first in list, pPrev is set to NULL.
- */
-static Bool
-WindowSeekDeviceCursor(WindowPtr pWin,
- DeviceIntPtr pDev,
- DevCursNodePtr* pNode,
- DevCursNodePtr* pPrev)
-{
- DevCursorList pList;
-
- if (!pWin->optional)
- return FALSE;
-
- pList = pWin->optional->deviceCursors;
-
- if (pList && pList->dev == pDev)
- {
- *pNode = pList;
- *pPrev = NULL;
- return TRUE;
- }
-
- while(pList)
- {
- if (pList->next)
- {
- if (pList->next->dev == pDev)
- {
- *pNode = pList->next;
- *pPrev = pList;
- return TRUE;
- }
- }
- pList = pList->next;
- }
- return FALSE;
-}
-
-/* Return True if a parent has the same device cursor set or False if
- * otherwise
- */
-static Bool
-WindowParentHasDeviceCursor(WindowPtr pWin,
- DeviceIntPtr pDev,
- CursorPtr pCursor)
-{
- WindowPtr pParent;
- DevCursNodePtr pParentNode, pParentPrev;
-
- pParent = pWin->parent;
- while(pParent)
- {
- if (WindowSeekDeviceCursor(pParent, pDev,
- &pParentNode, &pParentPrev))
- {
- /* if there is a node in the list, the win has a dev cursor */
- if (!pParentNode->cursor) /* inherited. loop needs to cont. */
- {
- } else if (pParentNode->cursor == pCursor) /* inherit */
- return TRUE;
- else /* different cursor */
- return FALSE;
- }
- else
- /* parent does not have a device cursor for our device */
- return FALSE;
- }
- return FALSE;
-}
-
-#ifndef NOLOGOHACK
-static void
-DrawLogo(WindowPtr pWin)
-{
- DrawablePtr pDraw;
- ScreenPtr pScreen;
- int x, y;
- unsigned int width, height, size;
- GC *pGC;
- int rc, thin, gap, d31;
- DDXPointRec poly[4];
- ChangeGCVal fore[2], back[2];
- xrgb rgb[2];
- BITS32 fmask, bmask;
- ColormapPtr cmap;
-
- pDraw = (DrawablePtr)pWin;
- pScreen = pDraw->pScreen;
- x = -pWin->origin.x;
- y = -pWin->origin.y;
- width = pScreen->width;
- height = pScreen->height;
- pGC = GetScratchGC(pScreen->rootDepth, pScreen);
- if (!pGC)
- return;
-
- if ((rand() % 100) <= 17) /* make the probability for white fairly low */
- fore[0].val = pScreen->whitePixel;
- else
- fore[0].val = pScreen->blackPixel;
- if (pWin->backgroundState == BackgroundPixel) {
- rc = dixLookupResourceByType((pointer *)&cmap, wColormap(pWin),
- RT_COLORMAP, serverClient, DixReadAccess);
- if (rc == Success) {
- Pixel querypixels[2];
-
- querypixels[0] = fore[0].val;
- querypixels[1] = pWin->background.pixel;
- QueryColors(cmap, 2, querypixels, rgb);
- if ((rgb[0].red == rgb[1].red) &&
- (rgb[0].green == rgb[1].green) &&
- (rgb[0].blue == rgb[1].blue)) {
- if (fore[0].val == pScreen->blackPixel)
- fore[0].val = pScreen->whitePixel;
- else
- fore[0].val = pScreen->blackPixel;
- }
- }
- }
- fore[1].val = FillSolid;
- fmask = GCForeground|GCFillStyle;
- if (pWin->backgroundState == BackgroundPixel) {
- back[0].val = pWin->background.pixel;
- back[1].val = FillSolid;
- bmask = GCForeground|GCFillStyle;
- } else {
- back[0].val = 0;
- back[1].val = 0;
- dixChangeGC(NullClient, pGC, GCTileStipXOrigin|GCTileStipYOrigin,
- NULL, back);
- back[0].val = FillTiled;
- back[1].ptr = pWin->background.pixmap;
- bmask = GCFillStyle|GCTile;
- }
-
- /* should be the same as the reference function XmuDrawLogo() */
-
- size = width;
- if (height < width)
- size = height;
- size = RANDOM_WIDTH + rand() % (size - RANDOM_WIDTH);
- size &= ~1;
- x += rand() % (width - size);
- y += rand() % (height - size);
-
-/*
- * Draw what will be the thin strokes.
- *
- * -----
- * / /
- * / /
- * / /
- * / /
- * /____/
- * d
- *
- * Point d is 9/44 (~1/5) of the way across.
- */
-
- thin = (size / 11);
- if (thin < 1) thin = 1;
- gap = (thin+3) / 4;
- d31 = thin + thin + gap;
- poly[0].x = x + size; poly[0].y = y;
- poly[1].x = x + size-d31; poly[1].y = y;
- poly[2].x = x + 0; poly[2].y = y + size;
- poly[3].x = x + d31; poly[3].y = y + size;
- dixChangeGC(NullClient, pGC, fmask, NULL, fore);
- ValidateGC(pDraw, pGC);
- (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
-
-/*
- * Erase area not needed for lower thin stroke.
- *
- * ------
- * / /
- * / __ /
- * / / /
- * / / /
- * /__/__/
- */
-
- poly[0].x = x + d31/2; poly[0].y = y + size;
- poly[1].x = x + size / 2; poly[1].y = y + size/2;
- poly[2].x = x + (size/2)+(d31-(d31/2)); poly[2].y = y + size/2;
- poly[3].x = x + d31; poly[3].y = y + size;
- dixChangeGC(NullClient, pGC, bmask, NULL, back);
- ValidateGC(pDraw, pGC);
- (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
-
-/*
- * Erase area not needed for upper thin stroke.
- *
- * ------
- * / / /
- * /--/ /
- * / /
- * / /
- * /_____/
- */
-
- poly[0].x = x + size - d31/2; poly[0].y = y;
- poly[1].x = x + size / 2; poly[1].y = y + size/2;
- poly[2].x = x + (size/2)-(d31-(d31/2)); poly[2].y = y + size/2;
- poly[3].x = x + size - d31; poly[3].y = y;
- ValidateGC(pDraw, pGC);
- (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
-
-/*
- * Draw thick stroke.
- * Point b is 1/4 of the way across.
- *
- * b
- * -----
- * \ \
- * \ \
- * \ \
- * \ \
- * \____\
- */
-
- poly[0].x = x; poly[0].y = y;
- poly[1].x = x + size/4; poly[1].y = y;
- poly[2].x = x + size; poly[2].y = y + size;
- poly[3].x = x + size - size/4; poly[3].y = y + size;
- dixChangeGC(NullClient, pGC, fmask, NULL, fore);
- ValidateGC(pDraw, pGC);
- (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
-
-/*
- * Erase to create gap.
- *
- * /
- * /
- * /
- * /
- * /
- */
-
- poly[0].x = x + size- thin; poly[0].y = y;
- poly[1].x = x + size-( thin+gap); poly[1].y = y;
- poly[2].x = x + thin; poly[2].y = y + size;
- poly[3].x = x + thin + gap; poly[3].y = y + size;
- dixChangeGC(NullClient, pGC, bmask, NULL, back);
- ValidateGC(pDraw, pGC);
- (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
-
- FreeScratchGC(pGC);
-}
-
-#endif
+/*
+
+Copyright (c) 2006, Red Hat, Inc.
+
+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, 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 NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS 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 1987, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+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 THE OPEN GROUP 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.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, 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,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+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
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+
+*/
+
+/* The panoramix components contained the following notice */
+/*****************************************************************
+
+Copyright (c) 1991, 1997 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 "misc.h"
+#include "scrnintstr.h"
+#include "os.h"
+#include "regionstr.h"
+#include "validate.h"
+#include "windowstr.h"
+#include "input.h"
+#include "inputstr.h"
+#include "resource.h"
+#include "colormapst.h"
+#include "cursorstr.h"
+#include "dixstruct.h"
+#include "gcstruct.h"
+#include "servermd.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+#include "dixevents.h"
+#include "globals.h"
+#include "mi.h" /* miPaintWindow */
+
+#include "privates.h"
+#include "xace.h"
+
+/******
+ * Window stuff for server
+ *
+ * CreateRootWindow, CreateWindow, ChangeWindowAttributes,
+ * GetWindowAttributes, DeleteWindow, DestroySubWindows,
+ * HandleSaveSet, ReparentWindow, MapWindow, MapSubWindows,
+ * UnmapWindow, UnmapSubWindows, ConfigureWindow, CirculateWindow,
+ * ChangeWindowDeviceCursor
+ ******/
+
+static unsigned char _back_lsb[4] = {0x88, 0x22, 0x44, 0x11};
+static unsigned char _back_msb[4] = {0x11, 0x44, 0x22, 0x88};
+
+static Bool WindowParentHasDeviceCursor(WindowPtr pWin,
+ DeviceIntPtr pDev,
+ CursorPtr pCurs);
+static Bool
+WindowSeekDeviceCursor(WindowPtr pWin,
+ DeviceIntPtr pDev,
+ DevCursNodePtr* pNode,
+ DevCursNodePtr* pPrev);
+
+int screenIsSaved = SCREEN_SAVER_OFF;
+
+ScreenSaverStuffRec savedScreenInfo[MAXSCREENS];
+
+static int FocusPrivatesKeyIndex;
+DevPrivateKey FocusPrivatesKey = &FocusPrivatesKeyIndex;
+
+static Bool TileScreenSaver(int i, int kind);
+
+
+#define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \
+ CWDontPropagate | CWOverrideRedirect | CWCursor )
+
+#define BOXES_OVERLAP(b1, b2) \
+ (!( ((b1)->x2 <= (b2)->x1) || \
+ ( ((b1)->x1 >= (b2)->x2)) || \
+ ( ((b1)->y2 <= (b2)->y1)) || \
+ ( ((b1)->y1 >= (b2)->y2)) ) )
+
+#define RedirectSend(pWin) \
+ ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureRedirectMask)
+
+#define SubSend(pWin) \
+ ((pWin->eventMask|wOtherEventMasks(pWin)) & SubstructureNotifyMask)
+
+#define StrSend(pWin) \
+ ((pWin->eventMask|wOtherEventMasks(pWin)) & StructureNotifyMask)
+
+#define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent))
+
+#ifdef DEBUG
+/******
+ * PrintWindowTree
+ * For debugging only
+ ******/
+
+static void
+PrintChildren(WindowPtr p1, int indent)
+{
+ WindowPtr p2;
+ int i;
+
+ while (p1)
+ {
+ p2 = p1->firstChild;
+ ErrorF("[dix] ");
+ for (i=0; i<indent; i++) ErrorF(" ");
+ ErrorF("%lx\n", p1->drawable.id);
+ miPrintRegion(&p1->clipList);
+ PrintChildren(p2, indent+4);
+ p1 = p1->nextSib;
+ }
+}
+
+static void
+PrintWindowTree(void)
+{
+ int i;
+ WindowPtr pWin, p1;
+
+ for (i=0; i<screenInfo.numScreens; i++)
+ {
+ ErrorF("[dix] WINDOW %d\n", i);
+ pWin = WindowTable[i];
+ miPrintRegion(&pWin->clipList);
+ p1 = pWin->firstChild;
+ PrintChildren(p1, 4);
+ }
+}
+#endif
+
+int
+TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, pointer data)
+{
+ int result;
+ WindowPtr pChild;
+
+ if (!(pChild = pWin))
+ return(WT_NOMATCH);
+ while (1)
+ {
+ result = (* func)(pChild, data);
+ if (result == WT_STOPWALKING)
+ return(WT_STOPWALKING);
+ if ((result == WT_WALKCHILDREN) && pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ break;
+ pChild = pChild->nextSib;
+ }
+ return(WT_NOMATCH);
+}
+
+/*****
+ * WalkTree
+ * Walk the window tree, for SCREEN, preforming FUNC(pWin, data) on
+ * each window. If FUNC returns WT_WALKCHILDREN, traverse the children,
+ * if it returns WT_DONTWALKCHILDREN, dont. If it returns WT_STOPWALKING
+ * exit WalkTree. Does depth-first traverse.
+ *****/
+
+int
+WalkTree(ScreenPtr pScreen, VisitWindowProcPtr func, pointer data)
+{
+ return(TraverseTree(WindowTable[pScreen->myNum], func, data));
+}
+
+/* hack for forcing backing store on all windows */
+int defaultBackingStore = NotUseful;
+/* hack to force no backing store */
+Bool disableBackingStore = FALSE;
+Bool enableBackingStore = FALSE;
+
+static void
+SetWindowToDefaults(WindowPtr pWin)
+{
+ pWin->prevSib = NullWindow;
+ pWin->firstChild = NullWindow;
+ pWin->lastChild = NullWindow;
+
+ pWin->valdata = (ValidatePtr)NULL;
+ pWin->optional = (WindowOptPtr)NULL;
+ pWin->cursorIsNone = TRUE;
+
+ pWin->backingStore = NotUseful;
+ pWin->DIXsaveUnder = FALSE;
+ pWin->backStorage = (pointer) NULL;
+
+ pWin->mapped = FALSE; /* off */
+ pWin->realized = FALSE; /* off */
+ pWin->viewable = FALSE;
+ pWin->visibility = VisibilityNotViewable;
+ pWin->overrideRedirect = FALSE;
+ pWin->saveUnder = FALSE;
+
+ pWin->bitGravity = ForgetGravity;
+ pWin->winGravity = NorthWestGravity;
+
+ pWin->eventMask = 0;
+ pWin->deliverableEvents = 0;
+ pWin->dontPropagate = 0;
+ pWin->forcedBS = FALSE;
+ pWin->redirectDraw = RedirectDrawNone;
+ pWin->forcedBG = FALSE;
+
+#ifdef ROOTLESS
+ pWin->rootlessUnhittable = FALSE;
+#endif
+}
+
+static void
+MakeRootTile(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ GCPtr pGC;
+ unsigned char back[128];
+ int len = BitmapBytePad(sizeof(long));
+ unsigned char *from, *to;
+ int i, j;
+
+ pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4,
+ pScreen->rootDepth, 0);
+
+ pWin->backgroundState = BackgroundPixmap;
+ pGC = GetScratchGC(pScreen->rootDepth, pScreen);
+ if (!pWin->background.pixmap || !pGC)
+ FatalError("could not create root tile");
+
+ {
+ CARD32 attributes[2];
+
+ attributes[0] = pScreen->whitePixel;
+ attributes[1] = pScreen->blackPixel;
+
+ (void)ChangeGC(pGC, GCForeground | GCBackground, attributes);
+ }
+
+ ValidateGC((DrawablePtr)pWin->background.pixmap, pGC);
+
+ from = (screenInfo.bitmapBitOrder == LSBFirst) ? _back_lsb : _back_msb;
+ to = back;
+
+ for (i = 4; i > 0; i--, from++)
+ for (j = len; j > 0; j--)
+ *to++ = *from;
+
+ (*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap, pGC, 1,
+ 0, 0, len, 4, 0, XYBitmap, (char *)back);
+
+ FreeScratchGC(pGC);
+
+}
+
+/*****
+ * CreateRootWindow
+ * Makes a window at initialization time for specified screen
+ *****/
+
+Bool
+CreateRootWindow(ScreenPtr pScreen)
+{
+ WindowPtr pWin;
+ BoxRec box;
+ PixmapFormatRec *format;
+
+ pWin = xalloc(sizeof(WindowRec));
+ if (!pWin)
+ return FALSE;
+
+ savedScreenInfo[pScreen->myNum].pWindow = NULL;
+ savedScreenInfo[pScreen->myNum].wid = FakeClientID(0);
+ savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL;
+ screenIsSaved = SCREEN_SAVER_OFF;
+
+ WindowTable[pScreen->myNum] = pWin;
+
+ pWin->drawable.pScreen = pScreen;
+ pWin->drawable.type = DRAWABLE_WINDOW;
+ pWin->devPrivates = NULL;
+
+ pWin->drawable.depth = pScreen->rootDepth;
+ for (format = screenInfo.formats;
+ format->depth != pScreen->rootDepth;
+ format++)
+ ;
+ pWin->drawable.bitsPerPixel = format->bitsPerPixel;
+
+ pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ pWin->parent = NullWindow;
+ SetWindowToDefaults(pWin);
+
+ pWin->optional = xalloc (sizeof (WindowOptRec));
+ if (!pWin->optional)
+ return FALSE;
+
+ pWin->optional->dontPropagateMask = 0;
+ pWin->optional->otherEventMasks = 0;
+ pWin->optional->otherClients = NULL;
+ pWin->optional->passiveGrabs = NULL;
+ pWin->optional->userProps = NULL;
+ pWin->optional->backingBitPlanes = ~0L;
+ pWin->optional->backingPixel = 0;
+ pWin->optional->boundingShape = NULL;
+ pWin->optional->clipShape = NULL;
+ pWin->optional->inputShape = NULL;
+ pWin->optional->inputMasks = NULL;
+ pWin->optional->deviceCursors = NULL;
+ pWin->optional->colormap = pScreen->defColormap;
+ pWin->optional->visual = pScreen->rootVisual;
+
+ pWin->nextSib = NullWindow;
+
+ pWin->drawable.id = FakeClientID(0);
+
+ pWin->origin.x = pWin->origin.y = 0;
+ pWin->drawable.height = pScreen->height;
+ pWin->drawable.width = pScreen->width;
+ pWin->drawable.x = pWin->drawable.y = 0;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+ REGION_INIT(pScreen, &pWin->clipList, &box, 1);
+ REGION_INIT(pScreen, &pWin->winSize, &box, 1);
+ REGION_INIT(pScreen, &pWin->borderSize, &box, 1);
+ REGION_INIT(pScreen, &pWin->borderClip, &box, 1);
+
+ pWin->drawable.class = InputOutput;
+ pWin->optional->visual = pScreen->rootVisual;
+
+ pWin->backgroundState = BackgroundPixel;
+ pWin->background.pixel = pScreen->whitePixel;
+
+ pWin->borderIsPixel = TRUE;
+ pWin->border.pixel = pScreen->blackPixel;
+ pWin->borderWidth = 0;
+
+ /* security creation/labeling check
+ */
+ if (XaceHook(XACE_RESOURCE_ACCESS, serverClient, pWin->drawable.id,
+ RT_WINDOW, pWin, RT_NONE, NULL, DixCreateAccess))
+ return FALSE;
+
+ if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin))
+ return FALSE;
+
+ if (disableBackingStore)
+ pScreen->backingStoreSupport = NotUseful;
+ if (enableBackingStore)
+ pScreen->backingStoreSupport = Always;
+
+ pScreen->saveUnderSupport = NotUseful;
+
+ return TRUE;
+}
+
+void
+InitRootWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ int backFlag = CWBorderPixel | CWCursor | CWBackingStore;
+
+ if (!(*pScreen->CreateWindow)(pWin))
+ return; /* XXX */
+ (*pScreen->PositionWindow)(pWin, 0, 0);
+
+ pWin->cursorIsNone = FALSE;
+ pWin->optional->cursor = rootCursor;
+ rootCursor->refcnt++;
+
+
+ if (party_like_its_1989) {
+ MakeRootTile(pWin);
+ backFlag |= CWBackPixmap;
+ } else {
+ if (whiteRoot)
+ pWin->background.pixel = pScreen->whitePixel;
+ else
+ pWin->background.pixel = pScreen->blackPixel;
+ backFlag |= CWBackPixel;
+ }
+
+ pWin->backingStore = defaultBackingStore;
+ pWin->forcedBS = (defaultBackingStore != NotUseful);
+ /* We SHOULD check for an error value here XXX */
+ (*pScreen->ChangeWindowAttributes)(pWin, backFlag);
+
+ MapWindow(pWin, serverClient);
+}
+
+/* Set the region to the intersection of the rectangle and the
+ * window's winSize. The window is typically the parent of the
+ * window from which the region came.
+ */
+
+static void
+ClippedRegionFromBox(WindowPtr pWin, RegionPtr Rgn,
+ int x, int y,
+ int w, int h)
+{
+ ScreenPtr pScreen;
+ BoxRec box;
+
+ pScreen = pWin->drawable.pScreen;
+
+ box = *(REGION_EXTENTS(pScreen, &pWin->winSize));
+ /* we do these calculations to avoid overflows */
+ if (x > box.x1)
+ box.x1 = x;
+ if (y > box.y1)
+ box.y1 = y;
+ x += w;
+ if (x < box.x2)
+ box.x2 = x;
+ y += h;
+ if (y < box.y2)
+ box.y2 = y;
+ if (box.x1 > box.x2)
+ box.x2 = box.x1;
+ if (box.y1 > box.y2)
+ box.y2 = box.y1;
+ REGION_RESET(pScreen, Rgn, &box);
+ REGION_INTERSECT(pScreen, Rgn, Rgn, &pWin->winSize);
+}
+
+static RealChildHeadProc realChildHeadProc = NULL;
+
+void
+RegisterRealChildHeadProc (RealChildHeadProc proc)
+{
+ realChildHeadProc = proc;
+}
+
+
+WindowPtr
+RealChildHead(WindowPtr pWin)
+{
+ if (realChildHeadProc) {
+ return realChildHeadProc (pWin);
+ }
+
+ if (!pWin->parent &&
+ (screenIsSaved == SCREEN_SAVER_ON) &&
+ (HasSaverWindow (pWin->drawable.pScreen->myNum)))
+ return (pWin->firstChild);
+ else
+ return (NullWindow);
+}
+
+/*****
+ * CreateWindow
+ * Makes a window in response to client request
+ *****/
+
+WindowPtr
+CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
+ unsigned h, unsigned bw, unsigned class, Mask vmask, XID *vlist,
+ int depth, ClientPtr client, VisualID visual, int *error)
+{
+ WindowPtr pWin;
+ WindowPtr pHead;
+ ScreenPtr pScreen;
+ xEvent event;
+ int idepth, ivisual;
+ Bool fOK;
+ DepthPtr pDepth;
+ PixmapFormatRec *format;
+ WindowOptPtr ancwopt;
+
+ if (class == CopyFromParent)
+ class = pParent->drawable.class;
+
+ if ((class != InputOutput) && (class != InputOnly))
+ {
+ *error = BadValue;
+ client->errorValue = class;
+ return NullWindow;
+ }
+
+ if ((class != InputOnly) && (pParent->drawable.class == InputOnly))
+ {
+ *error = BadMatch;
+ return NullWindow;
+ }
+
+ if ((class == InputOnly) && ((bw != 0) || (depth != 0)))
+ {
+ *error = BadMatch;
+ return NullWindow;
+ }
+
+ pScreen = pParent->drawable.pScreen;
+ if ((class == InputOutput) && (depth == 0))
+ depth = pParent->drawable.depth;
+ ancwopt = pParent->optional;
+ if (!ancwopt)
+ ancwopt = FindWindowWithOptional(pParent)->optional;
+ if (visual == CopyFromParent) {
+ visual = ancwopt->visual;
+ }
+
+ /* Find out if the depth and visual are acceptable for this Screen */
+ if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth))
+ {
+ fOK = FALSE;
+ for(idepth = 0; idepth < pScreen->numDepths; idepth++)
+ {
+ pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
+ if ((depth == pDepth->depth) || (depth == 0))
+ {
+ for (ivisual = 0; ivisual < pDepth->numVids; ivisual++)
+ {
+ if (visual == pDepth->vids[ivisual])
+ {
+ fOK = TRUE;
+ break;
+ }
+ }
+ }
+ }
+ if (fOK == FALSE)
+ {
+ *error = BadMatch;
+ return NullWindow;
+ }
+ }
+
+ if (((vmask & (CWBorderPixmap | CWBorderPixel)) == 0) &&
+ (class != InputOnly) &&
+ (depth != pParent->drawable.depth))
+ {
+ *error = BadMatch;
+ return NullWindow;
+ }
+
+ if (((vmask & CWColormap) == 0) &&
+ (class != InputOnly) &&
+ ((visual != ancwopt->visual) || (ancwopt->colormap == None)))
+ {
+ *error = BadMatch;
+ return NullWindow;
+ }
+
+ pWin = xalloc(sizeof(WindowRec));
+ if (!pWin)
+ {
+ *error = BadAlloc;
+ return NullWindow;
+ }
+ pWin->drawable = pParent->drawable;
+ pWin->devPrivates = NULL;
+ pWin->drawable.depth = depth;
+ if (depth == pParent->drawable.depth)
+ pWin->drawable.bitsPerPixel = pParent->drawable.bitsPerPixel;
+ else
+ {
+ for (format = screenInfo.formats; format->depth != depth; format++)
+ ;
+ pWin->drawable.bitsPerPixel = format->bitsPerPixel;
+ }
+ if (class == InputOnly)
+ pWin->drawable.type = (short) UNDRAWABLE_WINDOW;
+ pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ pWin->drawable.id = wid;
+ pWin->drawable.class = class;
+
+ pWin->parent = pParent;
+ SetWindowToDefaults(pWin);
+
+ if (visual != ancwopt->visual)
+ {
+ if (!MakeWindowOptional (pWin))
+ {
+ xfree (pWin);
+ *error = BadAlloc;
+ return NullWindow;
+ }
+ pWin->optional->visual = visual;
+ pWin->optional->colormap = None;
+ }
+
+ pWin->borderWidth = bw;
+
+ /* security creation/labeling check
+ */
+ *error = XaceHook(XACE_RESOURCE_ACCESS, client, wid, RT_WINDOW, pWin,
+ RT_WINDOW, pWin->parent, DixCreateAccess|DixSetAttrAccess);
+ if (*error != Success) {
+ xfree(pWin);
+ return NullWindow;
+ }
+
+ pWin->backgroundState = XaceBackgroundNoneState(pWin);
+ pWin->background.pixel = pScreen->whitePixel;
+
+ pWin->borderIsPixel = pParent->borderIsPixel;
+ pWin->border = pParent->border;
+ if (pWin->borderIsPixel == FALSE)
+ pWin->border.pixmap->refcnt++;
+
+ pWin->origin.x = x + (int)bw;
+ pWin->origin.y = y + (int)bw;
+ pWin->drawable.width = w;
+ pWin->drawable.height = h;
+ pWin->drawable.x = pParent->drawable.x + x + (int)bw;
+ pWin->drawable.y = pParent->drawable.y + y + (int)bw;
+
+ /* set up clip list correctly for unobscured WindowPtr */
+ REGION_NULL(pScreen, &pWin->clipList);
+ REGION_NULL(pScreen, &pWin->borderClip);
+ REGION_NULL(pScreen, &pWin->winSize);
+ REGION_NULL(pScreen, &pWin->borderSize);
+
+ pHead = RealChildHead(pParent);
+ if (pHead)
+ {
+ pWin->nextSib = pHead->nextSib;
+ if (pHead->nextSib)
+ pHead->nextSib->prevSib = pWin;
+ else
+ pParent->lastChild = pWin;
+ pHead->nextSib = pWin;
+ pWin->prevSib = pHead;
+ }
+ else
+ {
+ pWin->nextSib = pParent->firstChild;
+ if (pParent->firstChild)
+ pParent->firstChild->prevSib = pWin;
+ else
+ pParent->lastChild = pWin;
+ pParent->firstChild = pWin;
+ }
+
+ SetWinSize (pWin);
+ SetBorderSize (pWin);
+
+ /* We SHOULD check for an error value here XXX */
+ if (!(*pScreen->CreateWindow)(pWin))
+ {
+ *error = BadAlloc;
+ DeleteWindow(pWin, None);
+ return NullWindow;
+ }
+ /* We SHOULD check for an error value here XXX */
+ (*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y);
+
+ if (!(vmask & CWEventMask))
+ RecalculateDeliverableEvents(pWin);
+
+ if (vmask)
+ *error = ChangeWindowAttributes(pWin, vmask, vlist, wClient (pWin));
+ else
+ *error = Success;
+
+ if (*error != Success)
+ {
+ DeleteWindow(pWin, None);
+ return NullWindow;
+ }
+ if (!(vmask & CWBackingStore) && (defaultBackingStore != NotUseful))
+ {
+ XID value = defaultBackingStore;
+ (void)ChangeWindowAttributes(pWin, CWBackingStore, &value, wClient (pWin));
+ pWin->forcedBS = TRUE;
+ }
+
+ if (SubSend(pParent))
+ {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = CreateNotify;
+ event.u.createNotify.window = wid;
+ event.u.createNotify.parent = pParent->drawable.id;
+ event.u.createNotify.x = x;
+ event.u.createNotify.y = y;
+ event.u.createNotify.width = w;
+ event.u.createNotify.height = h;
+ event.u.createNotify.borderWidth = bw;
+ event.u.createNotify.override = pWin->overrideRedirect;
+ DeliverEvents(pParent, &event, 1, NullWindow);
+ }
+ return pWin;
+}
+
+static void
+DisposeWindowOptional (WindowPtr pWin)
+{
+ if (!pWin->optional)
+ return;
+ /*
+ * everything is peachy. Delete the optional record
+ * and clean up
+ */
+ if (pWin->optional->cursor)
+ {
+ FreeCursor (pWin->optional->cursor, (Cursor)0);
+ pWin->cursorIsNone = FALSE;
+ }
+ else
+ pWin->cursorIsNone = TRUE;
+
+ if (pWin->optional->deviceCursors)
+ {
+ DevCursorList pList;
+ DevCursorList pPrev;
+ pList = pWin->optional->deviceCursors;
+ while(pList)
+ {
+ if (pList->cursor)
+ FreeCursor(pList->cursor, (XID)0);
+ pPrev = pList;
+ pList = pList->next;
+ xfree(pPrev);
+ }
+ pWin->optional->deviceCursors = NULL;
+ }
+
+ xfree (pWin->optional);
+ pWin->optional = NULL;
+}
+
+static void
+FreeWindowResources(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ DeleteWindowFromAnySaveSet(pWin);
+ DeleteWindowFromAnySelections(pWin);
+ DeleteWindowFromAnyEvents(pWin, TRUE);
+ REGION_UNINIT(pScreen, &pWin->clipList);
+ REGION_UNINIT(pScreen, &pWin->winSize);
+ REGION_UNINIT(pScreen, &pWin->borderClip);
+ REGION_UNINIT(pScreen, &pWin->borderSize);
+ if (wBoundingShape (pWin))
+ REGION_DESTROY(pScreen, wBoundingShape (pWin));
+ if (wClipShape (pWin))
+ REGION_DESTROY(pScreen, wClipShape (pWin));
+ if (wInputShape (pWin))
+ REGION_DESTROY(pScreen, wInputShape (pWin));
+ if (pWin->borderIsPixel == FALSE)
+ (*pScreen->DestroyPixmap)(pWin->border.pixmap);
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+
+ DeleteAllWindowProperties(pWin);
+ /* We SHOULD check for an error value here XXX */
+ (*pScreen->DestroyWindow)(pWin);
+ DisposeWindowOptional (pWin);
+}
+
+static void
+CrushTree(WindowPtr pWin)
+{
+ WindowPtr pChild, pSib, pParent;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ xEvent event;
+
+ if (!(pChild = pWin->firstChild))
+ return;
+ UnrealizeWindow = pWin->drawable.pScreen->UnrealizeWindow;
+ while (1)
+ {
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ while (1)
+ {
+ pParent = pChild->parent;
+ if (SubStrSend(pChild, pParent))
+ {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = DestroyNotify;
+ event.u.destroyNotify.window = pChild->drawable.id;
+ DeliverEvents(pChild, &event, 1, NullWindow);
+ }
+ FreeResource(pChild->drawable.id, RT_WINDOW);
+ pSib = pChild->nextSib;
+ pChild->viewable = FALSE;
+ if (pChild->realized)
+ {
+ pChild->realized = FALSE;
+ (*UnrealizeWindow)(pChild);
+ }
+ FreeWindowResources(pChild);
+ dixFreePrivates(pChild->devPrivates);
+ xfree(pChild);
+ if ( (pChild = pSib) )
+ break;
+ pChild = pParent;
+ pChild->firstChild = NullWindow;
+ pChild->lastChild = NullWindow;
+ if (pChild == pWin)
+ return;
+ }
+ }
+}
+
+/*****
+ * DeleteWindow
+ * Deletes child of window then window itself
+ * If wid is None, don't send any events
+ *****/
+
+int
+DeleteWindow(pointer value, XID wid)
+ {
+ WindowPtr pParent;
+ WindowPtr pWin = (WindowPtr)value;
+ xEvent event;
+
+ UnmapWindow(pWin, FALSE);
+
+ CrushTree(pWin);
+
+ pParent = pWin->parent;
+ if (wid && pParent && SubStrSend(pWin, pParent))
+ {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = DestroyNotify;
+ event.u.destroyNotify.window = pWin->drawable.id;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }
+
+ FreeWindowResources(pWin);
+ if (pParent)
+ {
+ if (pParent->firstChild == pWin)
+ pParent->firstChild = pWin->nextSib;
+ if (pParent->lastChild == pWin)
+ pParent->lastChild = pWin->prevSib;
+ if (pWin->nextSib)
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
+ }
+ xfree(dixLookupPrivate(&pWin->devPrivates, FocusPrivatesKey));
+ dixFreePrivates(pWin->devPrivates);
+ xfree(pWin);
+ return Success;
+}
+
+int
+DestroySubwindows(WindowPtr pWin, ClientPtr client)
+{
+ /* XXX
+ * The protocol is quite clear that each window should be
+ * destroyed in turn, however, unmapping all of the first
+ * eliminates most of the calls to ValidateTree. So,
+ * this implementation is incorrect in that all of the
+ * UnmapNotifies occur before all of the DestroyNotifies.
+ * If you care, simply delete the call to UnmapSubwindows.
+ */
+ UnmapSubwindows(pWin);
+ while (pWin->lastChild) {
+ int rc = XaceHook(XACE_RESOURCE_ACCESS, client,
+ pWin->lastChild->drawable.id, RT_WINDOW,
+ pWin->lastChild, RT_NONE, NULL, DixDestroyAccess);
+ if (rc != Success)
+ return rc;
+ FreeResource(pWin->lastChild->drawable.id, RT_NONE);
+ }
+ return Success;
+}
+
+/*****
+ * ChangeWindowAttributes
+ *
+ * The value-mask specifies which attributes are to be changed; the
+ * value-list contains one value for each one bit in the mask, from least
+ * to most significant bit in the mask.
+ *****/
+
+int
+ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
+{
+ XID *pVlist;
+ PixmapPtr pPixmap;
+ Pixmap pixID;
+ CursorPtr pCursor, pOldCursor;
+ Cursor cursorID;
+ WindowPtr pChild;
+ Colormap cmap;
+ ColormapPtr pCmap;
+ xEvent xE;
+ int error, rc;
+ ScreenPtr pScreen;
+ Mask index2, tmask, vmaskCopy = 0;
+ unsigned int val;
+ Bool checkOptional = FALSE, borderRelative = FALSE;
+
+ if ((pWin->drawable.class == InputOnly) && (vmask & (~INPUTONLY_LEGAL_MASK)))
+ return BadMatch;
+
+ error = Success;
+ pScreen = pWin->drawable.pScreen;
+ pVlist = vlist;
+ tmask = vmask;
+ while (tmask)
+ {
+ index2 = (Mask) lowbit (tmask);
+ tmask &= ~index2;
+ switch (index2)
+ {
+ case CWBackPixmap:
+ pixID = (Pixmap )*pVlist;
+ pVlist++;
+ if (pWin->backgroundState == ParentRelative)
+ borderRelative = TRUE;
+ if (pixID == None)
+ {
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ if (!pWin->parent)
+ MakeRootTile(pWin);
+ else {
+ pWin->backgroundState = XaceBackgroundNoneState(pWin);
+ pWin->background.pixel = pScreen->whitePixel;
+ }
+ }
+ else if (pixID == ParentRelative)
+ {
+ if (pWin->parent &&
+ pWin->drawable.depth != pWin->parent->drawable.depth)
+ {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ if (!pWin->parent)
+ MakeRootTile(pWin);
+ else
+ pWin->backgroundState = ParentRelative;
+ borderRelative = TRUE;
+ /* Note that the parent's backgroundTile's refcnt is NOT
+ * incremented. */
+ }
+ else
+ {
+ rc = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
+ client, DixReadAccess);
+ if (rc == Success)
+ {
+ if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
+ (pPixmap->drawable.pScreen != pScreen))
+ {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ pWin->backgroundState = BackgroundPixmap;
+ pWin->background.pixmap = pPixmap;
+ pPixmap->refcnt++;
+ }
+ else
+ {
+ error = (rc == BadValue) ? BadPixmap : rc;
+ client->errorValue = pixID;
+ goto PatchUp;
+ }
+ }
+ break;
+ case CWBackPixel:
+ if (pWin->backgroundState == ParentRelative)
+ borderRelative = TRUE;
+ if (pWin->backgroundState == BackgroundPixmap)
+ (*pScreen->DestroyPixmap)(pWin->background.pixmap);
+ pWin->backgroundState = BackgroundPixel;
+ pWin->background.pixel = (CARD32 ) *pVlist;
+ /* background pixel overrides background pixmap,
+ so don't let the ddx layer see both bits */
+ vmaskCopy &= ~CWBackPixmap;
+ pVlist++;
+ break;
+ case CWBorderPixmap:
+ pixID = (Pixmap ) *pVlist;
+ pVlist++;
+ if (pixID == CopyFromParent)
+ {
+ if (!pWin->parent ||
+ (pWin->drawable.depth != pWin->parent->drawable.depth))
+ {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (pWin->parent->borderIsPixel == TRUE) {
+ if (pWin->borderIsPixel == FALSE)
+ (*pScreen->DestroyPixmap)(pWin->border.pixmap);
+ pWin->border = pWin->parent->border;
+ pWin->borderIsPixel = TRUE;
+ index2 = CWBorderPixel;
+ break;
+ }
+ else
+ {
+ pixID = pWin->parent->border.pixmap->drawable.id;
+ }
+ }
+ rc = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
+ client, DixReadAccess);
+ if (rc == Success)
+ {
+ if ((pPixmap->drawable.depth != pWin->drawable.depth) ||
+ (pPixmap->drawable.pScreen != pScreen))
+ {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (pWin->borderIsPixel == FALSE)
+ (*pScreen->DestroyPixmap)(pWin->border.pixmap);
+ pWin->borderIsPixel = FALSE;
+ pWin->border.pixmap = pPixmap;
+ pPixmap->refcnt++;
+ }
+ else
+ {
+ error = (rc == BadValue) ? BadPixmap : rc;
+ client->errorValue = pixID;
+ goto PatchUp;
+ }
+ break;
+ case CWBorderPixel:
+ if (pWin->borderIsPixel == FALSE)
+ (*pScreen->DestroyPixmap)(pWin->border.pixmap);
+ pWin->borderIsPixel = TRUE;
+ pWin->border.pixel = (CARD32) *pVlist;
+ /* border pixel overrides border pixmap,
+ so don't let the ddx layer see both bits */
+ vmaskCopy &= ~CWBorderPixmap;
+ pVlist++;
+ break;
+ case CWBitGravity:
+ val = (CARD8 )*pVlist;
+ pVlist++;
+ if (val > StaticGravity)
+ {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ pWin->bitGravity = val;
+ break;
+ case CWWinGravity:
+ val = (CARD8 )*pVlist;
+ pVlist++;
+ if (val > StaticGravity)
+ {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ pWin->winGravity = val;
+ break;
+ case CWBackingStore:
+ val = (CARD8 )*pVlist;
+ pVlist++;
+ if ((val != NotUseful) && (val != WhenMapped) && (val != Always))
+ {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ pWin->backingStore = val;
+ pWin->forcedBS = FALSE;
+ break;
+ case CWBackingPlanes:
+ if (pWin->optional || ((CARD32)*pVlist != (CARD32)~0L)) {
+ if (!pWin->optional && !MakeWindowOptional (pWin))
+ {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ pWin->optional->backingBitPlanes = (CARD32) *pVlist;
+ if ((CARD32)*pVlist == (CARD32)~0L)
+ checkOptional = TRUE;
+ }
+ pVlist++;
+ break;
+ case CWBackingPixel:
+ if (pWin->optional || (CARD32) *pVlist) {
+ if (!pWin->optional && !MakeWindowOptional (pWin))
+ {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ pWin->optional->backingPixel = (CARD32) *pVlist;
+ if (!*pVlist)
+ checkOptional = TRUE;
+ }
+ pVlist++;
+ break;
+ case CWSaveUnder:
+ val = (BOOL) *pVlist;
+ pVlist++;
+ if ((val != xTrue) && (val != xFalse))
+ {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ pWin->saveUnder = val;
+ break;
+ case CWEventMask:
+ rc = EventSelectForWindow(pWin, client, (Mask )*pVlist);
+ if (rc)
+ {
+ error = rc;
+ goto PatchUp;
+ }
+ pVlist++;
+ break;
+ case CWDontPropagate:
+ rc = EventSuppressForWindow(pWin, client, (Mask )*pVlist,
+ &checkOptional);
+ if (rc)
+ {
+ error = rc;
+ goto PatchUp;
+ }
+ pVlist++;
+ break;
+ case CWOverrideRedirect:
+ val = (BOOL ) *pVlist;
+ pVlist++;
+ if ((val != xTrue) && (val != xFalse))
+ {
+ error = BadValue;
+ client->errorValue = val;
+ goto PatchUp;
+ }
+ if (val == xTrue) {
+ rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id,
+ RT_WINDOW, pWin, RT_NONE, NULL, DixGrabAccess);
+ if (rc != Success) {
+ error = rc;
+ client->errorValue = pWin->drawable.id;
+ goto PatchUp;
+ }
+ }
+ pWin->overrideRedirect = val;
+ break;
+ case CWColormap:
+ cmap = (Colormap) *pVlist;
+ pVlist++;
+ if (cmap == CopyFromParent)
+ {
+ if (pWin->parent &&
+ (!pWin->optional ||
+ pWin->optional->visual == wVisual (pWin->parent)))
+ {
+ cmap = wColormap (pWin->parent);
+ }
+ else
+ cmap = None;
+ }
+ if (cmap == None)
+ {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ rc = dixLookupResourceByType((pointer *)&pCmap, cmap, RT_COLORMAP,
+ client, DixUseAccess);
+ if (rc != Success)
+ {
+ error = (rc == BadValue) ? BadColor : rc;
+ client->errorValue = cmap;
+ goto PatchUp;
+ }
+ if (pCmap->pVisual->vid != wVisual (pWin) ||
+ pCmap->pScreen != pScreen)
+ {
+ error = BadMatch;
+ goto PatchUp;
+ }
+ if (cmap != wColormap (pWin))
+ {
+ if (!pWin->optional)
+ {
+ if (!MakeWindowOptional (pWin))
+ {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ }
+ else if (pWin->parent && cmap == wColormap (pWin->parent))
+ checkOptional = TRUE;
+
+ /*
+ * propagate the original colormap to any children
+ * inheriting it
+ */
+
+ for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)
+ {
+ if (!pChild->optional && !MakeWindowOptional (pChild))
+ {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ }
+
+ pWin->optional->colormap = cmap;
+
+ /*
+ * check on any children now matching the new colormap
+ */
+
+ for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)
+ {
+ if (pChild->optional->colormap == cmap)
+ CheckWindowOptionalNeed (pChild);
+ }
+
+ xE.u.u.type = ColormapNotify;
+ xE.u.colormap.window = pWin->drawable.id;
+ xE.u.colormap.colormap = cmap;
+ xE.u.colormap.new = xTrue;
+ xE.u.colormap.state = IsMapInstalled(cmap, pWin);
+ DeliverEvents(pWin, &xE, 1, NullWindow);
+ }
+ break;
+ case CWCursor:
+ cursorID = (Cursor ) *pVlist;
+ pVlist++;
+ /*
+ * install the new
+ */
+ if ( cursorID == None)
+ {
+ if (pWin == WindowTable[pWin->drawable.pScreen->myNum])
+ pCursor = rootCursor;
+ else
+ pCursor = (CursorPtr) None;
+ }
+ else
+ {
+ rc = dixLookupResourceByType((pointer *)&pCursor, cursorID,
+ RT_CURSOR, client, DixUseAccess);
+ if (rc != Success)
+ {
+ error = (rc == BadValue) ? BadCursor : rc;
+ client->errorValue = cursorID;
+ goto PatchUp;
+ }
+ }
+
+ if (pCursor != wCursor (pWin))
+ {
+ /*
+ * patch up child windows so they don't lose cursors.
+ */
+
+ for (pChild = pWin->firstChild; pChild; pChild=pChild->nextSib)
+ {
+ if (!pChild->optional && !pChild->cursorIsNone &&
+ !MakeWindowOptional (pChild))
+ {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ }
+
+ pOldCursor = 0;
+ if (pCursor == (CursorPtr) None)
+ {
+ pWin->cursorIsNone = TRUE;
+ if (pWin->optional)
+ {
+ pOldCursor = pWin->optional->cursor;
+ pWin->optional->cursor = (CursorPtr) None;
+ checkOptional = TRUE;
+ }
+ } else {
+ if (!pWin->optional)
+ {
+ if (!MakeWindowOptional (pWin))
+ {
+ error = BadAlloc;
+ goto PatchUp;
+ }
+ }
+ else if (pWin->parent && pCursor == wCursor (pWin->parent))
+ checkOptional = TRUE;
+ pOldCursor = pWin->optional->cursor;
+ pWin->optional->cursor = pCursor;
+ pCursor->refcnt++;
+ pWin->cursorIsNone = FALSE;
+ /*
+ * check on any children now matching the new cursor
+ */
+
+ for (pChild=pWin->firstChild; pChild; pChild=pChild->nextSib)
+ {
+ if (pChild->optional &&
+ (pChild->optional->cursor == pCursor))
+ CheckWindowOptionalNeed (pChild);
+ }
+ }
+
+ if (pWin->realized)
+ WindowHasNewCursor( pWin);
+
+ /* Can't free cursor until here - old cursor
+ * is needed in WindowHasNewCursor
+ */
+ if (pOldCursor)
+ FreeCursor (pOldCursor, (Cursor)0);
+ }
+ break;
+ default:
+ error = BadValue;
+ client->errorValue = vmask;
+ goto PatchUp;
+ }
+ vmaskCopy |= index2;
+ }
+PatchUp:
+ if (checkOptional)
+ CheckWindowOptionalNeed (pWin);
+
+ /* We SHOULD check for an error value here XXX */
+ (*pScreen->ChangeWindowAttributes)(pWin, vmaskCopy);
+
+ /*
+ If the border contents have changed, redraw the border.
+ Note that this has to be done AFTER pScreen->ChangeWindowAttributes
+ for the tile to be rotated, and the correct function selected.
+ */
+ if (((vmaskCopy & (CWBorderPixel | CWBorderPixmap)) || borderRelative)
+ && pWin->viewable && HasBorder (pWin))
+ {
+ RegionRec exposed;
+
+ REGION_NULL(pScreen, &exposed);
+ REGION_SUBTRACT(pScreen, &exposed, &pWin->borderClip, &pWin->winSize);
+ miPaintWindow(pWin, &exposed, PW_BORDER);
+ REGION_UNINIT(pScreen, &exposed);
+ }
+ return error;
+}
+
+
+/*****
+ * GetWindowAttributes
+ * Notice that this is different than ChangeWindowAttributes
+ *****/
+
+void
+GetWindowAttributes(WindowPtr pWin, ClientPtr client, xGetWindowAttributesReply *wa)
+{
+ wa->type = X_Reply;
+ wa->bitGravity = pWin->bitGravity;
+ wa->winGravity = pWin->winGravity;
+ if (pWin->forcedBS && pWin->backingStore != Always)
+ wa->backingStore = NotUseful;
+ else
+ wa->backingStore = pWin->backingStore;
+ wa->length = bytes_to_int32(sizeof(xGetWindowAttributesReply) -
+ sizeof(xGenericReply));
+ wa->sequenceNumber = client->sequence;
+ wa->backingBitPlanes = wBackingBitPlanes (pWin);
+ wa->backingPixel = wBackingPixel (pWin);
+ wa->saveUnder = (BOOL)pWin->saveUnder;
+ wa->override = pWin->overrideRedirect;
+ if (!pWin->mapped)
+ wa->mapState = IsUnmapped;
+ else if (pWin->realized)
+ wa->mapState = IsViewable;
+ else
+ wa->mapState = IsUnviewable;
+
+ wa->colormap = wColormap (pWin);
+ wa->mapInstalled = (wa->colormap == None) ? xFalse
+ : IsMapInstalled(wa->colormap, pWin);
+
+ wa->yourEventMask = EventMaskForClient(pWin, client);
+ wa->allEventMasks = pWin->eventMask | wOtherEventMasks (pWin);
+ wa->doNotPropagateMask = wDontPropagateMask (pWin);
+ wa->class = pWin->drawable.class;
+ wa->visualID = wVisual (pWin);
+}
+
+
+WindowPtr
+MoveWindowInStack(WindowPtr pWin, WindowPtr pNextSib)
+{
+ WindowPtr pParent = pWin->parent;
+ WindowPtr pFirstChange = pWin; /* highest window where list changes */
+
+ if (pWin->nextSib != pNextSib)
+ {
+ WindowPtr pOldNextSib = pWin->nextSib;
+
+ if (!pNextSib) /* move to bottom */
+ {
+ if (pParent->firstChild == pWin)
+ pParent->firstChild = pWin->nextSib;
+ /* if (pWin->nextSib) */ /* is always True: pNextSib == NULL
+ * and pWin->nextSib != pNextSib
+ * therefore pWin->nextSib != NULL */
+ pFirstChange = pWin->nextSib;
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
+ pParent->lastChild->nextSib = pWin;
+ pWin->prevSib = pParent->lastChild;
+ pWin->nextSib = NullWindow;
+ pParent->lastChild = pWin;
+ }
+ else if (pParent->firstChild == pNextSib) /* move to top */
+ {
+ pFirstChange = pWin;
+ if (pParent->lastChild == pWin)
+ pParent->lastChild = pWin->prevSib;
+ if (pWin->nextSib)
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
+ pWin->nextSib = pParent->firstChild;
+ pWin->prevSib = (WindowPtr ) NULL;
+ pNextSib->prevSib = pWin;
+ pParent->firstChild = pWin;
+ }
+ else /* move in middle of list */
+ {
+ WindowPtr pOldNext = pWin->nextSib;
+
+ pFirstChange = NullWindow;
+ if (pParent->firstChild == pWin)
+ pFirstChange = pParent->firstChild = pWin->nextSib;
+ if (pParent->lastChild == pWin) {
+ pFirstChange = pWin;
+ pParent->lastChild = pWin->prevSib;
+ }
+ if (pWin->nextSib)
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
+ pWin->nextSib = pNextSib;
+ pWin->prevSib = pNextSib->prevSib;
+ if (pNextSib->prevSib)
+ pNextSib->prevSib->nextSib = pWin;
+ pNextSib->prevSib = pWin;
+ if (!pFirstChange) { /* do we know it yet? */
+ pFirstChange = pParent->firstChild; /* no, search from top */
+ while ((pFirstChange != pWin) && (pFirstChange != pOldNext))
+ pFirstChange = pFirstChange->nextSib;
+ }
+ }
+ if(pWin->drawable.pScreen->RestackWindow)
+ (*pWin->drawable.pScreen->RestackWindow)(pWin, pOldNextSib);
+ }
+
+#ifdef ROOTLESS
+ /*
+ * In rootless mode we can't optimize away window restacks.
+ * There may be non-X windows around, so even if the window
+ * is in the correct position from X's point of view,
+ * the underlying window system may want to reorder it.
+ */
+ else if (pWin->drawable.pScreen->RestackWindow)
+ (*pWin->drawable.pScreen->RestackWindow)(pWin, pWin->nextSib);
+#endif
+
+ return( pFirstChange );
+}
+
+void
+SetWinSize (WindowPtr pWin)
+{
+#ifdef COMPOSITE
+ if (pWin->redirectDraw != RedirectDrawNone)
+ {
+ BoxRec box;
+
+ /*
+ * Redirected clients get clip list equal to their
+ * own geometry, not clipped to their parent
+ */
+ box.x1 = pWin->drawable.x;
+ box.y1 = pWin->drawable.y;
+ box.x2 = pWin->drawable.x + pWin->drawable.width;
+ box.y2 = pWin->drawable.y + pWin->drawable.height;
+ REGION_RESET (pScreen, &pWin->winSize, &box);
+ }
+ else
+#endif
+ ClippedRegionFromBox(pWin->parent, &pWin->winSize,
+ pWin->drawable.x, pWin->drawable.y,
+ (int)pWin->drawable.width,
+ (int)pWin->drawable.height);
+ if (wBoundingShape (pWin) || wClipShape (pWin)) {
+ ScreenPtr pScreen;
+ pScreen = pWin->drawable.pScreen;
+
+ REGION_TRANSLATE(pScreen, &pWin->winSize, - pWin->drawable.x,
+ - pWin->drawable.y);
+ if (wBoundingShape (pWin))
+ REGION_INTERSECT(pScreen, &pWin->winSize, &pWin->winSize,
+ wBoundingShape (pWin));
+ if (wClipShape (pWin))
+ REGION_INTERSECT(pScreen, &pWin->winSize, &pWin->winSize,
+ wClipShape (pWin));
+ REGION_TRANSLATE(pScreen, &pWin->winSize, pWin->drawable.x,
+ pWin->drawable.y);
+ }
+}
+
+void
+SetBorderSize (WindowPtr pWin)
+{
+ int bw;
+
+ if (HasBorder (pWin)) {
+ bw = wBorderWidth (pWin);
+#ifdef COMPOSITE
+ if (pWin->redirectDraw != RedirectDrawNone)
+ {
+ BoxRec box;
+
+ /*
+ * Redirected clients get clip list equal to their
+ * own geometry, not clipped to their parent
+ */
+ box.x1 = pWin->drawable.x - bw;
+ box.y1 = pWin->drawable.y - bw;
+ box.x2 = pWin->drawable.x + pWin->drawable.width + bw;
+ box.y2 = pWin->drawable.y + pWin->drawable.height + bw;
+ REGION_RESET (pScreen, &pWin->borderSize, &box);
+ }
+ else
+#endif
+ ClippedRegionFromBox(pWin->parent, &pWin->borderSize,
+ pWin->drawable.x - bw, pWin->drawable.y - bw,
+ (int)(pWin->drawable.width + (bw<<1)),
+ (int)(pWin->drawable.height + (bw<<1)));
+ if (wBoundingShape (pWin)) {
+ ScreenPtr pScreen;
+ pScreen = pWin->drawable.pScreen;
+
+ REGION_TRANSLATE(pScreen, &pWin->borderSize, - pWin->drawable.x,
+ - pWin->drawable.y);
+ REGION_INTERSECT(pScreen, &pWin->borderSize, &pWin->borderSize,
+ wBoundingShape (pWin));
+ REGION_TRANSLATE(pScreen, &pWin->borderSize, pWin->drawable.x,
+ pWin->drawable.y);
+ REGION_UNION(pScreen, &pWin->borderSize, &pWin->borderSize,
+ &pWin->winSize);
+ }
+ } else {
+ REGION_COPY(pWin->drawable.pScreen, &pWin->borderSize,
+ &pWin->winSize);
+ }
+}
+
+/**
+ *
+ * \param x,y new window position
+ * \param oldx,oldy old window position
+ * \param destx,desty position relative to gravity
+ */
+
+void
+GravityTranslate (int x, int y, int oldx, int oldy,
+ int dw, int dh, unsigned gravity,
+ int *destx, int *desty)
+{
+ switch (gravity) {
+ case NorthGravity:
+ *destx = x + dw / 2;
+ *desty = y;
+ break;
+ case NorthEastGravity:
+ *destx = x + dw;
+ *desty = y;
+ break;
+ case WestGravity:
+ *destx = x;
+ *desty = y + dh / 2;
+ break;
+ case CenterGravity:
+ *destx = x + dw / 2;
+ *desty = y + dh / 2;
+ break;
+ case EastGravity:
+ *destx = x + dw;
+ *desty = y + dh / 2;
+ break;
+ case SouthWestGravity:
+ *destx = x;
+ *desty = y + dh;
+ break;
+ case SouthGravity:
+ *destx = x + dw / 2;
+ *desty = y + dh;
+ break;
+ case SouthEastGravity:
+ *destx = x + dw;
+ *desty = y + dh;
+ break;
+ case StaticGravity:
+ *destx = oldx;
+ *desty = oldy;
+ break;
+ default:
+ *destx = x;
+ *desty = y;
+ break;
+ }
+}
+
+/* XXX need to retile border on each window with ParentRelative origin */
+void
+ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
+{
+ ScreenPtr pScreen;
+ WindowPtr pSib, pChild;
+ Bool resized = (dw || dh);
+
+ pScreen = pWin->drawable.pScreen;
+
+ for (pSib = pWin->firstChild; pSib; pSib = pSib->nextSib)
+ {
+ if (resized && (pSib->winGravity > NorthWestGravity))
+ {
+ int cwsx, cwsy;
+
+ cwsx = pSib->origin.x;
+ cwsy = pSib->origin.y;
+ GravityTranslate (cwsx, cwsy, cwsx - dx, cwsy - dy, dw, dh,
+ pSib->winGravity, &cwsx, &cwsy);
+ if (cwsx != pSib->origin.x || cwsy != pSib->origin.y)
+ {
+ xEvent event;
+
+ event.u.u.type = GravityNotify;
+ event.u.gravity.window = pSib->drawable.id;
+ event.u.gravity.x = cwsx - wBorderWidth (pSib);
+ event.u.gravity.y = cwsy - wBorderWidth (pSib);
+ DeliverEvents (pSib, &event, 1, NullWindow);
+ pSib->origin.x = cwsx;
+ pSib->origin.y = cwsy;
+ }
+ }
+ pSib->drawable.x = pWin->drawable.x + pSib->origin.x;
+ pSib->drawable.y = pWin->drawable.y + pSib->origin.y;
+ SetWinSize (pSib);
+ SetBorderSize (pSib);
+ (*pScreen->PositionWindow)(pSib, pSib->drawable.x, pSib->drawable.y);
+
+ if ( (pChild = pSib->firstChild) )
+ {
+ while (1)
+ {
+ pChild->drawable.x = pChild->parent->drawable.x +
+ pChild->origin.x;
+ pChild->drawable.y = pChild->parent->drawable.y +
+ pChild->origin.y;
+ SetWinSize (pChild);
+ SetBorderSize (pChild);
+ (*pScreen->PositionWindow)(pChild,
+ pChild->drawable.x, pChild->drawable.y);
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ while (!pChild->nextSib && (pChild != pSib))
+ pChild = pChild->parent;
+ if (pChild == pSib)
+ break;
+ pChild = pChild->nextSib;
+ }
+ }
+ }
+}
+
+#define GET_INT16(m, f) \
+ if (m & mask) \
+ { \
+ f = (INT16) *pVlist;\
+ pVlist++; \
+ }
+#define GET_CARD16(m, f) \
+ if (m & mask) \
+ { \
+ f = (CARD16) *pVlist;\
+ pVlist++;\
+ }
+
+#define GET_CARD8(m, f) \
+ if (m & mask) \
+ { \
+ f = (CARD8) *pVlist;\
+ pVlist++;\
+ }
+
+#define ChangeMask ((Mask)(CWX | CWY | CWWidth | CWHeight))
+
+#define IllegalInputOnlyConfigureMask (CWBorderWidth)
+
+/*
+ * IsSiblingAboveMe
+ * returns Above if pSib above pMe in stack or Below otherwise
+ */
+
+static int
+IsSiblingAboveMe(
+ WindowPtr pMe,
+ WindowPtr pSib)
+{
+ WindowPtr pWin;
+
+ pWin = pMe->parent->firstChild;
+ while (pWin)
+ {
+ if (pWin == pSib)
+ return(Above);
+ else if (pWin == pMe)
+ return(Below);
+ pWin = pWin->nextSib;
+ }
+ return(Below);
+}
+
+static BoxPtr
+WindowExtents(
+ WindowPtr pWin,
+ BoxPtr pBox)
+{
+ pBox->x1 = pWin->drawable.x - wBorderWidth (pWin);
+ pBox->y1 = pWin->drawable.y - wBorderWidth (pWin);
+ pBox->x2 = pWin->drawable.x + (int)pWin->drawable.width
+ + wBorderWidth (pWin);
+ pBox->y2 = pWin->drawable.y + (int)pWin->drawable.height
+ + wBorderWidth (pWin);
+ return(pBox);
+}
+
+#define IS_SHAPED(pWin) (wBoundingShape (pWin) != (RegionPtr) NULL)
+
+static RegionPtr
+MakeBoundingRegion (
+ WindowPtr pWin,
+ BoxPtr pBox)
+{
+ RegionPtr pRgn;
+ ScreenPtr pScreen;
+ pScreen = pWin->drawable.pScreen;
+
+ pRgn = REGION_CREATE(pScreen, pBox, 1);
+ if (wBoundingShape (pWin)) {
+ REGION_TRANSLATE(pScreen, pRgn, -pWin->origin.x,
+ -pWin->origin.y);
+ REGION_INTERSECT(pScreen, pRgn, pRgn, wBoundingShape (pWin));
+ REGION_TRANSLATE(pScreen, pRgn, pWin->origin.x,
+ pWin->origin.y);
+ }
+ return pRgn;
+}
+
+static Bool
+ShapeOverlap (
+ WindowPtr pWin,
+ BoxPtr pWinBox,
+ WindowPtr pSib,
+ BoxPtr pSibBox)
+{
+ RegionPtr pWinRgn, pSibRgn;
+ ScreenPtr pScreen;
+ Bool ret;
+
+ if (!IS_SHAPED(pWin) && !IS_SHAPED(pSib))
+ return TRUE;
+ pScreen = pWin->drawable.pScreen;
+ pWinRgn = MakeBoundingRegion (pWin, pWinBox);
+ pSibRgn = MakeBoundingRegion (pSib, pSibBox);
+ REGION_INTERSECT(pScreen, pWinRgn, pWinRgn, pSibRgn);
+ ret = REGION_NOTEMPTY(pScreen, pWinRgn);
+ REGION_DESTROY(pScreen, pWinRgn);
+ REGION_DESTROY(pScreen, pSibRgn);
+ return ret;
+}
+
+static Bool
+AnyWindowOverlapsMe(
+ WindowPtr pWin,
+ WindowPtr pHead,
+ BoxPtr box)
+{
+ WindowPtr pSib;
+ BoxRec sboxrec;
+ BoxPtr sbox;
+
+ for (pSib = pWin->prevSib; pSib != pHead; pSib = pSib->prevSib)
+ {
+ if (pSib->mapped)
+ {
+ sbox = WindowExtents(pSib, &sboxrec);
+ if (BOXES_OVERLAP(sbox, box)
+ && ShapeOverlap (pWin, box, pSib, sbox)
+ )
+ return(TRUE);
+ }
+ }
+ return(FALSE);
+}
+
+static Bool
+IOverlapAnyWindow(
+ WindowPtr pWin,
+ BoxPtr box)
+{
+ WindowPtr pSib;
+ BoxRec sboxrec;
+ BoxPtr sbox;
+
+ for (pSib = pWin->nextSib; pSib; pSib = pSib->nextSib)
+ {
+ if (pSib->mapped)
+ {
+ sbox = WindowExtents(pSib, &sboxrec);
+ if (BOXES_OVERLAP(sbox, box)
+ && ShapeOverlap (pWin, box, pSib, sbox)
+ )
+ return(TRUE);
+ }
+ }
+ return(FALSE);
+}
+
+/*
+ * WhereDoIGoInTheStack()
+ * Given pWin and pSib and the relationshipe smode, return
+ * the window that pWin should go ABOVE.
+ * If a pSib is specified:
+ * Above: pWin is placed just above pSib
+ * Below: pWin is placed just below pSib
+ * TopIf: if pSib occludes pWin, then pWin is placed
+ * at the top of the stack
+ * BottomIf: if pWin occludes pSib, then pWin is
+ * placed at the bottom of the stack
+ * Opposite: if pSib occludes pWin, then pWin is placed at the
+ * top of the stack, else if pWin occludes pSib, then
+ * pWin is placed at the bottom of the stack
+ *
+ * If pSib is NULL:
+ * Above: pWin is placed at the top of the stack
+ * Below: pWin is placed at the bottom of the stack
+ * TopIf: if any sibling occludes pWin, then pWin is placed at
+ * the top of the stack
+ * BottomIf: if pWin occludes any sibline, then pWin is placed at
+ * the bottom of the stack
+ * Opposite: if any sibling occludes pWin, then pWin is placed at
+ * the top of the stack, else if pWin occludes any
+ * sibling, then pWin is placed at the bottom of the stack
+ *
+ */
+
+static WindowPtr
+WhereDoIGoInTheStack(
+ WindowPtr pWin,
+ WindowPtr pSib,
+ short x,
+ short y,
+ unsigned short w,
+ unsigned short h,
+ int smode)
+{
+ BoxRec box;
+ ScreenPtr pScreen;
+ WindowPtr pHead, pFirst;
+
+ if ((pWin == pWin->parent->firstChild) &&
+ (pWin == pWin->parent->lastChild))
+ return((WindowPtr ) NULL);
+ pHead = RealChildHead(pWin->parent);
+ pFirst = pHead ? pHead->nextSib : pWin->parent->firstChild;
+ pScreen = pWin->drawable.pScreen;
+ box.x1 = x;
+ box.y1 = y;
+ box.x2 = x + (int)w;
+ box.y2 = y + (int)h;
+ switch (smode)
+ {
+ case Above:
+ if (pSib)
+ return(pSib);
+ else if (pWin == pFirst)
+ return(pWin->nextSib);
+ else
+ return(pFirst);
+ case Below:
+ if (pSib)
+ if (pSib->nextSib != pWin)
+ return(pSib->nextSib);
+ else
+ return(pWin->nextSib);
+ else
+ return NullWindow;
+ case TopIf:
+ if ((!pWin->mapped || (pSib && !pSib->mapped)))
+ return(pWin->nextSib);
+ else if (pSib)
+ {
+ if ((IsSiblingAboveMe(pWin, pSib) == Above) &&
+ (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT))
+ return(pFirst);
+ else
+ return(pWin->nextSib);
+ }
+ else if (AnyWindowOverlapsMe(pWin, pHead, &box))
+ return(pFirst);
+ else
+ return(pWin->nextSib);
+ case BottomIf:
+ if ((!pWin->mapped || (pSib && !pSib->mapped)))
+ return(pWin->nextSib);
+ else if (pSib)
+ {
+ if ((IsSiblingAboveMe(pWin, pSib) == Below) &&
+ (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT))
+ return NullWindow;
+ else
+ return(pWin->nextSib);
+ }
+ else if (IOverlapAnyWindow(pWin, &box))
+ return NullWindow;
+ else
+ return(pWin->nextSib);
+ case Opposite:
+ if ((!pWin->mapped || (pSib && !pSib->mapped)))
+ return(pWin->nextSib);
+ else if (pSib)
+ {
+ if (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT)
+ {
+ if (IsSiblingAboveMe(pWin, pSib) == Above)
+ return(pFirst);
+ else
+ return NullWindow;
+ }
+ else
+ return(pWin->nextSib);
+ }
+ else if (AnyWindowOverlapsMe(pWin, pHead, &box))
+ {
+ /* If I'm occluded, I can't possibly be the first child
+ * if (pWin == pWin->parent->firstChild)
+ * return pWin->nextSib;
+ */
+ return(pFirst);
+ }
+ else if (IOverlapAnyWindow(pWin, &box))
+ return NullWindow;
+ else
+ return pWin->nextSib;
+ default:
+ {
+ /* should never happen; make something up. */
+ return pWin->nextSib;
+ }
+ }
+}
+
+static void
+ReflectStackChange(
+ WindowPtr pWin,
+ WindowPtr pSib,
+ VTKind kind)
+{
+/* Note that pSib might be NULL */
+
+ Bool WasViewable = (Bool)pWin->viewable;
+ Bool anyMarked;
+ WindowPtr pFirstChange;
+ WindowPtr pLayerWin;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ /* if this is a root window, can't be restacked */
+ if (!pWin->parent)
+ return;
+
+ pFirstChange = MoveWindowInStack(pWin, pSib);
+
+ if (WasViewable)
+ {
+ anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange,
+ &pLayerWin);
+ if (pLayerWin != pWin) pFirstChange = pLayerWin;
+ if (anyMarked)
+ {
+ (*pScreen->ValidateTree)(pLayerWin->parent, pFirstChange, kind);
+ (*pScreen->HandleExposures)(pLayerWin->parent);
+ }
+ if (anyMarked && pWin->drawable.pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstChange, kind);
+ }
+ if (pWin->realized)
+ WindowsRestructured ();
+}
+
+/*****
+ * ConfigureWindow
+ *****/
+
+int
+ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
+{
+#define RESTACK_WIN 0
+#define MOVE_WIN 1
+#define RESIZE_WIN 2
+#define REBORDER_WIN 3
+ WindowPtr pSib = NullWindow;
+ WindowPtr pParent = pWin->parent;
+ Window sibwid = 0;
+ Mask index2, tmask;
+ XID *pVlist;
+ short x, y, beforeX, beforeY;
+ unsigned short w = pWin->drawable.width,
+ h = pWin->drawable.height,
+ bw = pWin->borderWidth;
+ int rc, action, smode = Above;
+ xEvent event;
+
+ if ((pWin->drawable.class == InputOnly) && (mask & IllegalInputOnlyConfigureMask))
+ return(BadMatch);
+
+ if ((mask & CWSibling) && !(mask & CWStackMode))
+ return(BadMatch);
+
+ pVlist = vlist;
+
+ if (pParent)
+ {
+ x = pWin->drawable.x - pParent->drawable.x - (int)bw;
+ y = pWin->drawable.y - pParent->drawable.y - (int)bw;
+ }
+ else
+ {
+ x = pWin->drawable.x;
+ y = pWin->drawable.y;
+ }
+ beforeX = x;
+ beforeY = y;
+ action = RESTACK_WIN;
+ if ((mask & (CWX | CWY)) && (!(mask & (CWHeight | CWWidth))))
+ {
+ GET_INT16(CWX, x);
+ GET_INT16(CWY, y);
+ action = MOVE_WIN;
+ }
+ /* or should be resized */
+ else if (mask & (CWX | CWY | CWWidth | CWHeight))
+ {
+ GET_INT16(CWX, x);
+ GET_INT16(CWY, y);
+ GET_CARD16(CWWidth, w);
+ GET_CARD16 (CWHeight, h);
+ if (!w || !h)
+ {
+ client->errorValue = 0;
+ return BadValue;
+ }
+ action = RESIZE_WIN;
+ }
+ tmask = mask & ~ChangeMask;
+ while (tmask)
+ {
+ index2 = (Mask)lowbit (tmask);
+ tmask &= ~index2;
+ switch (index2)
+ {
+ case CWBorderWidth:
+ GET_CARD16(CWBorderWidth, bw);
+ break;
+ case CWSibling:
+ sibwid = (Window ) *pVlist;
+ pVlist++;
+ rc = dixLookupWindow(&pSib, sibwid, client, DixGetAttrAccess);
+ if (rc != Success)
+ {
+ client->errorValue = sibwid;
+ return rc;
+ }
+ if (pSib->parent != pParent)
+ return(BadMatch);
+ if (pSib == pWin)
+ return(BadMatch);
+ break;
+ case CWStackMode:
+ GET_CARD8(CWStackMode, smode);
+ if ((smode != TopIf) && (smode != BottomIf) &&
+ (smode != Opposite) && (smode != Above) && (smode != Below))
+ {
+ client->errorValue = smode;
+ return(BadValue);
+ }
+ break;
+ default:
+ client->errorValue = mask;
+ return(BadValue);
+ }
+ }
+ /* root really can't be reconfigured, so just return */
+ if (!pParent)
+ return Success;
+
+ /* Figure out if the window should be moved. Doesnt
+ make the changes to the window if event sent */
+
+ if (mask & CWStackMode)
+ pSib = WhereDoIGoInTheStack(pWin, pSib, pParent->drawable.x + x,
+ pParent->drawable.y + y,
+ w + (bw << 1), h + (bw << 1), smode);
+ else
+ pSib = pWin->nextSib;
+
+
+ if ((!pWin->overrideRedirect) &&
+ (RedirectSend(pParent)
+ ))
+ {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = ConfigureRequest;
+ event.u.configureRequest.window = pWin->drawable.id;
+ if (mask & CWSibling)
+ event.u.configureRequest.sibling = sibwid;
+ else
+ event.u.configureRequest.sibling = None;
+ if (mask & CWStackMode)
+ event.u.u.detail = smode;
+ else
+ event.u.u.detail = Above;
+ event.u.configureRequest.x = x;
+ event.u.configureRequest.y = y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && (!pParent || !pParent->parent)) {
+ event.u.configureRequest.x += panoramiXdataPtr[0].x;
+ event.u.configureRequest.y += panoramiXdataPtr[0].y;
+ }
+#endif
+ event.u.configureRequest.width = w;
+ event.u.configureRequest.height = h;
+ event.u.configureRequest.borderWidth = bw;
+ event.u.configureRequest.valueMask = mask;
+ event.u.configureRequest.parent = pParent->drawable.id;
+ if (MaybeDeliverEventsToClient(pParent, &event, 1,
+ SubstructureRedirectMask, client) == 1)
+ return(Success);
+ }
+ if (action == RESIZE_WIN)
+ {
+ Bool size_change = (w != pWin->drawable.width)
+ || (h != pWin->drawable.height);
+ if (size_change && ((pWin->eventMask|wOtherEventMasks(pWin)) & ResizeRedirectMask))
+ {
+ xEvent eventT;
+ memset(&eventT, 0, sizeof(xEvent));
+ eventT.u.u.type = ResizeRequest;
+ eventT.u.resizeRequest.window = pWin->drawable.id;
+ eventT.u.resizeRequest.width = w;
+ eventT.u.resizeRequest.height = h;
+ if (MaybeDeliverEventsToClient(pWin, &eventT, 1,
+ ResizeRedirectMask, client) == 1)
+ {
+ /* if event is delivered, leave the actual size alone. */
+ w = pWin->drawable.width;
+ h = pWin->drawable.height;
+ size_change = FALSE;
+ }
+ }
+ if (!size_change)
+ {
+ if (mask & (CWX | CWY))
+ action = MOVE_WIN;
+ else if (mask & (CWStackMode | CWBorderWidth))
+ action = RESTACK_WIN;
+ else /* really nothing to do */
+ return(Success) ;
+ }
+ }
+
+ if (action == RESIZE_WIN)
+ /* we've already checked whether there's really a size change */
+ goto ActuallyDoSomething;
+ if ((mask & CWX) && (x != beforeX))
+ goto ActuallyDoSomething;
+ if ((mask & CWY) && (y != beforeY))
+ goto ActuallyDoSomething;
+ if ((mask & CWBorderWidth) && (bw != wBorderWidth (pWin)))
+ goto ActuallyDoSomething;
+ if (mask & CWStackMode)
+ {
+#ifndef ROOTLESS
+ /* See above for why we always reorder in rootless mode. */
+ if (pWin->nextSib != pSib)
+#endif
+ goto ActuallyDoSomething;
+ }
+ return(Success);
+
+ActuallyDoSomething:
+ if (pWin->drawable.pScreen->ConfigNotify)
+ (*pWin->drawable.pScreen->ConfigNotify)(pWin, x, y, w, h, bw, pSib);
+
+ if (SubStrSend(pWin, pParent))
+ {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = ConfigureNotify;
+ event.u.configureNotify.window = pWin->drawable.id;
+ if (pSib)
+ event.u.configureNotify.aboveSibling = pSib->drawable.id;
+ else
+ event.u.configureNotify.aboveSibling = None;
+ event.u.configureNotify.x = x;
+ event.u.configureNotify.y = y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && (!pParent || !pParent->parent)) {
+ event.u.configureNotify.x += panoramiXdataPtr[0].x;
+ event.u.configureNotify.y += panoramiXdataPtr[0].y;
+ }
+#endif
+ event.u.configureNotify.width = w;
+ event.u.configureNotify.height = h;
+ event.u.configureNotify.borderWidth = bw;
+ event.u.configureNotify.override = pWin->overrideRedirect;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }
+ if (mask & CWBorderWidth)
+ {
+ if (action == RESTACK_WIN)
+ {
+ action = MOVE_WIN;
+ pWin->borderWidth = bw;
+ }
+ else if ((action == MOVE_WIN) &&
+ (beforeX + wBorderWidth (pWin) == x + (int)bw) &&
+ (beforeY + wBorderWidth (pWin) == y + (int)bw))
+ {
+ action = REBORDER_WIN;
+ (*pWin->drawable.pScreen->ChangeBorderWidth)(pWin, bw);
+ }
+ else
+ pWin->borderWidth = bw;
+ }
+ if (action == MOVE_WIN)
+ (*pWin->drawable.pScreen->MoveWindow)(pWin, x, y, pSib,
+ (mask & CWBorderWidth) ? VTOther : VTMove);
+ else if (action == RESIZE_WIN)
+ (*pWin->drawable.pScreen->ResizeWindow)(pWin, x, y, w, h, pSib);
+ else if (mask & CWStackMode)
+ ReflectStackChange(pWin, pSib, VTOther);
+
+ if (action != RESTACK_WIN)
+ CheckCursorConfinement(pWin);
+ return(Success);
+#undef RESTACK_WIN
+#undef MOVE_WIN
+#undef RESIZE_WIN
+#undef REBORDER_WIN
+}
+
+
+/******
+ *
+ * CirculateWindow
+ * For RaiseLowest, raises the lowest mapped child (if any) that is
+ * obscured by another child to the top of the stack. For LowerHighest,
+ * lowers the highest mapped child (if any) that is obscuring another
+ * child to the bottom of the stack. Exposure processing is performed
+ *
+ ******/
+
+int
+CirculateWindow(WindowPtr pParent, int direction, ClientPtr client)
+{
+ WindowPtr pWin, pHead, pFirst;
+ xEvent event;
+ BoxRec box;
+
+ pHead = RealChildHead(pParent);
+ pFirst = pHead ? pHead->nextSib : pParent->firstChild;
+ if (direction == RaiseLowest)
+ {
+ for (pWin = pParent->lastChild;
+ (pWin != pHead) &&
+ !(pWin->mapped &&
+ AnyWindowOverlapsMe(pWin, pHead, WindowExtents(pWin, &box)));
+ pWin = pWin->prevSib) ;
+ if (pWin == pHead)
+ return Success;
+ }
+ else
+ {
+ for (pWin = pFirst;
+ pWin &&
+ !(pWin->mapped &&
+ IOverlapAnyWindow(pWin, WindowExtents(pWin, &box)));
+ pWin = pWin->nextSib) ;
+ if (!pWin)
+ return Success;
+ }
+
+ event.u.circulate.window = pWin->drawable.id;
+ event.u.circulate.parent = pParent->drawable.id;
+ event.u.circulate.event = pParent->drawable.id;
+ if (direction == RaiseLowest)
+ event.u.circulate.place = PlaceOnTop;
+ else
+ event.u.circulate.place = PlaceOnBottom;
+
+ if (RedirectSend(pParent))
+ {
+ event.u.u.type = CirculateRequest;
+ if (MaybeDeliverEventsToClient(pParent, &event, 1,
+ SubstructureRedirectMask, client) == 1)
+ return(Success);
+ }
+
+ event.u.u.type = CirculateNotify;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ ReflectStackChange(pWin,
+ (direction == RaiseLowest) ? pFirst : NullWindow,
+ VTStack);
+
+ return(Success);
+}
+
+static int
+CompareWIDs(
+ WindowPtr pWin,
+ pointer value) /* must conform to VisitWindowProcPtr */
+{
+ Window *wid = (Window *)value;
+
+ if (pWin->drawable.id == *wid)
+ return(WT_STOPWALKING);
+ else
+ return(WT_WALKCHILDREN);
+}
+
+/*****
+ * ReparentWindow
+ *****/
+
+int
+ReparentWindow(WindowPtr pWin, WindowPtr pParent,
+ int x, int y, ClientPtr client)
+{
+ WindowPtr pPrev, pPriorParent;
+ Bool WasMapped = (Bool)(pWin->mapped);
+ xEvent event;
+ int bw = wBorderWidth (pWin);
+ ScreenPtr pScreen;
+
+ pScreen = pWin->drawable.pScreen;
+ if (TraverseTree(pWin, CompareWIDs, (pointer)&pParent->drawable.id) == WT_STOPWALKING)
+ return(BadMatch);
+ if (!MakeWindowOptional(pWin))
+ return(BadAlloc);
+
+ if (WasMapped)
+ UnmapWindow(pWin, FALSE);
+
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = ReparentNotify;
+ event.u.reparent.window = pWin->drawable.id;
+ event.u.reparent.parent = pParent->drawable.id;
+ event.u.reparent.x = x;
+ event.u.reparent.y = y;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && !pParent->parent) {
+ event.u.reparent.x += panoramiXdataPtr[0].x;
+ event.u.reparent.y += panoramiXdataPtr[0].y;
+ }
+#endif
+ event.u.reparent.override = pWin->overrideRedirect;
+ DeliverEvents(pWin, &event, 1, pParent);
+
+ /* take out of sibling chain */
+
+ pPriorParent = pPrev = pWin->parent;
+ if (pPrev->firstChild == pWin)
+ pPrev->firstChild = pWin->nextSib;
+ if (pPrev->lastChild == pWin)
+ pPrev->lastChild = pWin->prevSib;
+
+ if (pWin->nextSib)
+ pWin->nextSib->prevSib = pWin->prevSib;
+ if (pWin->prevSib)
+ pWin->prevSib->nextSib = pWin->nextSib;
+
+ /* insert at begining of pParent */
+ pWin->parent = pParent;
+ pPrev = RealChildHead(pParent);
+ if (pPrev)
+ {
+ pWin->nextSib = pPrev->nextSib;
+ if (pPrev->nextSib)
+ pPrev->nextSib->prevSib = pWin;
+ else
+ pParent->lastChild = pWin;
+ pPrev->nextSib = pWin;
+ pWin->prevSib = pPrev;
+ }
+ else
+ {
+ pWin->nextSib = pParent->firstChild;
+ pWin->prevSib = NullWindow;
+ if (pParent->firstChild)
+ pParent->firstChild->prevSib = pWin;
+ else
+ pParent->lastChild = pWin;
+ pParent->firstChild = pWin;
+ }
+
+ pWin->origin.x = x + bw;
+ pWin->origin.y = y + bw;
+ pWin->drawable.x = x + bw + pParent->drawable.x;
+ pWin->drawable.y = y + bw + pParent->drawable.y;
+
+ /* clip to parent */
+ SetWinSize (pWin);
+ SetBorderSize (pWin);
+
+ if (pScreen->ReparentWindow)
+ (*pScreen->ReparentWindow)(pWin, pPriorParent);
+ (*pScreen->PositionWindow)(pWin, pWin->drawable.x, pWin->drawable.y);
+ ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
+
+ CheckWindowOptionalNeed(pWin);
+
+ if (WasMapped)
+ MapWindow(pWin, client);
+ RecalculateDeliverableEvents(pWin);
+ return(Success);
+}
+
+static void
+RealizeTree(WindowPtr pWin)
+{
+ WindowPtr pChild;
+ RealizeWindowProcPtr Realize;
+
+ Realize = pWin->drawable.pScreen->RealizeWindow;
+ pChild = pWin;
+ while (1)
+ {
+ if (pChild->mapped)
+ {
+ pChild->realized = TRUE;
+ pChild->viewable = (pChild->drawable.class == InputOutput);
+ (* Realize)(pChild);
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ return;
+ pChild = pChild->nextSib;
+ }
+}
+
+static WindowPtr windowDisableMapUnmapEvents;
+
+void
+DisableMapUnmapEvents(WindowPtr pWin)
+{
+ assert (windowDisableMapUnmapEvents == NULL);
+
+ windowDisableMapUnmapEvents = pWin;
+}
+
+void
+EnableMapUnmapEvents(WindowPtr pWin)
+{
+ assert (windowDisableMapUnmapEvents != NULL);
+
+ windowDisableMapUnmapEvents = NULL;
+}
+
+static Bool
+MapUnmapEventsEnabled(WindowPtr pWin)
+{
+ return pWin != windowDisableMapUnmapEvents;
+}
+
+/*****
+ * MapWindow
+ * If some other client has selected SubStructureReDirect on the parent
+ * and override-redirect is xFalse, then a MapRequest event is generated,
+ * but the window remains unmapped. Otherwise, the window is mapped and a
+ * MapNotify event is generated.
+ *****/
+
+int
+MapWindow(WindowPtr pWin, ClientPtr client)
+{
+ ScreenPtr pScreen;
+
+ WindowPtr pParent;
+ WindowPtr pLayerWin;
+
+ if (pWin->mapped)
+ return(Success);
+
+ /* general check for permission to map window */
+ if (XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id, RT_WINDOW,
+ pWin, RT_NONE, NULL, DixShowAccess) != Success)
+ return Success;
+
+ pScreen = pWin->drawable.pScreen;
+ if ( (pParent = pWin->parent) )
+ {
+ xEvent event;
+ Bool anyMarked;
+
+ if ((!pWin->overrideRedirect) &&
+ (RedirectSend(pParent)
+ ))
+ {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = MapRequest;
+ event.u.mapRequest.window = pWin->drawable.id;
+ event.u.mapRequest.parent = pParent->drawable.id;
+
+ if (MaybeDeliverEventsToClient(pParent, &event, 1,
+ SubstructureRedirectMask, client) == 1)
+ return(Success);
+ }
+
+ pWin->mapped = TRUE;
+ if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
+ {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = MapNotify;
+ event.u.mapNotify.window = pWin->drawable.id;
+ event.u.mapNotify.override = pWin->overrideRedirect;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }
+
+ if (!pParent->realized)
+ return(Success);
+ RealizeTree(pWin);
+ if (pWin->viewable)
+ {
+ anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin,
+ &pLayerWin);
+ if (anyMarked)
+ {
+ (*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTMap);
+ (*pScreen->HandleExposures)(pLayerWin->parent);
+ }
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin, VTMap);
+ }
+ WindowsRestructured ();
+ }
+ else
+ {
+ RegionRec temp;
+
+ pWin->mapped = TRUE;
+ pWin->realized = TRUE; /* for roots */
+ pWin->viewable = pWin->drawable.class == InputOutput;
+ /* We SHOULD check for an error value here XXX */
+ (*pScreen->RealizeWindow)(pWin);
+ if (pScreen->ClipNotify)
+ (*pScreen->ClipNotify) (pWin, 0, 0);
+ if (pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(NullWindow, pWin, VTMap);
+ REGION_NULL(pScreen, &temp);
+ REGION_COPY(pScreen, &temp, &pWin->clipList);
+ (*pScreen->WindowExposures) (pWin, &temp, NullRegion);
+ REGION_UNINIT(pScreen, &temp);
+ }
+
+ return(Success);
+}
+
+
+/*****
+ * MapSubwindows
+ * Performs a MapWindow all unmapped children of the window, in top
+ * to bottom stacking order.
+ *****/
+
+void
+MapSubwindows(WindowPtr pParent, ClientPtr client)
+{
+ WindowPtr pWin;
+ WindowPtr pFirstMapped = NullWindow;
+ ScreenPtr pScreen;
+ Mask parentRedirect;
+ Mask parentNotify;
+ xEvent event;
+ Bool anyMarked;
+ WindowPtr pLayerWin;
+
+ pScreen = pParent->drawable.pScreen;
+ parentRedirect = RedirectSend(pParent);
+ parentNotify = SubSend(pParent);
+ anyMarked = FALSE;
+ for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib)
+ {
+ if (!pWin->mapped)
+ {
+ if (parentRedirect && !pWin->overrideRedirect)
+ {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = MapRequest;
+ event.u.mapRequest.window = pWin->drawable.id;
+ event.u.mapRequest.parent = pParent->drawable.id;
+
+ if (MaybeDeliverEventsToClient(pParent, &event, 1,
+ SubstructureRedirectMask, client) == 1)
+ continue;
+ }
+
+ pWin->mapped = TRUE;
+ if (parentNotify || StrSend(pWin))
+ {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = MapNotify;
+ event.u.mapNotify.window = pWin->drawable.id;
+ event.u.mapNotify.override = pWin->overrideRedirect;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }
+
+ if (!pFirstMapped)
+ pFirstMapped = pWin;
+ if (pParent->realized)
+ {
+ RealizeTree(pWin);
+ if (pWin->viewable)
+ {
+ anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin,
+ (WindowPtr *)NULL);
+ }
+ }
+ }
+ }
+
+ if (pFirstMapped)
+ {
+ pLayerWin = (*pScreen->GetLayerWindow)(pParent);
+ if (pLayerWin->parent != pParent) {
+ anyMarked |= (*pScreen->MarkOverlappedWindows)(pLayerWin,
+ pLayerWin,
+ (WindowPtr *)NULL);
+ pFirstMapped = pLayerWin;
+ }
+ if (anyMarked)
+ {
+ (*pScreen->ValidateTree)(pLayerWin->parent, pFirstMapped, VTMap);
+ (*pScreen->HandleExposures)(pLayerWin->parent);
+ }
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pLayerWin->parent, pFirstMapped,
+ VTMap);
+ WindowsRestructured ();
+ }
+}
+
+static void
+UnrealizeTree(
+ WindowPtr pWin,
+ Bool fromConfigure)
+{
+ WindowPtr pChild;
+ UnrealizeWindowProcPtr Unrealize;
+ MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
+ int rc;
+
+ Unrealize = pWin->drawable.pScreen->UnrealizeWindow;
+ MarkUnrealizedWindow = pWin->drawable.pScreen->MarkUnrealizedWindow;
+ pChild = pWin;
+ while (1)
+ {
+ if (pChild->realized)
+ {
+ pChild->realized = FALSE;
+ pChild->visibility = VisibilityNotViewable;
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) {
+ PanoramiXRes *win;
+ rc = dixLookupResourceByType((pointer *)&win,
+ pChild->drawable.id, XRT_WINDOW,
+ serverClient, DixWriteAccess);
+ if (rc == Success)
+ win->u.win.visibility = VisibilityNotViewable;
+ }
+#endif
+ (* Unrealize)(pChild);
+ if (MapUnmapEventsEnabled(pWin))
+ DeleteWindowFromAnyEvents(pChild, FALSE);
+ if (pChild->viewable)
+ {
+ pChild->viewable = FALSE;
+ (* MarkUnrealizedWindow)(pChild, pWin, fromConfigure);
+ pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
+ if (pChild->firstChild)
+ {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pWin))
+ pChild = pChild->parent;
+ if (pChild == pWin)
+ return;
+ pChild = pChild->nextSib;
+ }
+}
+
+/*****
+ * UnmapWindow
+ * If the window is already unmapped, this request has no effect.
+ * Otherwise, the window is unmapped and an UnMapNotify event is
+ * generated. Cannot unmap a root window.
+ *****/
+
+int
+UnmapWindow(WindowPtr pWin, Bool fromConfigure)
+{
+ WindowPtr pParent;
+ xEvent event;
+ Bool wasRealized = (Bool)pWin->realized;
+ Bool wasViewable = (Bool)pWin->viewable;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ WindowPtr pLayerWin = pWin;
+
+ if ((!pWin->mapped) || (!(pParent = pWin->parent)))
+ return(Success);
+ if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin))
+ {
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = UnmapNotify;
+ event.u.unmapNotify.window = pWin->drawable.id;
+ event.u.unmapNotify.fromConfigure = fromConfigure;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+ }
+ if (wasViewable && !fromConfigure)
+ {
+ pWin->valdata = UnmapValData;
+ (*pScreen->MarkOverlappedWindows)(pWin, pWin->nextSib, &pLayerWin);
+ (*pScreen->MarkWindow)(pLayerWin->parent);
+ }
+ pWin->mapped = FALSE;
+ if (wasRealized)
+ UnrealizeTree(pWin, fromConfigure);
+ if (wasViewable)
+ {
+ if (!fromConfigure)
+ {
+ (*pScreen->ValidateTree)(pLayerWin->parent, pWin, VTUnmap);
+ (*pScreen->HandleExposures)(pLayerWin->parent);
+ }
+ if (!fromConfigure && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pLayerWin->parent, pWin, VTUnmap);
+ }
+ if (wasRealized && !fromConfigure)
+ WindowsRestructured ();
+ return(Success);
+}
+
+/*****
+ * UnmapSubwindows
+ * Performs an UnmapWindow request with the specified mode on all mapped
+ * children of the window, in bottom to top stacking order.
+ *****/
+
+void
+UnmapSubwindows(WindowPtr pWin)
+{
+ WindowPtr pChild, pHead;
+ xEvent event;
+ Bool wasRealized = (Bool)pWin->realized;
+ Bool wasViewable = (Bool)pWin->viewable;
+ Bool anyMarked = FALSE;
+ Mask parentNotify;
+ WindowPtr pLayerWin = NULL;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ if (!pWin->firstChild)
+ return;
+ parentNotify = SubSend(pWin);
+ pHead = RealChildHead(pWin);
+
+ if (wasViewable)
+ pLayerWin = (*pScreen->GetLayerWindow)(pWin);
+
+ for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
+ {
+ if (pChild->mapped)
+ {
+ if (parentNotify || StrSend(pChild))
+ {
+ event.u.u.type = UnmapNotify;
+ event.u.unmapNotify.window = pChild->drawable.id;
+ event.u.unmapNotify.fromConfigure = xFalse;
+ DeliverEvents(pChild, &event, 1, NullWindow);
+ }
+ if (pChild->viewable)
+ {
+ pChild->valdata = UnmapValData;
+ anyMarked = TRUE;
+ }
+ pChild->mapped = FALSE;
+ if (pChild->realized)
+ UnrealizeTree(pChild, FALSE);
+ if (wasViewable)
+ {
+ }
+ }
+ }
+ if (wasViewable)
+ {
+ if (anyMarked)
+ {
+ if (pLayerWin->parent == pWin)
+ (*pScreen->MarkWindow)(pWin);
+ else
+ {
+ WindowPtr ptmp;
+ (*pScreen->MarkOverlappedWindows)(pWin, pLayerWin,
+ (WindowPtr *)NULL);
+ (*pScreen->MarkWindow)(pLayerWin->parent);
+
+ /* Windows between pWin and pLayerWin may not have been marked */
+ ptmp = pWin;
+
+ while (ptmp != pLayerWin->parent)
+ {
+ (*pScreen->MarkWindow)(ptmp);
+ ptmp = ptmp->parent;
+ }
+ pHead = pWin->firstChild;
+ }
+ (*pScreen->ValidateTree)(pLayerWin->parent, pHead, VTUnmap);
+ (*pScreen->HandleExposures)(pLayerWin->parent);
+ }
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pLayerWin->parent, pHead, VTUnmap);
+ }
+ if (wasRealized)
+ WindowsRestructured ();
+}
+
+
+void
+HandleSaveSet(ClientPtr client)
+{
+ WindowPtr pParent, pWin;
+ int j;
+
+ for (j=0; j<client->numSaved; j++)
+ {
+ pWin = SaveSetWindow(client->saveSet[j]);
+#ifdef XFIXES
+ if (SaveSetToRoot(client->saveSet[j]))
+ pParent = WindowTable[pWin->drawable.pScreen->myNum];
+ else
+#endif
+ {
+ pParent = pWin->parent;
+ while (pParent && (wClient (pParent) == client))
+ pParent = pParent->parent;
+ }
+ if (pParent)
+ {
+ if (pParent != pWin->parent)
+ {
+#ifdef XFIXES
+ /* unmap first so that ReparentWindow doesn't remap */
+ if (!SaveSetShouldMap (client->saveSet[j]))
+ UnmapWindow(pWin, FALSE);
+#endif
+ ReparentWindow(pWin, pParent,
+ pWin->drawable.x - wBorderWidth (pWin) - pParent->drawable.x,
+ pWin->drawable.y - wBorderWidth (pWin) - pParent->drawable.y,
+ client);
+ if(!pWin->realized && pWin->mapped)
+ pWin->mapped = FALSE;
+ }
+#ifdef XFIXES
+ if (SaveSetShouldMap (client->saveSet[j]))
+#endif
+ MapWindow(pWin, client);
+ }
+ }
+ xfree(client->saveSet);
+ client->numSaved = 0;
+ client->saveSet = (SaveSetElt *)NULL;
+}
+
+/**
+ *
+ * \param x,y in root
+ */
+Bool
+PointInWindowIsVisible(WindowPtr pWin, int x, int y)
+{
+ BoxRec box;
+
+ if (!pWin->realized)
+ return (FALSE);
+ if (POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderClip,
+ x, y, &box)
+ && (!wInputShape(pWin) ||
+ POINT_IN_REGION(pWin->drawable.pScreen,
+ wInputShape(pWin),
+ x - pWin->drawable.x,
+ y - pWin->drawable.y, &box)))
+ return(TRUE);
+ return(FALSE);
+}
+
+
+RegionPtr
+NotClippedByChildren(WindowPtr pWin)
+{
+ ScreenPtr pScreen;
+ RegionPtr pReg;
+
+ pScreen = pWin->drawable.pScreen;
+ pReg = REGION_CREATE(pScreen, NullBox, 1);
+ if (pWin->parent ||
+ screenIsSaved != SCREEN_SAVER_ON ||
+ !HasSaverWindow (pWin->drawable.pScreen->myNum))
+ {
+ REGION_INTERSECT(pScreen, pReg, &pWin->borderClip, &pWin->winSize);
+ }
+ return(pReg);
+}
+
+void
+SendVisibilityNotify(WindowPtr pWin)
+{
+ xEvent event;
+#ifndef NO_XINERAMA_PORT
+ unsigned int visibility = pWin->visibility;
+#endif
+ if (!MapUnmapEventsEnabled(pWin))
+ return;
+#ifdef PANORAMIX
+ /* This is not quite correct yet, but it's close */
+ if(!noPanoramiXExtension) {
+ PanoramiXRes *win;
+ WindowPtr pWin2;
+ int rc, i, Scrnum;
+
+ Scrnum = pWin->drawable.pScreen->myNum;
+
+ win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, Scrnum);
+
+ if(!win || (win->u.win.visibility == visibility))
+ return;
+
+ switch(visibility) {
+ case VisibilityUnobscured:
+ for(i = 0; i < PanoramiXNumScreens; i++) {
+ if(i == Scrnum) continue;
+
+ rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient,
+ DixWriteAccess);
+
+ if (rc == Success) {
+ if(pWin2->visibility == VisibilityPartiallyObscured)
+ return;
+
+ if(!i) pWin = pWin2;
+ }
+ }
+ break;
+ case VisibilityPartiallyObscured:
+ if(Scrnum) {
+ rc = dixLookupWindow(&pWin2, win->info[0].id, serverClient,
+ DixWriteAccess);
+ if (rc == Success) pWin = pWin2;
+ }
+ break;
+ case VisibilityFullyObscured:
+ for(i = 0; i < PanoramiXNumScreens; i++) {
+ if(i == Scrnum) continue;
+
+ rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient,
+ DixWriteAccess);
+
+ if (rc == Success) {
+ if(pWin2->visibility != VisibilityFullyObscured)
+ return;
+
+ if(!i) pWin = pWin2;
+ }
+ }
+ break;
+ }
+
+ win->u.win.visibility = visibility;
+ }
+#endif
+
+ memset(&event, 0, sizeof(xEvent));
+ event.u.u.type = VisibilityNotify;
+ event.u.visibility.window = pWin->drawable.id;
+ event.u.visibility.state = visibility;
+ DeliverEvents(pWin, &event, 1, NullWindow);
+}
+
+#define RANDOM_WIDTH 32
+
+#ifndef NOLOGOHACK
+static void DrawLogo(
+ WindowPtr pWin
+);
+#endif
+
+int
+dixSaveScreens(ClientPtr client, int on, int mode)
+{
+ int rc, i, what, type;
+
+ if (on == SCREEN_SAVER_FORCER)
+ {
+ if (mode == ScreenSaverReset)
+ what = SCREEN_SAVER_OFF;
+ else
+ what = SCREEN_SAVER_ON;
+ type = what;
+ }
+ else
+ {
+ what = on;
+ type = what;
+ if (what == screenIsSaved)
+ type = SCREEN_SAVER_CYCLE;
+ }
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
+ DixShowAccess | DixHideAccess);
+ if (rc != Success)
+ return rc;
+ }
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ if (on == SCREEN_SAVER_FORCER)
+ (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], on);
+ if (savedScreenInfo[i].ExternalScreenSaver)
+ {
+ if ((*savedScreenInfo[i].ExternalScreenSaver)
+ (screenInfo.screens[i], type, on == SCREEN_SAVER_FORCER))
+ continue;
+ }
+ if (type == screenIsSaved)
+ continue;
+ switch (type) {
+ case SCREEN_SAVER_OFF:
+ if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED)
+ {
+ (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i],
+ what);
+ }
+ else if (HasSaverWindow (i))
+ {
+ savedScreenInfo[i].pWindow = NullWindow;
+ FreeResource(savedScreenInfo[i].wid, RT_NONE);
+ }
+ break;
+ case SCREEN_SAVER_CYCLE:
+ if (savedScreenInfo[i].blanked == SCREEN_IS_TILED)
+ {
+ WindowPtr pWin = savedScreenInfo[i].pWindow;
+ /* make it look like screen saver is off, so that
+ * NotClippedByChildren will compute a clip list
+ * for the root window, so miPaintWindow works
+ */
+ screenIsSaved = SCREEN_SAVER_OFF;
+#ifndef NOLOGOHACK
+ if (logoScreenSaver)
+ (*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, FALSE);
+#endif
+ (*pWin->drawable.pScreen->MoveWindow)(pWin,
+ (short)(-(rand() % RANDOM_WIDTH)),
+ (short)(-(rand() % RANDOM_WIDTH)),
+ pWin->nextSib, VTMove);
+#ifndef NOLOGOHACK
+ if (logoScreenSaver)
+ DrawLogo(pWin);
+#endif
+ screenIsSaved = SCREEN_SAVER_ON;
+ }
+ /*
+ * Call the DDX saver in case it wants to do something
+ * at cycle time
+ */
+ else if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED)
+ {
+ (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i],
+ type);
+ }
+ break;
+ case SCREEN_SAVER_ON:
+ if (ScreenSaverBlanking != DontPreferBlanking)
+ {
+ if ((* screenInfo.screens[i]->SaveScreen)
+ (screenInfo.screens[i], what))
+ {
+ savedScreenInfo[i].blanked = SCREEN_IS_BLANKED;
+ continue;
+ }
+ if ((ScreenSaverAllowExposures != DontAllowExposures) &&
+ TileScreenSaver(i, SCREEN_IS_BLACK))
+ {
+ savedScreenInfo[i].blanked = SCREEN_IS_BLACK;
+ continue;
+ }
+ }
+ if ((ScreenSaverAllowExposures != DontAllowExposures) &&
+ TileScreenSaver(i, SCREEN_IS_TILED))
+ {
+ savedScreenInfo[i].blanked = SCREEN_IS_TILED;
+ }
+ else
+ savedScreenInfo[i].blanked = SCREEN_ISNT_SAVED;
+ break;
+ }
+ }
+ screenIsSaved = what;
+ if (mode == ScreenSaverReset) {
+ if (on == SCREEN_SAVER_FORCER) {
+ UpdateCurrentTimeIf();
+ lastDeviceEventTime = currentTime;
+ }
+ SetScreenSaverTimer();
+ }
+ return Success;
+}
+
+int
+SaveScreens(int on, int mode)
+{
+ return dixSaveScreens(serverClient, on, mode);
+}
+
+static Bool
+TileScreenSaver(int i, int kind)
+{
+ int j;
+ int result;
+ XID attributes[3];
+ Mask mask;
+ WindowPtr pWin;
+ CursorMetricRec cm;
+ unsigned char *srcbits, *mskbits;
+ CursorPtr cursor;
+ XID cursorID = 0;
+ int attri;
+
+ mask = 0;
+ attri = 0;
+ switch (kind) {
+ case SCREEN_IS_TILED:
+ switch (WindowTable[i]->backgroundState) {
+ case BackgroundPixel:
+ attributes[attri++] = WindowTable[i]->background.pixel;
+ mask |= CWBackPixel;
+ break;
+ case BackgroundPixmap:
+ attributes[attri++] = None;
+ mask |= CWBackPixmap;
+ break;
+ default:
+ break;
+ }
+ break;
+ case SCREEN_IS_BLACK:
+ attributes[attri++] = WindowTable[i]->drawable.pScreen->blackPixel;
+ mask |= CWBackPixel;
+ break;
+ }
+ mask |= CWOverrideRedirect;
+ attributes[attri++] = xTrue;
+
+ /*
+ * create a blank cursor
+ */
+
+ cm.width=16;
+ cm.height=16;
+ cm.xhot=8;
+ cm.yhot=8;
+ srcbits = xalloc( BitmapBytePad(32)*16);
+ mskbits = xalloc( BitmapBytePad(32)*16);
+ if (!srcbits || !mskbits)
+ {
+ xfree(srcbits);
+ xfree(mskbits);
+ cursor = 0;
+ }
+ else
+ {
+ for (j=0; j<BitmapBytePad(32)*16; j++)
+ srcbits[j] = mskbits[j] = 0x0;
+ result = AllocARGBCursor(srcbits, mskbits, NULL, &cm, 0, 0, 0, 0, 0, 0,
+ &cursor, serverClient, (XID)0);
+ if (cursor)
+ {
+ cursorID = FakeClientID(0);
+ if (AddResource (cursorID, RT_CURSOR, (pointer) cursor))
+ {
+ attributes[attri] = cursorID;
+ mask |= CWCursor;
+ }
+ else
+ cursor = 0;
+ }
+ else
+ {
+ xfree (srcbits);
+ xfree (mskbits);
+ }
+ }
+
+ pWin = savedScreenInfo[i].pWindow =
+ CreateWindow(savedScreenInfo[i].wid,
+ WindowTable[i],
+ -RANDOM_WIDTH, -RANDOM_WIDTH,
+ (unsigned short)screenInfo.screens[i]->width + RANDOM_WIDTH,
+ (unsigned short)screenInfo.screens[i]->height + RANDOM_WIDTH,
+ 0, InputOutput, mask, attributes, 0, serverClient,
+ wVisual (WindowTable[i]), &result);
+
+ if (cursor)
+ FreeResource (cursorID, RT_NONE);
+
+ if (!pWin)
+ return FALSE;
+
+ if (!AddResource(pWin->drawable.id, RT_WINDOW,
+ (pointer)savedScreenInfo[i].pWindow))
+ return FALSE;
+
+ if (mask & CWBackPixmap)
+ {
+ MakeRootTile (pWin);
+ (*pWin->drawable.pScreen->ChangeWindowAttributes)(pWin, CWBackPixmap);
+ }
+ MapWindow(pWin, serverClient);
+#ifndef NOLOGOHACK
+ if (kind == SCREEN_IS_TILED && logoScreenSaver)
+ DrawLogo(pWin);
+#endif
+ return TRUE;
+}
+
+/*
+ * FindWindowWithOptional
+ *
+ * search ancestors of the given window for an entry containing
+ * a WindowOpt structure. Assumptions: some parent will
+ * contain the structure.
+ */
+
+WindowPtr
+FindWindowWithOptional (WindowPtr w)
+{
+ do
+ w = w->parent;
+ while (!w->optional);
+ return w;
+}
+
+/*
+ * CheckWindowOptionalNeed
+ *
+ * check each optional entry in the given window to see if
+ * the value is satisfied by the default rules. If so,
+ * release the optional record
+ */
+
+void
+CheckWindowOptionalNeed (WindowPtr w)
+{
+ WindowOptPtr optional;
+ WindowOptPtr parentOptional;
+
+ if (!w->parent || !w->optional)
+ return;
+ optional = w->optional;
+ if (optional->dontPropagateMask != DontPropagateMasks[w->dontPropagate])
+ return;
+ if (optional->otherEventMasks != 0)
+ return;
+ if (optional->otherClients != NULL)
+ return;
+ if (optional->passiveGrabs != NULL)
+ return;
+ if (optional->userProps != NULL)
+ return;
+ if (optional->backingBitPlanes != ~0L)
+ return;
+ if (optional->backingPixel != 0)
+ return;
+ if (optional->boundingShape != NULL)
+ return;
+ if (optional->clipShape != NULL)
+ return;
+ if (optional->inputShape != NULL)
+ return;
+ if (optional->inputMasks != NULL)
+ return;
+ if (optional->deviceCursors != NULL)
+ {
+ DevCursNodePtr pNode = optional->deviceCursors;
+ while(pNode)
+ {
+ if (pNode->cursor != None)
+ return;
+ pNode = pNode->next;
+ }
+ }
+
+ parentOptional = FindWindowWithOptional(w)->optional;
+ if (optional->visual != parentOptional->visual)
+ return;
+ if (optional->cursor != None &&
+ (optional->cursor != parentOptional->cursor ||
+ w->parent->cursorIsNone))
+ return;
+ if (optional->colormap != parentOptional->colormap)
+ return;
+ DisposeWindowOptional (w);
+}
+
+/*
+ * MakeWindowOptional
+ *
+ * create an optional record and initialize it with the default
+ * values.
+ */
+
+Bool
+MakeWindowOptional (WindowPtr pWin)
+{
+ WindowOptPtr optional;
+ WindowOptPtr parentOptional;
+
+ if (pWin->optional)
+ return TRUE;
+ optional = xalloc (sizeof (WindowOptRec));
+ if (!optional)
+ return FALSE;
+ optional->dontPropagateMask = DontPropagateMasks[pWin->dontPropagate];
+ optional->otherEventMasks = 0;
+ optional->otherClients = NULL;
+ optional->passiveGrabs = NULL;
+ optional->userProps = NULL;
+ optional->backingBitPlanes = ~0L;
+ optional->backingPixel = 0;
+ optional->boundingShape = NULL;
+ optional->clipShape = NULL;
+ optional->inputShape = NULL;
+ optional->inputMasks = NULL;
+ optional->deviceCursors = NULL;
+
+ parentOptional = FindWindowWithOptional(pWin)->optional;
+ optional->visual = parentOptional->visual;
+ if (!pWin->cursorIsNone)
+ {
+ optional->cursor = parentOptional->cursor;
+ optional->cursor->refcnt++;
+ }
+ else
+ {
+ optional->cursor = None;
+ }
+ optional->colormap = parentOptional->colormap;
+ pWin->optional = optional;
+ return TRUE;
+}
+
+/*
+ * Changes the cursor struct for the given device and the given window.
+ * A cursor that does not have a device cursor set will use whatever the
+ * standard cursor is for the window. If all devices have a cursor set,
+ * changing the window cursor (e.g. using XDefineCursor()) will not have any
+ * visible effect. Only when one of the device cursors is set to None again,
+ * this device's cursor will display the changed standard cursor.
+ *
+ * CursorIsNone of the window struct is NOT modified if you set a device
+ * cursor.
+ *
+ * Assumption: If there is a node for a device in the list, the device has a
+ * cursor. If the cursor is set to None, it is inherited by the parent.
+ */
+int
+ChangeWindowDeviceCursor(WindowPtr pWin,
+ DeviceIntPtr pDev,
+ CursorPtr pCursor)
+{
+ DevCursNodePtr pNode, pPrev;
+ CursorPtr pOldCursor = NULL;
+ ScreenPtr pScreen;
+ WindowPtr pChild;
+
+ if (!pWin->optional && !MakeWindowOptional(pWin))
+ return BadAlloc;
+
+ /* 1) Check if window has device cursor set
+ * Yes: 1.1) swap cursor with given cursor if parent does not have same
+ * cursor, free old cursor
+ * 1.2) free old cursor, use parent cursor
+ * No: 1.1) add node to beginning of list.
+ * 1.2) add cursor to node if parent does not have same cursor
+ * 1.3) use parent cursor if parent does not have same cursor
+ * 2) Patch up children if child has a devcursor
+ * 2.1) if child has cursor None, it inherited from parent, set to old
+ * cursor
+ * 2.2) if child has same cursor as new cursor, remove and set to None
+ */
+
+ pScreen = pWin->drawable.pScreen;
+
+ if (WindowSeekDeviceCursor(pWin, pDev, &pNode, &pPrev))
+ {
+ /* has device cursor */
+
+ if (pNode->cursor == pCursor)
+ return Success;
+
+ pOldCursor = pNode->cursor;
+
+ if (!pCursor) /* remove from list */
+ {
+ if(pPrev)
+ pPrev->next = pNode->next;
+ else
+ /* first item in list */
+ pWin->optional->deviceCursors = pNode->next;
+
+ xfree(pNode);
+ goto out;
+ }
+
+ } else
+ {
+ /* no device cursor yet */
+ DevCursNodePtr pNewNode;
+
+ if (!pCursor)
+ return Success;
+
+ pNewNode = xalloc(sizeof(DevCursNodeRec));
+ pNewNode->dev = pDev;
+ pNewNode->next = pWin->optional->deviceCursors;
+ pWin->optional->deviceCursors = pNewNode;
+ pNode = pNewNode;
+
+ }
+
+ if (pCursor && WindowParentHasDeviceCursor(pWin, pDev, pCursor))
+ pNode->cursor = None;
+ else
+ {
+ pNode->cursor = pCursor;
+ pCursor->refcnt++;
+ }
+
+ pNode = pPrev = NULL;
+ /* fix up children */
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
+ {
+ if (WindowSeekDeviceCursor(pChild, pDev, &pNode, &pPrev))
+ {
+ if (pNode->cursor == None) /* inherited from parent */
+ {
+ pNode->cursor = pOldCursor;
+ pOldCursor->refcnt++;
+ } else if (pNode->cursor == pCursor)
+ {
+ pNode->cursor = None;
+ FreeCursor(pCursor, (Cursor)0); /* fix up refcnt */
+ }
+ }
+ }
+
+out:
+ if (pWin->realized)
+ WindowHasNewCursor(pWin);
+
+ if (pOldCursor)
+ FreeCursor(pOldCursor, (Cursor)0);
+
+ /* FIXME: We SHOULD check for an error value here XXX
+ (comment taken from ChangeWindowAttributes) */
+ (*pScreen->ChangeWindowAttributes)(pWin, CWCursor);
+
+ return Success;
+}
+
+/* Get device cursor for given device or None if none is set */
+CursorPtr
+WindowGetDeviceCursor(WindowPtr pWin, DeviceIntPtr pDev)
+{
+ DevCursorList pList;
+
+ if (!pWin->optional || !pWin->optional->deviceCursors)
+ return NULL;
+
+ pList = pWin->optional->deviceCursors;
+
+ while(pList)
+ {
+ if (pList->dev == pDev)
+ {
+ if (pList->cursor == None) /* inherited from parent */
+ return WindowGetDeviceCursor(pWin->parent, pDev);
+ else
+ return pList->cursor;
+ }
+ pList = pList->next;
+ }
+ return NULL;
+}
+
+/* Searches for a DevCursorNode for the given window and device. If one is
+ * found, return True and set pNode and pPrev to the node and to the node
+ * before the node respectively. Otherwise return False.
+ * If the device is the first in list, pPrev is set to NULL.
+ */
+static Bool
+WindowSeekDeviceCursor(WindowPtr pWin,
+ DeviceIntPtr pDev,
+ DevCursNodePtr* pNode,
+ DevCursNodePtr* pPrev)
+{
+ DevCursorList pList;
+
+ if (!pWin->optional)
+ return FALSE;
+
+ pList = pWin->optional->deviceCursors;
+
+ if (pList && pList->dev == pDev)
+ {
+ *pNode = pList;
+ *pPrev = NULL;
+ return TRUE;
+ }
+
+ while(pList)
+ {
+ if (pList->next)
+ {
+ if (pList->next->dev == pDev)
+ {
+ *pNode = pList->next;
+ *pPrev = pList;
+ return TRUE;
+ }
+ }
+ pList = pList->next;
+ }
+ return FALSE;
+}
+
+/* Return True if a parent has the same device cursor set or False if
+ * otherwise
+ */
+static Bool
+WindowParentHasDeviceCursor(WindowPtr pWin,
+ DeviceIntPtr pDev,
+ CursorPtr pCursor)
+{
+ WindowPtr pParent;
+ DevCursNodePtr pParentNode, pParentPrev;
+
+ pParent = pWin->parent;
+ while(pParent)
+ {
+ if (WindowSeekDeviceCursor(pParent, pDev,
+ &pParentNode, &pParentPrev))
+ {
+ /* if there is a node in the list, the win has a dev cursor */
+ if (!pParentNode->cursor) /* inherited. loop needs to cont. */
+ {
+ } else if (pParentNode->cursor == pCursor) /* inherit */
+ return TRUE;
+ else /* different cursor */
+ return FALSE;
+ }
+ else
+ /* parent does not have a device cursor for our device */
+ return FALSE;
+ }
+ return FALSE;
+}
+
+#ifndef NOLOGOHACK
+static void
+DrawLogo(WindowPtr pWin)
+{
+ DrawablePtr pDraw;
+ ScreenPtr pScreen;
+ int x, y;
+ unsigned int width, height, size;
+ GC *pGC;
+ int rc, thin, gap, d31;
+ DDXPointRec poly[4];
+ ChangeGCVal fore[2], back[2];
+ xrgb rgb[2];
+ BITS32 fmask, bmask;
+ ColormapPtr cmap;
+
+ pDraw = (DrawablePtr)pWin;
+ pScreen = pDraw->pScreen;
+ x = -pWin->origin.x;
+ y = -pWin->origin.y;
+ width = pScreen->width;
+ height = pScreen->height;
+ pGC = GetScratchGC(pScreen->rootDepth, pScreen);
+ if (!pGC)
+ return;
+
+ if ((rand() % 100) <= 17) /* make the probability for white fairly low */
+ fore[0].val = pScreen->whitePixel;
+ else
+ fore[0].val = pScreen->blackPixel;
+ if (pWin->backgroundState == BackgroundPixel) {
+ rc = dixLookupResourceByType((pointer *)&cmap, wColormap(pWin),
+ RT_COLORMAP, serverClient, DixReadAccess);
+ if (rc == Success) {
+ Pixel querypixels[2];
+
+ querypixels[0] = fore[0].val;
+ querypixels[1] = pWin->background.pixel;
+ QueryColors(cmap, 2, querypixels, rgb);
+ if ((rgb[0].red == rgb[1].red) &&
+ (rgb[0].green == rgb[1].green) &&
+ (rgb[0].blue == rgb[1].blue)) {
+ if (fore[0].val == pScreen->blackPixel)
+ fore[0].val = pScreen->whitePixel;
+ else
+ fore[0].val = pScreen->blackPixel;
+ }
+ }
+ }
+ fore[1].val = FillSolid;
+ fmask = GCForeground|GCFillStyle;
+ if (pWin->backgroundState == BackgroundPixel) {
+ back[0].val = pWin->background.pixel;
+ back[1].val = FillSolid;
+ bmask = GCForeground|GCFillStyle;
+ } else {
+ back[0].val = 0;
+ back[1].val = 0;
+ dixChangeGC(NullClient, pGC, GCTileStipXOrigin|GCTileStipYOrigin,
+ NULL, back);
+ back[0].val = FillTiled;
+ back[1].ptr = pWin->background.pixmap;
+ bmask = GCFillStyle|GCTile;
+ }
+
+ /* should be the same as the reference function XmuDrawLogo() */
+
+ size = width;
+ if (height < width)
+ size = height;
+ size = RANDOM_WIDTH + rand() % (size - RANDOM_WIDTH);
+ size &= ~1;
+ x += rand() % (width - size);
+ y += rand() % (height - size);
+
+/*
+ * Draw what will be the thin strokes.
+ *
+ * -----
+ * / /
+ * / /
+ * / /
+ * / /
+ * /____/
+ * d
+ *
+ * Point d is 9/44 (~1/5) of the way across.
+ */
+
+ thin = (size / 11);
+ if (thin < 1) thin = 1;
+ gap = (thin+3) / 4;
+ d31 = thin + thin + gap;
+ poly[0].x = x + size; poly[0].y = y;
+ poly[1].x = x + size-d31; poly[1].y = y;
+ poly[2].x = x + 0; poly[2].y = y + size;
+ poly[3].x = x + d31; poly[3].y = y + size;
+ dixChangeGC(NullClient, pGC, fmask, NULL, fore);
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
+
+/*
+ * Erase area not needed for lower thin stroke.
+ *
+ * ------
+ * / /
+ * / __ /
+ * / / /
+ * / / /
+ * /__/__/
+ */
+
+ poly[0].x = x + d31/2; poly[0].y = y + size;
+ poly[1].x = x + size / 2; poly[1].y = y + size/2;
+ poly[2].x = x + (size/2)+(d31-(d31/2)); poly[2].y = y + size/2;
+ poly[3].x = x + d31; poly[3].y = y + size;
+ dixChangeGC(NullClient, pGC, bmask, NULL, back);
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
+
+/*
+ * Erase area not needed for upper thin stroke.
+ *
+ * ------
+ * / / /
+ * /--/ /
+ * / /
+ * / /
+ * /_____/
+ */
+
+ poly[0].x = x + size - d31/2; poly[0].y = y;
+ poly[1].x = x + size / 2; poly[1].y = y + size/2;
+ poly[2].x = x + (size/2)-(d31-(d31/2)); poly[2].y = y + size/2;
+ poly[3].x = x + size - d31; poly[3].y = y;
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
+
+/*
+ * Draw thick stroke.
+ * Point b is 1/4 of the way across.
+ *
+ * b
+ * -----
+ * \ \
+ * \ \
+ * \ \
+ * \ \
+ * \____\
+ */
+
+ poly[0].x = x; poly[0].y = y;
+ poly[1].x = x + size/4; poly[1].y = y;
+ poly[2].x = x + size; poly[2].y = y + size;
+ poly[3].x = x + size - size/4; poly[3].y = y + size;
+ dixChangeGC(NullClient, pGC, fmask, NULL, fore);
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
+
+/*
+ * Erase to create gap.
+ *
+ * /
+ * /
+ * /
+ * /
+ * /
+ */
+
+ poly[0].x = x + size- thin; poly[0].y = y;
+ poly[1].x = x + size-( thin+gap); poly[1].y = y;
+ poly[2].x = x + thin; poly[2].y = y + size;
+ poly[3].x = x + thin + gap; poly[3].y = y + size;
+ dixChangeGC(NullClient, pGC, bmask, NULL, back);
+ ValidateGC(pDraw, pGC);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, Convex, CoordModeOrigin, 4, poly);
+
+ FreeScratchGC(pGC);
+}
+
+#endif
diff --git a/xorg-server/doc/Makefile.in b/xorg-server/doc/Makefile.in
index c081fa062..b2fb184cb 100644
--- a/xorg-server/doc/Makefile.in
+++ b/xorg-server/doc/Makefile.in
@@ -127,6 +127,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -258,6 +259,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = sed
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/exa/Makefile.in b/xorg-server/exa/Makefile.in
index c3572c586..0ff5597bb 100644
--- a/xorg-server/exa/Makefile.in
+++ b/xorg-server/exa/Makefile.in
@@ -152,6 +152,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -283,6 +284,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/exa/exa.c b/xorg-server/exa/exa.c
index c5ac7dec2..590d9a500 100644
--- a/xorg-server/exa/exa.c
+++ b/xorg-server/exa/exa.c
@@ -417,8 +417,8 @@ exaFinishAccess(DrawablePtr pDrawable, int index)
/* Catch unbalanced Prepare/FinishAccess calls. */
if (i == EXA_NUM_PREPARE_INDICES)
- EXA_FatalErrorDebug(("EXA bug: FinishAccess called without PrepareAccess for pixmap 0x%p.\n",
- pPixmap));
+ EXA_FatalErrorDebugWithRet(("EXA bug: FinishAccess called without PrepareAccess for pixmap 0x%p.\n",
+ pPixmap),);
pExaScr->access[i].pixmap = NULL;
diff --git a/xorg-server/fb/Makefile.in b/xorg-server/fb/Makefile.in
index eafae2504..0f716f8c7 100644
--- a/xorg-server/fb/Makefile.in
+++ b/xorg-server/fb/Makefile.in
@@ -180,6 +180,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -311,6 +312,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/fb/fbscreen.c b/xorg-server/fb/fbscreen.c
index 24eadde1a..53e2ada9f 100644
--- a/xorg-server/fb/fbscreen.c
+++ b/xorg-server/fb/fbscreen.c
@@ -228,7 +228,11 @@ fbFinishScreenInit(ScreenPtr pScreen,
rootdepth = 0;
if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
&defaultVisual,((unsigned long)1<<(imagebpp-1)), 8))
+ {
+ xfree (visuals);
+ xfree (depths);
return FALSE;
+ }
if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
rootdepth, ndepths, depths,
defaultVisual, nvisuals, visuals))
diff --git a/xorg-server/glx/Makefile.in b/xorg-server/glx/Makefile.in
index 7e1781215..25efe54c6 100644
--- a/xorg-server/glx/Makefile.in
+++ b/xorg-server/glx/Makefile.in
@@ -144,6 +144,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -275,6 +276,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/Makefile.in b/xorg-server/hw/Makefile.in
index 9a39a8fa7..98ddfd039 100644
--- a/xorg-server/hw/Makefile.in
+++ b/xorg-server/hw/Makefile.in
@@ -137,6 +137,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -268,6 +269,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/dmx/Makefile.in b/xorg-server/hw/dmx/Makefile.in
index ff9bc4170..86c2d2f83 100644
--- a/xorg-server/hw/dmx/Makefile.in
+++ b/xorg-server/hw/dmx/Makefile.in
@@ -213,6 +213,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -344,6 +345,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/dmx/config/Makefile.in b/xorg-server/hw/dmx/config/Makefile.in
index 34b68311a..ec66a2a26 100644
--- a/xorg-server/hw/dmx/config/Makefile.in
+++ b/xorg-server/hw/dmx/config/Makefile.in
@@ -186,6 +186,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -317,6 +318,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/dmx/doc/Makefile.in b/xorg-server/hw/dmx/doc/Makefile.in
index 8722e556d..37b3f16d7 100644
--- a/xorg-server/hw/dmx/doc/Makefile.in
+++ b/xorg-server/hw/dmx/doc/Makefile.in
@@ -121,6 +121,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -252,6 +253,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/dmx/examples/Makefile.in b/xorg-server/hw/dmx/examples/Makefile.in
index 36127b0e5..b97173c09 100644
--- a/xorg-server/hw/dmx/examples/Makefile.in
+++ b/xorg-server/hw/dmx/examples/Makefile.in
@@ -228,6 +228,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -359,6 +360,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/dmx/examples/xinput.c b/xorg-server/hw/dmx/examples/xinput.c
index 7421be337..b12daf201 100644
--- a/xorg-server/hw/dmx/examples/xinput.c
+++ b/xorg-server/hw/dmx/examples/xinput.c
@@ -233,7 +233,7 @@ int main(int argc, char **argv)
int total = 0;
#define ADD(type) \
- if (cnt >= MAX_EVENTS) OsAbort(); \
+ if (cnt >= MAX_EVENTS) abort(); \
names[cnt] = #type; \
type(dev, event_type[cnt], event_list[cnt]); \
if (event_type[cnt]) ++cnt
diff --git a/xorg-server/hw/dmx/glxProxy/Makefile.in b/xorg-server/hw/dmx/glxProxy/Makefile.in
index 2f80f995a..5ca05f9a0 100644
--- a/xorg-server/hw/dmx/glxProxy/Makefile.in
+++ b/xorg-server/hw/dmx/glxProxy/Makefile.in
@@ -135,6 +135,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -266,6 +267,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/dmx/input/Makefile.in b/xorg-server/hw/dmx/input/Makefile.in
index 101566ce7..c71e62752 100644
--- a/xorg-server/hw/dmx/input/Makefile.in
+++ b/xorg-server/hw/dmx/input/Makefile.in
@@ -149,6 +149,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -280,6 +281,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/kdrive/Makefile.in b/xorg-server/hw/kdrive/Makefile.in
index 4299e77c5..a14b0309b 100644
--- a/xorg-server/hw/kdrive/Makefile.in
+++ b/xorg-server/hw/kdrive/Makefile.in
@@ -137,6 +137,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -268,6 +269,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/kdrive/ephyr/Makefile.in b/xorg-server/hw/kdrive/ephyr/Makefile.in
index e17146a7b..bc65da957 100644
--- a/xorg-server/hw/kdrive/ephyr/Makefile.in
+++ b/xorg-server/hw/kdrive/ephyr/Makefile.in
@@ -187,6 +187,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -318,6 +319,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = sed
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/kdrive/fake/Makefile.in b/xorg-server/hw/kdrive/fake/Makefile.in
index 346a1e1c8..5e59a8277 100644
--- a/xorg-server/hw/kdrive/fake/Makefile.in
+++ b/xorg-server/hw/kdrive/fake/Makefile.in
@@ -133,6 +133,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -264,6 +265,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/kdrive/fbdev/Makefile.in b/xorg-server/hw/kdrive/fbdev/Makefile.in
index b5366e1e3..2b5257a59 100644
--- a/xorg-server/hw/kdrive/fbdev/Makefile.in
+++ b/xorg-server/hw/kdrive/fbdev/Makefile.in
@@ -134,6 +134,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -265,6 +266,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/kdrive/linux/Makefile.in b/xorg-server/hw/kdrive/linux/Makefile.in
index 46615d6e2..e0598dcb7 100644
--- a/xorg-server/hw/kdrive/linux/Makefile.in
+++ b/xorg-server/hw/kdrive/linux/Makefile.in
@@ -135,6 +135,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -266,6 +267,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/kdrive/src/Makefile.in b/xorg-server/hw/kdrive/src/Makefile.in
index bdb1cda21..a2b44fa16 100644
--- a/xorg-server/hw/kdrive/src/Makefile.in
+++ b/xorg-server/hw/kdrive/src/Makefile.in
@@ -133,6 +133,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -264,6 +265,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/vfb/Makefile.in b/xorg-server/hw/vfb/Makefile.in
index a6012d51a..91ea51223 100644
--- a/xorg-server/hw/vfb/Makefile.in
+++ b/xorg-server/hw/vfb/Makefile.in
@@ -171,6 +171,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -302,6 +303,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = sed
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/Makefile.in b/xorg-server/hw/xfree86/Makefile.in
index f403408f3..ca37434b7 100644
--- a/xorg-server/hw/xfree86/Makefile.in
+++ b/xorg-server/hw/xfree86/Makefile.in
@@ -184,6 +184,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -315,6 +316,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = sed
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/common/Makefile.in b/xorg-server/hw/xfree86/common/Makefile.in
index 12341f396..1ca3ada76 100644
--- a/xorg-server/hw/xfree86/common/Makefile.in
+++ b/xorg-server/hw/xfree86/common/Makefile.in
@@ -176,6 +176,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -307,6 +308,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index 132e8bc37..718a07860 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -1286,14 +1286,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
}
- if (!foundPointer) {
- if (!xf86Info.allowEmptyInput) {
- /* This shouldn't happen. */
- xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
- return FALSE;
- } else {
- xf86Msg(X_INFO, "Cannot locate a core pointer device.\n");
- }
+ if (!foundPointer && !xf86Info.allowEmptyInput) {
+ /* This shouldn't happen. */
+ xf86Msg(X_ERROR, "Cannot locate a core pointer device.\n");
+ return FALSE;
}
/*
@@ -1430,14 +1426,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
}
- if (!foundKeyboard) {
- if (!xf86Info.allowEmptyInput) {
- /* This shouldn't happen. */
- xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
- return FALSE;
- } else {
- xf86Msg(X_INFO, "Cannot locate a core keyboard device.\n");
- }
+ if (!foundKeyboard && !xf86Info.allowEmptyInput) {
+ /* This shouldn't happen. */
+ xf86Msg(X_ERROR, "Cannot locate a core keyboard device.\n");
+ return FALSE;
}
if (pointerMsg) {
@@ -1511,7 +1503,7 @@ configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp)
irp = (XF86ConfInputrefPtr)irp->list.next;
}
DebugF("Found %d input devices in the layout section %s\n",
- count, layout.lay_identifier);
+ count, layout->lay_identifier);
indp = xnfcalloc((count + 1), sizeof(IDevPtr));
indp[count] = NULL;
irp = layout->lay_input_lst;
diff --git a/xorg-server/hw/xfree86/common/xf86Configure.c b/xorg-server/hw/xfree86/common/xf86Configure.c
index d74d90bdd..67bf08bbf 100644
--- a/xorg-server/hw/xfree86/common/xf86Configure.c
+++ b/xorg-server/hw/xfree86/common/xf86Configure.c
@@ -612,7 +612,7 @@ configureDDCMonitorSection (int screennum)
len = 0;
}
if ((ptr->mon_comment =
- realloc(ptr->mon_comment, len+strlen(displaySize_string)))) {
+ realloc(ptr->mon_comment, len + strlen(displaySize_string) + 1))) {
strcpy(ptr->mon_comment + len, displaySize_string);
}
}
diff --git a/xorg-server/hw/xfree86/common/xf86cmap.c b/xorg-server/hw/xfree86/common/xf86cmap.c
index 4cab8b3eb..f60d96e7d 100644
--- a/xorg-server/hw/xfree86/common/xf86cmap.c
+++ b/xorg-server/hw/xfree86/common/xf86cmap.c
@@ -1,1170 +1,1167 @@
-/*
- * Copyright (c) 1998-2001 by The XFree86 Project, Inc.
- *
- * 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, 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 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
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#if defined(_XOPEN_SOURCE) || defined(sun) && defined(__SVR4)
-#include <math.h>
-#else
-#define _XOPEN_SOURCE /* to get prototype for pow on some systems */
-#include <math.h>
-#undef _XOPEN_SOURCE
-#endif
-
-#include <X11/X.h>
-#include "misc.h"
-#include <X11/Xproto.h>
-#include "colormapst.h"
-#include "scrnintstr.h"
-
-#include "resource.h"
-
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "xf86str.h"
-#include "micmap.h"
-#include "xf86Crtc.h"
-
-#ifdef XFreeXDGA
-#include <X11/extensions/xf86dgaproto.h>
-#include "dgaproc.h"
-#endif
-
-#include "xf86cmap.h"
-
-#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
- ((CMapScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, CMapScreenKey))->field)
-#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
- ((pScreen)->field = wrapper)
-
-#define LOAD_PALETTE(pmap, index) \
- ((pmap == miInstalledMaps[index]) && \
- ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \
- xf86Screens[index]->vtSema || pScreenPriv->isDGAmode))
-
-
-typedef struct _CMapLink {
- ColormapPtr cmap;
- struct _CMapLink *next;
-} CMapLink, *CMapLinkPtr;
-
-typedef struct {
- ScrnInfoPtr pScrn;
- CloseScreenProcPtr CloseScreen;
- CreateColormapProcPtr CreateColormap;
- DestroyColormapProcPtr DestroyColormap;
- InstallColormapProcPtr InstallColormap;
- StoreColorsProcPtr StoreColors;
- Bool (*EnterVT)(int, int);
- Bool (*SwitchMode)(int, DisplayModePtr, int);
- int (*SetDGAMode)(int, int, DGADevicePtr);
- xf86ChangeGammaProc *ChangeGamma;
- int maxColors;
- int sigRGBbits;
- int gammaElements;
- LOCO *gamma;
- int *PreAllocIndices;
- CMapLinkPtr maps;
- unsigned int flags;
- Bool isDGAmode;
-} CMapScreenRec, *CMapScreenPtr;
-
-typedef struct {
- int numColors;
- LOCO *colors;
- Bool recalculate;
- int overscan;
-} CMapColormapRec, *CMapColormapPtr;
-
-static int CMapScreenKeyIndex;
-static DevPrivateKey CMapScreenKey;
-static int CMapColormapKeyIndex;
-static DevPrivateKey CMapColormapKey = &CMapColormapKeyIndex;
-
-static void CMapInstallColormap(ColormapPtr);
-static void CMapStoreColors(ColormapPtr, int, xColorItem *);
-static Bool CMapCloseScreen (int, ScreenPtr);
-static Bool CMapCreateColormap (ColormapPtr);
-static void CMapDestroyColormap (ColormapPtr);
-
-static Bool CMapEnterVT(int, int);
-static Bool CMapSwitchMode(int, DisplayModePtr, int);
-#ifdef XFreeXDGA
-static int CMapSetDGAMode(int, int, DGADevicePtr);
-#endif
-static int CMapChangeGamma(int, Gamma);
-
-static void ComputeGamma(CMapScreenPtr);
-static Bool CMapAllocateColormapPrivate(ColormapPtr);
-static void CMapRefreshColors(ColormapPtr, int, int*);
-static void CMapSetOverscan(ColormapPtr, int, int *);
-static void CMapReinstallMap(ColormapPtr);
-static void CMapUnwrapScreen(ScreenPtr pScreen);
-
-
-
-Bool xf86HandleColormaps(
- ScreenPtr pScreen,
- int maxColors,
- int sigRGBbits,
- xf86LoadPaletteProc *loadPalette,
- xf86SetOverscanProc *setOverscan,
- unsigned int flags
-){
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- ColormapPtr pDefMap = NULL;
- CMapScreenPtr pScreenPriv;
- LOCO *gamma;
- int *indices;
- int elements;
-
- /* If we support a better colormap system, then pretend we succeeded. */
- if (xf86_crtc_supports_gamma(pScrn))
- return TRUE;
-
- if(!maxColors || !sigRGBbits || !loadPalette)
- return FALSE;
-
- CMapScreenKey = &CMapScreenKeyIndex;
-
- elements = 1 << sigRGBbits;
-
- if(!(gamma = xalloc(elements * sizeof(LOCO))))
- return FALSE;
-
- if(!(indices = xalloc(maxColors * sizeof(int)))) {
- xfree(gamma);
- return FALSE;
- }
-
- if(!(pScreenPriv = xalloc(sizeof(CMapScreenRec)))) {
- xfree(gamma);
- xfree(indices);
- return FALSE;
- }
-
- dixSetPrivate(&pScreen->devPrivates, CMapScreenKey, pScreenPriv);
-
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreenPriv->CreateColormap = pScreen->CreateColormap;
- pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
- pScreenPriv->InstallColormap = pScreen->InstallColormap;
- pScreenPriv->StoreColors = pScreen->StoreColors;
- pScreen->CloseScreen = CMapCloseScreen;
- pScreen->CreateColormap = CMapCreateColormap;
- pScreen->DestroyColormap = CMapDestroyColormap;
- pScreen->InstallColormap = CMapInstallColormap;
- pScreen->StoreColors = CMapStoreColors;
-
- pScreenPriv->pScrn = pScrn;
- pScrn->LoadPalette = loadPalette;
- pScrn->SetOverscan = setOverscan;
- pScreenPriv->maxColors = maxColors;
- pScreenPriv->sigRGBbits = sigRGBbits;
- pScreenPriv->gammaElements = elements;
- pScreenPriv->gamma = gamma;
- pScreenPriv->PreAllocIndices = indices;
- pScreenPriv->maps = NULL;
- pScreenPriv->flags = flags;
- pScreenPriv->isDGAmode = FALSE;
-
- pScreenPriv->EnterVT = pScrn->EnterVT;
- pScreenPriv->SwitchMode = pScrn->SwitchMode;
- pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
- pScreenPriv->ChangeGamma = pScrn->ChangeGamma;
-
- if (!(flags & CMAP_LOAD_EVEN_IF_OFFSCREEN)) {
- pScrn->EnterVT = CMapEnterVT;
- if ((flags & CMAP_RELOAD_ON_MODE_SWITCH) && pScrn->SwitchMode)
- pScrn->SwitchMode = CMapSwitchMode;
- }
-#ifdef XFreeXDGA
- pScrn->SetDGAMode = CMapSetDGAMode;
-#endif
- pScrn->ChangeGamma = CMapChangeGamma;
-
- ComputeGamma(pScreenPriv);
-
- /* get the default map */
- dixLookupResourceByType((pointer *)&pDefMap, pScreen->defColormap,
- RT_COLORMAP, serverClient, DixInstallAccess);
-
- if(!CMapAllocateColormapPrivate(pDefMap)) {
- CMapUnwrapScreen(pScreen);
- return FALSE;
- }
-
- /* Force the initial map to be loaded */
- miInstalledMaps[pScreen->myNum] = NULL;
- CMapInstallColormap(pDefMap);
- return TRUE;
-}
-
-
-/**** Screen functions ****/
-
-
-static Bool
-CMapCloseScreen (int i, ScreenPtr pScreen)
-{
- CMapUnwrapScreen(pScreen);
-
- return (*pScreen->CloseScreen) (i, pScreen);
-}
-
-static Bool
-CMapColormapUseMax(VisualPtr pVisual, CMapScreenPtr pScreenPriv)
-{
- if (pVisual->nplanes > 16)
- return TRUE;
- return ((1 << pVisual->nplanes) > pScreenPriv->maxColors);
-}
-
-static Bool
-CMapAllocateColormapPrivate(ColormapPtr pmap)
-{
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pmap->pScreen->devPrivates, CMapScreenKey);
- CMapColormapPtr pColPriv;
- CMapLinkPtr pLink;
- int numColors;
- LOCO *colors;
-
- if (CMapColormapUseMax(pmap->pVisual, pScreenPriv))
- numColors = pmap->pVisual->ColormapEntries;
- else
- numColors = 1 << pmap->pVisual->nplanes;
-
- if(!(colors = xalloc(numColors * sizeof(LOCO))))
- return FALSE;
-
- if(!(pColPriv = xalloc(sizeof(CMapColormapRec)))) {
- xfree(colors);
- return FALSE;
- }
-
- dixSetPrivate(&pmap->devPrivates, CMapColormapKey, pColPriv);
-
- pColPriv->numColors = numColors;
- pColPriv->colors = colors;
- pColPriv->recalculate = TRUE;
- pColPriv->overscan = -1;
-
- /* add map to list */
- pLink = xalloc(sizeof(CMapLink));
- if(pLink) {
- pLink->cmap = pmap;
- pLink->next = pScreenPriv->maps;
- pScreenPriv->maps = pLink;
- }
-
- return TRUE;
-}
-
-static Bool
-CMapCreateColormap (ColormapPtr pmap)
-{
- ScreenPtr pScreen = pmap->pScreen;
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
- Bool ret = FALSE;
-
- pScreen->CreateColormap = pScreenPriv->CreateColormap;
- if((*pScreen->CreateColormap)(pmap)) {
- if(CMapAllocateColormapPrivate(pmap))
- ret = TRUE;
- }
- pScreen->CreateColormap = CMapCreateColormap;
-
- return ret;
-}
-
-static void
-CMapDestroyColormap (ColormapPtr cmap)
-{
- ScreenPtr pScreen = cmap->pScreen;
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
- CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
- &cmap->devPrivates, CMapColormapKey);
- CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps;
-
- if(pColPriv) {
- if(pColPriv->colors) xfree(pColPriv->colors);
- xfree(pColPriv);
- }
-
- /* remove map from list */
- while(pLink) {
- if(pLink->cmap == cmap) {
- if(prevLink)
- prevLink->next = pLink->next;
- else
- pScreenPriv->maps = pLink->next;
- xfree(pLink);
- break;
- }
- prevLink = pLink;
- pLink = pLink->next;
- }
-
- if(pScreenPriv->DestroyColormap) {
- pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
- (*pScreen->DestroyColormap)(cmap);
- pScreen->DestroyColormap = CMapDestroyColormap;
- }
-}
-
-
-
-static void
-CMapStoreColors(
- ColormapPtr pmap,
- int ndef,
- xColorItem *pdefs
-){
- ScreenPtr pScreen = pmap->pScreen;
- VisualPtr pVisual = pmap->pVisual;
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
- int *indices = pScreenPriv->PreAllocIndices;
- int num = ndef;
-
- /* At the moment this isn't necessary since there's nobody below us */
- pScreen->StoreColors = pScreenPriv->StoreColors;
- (*pScreen->StoreColors)(pmap, ndef, pdefs);
- pScreen->StoreColors = CMapStoreColors;
-
- /* should never get here for these */
- if( (pVisual->class == TrueColor) ||
- (pVisual->class == StaticColor) ||
- (pVisual->class == StaticGray))
- return;
-
- if(pVisual->class == DirectColor) {
- CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
- &pmap->devPrivates, CMapColormapKey);
- int i;
-
- if (CMapColormapUseMax(pVisual, pScreenPriv)) {
- int index;
-
- num = 0;
- while(ndef--) {
- if(pdefs[ndef].flags & DoRed) {
- index = (pdefs[ndef].pixel & pVisual->redMask) >>
- pVisual->offsetRed;
- i = num;
- while(i--)
- if(indices[i] == index) break;
- if(i == -1)
- indices[num++] = index;
- }
- if(pdefs[ndef].flags & DoGreen) {
- index = (pdefs[ndef].pixel & pVisual->greenMask) >>
- pVisual->offsetGreen;
- i = num;
- while(i--)
- if(indices[i] == index) break;
- if(i == -1)
- indices[num++] = index;
- }
- if(pdefs[ndef].flags & DoBlue) {
- index = (pdefs[ndef].pixel & pVisual->blueMask) >>
- pVisual->offsetBlue;
- i = num;
- while(i--)
- if(indices[i] == index) break;
- if(i == -1)
- indices[num++] = index;
- }
- }
-
- } else {
- /* not really as overkill as it seems */
- num = pColPriv->numColors;
- for(i = 0; i < pColPriv->numColors; i++)
- indices[i] = i;
- }
- } else {
- while(ndef--)
- indices[ndef] = pdefs[ndef].pixel;
- }
-
- CMapRefreshColors(pmap, num, indices);
-}
-
-
-static void
-CMapInstallColormap(ColormapPtr pmap)
-{
- ScreenPtr pScreen = pmap->pScreen;
- int index = pScreen->myNum;
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
-
- if (pmap == miInstalledMaps[index])
- return;
-
- pScreen->InstallColormap = pScreenPriv->InstallColormap;
- (*pScreen->InstallColormap)(pmap);
- pScreen->InstallColormap = CMapInstallColormap;
-
- /* Important. We let the lower layers, namely DGA,
- overwrite the choice of Colormap to install */
- if (miInstalledMaps[index])
- pmap = miInstalledMaps[index];
-
- if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
- (pmap->pVisual->class == TrueColor) &&
- CMapColormapUseMax(pmap->pVisual, pScreenPriv))
- return;
-
- if(LOAD_PALETTE(pmap, index))
- CMapReinstallMap(pmap);
-}
-
-
-/**** ScrnInfoRec functions ****/
-
-static Bool
-CMapEnterVT(int index, int flags)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
-
- if((*pScreenPriv->EnterVT)(index, flags)) {
- if(miInstalledMaps[index])
- CMapReinstallMap(miInstalledMaps[index]);
- return TRUE;
- }
- return FALSE;
-}
-
-
-static Bool
-CMapSwitchMode(int index, DisplayModePtr mode, int flags)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
-
- if((*pScreenPriv->SwitchMode)(index, mode, flags)) {
- if(miInstalledMaps[index])
- CMapReinstallMap(miInstalledMaps[index]);
- return TRUE;
- }
- return FALSE;
-}
-
-#ifdef XFreeXDGA
-static int
-CMapSetDGAMode(int index, int num, DGADevicePtr dev)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
- int ret;
-
- ret = (*pScreenPriv->SetDGAMode)(index, num, dev);
-
- pScreenPriv->isDGAmode = DGAActive(index);
-
- if(!pScreenPriv->isDGAmode && miInstalledMaps[index]
- && xf86Screens[pScreen->myNum]->vtSema)
- CMapReinstallMap(miInstalledMaps[index]);
-
- return ret;
-}
-#endif
-
-
-/**** Utilities ****/
-
-static void
-CMapReinstallMap(ColormapPtr pmap)
-{
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pmap->pScreen->devPrivates, CMapScreenKey);
- CMapColormapPtr cmapPriv = (CMapColormapPtr)dixLookupPrivate(
- &pmap->devPrivates, CMapColormapKey);
- ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
- int i = cmapPriv->numColors;
- int *indices = pScreenPriv->PreAllocIndices;
-
- while(i--)
- indices[i] = i;
-
- if(cmapPriv->recalculate)
- CMapRefreshColors(pmap, cmapPriv->numColors, indices);
- else {
- (*pScrn->LoadPalette)(pScrn, cmapPriv->numColors,
- indices, cmapPriv->colors, pmap->pVisual);
- if (pScrn->SetOverscan) {
-#ifdef DEBUGOVERSCAN
- ErrorF("SetOverscan() called from CMapReinstallMap\n");
-#endif
- pScrn->SetOverscan(pScrn, cmapPriv->overscan);
- }
- }
-
- cmapPriv->recalculate = FALSE;
-}
-
-
-static void
-CMapRefreshColors(ColormapPtr pmap, int defs, int* indices)
-{
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pmap->pScreen->devPrivates, CMapScreenKey);
- CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
- &pmap->devPrivates, CMapColormapKey);
- VisualPtr pVisual = pmap->pVisual;
- ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
- int numColors, i;
- LOCO *gamma, *colors;
- EntryPtr entry;
- int reds, greens, blues, maxValue, index, shift;
-
- numColors = pColPriv->numColors;
- shift = 16 - pScreenPriv->sigRGBbits;
- maxValue = (1 << pScreenPriv->sigRGBbits) - 1;
- gamma = pScreenPriv->gamma;
- colors = pColPriv->colors;
-
- reds = pVisual->redMask >> pVisual->offsetRed;
- greens = pVisual->greenMask >> pVisual->offsetGreen;
- blues = pVisual->blueMask >> pVisual->offsetBlue;
-
- switch(pVisual->class) {
- case StaticGray:
- for(i = 0; i < numColors; i++) {
- index = (i+1) * maxValue / numColors;
- colors[i].red = gamma[index].red;
- colors[i].green = gamma[index].green;
- colors[i].blue = gamma[index].blue;
- }
- break;
- case TrueColor:
- if (CMapColormapUseMax(pVisual, pScreenPriv)) {
- for(i = 0; i <= reds; i++)
- colors[i].red = gamma[i * maxValue / reds].red;
- for(i = 0; i <= greens; i++)
- colors[i].green = gamma[i * maxValue / greens].green;
- for(i = 0; i <= blues; i++)
- colors[i].blue = gamma[i * maxValue / blues].blue;
- break;
- }
- for(i = 0; i < numColors; i++) {
- colors[i].red = gamma[((i >> pVisual->offsetRed) & reds) *
- maxValue / reds].red;
- colors[i].green = gamma[((i >> pVisual->offsetGreen) & greens) *
- maxValue / greens].green;
- colors[i].blue = gamma[((i >> pVisual->offsetBlue) & blues) *
- maxValue / blues].blue;
- }
- break;
- case StaticColor:
- case PseudoColor:
- case GrayScale:
- for(i = 0; i < defs; i++) {
- index = indices[i];
- entry = (EntryPtr)&pmap->red[index];
-
- if(entry->fShared) {
- colors[index].red =
- gamma[entry->co.shco.red->color >> shift].red;
- colors[index].green =
- gamma[entry->co.shco.green->color >> shift].green;
- colors[index].blue =
- gamma[entry->co.shco.blue->color >> shift].blue;
- } else {
- colors[index].red =
- gamma[entry->co.local.red >> shift].red;
- colors[index].green =
- gamma[entry->co.local.green >> shift].green;
- colors[index].blue =
- gamma[entry->co.local.blue >> shift].blue;
- }
- }
- break;
- case DirectColor:
- if (CMapColormapUseMax(pVisual, pScreenPriv)) {
- for(i = 0; i < defs; i++) {
- index = indices[i];
- if(index <= reds)
- colors[index].red =
- gamma[pmap->red[index].co.local.red >> shift].red;
- if(index <= greens)
- colors[index].green =
- gamma[pmap->green[index].co.local.green >> shift].green;
- if(index <= blues)
- colors[index].blue =
- gamma[pmap->blue[index].co.local.blue >> shift].blue;
-
- }
- break;
- }
- for(i = 0; i < defs; i++) {
- index = indices[i];
-
- colors[index].red = gamma[pmap->red[
- (index >> pVisual->offsetRed) & reds
- ].co.local.red >> shift].red;
- colors[index].green = gamma[pmap->green[
- (index >> pVisual->offsetGreen) & greens
- ].co.local.green >> shift].green;
- colors[index].blue = gamma[pmap->blue[
- (index >> pVisual->offsetBlue) & blues
- ].co.local.blue >> shift].blue;
- }
- break;
- }
-
-
- if(LOAD_PALETTE(pmap, pmap->pScreen->myNum))
- (*pScrn->LoadPalette)(pScreenPriv->pScrn, defs, indices,
- colors, pmap->pVisual);
-
- if (pScrn->SetOverscan)
- CMapSetOverscan(pmap, defs, indices);
-
-}
-
-static Bool
-CMapCompareColors(LOCO *color1, LOCO *color2)
-{
- /* return TRUE if the color1 is "closer" to black than color2 */
-#ifdef DEBUGOVERSCAN
- ErrorF("#%02x%02x%02x vs #%02x%02x%02x (%d vs %d)\n",
- color1->red, color1->green, color1->blue,
- color2->red, color2->green, color2->blue,
- color1->red + color1->green + color1->blue,
- color2->red + color2->green + color2->blue);
-#endif
- return (color1->red + color1->green + color1->blue <
- color2->red + color2->green + color2->blue);
-}
-
-static void
-CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
-{
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pmap->pScreen->devPrivates, CMapScreenKey);
- CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
- &pmap->devPrivates, CMapColormapKey);
- ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
- VisualPtr pVisual = pmap->pVisual;
- int i;
- LOCO *colors;
- int index;
- Bool newOverscan = FALSE;
- int overscan, tmpOverscan;
-
- colors = pColPriv->colors;
- overscan = pColPriv->overscan;
-
- /*
- * Search for a new overscan index in the following cases:
- *
- * - The index hasn't yet been initialised.  In this case search
- * for an index that is black or a close match to black.
- *
- * - The colour of the old index is changed. In this case search
- * all indices for a black or close match to black.
- *
- * - The colour of the old index wasn't black. In this case only
- * search the indices that were changed for a better match to black.
- */
-
- switch (pVisual->class) {
- case StaticGray:
- case TrueColor:
- /* Should only come here once. Initialise the overscan index to 0 */
- overscan = 0;
- newOverscan = TRUE;
- break;
- case StaticColor:
- /*
- * Only come here once, but search for the overscan in the same way
- * as for the other cases.
- */
- case DirectColor:
- case PseudoColor:
- case GrayScale:
- if (overscan < 0 || overscan > pScreenPriv->maxColors - 1) {
- /* Uninitialised */
- newOverscan = TRUE;
- } else {
- /* Check if the overscan was changed */
- for (i = 0; i < defs; i++) {
- index = indices[i];
- if (index == overscan) {
- newOverscan = TRUE;
- break;
- }
- }
- }
- if (newOverscan) {
- /* The overscan is either uninitialised or it has been changed */
-
- if (overscan < 0 || overscan > pScreenPriv->maxColors - 1)
- tmpOverscan = pScreenPriv->maxColors - 1;
- else
- tmpOverscan = overscan;
-
- /* search all entries for a close match to black */
- for (i = pScreenPriv->maxColors - 1; i >= 0; i--) {
- if (colors[i].red == 0 && colors[i].green == 0 &&
- colors[i].blue == 0) {
- overscan = i;
-#ifdef DEBUGOVERSCAN
- ErrorF("Black found at index 0x%02x\n", i);
-#endif
- break;
- } else {
-#ifdef DEBUGOVERSCAN
- ErrorF("0x%02x: ", i);
-#endif
- if (CMapCompareColors(&colors[i], &colors[tmpOverscan])) {
- tmpOverscan = i;
-#ifdef DEBUGOVERSCAN
- ErrorF("possible \"Black\" at index 0x%02x\n", i);
-#endif
- }
- }
- }
- if (i < 0)
- overscan = tmpOverscan;
- } else {
- /* Check of the old overscan wasn't black */
- if (colors[overscan].red != 0 || colors[overscan].green != 0 ||
- colors[overscan].blue != 0) {
- int oldOverscan = tmpOverscan = overscan;
- /* See of there is now a better match */
- for (i = 0; i < defs; i++) {
- index = indices[i];
- if (colors[index].red == 0 && colors[index].green == 0 &&
- colors[index].blue == 0) {
- overscan = index;
-#ifdef DEBUGOVERSCAN
- ErrorF("Black found at index 0x%02x\n", index);
-#endif
- break;
- } else {
-#ifdef DEBUGOVERSCAN
- ErrorF("0x%02x: ", index);
-#endif
- if (CMapCompareColors(&colors[index],
- &colors[tmpOverscan])) {
- tmpOverscan = index;
-#ifdef DEBUGOVERSCAN
- ErrorF("possible \"Black\" at index 0x%02x\n",
- index);
-#endif
- }
- }
- }
- if (i == defs)
- overscan = tmpOverscan;
- if (overscan != oldOverscan)
- newOverscan = TRUE;
- }
- }
- break;
- }
- if (newOverscan) {
- pColPriv->overscan = overscan;
- if (LOAD_PALETTE(pmap, pmap->pScreen->myNum)) {
-#ifdef DEBUGOVERSCAN
- ErrorF("SetOverscan() called from CmapSetOverscan\n");
-#endif
- pScrn->SetOverscan(pScreenPriv->pScrn, overscan);
- }
- }
-}
-
-static void
-CMapUnwrapScreen(ScreenPtr pScreen)
-{
- CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
- &pScreen->devPrivates, CMapScreenKey);
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-
- pScreen->CloseScreen = pScreenPriv->CloseScreen;
- pScreen->CreateColormap = pScreenPriv->CreateColormap;
- pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
- pScreen->InstallColormap = pScreenPriv->InstallColormap;
- pScreen->StoreColors = pScreenPriv->StoreColors;
-
- pScrn->EnterVT = pScreenPriv->EnterVT;
- pScrn->SwitchMode = pScreenPriv->SwitchMode;
- pScrn->SetDGAMode = pScreenPriv->SetDGAMode;
- pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
-
- xfree(pScreenPriv->gamma);
- xfree(pScreenPriv->PreAllocIndices);
- xfree(pScreenPriv);
-}
-
-
-static void
-ComputeGamma(CMapScreenPtr priv)
-{
- int elements = priv->gammaElements - 1;
- double RedGamma, GreenGamma, BlueGamma;
- int i;
-
-#ifndef DONT_CHECK_GAMMA
- /* This check is to catch drivers that are not initialising pScrn->gamma */
- if (priv->pScrn->gamma.red < GAMMA_MIN ||
- priv->pScrn->gamma.red > GAMMA_MAX ||
- priv->pScrn->gamma.green < GAMMA_MIN ||
- priv->pScrn->gamma.green > GAMMA_MAX ||
- priv->pScrn->gamma.blue < GAMMA_MIN ||
- priv->pScrn->gamma.blue > GAMMA_MAX) {
-
- xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
- "The %s driver didn't call xf86SetGamma() to initialise\n"
- "\tthe gamma values.\n", priv->pScrn->driverName);
- xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
- "PLEASE FIX THE `%s' DRIVER!\n", priv->pScrn->driverName);
- priv->pScrn->gamma.red = 1.0;
- priv->pScrn->gamma.green = 1.0;
- priv->pScrn->gamma.blue = 1.0;
- }
-#endif
-
- RedGamma = 1.0 / (double)priv->pScrn->gamma.red;
- GreenGamma = 1.0 / (double)priv->pScrn->gamma.green;
- BlueGamma = 1.0 / (double)priv->pScrn->gamma.blue;
-
- for(i = 0; i <= elements; i++) {
- if(RedGamma == 1.0)
- priv->gamma[i].red = i;
- else
- priv->gamma[i].red = (CARD16)(pow((double)i/(double)elements,
- RedGamma) * (double)elements + 0.5);
-
- if(GreenGamma == 1.0)
- priv->gamma[i].green = i;
- else
- priv->gamma[i].green = (CARD16)(pow((double)i/(double)elements,
- GreenGamma) * (double)elements + 0.5);
-
- if(BlueGamma == 1.0)
- priv->gamma[i].blue = i;
- else
- priv->gamma[i].blue = (CARD16)(pow((double)i/(double)elements,
- BlueGamma) * (double)elements + 0.5);
- }
-}
-
-
-int
-CMapChangeGamma(
- int index,
- Gamma gamma
-){
- int ret = Success;
- ScrnInfoPtr pScrn = xf86Screens[index];
- ScreenPtr pScreen = pScrn->pScreen;
- CMapColormapPtr pColPriv;
- CMapScreenPtr pScreenPriv;
- CMapLinkPtr pLink;
-
- /* Is this sufficient checking ? */
- if(CMapScreenKey == NULL)
- return BadImplementation;
-
- pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- CMapScreenKey);
- if(!pScreenPriv)
- return BadImplementation;
-
- if (gamma.red < GAMMA_MIN || gamma.red > GAMMA_MAX ||
- gamma.green < GAMMA_MIN || gamma.green > GAMMA_MAX ||
- gamma.blue < GAMMA_MIN || gamma.blue > GAMMA_MAX)
- return BadValue;
-
- pScrn->gamma.red = gamma.red;
- pScrn->gamma.green = gamma.green;
- pScrn->gamma.blue = gamma.blue;
-
- ComputeGamma(pScreenPriv);
-
- /* mark all colormaps on this screen */
- pLink = pScreenPriv->maps;
- while(pLink) {
- pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates,
- CMapColormapKey);
- pColPriv->recalculate = TRUE;
- pLink = pLink->next;
- }
-
- if(miInstalledMaps[pScreen->myNum] &&
- ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
- pScrn->vtSema || pScreenPriv->isDGAmode)) {
- ColormapPtr pMap = miInstalledMaps[pScreen->myNum];
-
- if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
- (pMap->pVisual->class == TrueColor) &&
- CMapColormapUseMax(pMap->pVisual, pScreenPriv)) {
-
- /* if the current map doesn't have a palette look
- for another map to change the gamma on. */
-
- pLink = pScreenPriv->maps;
- while(pLink) {
- if(pLink->cmap->pVisual->class == PseudoColor)
- break;
- pLink = pLink->next;
- }
-
- if(pLink) {
- /* need to trick CMapRefreshColors() into thinking
- this is the currently installed map */
- miInstalledMaps[pScreen->myNum] = pLink->cmap;
- CMapReinstallMap(pLink->cmap);
- miInstalledMaps[pScreen->myNum] = pMap;
- }
- } else
- CMapReinstallMap(pMap);
- }
-
- pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
- if (pScrn->ChangeGamma)
- ret = pScrn->ChangeGamma(index, gamma);
- pScrn->ChangeGamma = CMapChangeGamma;
-
- return ret;
-}
-
-
-static void
-ComputeGammaRamp (
- CMapScreenPtr priv,
- unsigned short *red,
- unsigned short *green,
- unsigned short *blue
-){
- int elements = priv->gammaElements;
- LOCO *entry = priv->gamma;
- int shift = 16 - priv->sigRGBbits;
-
- while(elements--) {
- entry->red = *(red++) >> shift;
- entry->green = *(green++) >> shift;
- entry->blue = *(blue++) >> shift;
- entry++;
- }
-}
-
-int
-xf86ChangeGammaRamp(
- ScreenPtr pScreen,
- int size,
- unsigned short *red,
- unsigned short *green,
- unsigned short *blue
-){
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- CMapColormapPtr pColPriv;
- CMapScreenPtr pScreenPriv;
- CMapLinkPtr pLink;
-
- if (xf86_crtc_supports_gamma(pScrn)) {
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
-
- if (crtc) {
- if (crtc->gammaSize != size)
- return BadValue;
-
- RRCrtcGammaSet(crtc, red, green, blue);
-
- return Success;
- }
- }
-
- if(CMapScreenKey == NULL)
- return BadImplementation;
-
- pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- CMapScreenKey);
- if(!pScreenPriv)
- return BadImplementation;
-
- if(pScreenPriv->gammaElements != size)
- return BadValue;
-
- ComputeGammaRamp(pScreenPriv, red, green, blue);
-
- /* mark all colormaps on this screen */
- pLink = pScreenPriv->maps;
- while(pLink) {
- pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates,
- CMapColormapKey);
- pColPriv->recalculate = TRUE;
- pLink = pLink->next;
- }
-
- if(miInstalledMaps[pScreen->myNum] &&
- ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
- pScrn->vtSema || pScreenPriv->isDGAmode)) {
- ColormapPtr pMap = miInstalledMaps[pScreen->myNum];
-
- if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
- (pMap->pVisual->class == TrueColor) &&
- CMapColormapUseMax(pMap->pVisual, pScreenPriv)) {
-
- /* if the current map doesn't have a palette look
- for another map to change the gamma on. */
-
- pLink = pScreenPriv->maps;
- while(pLink) {
- if(pLink->cmap->pVisual->class == PseudoColor)
- break;
- pLink = pLink->next;
- }
-
- if(pLink) {
- /* need to trick CMapRefreshColors() into thinking
- this is the currently installed map */
- miInstalledMaps[pScreen->myNum] = pLink->cmap;
- CMapReinstallMap(pLink->cmap);
- miInstalledMaps[pScreen->myNum] = pMap;
- }
- } else
- CMapReinstallMap(pMap);
- }
-
- return Success;
-}
-
-int
-xf86GetGammaRampSize(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- CMapScreenPtr pScreenPriv;
-
- if (xf86_crtc_supports_gamma(pScrn)) {
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
-
- if (crtc)
- return crtc->gammaSize;
- }
-
- if(CMapScreenKey == NULL) return 0;
-
- pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- CMapScreenKey);
- if(!pScreenPriv) return 0;
-
- return pScreenPriv->gammaElements;
-}
-
-int
-xf86GetGammaRamp(
- ScreenPtr pScreen,
- int size,
- unsigned short *red,
- unsigned short *green,
- unsigned short *blue
-){
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- CMapScreenPtr pScreenPriv;
- LOCO *entry;
- int shift, sigbits;
-
- if (xf86_crtc_supports_gamma(pScrn)) {
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
-
- if (crtc) {
- if (crtc->gammaSize < size)
- return BadValue;
-
- if (!RRCrtcGammaGet(crtc))
- return BadImplementation;
-
- memcpy(red, crtc->gammaRed, size * sizeof(*red));
- memcpy(green, crtc->gammaGreen, size * sizeof(*green));
- memcpy(blue, crtc->gammaBlue, size * sizeof(*blue));
-
- return Success;
- }
- }
-
- if(CMapScreenKey == NULL)
- return BadImplementation;
-
- pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- CMapScreenKey);
- if(!pScreenPriv)
- return BadImplementation;
-
- if(size > pScreenPriv->gammaElements)
- return BadValue;
-
- entry = pScreenPriv->gamma;
- sigbits = pScreenPriv->sigRGBbits;
-
- while(size--) {
- *red = entry->red << (16 - sigbits);
- *green = entry->green << (16 - sigbits);
- *blue = entry->blue << (16 - sigbits);
- shift = sigbits;
- while(shift < 16) {
- *red |= *red >> shift;
- *green |= *green >> shift;
- *blue |= *blue >> shift;
- shift += sigbits;
- }
- red++; green++; blue++;
- entry++;
- }
-
- return Success;
-}
-
-int
-xf86ChangeGamma(
- ScreenPtr pScreen,
- Gamma gamma
-){
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-
- if(pScrn->ChangeGamma)
- return (*pScrn->ChangeGamma)(pScreen->myNum, gamma);
-
- return BadImplementation;
-}
+/*
+ * Copyright (c) 1998-2001 by The XFree86 Project, Inc.
+ *
+ * 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, 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 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
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(sun) && defined(__SVR4)
+#include <math.h>
+#else
+#define _XOPEN_SOURCE /* to get prototype for pow on some systems */
+#include <math.h>
+#undef _XOPEN_SOURCE
+#endif
+
+#include <X11/X.h>
+#include "misc.h"
+#include <X11/Xproto.h>
+#include "colormapst.h"
+#include "scrnintstr.h"
+
+#include "resource.h"
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86str.h"
+#include "micmap.h"
+#include "xf86Crtc.h"
+
+#ifdef XFreeXDGA
+#include <X11/extensions/xf86dgaproto.h>
+#include "dgaproc.h"
+#endif
+
+#include "xf86cmap.h"
+
+#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
+ ((CMapScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, CMapScreenKey))->field)
+#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
+ ((pScreen)->field = wrapper)
+
+#define LOAD_PALETTE(pmap, index) \
+ ((pmap == miInstalledMaps[index]) && \
+ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || \
+ xf86Screens[index]->vtSema || pScreenPriv->isDGAmode))
+
+
+typedef struct _CMapLink {
+ ColormapPtr cmap;
+ struct _CMapLink *next;
+} CMapLink, *CMapLinkPtr;
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ CloseScreenProcPtr CloseScreen;
+ CreateColormapProcPtr CreateColormap;
+ DestroyColormapProcPtr DestroyColormap;
+ InstallColormapProcPtr InstallColormap;
+ StoreColorsProcPtr StoreColors;
+ Bool (*EnterVT)(int, int);
+ Bool (*SwitchMode)(int, DisplayModePtr, int);
+ int (*SetDGAMode)(int, int, DGADevicePtr);
+ xf86ChangeGammaProc *ChangeGamma;
+ int maxColors;
+ int sigRGBbits;
+ int gammaElements;
+ LOCO *gamma;
+ int *PreAllocIndices;
+ CMapLinkPtr maps;
+ unsigned int flags;
+ Bool isDGAmode;
+} CMapScreenRec, *CMapScreenPtr;
+
+typedef struct {
+ int numColors;
+ LOCO *colors;
+ Bool recalculate;
+ int overscan;
+} CMapColormapRec, *CMapColormapPtr;
+
+static int CMapScreenKeyIndex;
+static DevPrivateKey CMapScreenKey;
+static int CMapColormapKeyIndex;
+static DevPrivateKey CMapColormapKey = &CMapColormapKeyIndex;
+
+static void CMapInstallColormap(ColormapPtr);
+static void CMapStoreColors(ColormapPtr, int, xColorItem *);
+static Bool CMapCloseScreen (int, ScreenPtr);
+static Bool CMapCreateColormap (ColormapPtr);
+static void CMapDestroyColormap (ColormapPtr);
+
+static Bool CMapEnterVT(int, int);
+static Bool CMapSwitchMode(int, DisplayModePtr, int);
+#ifdef XFreeXDGA
+static int CMapSetDGAMode(int, int, DGADevicePtr);
+#endif
+static int CMapChangeGamma(int, Gamma);
+
+static void ComputeGamma(CMapScreenPtr);
+static Bool CMapAllocateColormapPrivate(ColormapPtr);
+static void CMapRefreshColors(ColormapPtr, int, int*);
+static void CMapSetOverscan(ColormapPtr, int, int *);
+static void CMapReinstallMap(ColormapPtr);
+static void CMapUnwrapScreen(ScreenPtr pScreen);
+
+
+
+Bool xf86HandleColormaps(
+ ScreenPtr pScreen,
+ int maxColors,
+ int sigRGBbits,
+ xf86LoadPaletteProc *loadPalette,
+ xf86SetOverscanProc *setOverscan,
+ unsigned int flags
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ColormapPtr pDefMap = NULL;
+ CMapScreenPtr pScreenPriv;
+ LOCO *gamma;
+ int *indices;
+ int elements;
+
+ /* If we support a better colormap system, then pretend we succeeded. */
+ if (xf86_crtc_supports_gamma(pScrn))
+ return TRUE;
+
+ if(!maxColors || !sigRGBbits || !loadPalette)
+ return FALSE;
+
+ CMapScreenKey = &CMapScreenKeyIndex;
+
+ elements = 1 << sigRGBbits;
+
+ if(!(gamma = xalloc(elements * sizeof(LOCO))))
+ return FALSE;
+
+ if(!(indices = xalloc(maxColors * sizeof(int)))) {
+ xfree(gamma);
+ return FALSE;
+ }
+
+ if(!(pScreenPriv = xalloc(sizeof(CMapScreenRec)))) {
+ xfree(gamma);
+ xfree(indices);
+ return FALSE;
+ }
+
+ dixSetPrivate(&pScreen->devPrivates, CMapScreenKey, pScreenPriv);
+
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreenPriv->CreateColormap = pScreen->CreateColormap;
+ pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
+ pScreenPriv->InstallColormap = pScreen->InstallColormap;
+ pScreenPriv->StoreColors = pScreen->StoreColors;
+ pScreen->CloseScreen = CMapCloseScreen;
+ pScreen->CreateColormap = CMapCreateColormap;
+ pScreen->DestroyColormap = CMapDestroyColormap;
+ pScreen->InstallColormap = CMapInstallColormap;
+ pScreen->StoreColors = CMapStoreColors;
+
+ pScreenPriv->pScrn = pScrn;
+ pScrn->LoadPalette = loadPalette;
+ pScrn->SetOverscan = setOverscan;
+ pScreenPriv->maxColors = maxColors;
+ pScreenPriv->sigRGBbits = sigRGBbits;
+ pScreenPriv->gammaElements = elements;
+ pScreenPriv->gamma = gamma;
+ pScreenPriv->PreAllocIndices = indices;
+ pScreenPriv->maps = NULL;
+ pScreenPriv->flags = flags;
+ pScreenPriv->isDGAmode = FALSE;
+
+ pScreenPriv->EnterVT = pScrn->EnterVT;
+ pScreenPriv->SwitchMode = pScrn->SwitchMode;
+ pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
+ pScreenPriv->ChangeGamma = pScrn->ChangeGamma;
+
+ if (!(flags & CMAP_LOAD_EVEN_IF_OFFSCREEN)) {
+ pScrn->EnterVT = CMapEnterVT;
+ if ((flags & CMAP_RELOAD_ON_MODE_SWITCH) && pScrn->SwitchMode)
+ pScrn->SwitchMode = CMapSwitchMode;
+ }
+#ifdef XFreeXDGA
+ pScrn->SetDGAMode = CMapSetDGAMode;
+#endif
+ pScrn->ChangeGamma = CMapChangeGamma;
+
+ ComputeGamma(pScreenPriv);
+
+ /* get the default map */
+ dixLookupResourceByType((pointer *)&pDefMap, pScreen->defColormap,
+ RT_COLORMAP, serverClient, DixInstallAccess);
+
+ if(!CMapAllocateColormapPrivate(pDefMap)) {
+ CMapUnwrapScreen(pScreen);
+ return FALSE;
+ }
+
+ /* Force the initial map to be loaded */
+ miInstalledMaps[pScreen->myNum] = NULL;
+ CMapInstallColormap(pDefMap);
+ return TRUE;
+}
+
+
+/**** Screen functions ****/
+
+
+static Bool
+CMapCloseScreen (int i, ScreenPtr pScreen)
+{
+ CMapUnwrapScreen(pScreen);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+static Bool
+CMapColormapUseMax(VisualPtr pVisual, CMapScreenPtr pScreenPriv)
+{
+ if (pVisual->nplanes > 16)
+ return TRUE;
+ return ((1 << pVisual->nplanes) > pScreenPriv->maxColors);
+}
+
+static Bool
+CMapAllocateColormapPrivate(ColormapPtr pmap)
+{
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv;
+ CMapLinkPtr pLink;
+ int numColors;
+ LOCO *colors;
+
+ if (CMapColormapUseMax(pmap->pVisual, pScreenPriv))
+ numColors = pmap->pVisual->ColormapEntries;
+ else
+ numColors = 1 << pmap->pVisual->nplanes;
+
+ if(!(colors = xalloc(numColors * sizeof(LOCO))))
+ return FALSE;
+
+ if(!(pColPriv = xalloc(sizeof(CMapColormapRec)))) {
+ xfree(colors);
+ return FALSE;
+ }
+
+ dixSetPrivate(&pmap->devPrivates, CMapColormapKey, pColPriv);
+
+ pColPriv->numColors = numColors;
+ pColPriv->colors = colors;
+ pColPriv->recalculate = TRUE;
+ pColPriv->overscan = -1;
+
+ /* add map to list */
+ pLink = xalloc(sizeof(CMapLink));
+ if(pLink) {
+ pLink->cmap = pmap;
+ pLink->next = pScreenPriv->maps;
+ pScreenPriv->maps = pLink;
+ }
+
+ return TRUE;
+}
+
+static Bool
+CMapCreateColormap (ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+ Bool ret = FALSE;
+
+ pScreen->CreateColormap = pScreenPriv->CreateColormap;
+ if((*pScreen->CreateColormap)(pmap)) {
+ if(CMapAllocateColormapPrivate(pmap))
+ ret = TRUE;
+ }
+ pScreen->CreateColormap = CMapCreateColormap;
+
+ return ret;
+}
+
+static void
+CMapDestroyColormap (ColormapPtr cmap)
+{
+ ScreenPtr pScreen = cmap->pScreen;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &cmap->devPrivates, CMapColormapKey);
+ CMapLinkPtr prevLink = NULL, pLink = pScreenPriv->maps;
+
+ if(pColPriv) {
+ if(pColPriv->colors) xfree(pColPriv->colors);
+ xfree(pColPriv);
+ }
+
+ /* remove map from list */
+ while(pLink) {
+ if(pLink->cmap == cmap) {
+ if(prevLink)
+ prevLink->next = pLink->next;
+ else
+ pScreenPriv->maps = pLink->next;
+ xfree(pLink);
+ break;
+ }
+ prevLink = pLink;
+ pLink = pLink->next;
+ }
+
+ if(pScreenPriv->DestroyColormap) {
+ pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
+ (*pScreen->DestroyColormap)(cmap);
+ pScreen->DestroyColormap = CMapDestroyColormap;
+ }
+}
+
+
+
+static void
+CMapStoreColors(
+ ColormapPtr pmap,
+ int ndef,
+ xColorItem *pdefs
+){
+ ScreenPtr pScreen = pmap->pScreen;
+ VisualPtr pVisual = pmap->pVisual;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+ int *indices = pScreenPriv->PreAllocIndices;
+ int num = ndef;
+
+ /* At the moment this isn't necessary since there's nobody below us */
+ pScreen->StoreColors = pScreenPriv->StoreColors;
+ (*pScreen->StoreColors)(pmap, ndef, pdefs);
+ pScreen->StoreColors = CMapStoreColors;
+
+ /* should never get here for these */
+ if( (pVisual->class == TrueColor) ||
+ (pVisual->class == StaticColor) ||
+ (pVisual->class == StaticGray))
+ return;
+
+ if(pVisual->class == DirectColor) {
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
+ int i;
+
+ if (CMapColormapUseMax(pVisual, pScreenPriv)) {
+ int index;
+
+ num = 0;
+ while(ndef--) {
+ if(pdefs[ndef].flags & DoRed) {
+ index = (pdefs[ndef].pixel & pVisual->redMask) >>
+ pVisual->offsetRed;
+ i = num;
+ while(i--)
+ if(indices[i] == index) break;
+ if(i == -1)
+ indices[num++] = index;
+ }
+ if(pdefs[ndef].flags & DoGreen) {
+ index = (pdefs[ndef].pixel & pVisual->greenMask) >>
+ pVisual->offsetGreen;
+ i = num;
+ while(i--)
+ if(indices[i] == index) break;
+ if(i == -1)
+ indices[num++] = index;
+ }
+ if(pdefs[ndef].flags & DoBlue) {
+ index = (pdefs[ndef].pixel & pVisual->blueMask) >>
+ pVisual->offsetBlue;
+ i = num;
+ while(i--)
+ if(indices[i] == index) break;
+ if(i == -1)
+ indices[num++] = index;
+ }
+ }
+
+ } else {
+ /* not really as overkill as it seems */
+ num = pColPriv->numColors;
+ for(i = 0; i < pColPriv->numColors; i++)
+ indices[i] = i;
+ }
+ } else {
+ while(ndef--)
+ indices[ndef] = pdefs[ndef].pixel;
+ }
+
+ CMapRefreshColors(pmap, num, indices);
+}
+
+
+static void
+CMapInstallColormap(ColormapPtr pmap)
+{
+ ScreenPtr pScreen = pmap->pScreen;
+ int index = pScreen->myNum;
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+
+ if (pmap == miInstalledMaps[index])
+ return;
+
+ pScreen->InstallColormap = pScreenPriv->InstallColormap;
+ (*pScreen->InstallColormap)(pmap);
+ pScreen->InstallColormap = CMapInstallColormap;
+
+ /* Important. We let the lower layers, namely DGA,
+ overwrite the choice of Colormap to install */
+ if (miInstalledMaps[index])
+ pmap = miInstalledMaps[index];
+
+ if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
+ (pmap->pVisual->class == TrueColor) &&
+ CMapColormapUseMax(pmap->pVisual, pScreenPriv))
+ return;
+
+ if(LOAD_PALETTE(pmap, index))
+ CMapReinstallMap(pmap);
+}
+
+
+/**** ScrnInfoRec functions ****/
+
+static Bool
+CMapEnterVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+
+ if((*pScreenPriv->EnterVT)(index, flags)) {
+ if(miInstalledMaps[index])
+ CMapReinstallMap(miInstalledMaps[index]);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+static Bool
+CMapSwitchMode(int index, DisplayModePtr mode, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+
+ if((*pScreenPriv->SwitchMode)(index, mode, flags)) {
+ if(miInstalledMaps[index])
+ CMapReinstallMap(miInstalledMaps[index]);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+#ifdef XFreeXDGA
+static int
+CMapSetDGAMode(int index, int num, DGADevicePtr dev)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+ int ret;
+
+ ret = (*pScreenPriv->SetDGAMode)(index, num, dev);
+
+ pScreenPriv->isDGAmode = DGAActive(index);
+
+ if(!pScreenPriv->isDGAmode && miInstalledMaps[index]
+ && xf86Screens[pScreen->myNum]->vtSema)
+ CMapReinstallMap(miInstalledMaps[index]);
+
+ return ret;
+}
+#endif
+
+
+/**** Utilities ****/
+
+static void
+CMapReinstallMap(ColormapPtr pmap)
+{
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr cmapPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
+ ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
+ int i = cmapPriv->numColors;
+ int *indices = pScreenPriv->PreAllocIndices;
+
+ while(i--)
+ indices[i] = i;
+
+ if(cmapPriv->recalculate)
+ CMapRefreshColors(pmap, cmapPriv->numColors, indices);
+ else {
+ (*pScrn->LoadPalette)(pScrn, cmapPriv->numColors,
+ indices, cmapPriv->colors, pmap->pVisual);
+ if (pScrn->SetOverscan) {
+#ifdef DEBUGOVERSCAN
+ ErrorF("SetOverscan() called from CMapReinstallMap\n");
+#endif
+ pScrn->SetOverscan(pScrn, cmapPriv->overscan);
+ }
+ }
+
+ cmapPriv->recalculate = FALSE;
+}
+
+
+static void
+CMapRefreshColors(ColormapPtr pmap, int defs, int* indices)
+{
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
+ VisualPtr pVisual = pmap->pVisual;
+ ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
+ int numColors, i;
+ LOCO *gamma, *colors;
+ EntryPtr entry;
+ int reds, greens, blues, maxValue, index, shift;
+
+ numColors = pColPriv->numColors;
+ shift = 16 - pScreenPriv->sigRGBbits;
+ maxValue = (1 << pScreenPriv->sigRGBbits) - 1;
+ gamma = pScreenPriv->gamma;
+ colors = pColPriv->colors;
+
+ reds = pVisual->redMask >> pVisual->offsetRed;
+ greens = pVisual->greenMask >> pVisual->offsetGreen;
+ blues = pVisual->blueMask >> pVisual->offsetBlue;
+
+ switch(pVisual->class) {
+ case StaticGray:
+ for(i = 0; i < numColors; i++) {
+ index = (i+1) * maxValue / numColors;
+ colors[i].red = gamma[index].red;
+ colors[i].green = gamma[index].green;
+ colors[i].blue = gamma[index].blue;
+ }
+ break;
+ case TrueColor:
+ if (CMapColormapUseMax(pVisual, pScreenPriv)) {
+ for(i = 0; i <= reds; i++)
+ colors[i].red = gamma[i * maxValue / reds].red;
+ for(i = 0; i <= greens; i++)
+ colors[i].green = gamma[i * maxValue / greens].green;
+ for(i = 0; i <= blues; i++)
+ colors[i].blue = gamma[i * maxValue / blues].blue;
+ break;
+ }
+ for(i = 0; i < numColors; i++) {
+ colors[i].red = gamma[((i >> pVisual->offsetRed) & reds) *
+ maxValue / reds].red;
+ colors[i].green = gamma[((i >> pVisual->offsetGreen) & greens) *
+ maxValue / greens].green;
+ colors[i].blue = gamma[((i >> pVisual->offsetBlue) & blues) *
+ maxValue / blues].blue;
+ }
+ break;
+ case StaticColor:
+ case PseudoColor:
+ case GrayScale:
+ for(i = 0; i < defs; i++) {
+ index = indices[i];
+ entry = (EntryPtr)&pmap->red[index];
+
+ if(entry->fShared) {
+ colors[index].red =
+ gamma[entry->co.shco.red->color >> shift].red;
+ colors[index].green =
+ gamma[entry->co.shco.green->color >> shift].green;
+ colors[index].blue =
+ gamma[entry->co.shco.blue->color >> shift].blue;
+ } else {
+ colors[index].red =
+ gamma[entry->co.local.red >> shift].red;
+ colors[index].green =
+ gamma[entry->co.local.green >> shift].green;
+ colors[index].blue =
+ gamma[entry->co.local.blue >> shift].blue;
+ }
+ }
+ break;
+ case DirectColor:
+ if (CMapColormapUseMax(pVisual, pScreenPriv)) {
+ for(i = 0; i < defs; i++) {
+ index = indices[i];
+ if(index <= reds)
+ colors[index].red =
+ gamma[pmap->red[index].co.local.red >> shift].red;
+ if(index <= greens)
+ colors[index].green =
+ gamma[pmap->green[index].co.local.green >> shift].green;
+ if(index <= blues)
+ colors[index].blue =
+ gamma[pmap->blue[index].co.local.blue >> shift].blue;
+
+ }
+ break;
+ }
+ for(i = 0; i < defs; i++) {
+ index = indices[i];
+
+ colors[index].red = gamma[pmap->red[
+ (index >> pVisual->offsetRed) & reds
+ ].co.local.red >> shift].red;
+ colors[index].green = gamma[pmap->green[
+ (index >> pVisual->offsetGreen) & greens
+ ].co.local.green >> shift].green;
+ colors[index].blue = gamma[pmap->blue[
+ (index >> pVisual->offsetBlue) & blues
+ ].co.local.blue >> shift].blue;
+ }
+ break;
+ }
+
+
+ if(LOAD_PALETTE(pmap, pmap->pScreen->myNum))
+ (*pScrn->LoadPalette)(pScreenPriv->pScrn, defs, indices,
+ colors, pmap->pVisual);
+
+ if (pScrn->SetOverscan)
+ CMapSetOverscan(pmap, defs, indices);
+
+}
+
+static Bool
+CMapCompareColors(LOCO *color1, LOCO *color2)
+{
+ /* return TRUE if the color1 is "closer" to black than color2 */
+#ifdef DEBUGOVERSCAN
+ ErrorF("#%02x%02x%02x vs #%02x%02x%02x (%d vs %d)\n",
+ color1->red, color1->green, color1->blue,
+ color2->red, color2->green, color2->blue,
+ color1->red + color1->green + color1->blue,
+ color2->red + color2->green + color2->blue);
+#endif
+ return (color1->red + color1->green + color1->blue <
+ color2->red + color2->green + color2->blue);
+}
+
+static void
+CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
+{
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pmap->pScreen->devPrivates, CMapScreenKey);
+ CMapColormapPtr pColPriv = (CMapColormapPtr)dixLookupPrivate(
+ &pmap->devPrivates, CMapColormapKey);
+ ScrnInfoPtr pScrn = xf86Screens[pmap->pScreen->myNum];
+ VisualPtr pVisual = pmap->pVisual;
+ int i;
+ LOCO *colors;
+ int index;
+ Bool newOverscan = FALSE;
+ int overscan, tmpOverscan;
+
+ colors = pColPriv->colors;
+ overscan = pColPriv->overscan;
+
+ /*
+ * Search for a new overscan index in the following cases:
+ *
+ * - The index hasn't yet been initialised.  In this case search
+ * for an index that is black or a close match to black.
+ *
+ * - The colour of the old index is changed. In this case search
+ * all indices for a black or close match to black.
+ *
+ * - The colour of the old index wasn't black. In this case only
+ * search the indices that were changed for a better match to black.
+ */
+
+ switch (pVisual->class) {
+ case StaticGray:
+ case TrueColor:
+ /* Should only come here once. Initialise the overscan index to 0 */
+ overscan = 0;
+ newOverscan = TRUE;
+ break;
+ case StaticColor:
+ /*
+ * Only come here once, but search for the overscan in the same way
+ * as for the other cases.
+ */
+ case DirectColor:
+ case PseudoColor:
+ case GrayScale:
+ if (overscan < 0 || overscan > pScreenPriv->maxColors - 1) {
+ /* Uninitialised */
+ newOverscan = TRUE;
+ } else {
+ /* Check if the overscan was changed */
+ for (i = 0; i < defs; i++) {
+ index = indices[i];
+ if (index == overscan) {
+ newOverscan = TRUE;
+ break;
+ }
+ }
+ }
+ if (newOverscan) {
+ /* The overscan is either uninitialised or it has been changed */
+
+ if (overscan < 0 || overscan > pScreenPriv->maxColors - 1)
+ tmpOverscan = pScreenPriv->maxColors - 1;
+ else
+ tmpOverscan = overscan;
+
+ /* search all entries for a close match to black */
+ for (i = pScreenPriv->maxColors - 1; i >= 0; i--) {
+ if (colors[i].red == 0 && colors[i].green == 0 &&
+ colors[i].blue == 0) {
+ overscan = i;
+#ifdef DEBUGOVERSCAN
+ ErrorF("Black found at index 0x%02x\n", i);
+#endif
+ break;
+ } else {
+#ifdef DEBUGOVERSCAN
+ ErrorF("0x%02x: ", i);
+#endif
+ if (CMapCompareColors(&colors[i], &colors[tmpOverscan])) {
+ tmpOverscan = i;
+#ifdef DEBUGOVERSCAN
+ ErrorF("possible \"Black\" at index 0x%02x\n", i);
+#endif
+ }
+ }
+ }
+ if (i < 0)
+ overscan = tmpOverscan;
+ } else {
+ /* Check of the old overscan wasn't black */
+ if (colors[overscan].red != 0 || colors[overscan].green != 0 ||
+ colors[overscan].blue != 0) {
+ int oldOverscan = tmpOverscan = overscan;
+ /* See of there is now a better match */
+ for (i = 0; i < defs; i++) {
+ index = indices[i];
+ if (colors[index].red == 0 && colors[index].green == 0 &&
+ colors[index].blue == 0) {
+ overscan = index;
+#ifdef DEBUGOVERSCAN
+ ErrorF("Black found at index 0x%02x\n", index);
+#endif
+ break;
+ } else {
+#ifdef DEBUGOVERSCAN
+ ErrorF("0x%02x: ", index);
+#endif
+ if (CMapCompareColors(&colors[index],
+ &colors[tmpOverscan])) {
+ tmpOverscan = index;
+#ifdef DEBUGOVERSCAN
+ ErrorF("possible \"Black\" at index 0x%02x\n",
+ index);
+#endif
+ }
+ }
+ }
+ if (i == defs)
+ overscan = tmpOverscan;
+ if (overscan != oldOverscan)
+ newOverscan = TRUE;
+ }
+ }
+ break;
+ }
+ if (newOverscan) {
+ pColPriv->overscan = overscan;
+ if (LOAD_PALETTE(pmap, pmap->pScreen->myNum)) {
+#ifdef DEBUGOVERSCAN
+ ErrorF("SetOverscan() called from CmapSetOverscan\n");
+#endif
+ pScrn->SetOverscan(pScreenPriv->pScrn, overscan);
+ }
+ }
+}
+
+static void
+CMapUnwrapScreen(ScreenPtr pScreen)
+{
+ CMapScreenPtr pScreenPriv = (CMapScreenPtr)dixLookupPrivate(
+ &pScreen->devPrivates, CMapScreenKey);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->CreateColormap = pScreenPriv->CreateColormap;
+ pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
+ pScreen->InstallColormap = pScreenPriv->InstallColormap;
+ pScreen->StoreColors = pScreenPriv->StoreColors;
+
+ pScrn->EnterVT = pScreenPriv->EnterVT;
+ pScrn->SwitchMode = pScreenPriv->SwitchMode;
+ pScrn->SetDGAMode = pScreenPriv->SetDGAMode;
+ pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
+
+ xfree(pScreenPriv->gamma);
+ xfree(pScreenPriv->PreAllocIndices);
+ xfree(pScreenPriv);
+}
+
+
+static void
+ComputeGamma(CMapScreenPtr priv)
+{
+ int elements = priv->gammaElements - 1;
+ double RedGamma, GreenGamma, BlueGamma;
+ int i;
+
+#ifndef DONT_CHECK_GAMMA
+ /* This check is to catch drivers that are not initialising pScrn->gamma */
+ if (priv->pScrn->gamma.red < GAMMA_MIN ||
+ priv->pScrn->gamma.red > GAMMA_MAX ||
+ priv->pScrn->gamma.green < GAMMA_MIN ||
+ priv->pScrn->gamma.green > GAMMA_MAX ||
+ priv->pScrn->gamma.blue < GAMMA_MIN ||
+ priv->pScrn->gamma.blue > GAMMA_MAX) {
+
+ xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
+ "The %s driver didn't call xf86SetGamma() to initialise\n"
+ "\tthe gamma values.\n", priv->pScrn->driverName);
+ xf86DrvMsgVerb(priv->pScrn->scrnIndex, X_WARNING, 0,
+ "PLEASE FIX THE `%s' DRIVER!\n", priv->pScrn->driverName);
+ priv->pScrn->gamma.red = 1.0;
+ priv->pScrn->gamma.green = 1.0;
+ priv->pScrn->gamma.blue = 1.0;
+ }
+#endif
+
+ RedGamma = 1.0 / (double)priv->pScrn->gamma.red;
+ GreenGamma = 1.0 / (double)priv->pScrn->gamma.green;
+ BlueGamma = 1.0 / (double)priv->pScrn->gamma.blue;
+
+ for(i = 0; i <= elements; i++) {
+ if(RedGamma == 1.0)
+ priv->gamma[i].red = i;
+ else
+ priv->gamma[i].red = (CARD16)(pow((double)i/(double)elements,
+ RedGamma) * (double)elements + 0.5);
+
+ if(GreenGamma == 1.0)
+ priv->gamma[i].green = i;
+ else
+ priv->gamma[i].green = (CARD16)(pow((double)i/(double)elements,
+ GreenGamma) * (double)elements + 0.5);
+
+ if(BlueGamma == 1.0)
+ priv->gamma[i].blue = i;
+ else
+ priv->gamma[i].blue = (CARD16)(pow((double)i/(double)elements,
+ BlueGamma) * (double)elements + 0.5);
+ }
+}
+
+
+int
+CMapChangeGamma(
+ int index,
+ Gamma gamma
+){
+ int ret = Success;
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ ScreenPtr pScreen = pScrn->pScreen;
+ CMapColormapPtr pColPriv;
+ CMapScreenPtr pScreenPriv;
+ CMapLinkPtr pLink;
+
+ /* Is this sufficient checking ? */
+ if(CMapScreenKey == NULL)
+ return BadImplementation;
+
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
+ if(!pScreenPriv)
+ return BadImplementation;
+
+ if (gamma.red < GAMMA_MIN || gamma.red > GAMMA_MAX ||
+ gamma.green < GAMMA_MIN || gamma.green > GAMMA_MAX ||
+ gamma.blue < GAMMA_MIN || gamma.blue > GAMMA_MAX)
+ return BadValue;
+
+ pScrn->gamma.red = gamma.red;
+ pScrn->gamma.green = gamma.green;
+ pScrn->gamma.blue = gamma.blue;
+
+ ComputeGamma(pScreenPriv);
+
+ /* mark all colormaps on this screen */
+ pLink = pScreenPriv->maps;
+ while(pLink) {
+ pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates,
+ CMapColormapKey);
+ pColPriv->recalculate = TRUE;
+ pLink = pLink->next;
+ }
+
+ if(miInstalledMaps[pScreen->myNum] &&
+ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
+ pScrn->vtSema || pScreenPriv->isDGAmode)) {
+ ColormapPtr pMap = miInstalledMaps[pScreen->myNum];
+
+ if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
+ (pMap->pVisual->class == TrueColor) &&
+ CMapColormapUseMax(pMap->pVisual, pScreenPriv)) {
+
+ /* if the current map doesn't have a palette look
+ for another map to change the gamma on. */
+
+ pLink = pScreenPriv->maps;
+ while(pLink) {
+ if(pLink->cmap->pVisual->class == PseudoColor)
+ break;
+ pLink = pLink->next;
+ }
+
+ if(pLink) {
+ /* need to trick CMapRefreshColors() into thinking
+ this is the currently installed map */
+ miInstalledMaps[pScreen->myNum] = pLink->cmap;
+ CMapReinstallMap(pLink->cmap);
+ miInstalledMaps[pScreen->myNum] = pMap;
+ }
+ } else
+ CMapReinstallMap(pMap);
+ }
+
+ pScrn->ChangeGamma = pScreenPriv->ChangeGamma;
+ if (pScrn->ChangeGamma)
+ ret = pScrn->ChangeGamma(index, gamma);
+ pScrn->ChangeGamma = CMapChangeGamma;
+
+ return ret;
+}
+
+
+static void
+ComputeGammaRamp (
+ CMapScreenPtr priv,
+ unsigned short *red,
+ unsigned short *green,
+ unsigned short *blue
+){
+ int elements = priv->gammaElements;
+ LOCO *entry = priv->gamma;
+ int shift = 16 - priv->sigRGBbits;
+
+ while(elements--) {
+ entry->red = *(red++) >> shift;
+ entry->green = *(green++) >> shift;
+ entry->blue = *(blue++) >> shift;
+ entry++;
+ }
+}
+
+int
+xf86ChangeGammaRamp(
+ ScreenPtr pScreen,
+ int size,
+ unsigned short *red,
+ unsigned short *green,
+ unsigned short *blue
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ CMapColormapPtr pColPriv;
+ CMapScreenPtr pScreenPriv;
+ CMapLinkPtr pLink;
+
+ if (xf86_crtc_supports_gamma(pScrn)) {
+ RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
+
+ if (crtc) {
+ if (crtc->gammaSize != size)
+ return BadValue;
+
+ RRCrtcGammaSet(crtc, red, green, blue);
+
+ return Success;
+ }
+ }
+
+ if(CMapScreenKey == NULL)
+ return BadImplementation;
+
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
+ if(!pScreenPriv)
+ return BadImplementation;
+
+ if(pScreenPriv->gammaElements != size)
+ return BadValue;
+
+ ComputeGammaRamp(pScreenPriv, red, green, blue);
+
+ /* mark all colormaps on this screen */
+ pLink = pScreenPriv->maps;
+ while(pLink) {
+ pColPriv = (CMapColormapPtr)dixLookupPrivate(&pLink->cmap->devPrivates,
+ CMapColormapKey);
+ pColPriv->recalculate = TRUE;
+ pLink = pLink->next;
+ }
+
+ if(miInstalledMaps[pScreen->myNum] &&
+ ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) ||
+ pScrn->vtSema || pScreenPriv->isDGAmode)) {
+ ColormapPtr pMap = miInstalledMaps[pScreen->myNum];
+
+ if (!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) &&
+ (pMap->pVisual->class == TrueColor) &&
+ CMapColormapUseMax(pMap->pVisual, pScreenPriv)) {
+
+ /* if the current map doesn't have a palette look
+ for another map to change the gamma on. */
+
+ pLink = pScreenPriv->maps;
+ while(pLink) {
+ if(pLink->cmap->pVisual->class == PseudoColor)
+ break;
+ pLink = pLink->next;
+ }
+
+ if(pLink) {
+ /* need to trick CMapRefreshColors() into thinking
+ this is the currently installed map */
+ miInstalledMaps[pScreen->myNum] = pLink->cmap;
+ CMapReinstallMap(pLink->cmap);
+ miInstalledMaps[pScreen->myNum] = pMap;
+ }
+ } else
+ CMapReinstallMap(pMap);
+ }
+
+ return Success;
+}
+
+int
+xf86GetGammaRampSize(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ CMapScreenPtr pScreenPriv;
+
+ if (xf86_crtc_supports_gamma(pScrn)) {
+ RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
+
+ if (crtc)
+ return crtc->gammaSize;
+ }
+
+ if(CMapScreenKey == NULL) return 0;
+
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
+ if(!pScreenPriv) return 0;
+
+ return pScreenPriv->gammaElements;
+}
+
+int
+xf86GetGammaRamp(
+ ScreenPtr pScreen,
+ int size,
+ unsigned short *red,
+ unsigned short *green,
+ unsigned short *blue
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ CMapScreenPtr pScreenPriv;
+ LOCO *entry;
+ int shift, sigbits;
+
+ if (xf86_crtc_supports_gamma(pScrn)) {
+ RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
+
+ if (crtc) {
+ if (crtc->gammaSize < size)
+ return BadValue;
+
+ if (!RRCrtcGammaGet(crtc))
+ return BadImplementation;
+
+ memcpy(red, crtc->gammaRed, size * sizeof(*red));
+ memcpy(green, crtc->gammaGreen, size * sizeof(*green));
+ memcpy(blue, crtc->gammaBlue, size * sizeof(*blue));
+
+ return Success;
+ }
+ }
+
+ if(CMapScreenKey == NULL)
+ return BadImplementation;
+
+ pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ CMapScreenKey);
+ if(!pScreenPriv)
+ return BadImplementation;
+
+ if(size > pScreenPriv->gammaElements)
+ return BadValue;
+
+ entry = pScreenPriv->gamma;
+ sigbits = pScreenPriv->sigRGBbits;
+
+ while(size--) {
+ *red = entry->red << (16 - sigbits);
+ *green = entry->green << (16 - sigbits);
+ *blue = entry->blue << (16 - sigbits);
+ shift = sigbits;
+ while(shift < 16) {
+ *red |= *red >> shift;
+ *green |= *green >> shift;
+ *blue |= *blue >> shift;
+ shift += sigbits;
+ }
+ red++; green++; blue++;
+ entry++;
+ }
+
+ return Success;
+}
+
+int
+xf86ChangeGamma(
+ ScreenPtr pScreen,
+ Gamma gamma
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if(pScrn->ChangeGamma)
+ return (*pScrn->ChangeGamma)(pScreen->myNum, gamma);
+
+ return BadImplementation;
+}
diff --git a/xorg-server/hw/xfree86/ddc/Makefile.in b/xorg-server/hw/xfree86/ddc/Makefile.in
index 4db870280..63f59d0bb 100644
--- a/xorg-server/hw/xfree86/ddc/Makefile.in
+++ b/xorg-server/hw/xfree86/ddc/Makefile.in
@@ -150,6 +150,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -281,6 +282,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/dixmods/Makefile.in b/xorg-server/hw/xfree86/dixmods/Makefile.in
index 5b0de7102..5eac39515 100644
--- a/xorg-server/hw/xfree86/dixmods/Makefile.in
+++ b/xorg-server/hw/xfree86/dixmods/Makefile.in
@@ -238,6 +238,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -369,6 +370,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/dixmods/extmod/Makefile.in b/xorg-server/hw/xfree86/dixmods/extmod/Makefile.in
index 7ebcb66c5..a5817f798 100644
--- a/xorg-server/hw/xfree86/dixmods/extmod/Makefile.in
+++ b/xorg-server/hw/xfree86/dixmods/extmod/Makefile.in
@@ -158,6 +158,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -289,6 +290,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/doc/Makefile.in b/xorg-server/hw/xfree86/doc/Makefile.in
index fba837fca..02ed9da6b 100644
--- a/xorg-server/hw/xfree86/doc/Makefile.in
+++ b/xorg-server/hw/xfree86/doc/Makefile.in
@@ -138,6 +138,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -269,6 +270,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/doc/devel/Makefile.in b/xorg-server/hw/xfree86/doc/devel/Makefile.in
index 754c3f2d5..65790fba5 100644
--- a/xorg-server/hw/xfree86/doc/devel/Makefile.in
+++ b/xorg-server/hw/xfree86/doc/devel/Makefile.in
@@ -101,6 +101,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -232,6 +233,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/doc/man/Makefile.in b/xorg-server/hw/xfree86/doc/man/Makefile.in
index 61bb2cc5a..c8b984c06 100644
--- a/xorg-server/hw/xfree86/doc/man/Makefile.in
+++ b/xorg-server/hw/xfree86/doc/man/Makefile.in
@@ -127,6 +127,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -258,6 +259,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = sed
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/doc/sgml/Makefile.in b/xorg-server/hw/xfree86/doc/sgml/Makefile.in
index 8f2b24e3f..41e45d7ca 100644
--- a/xorg-server/hw/xfree86/doc/sgml/Makefile.in
+++ b/xorg-server/hw/xfree86/doc/sgml/Makefile.in
@@ -121,6 +121,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -252,6 +253,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/dri/Makefile.in b/xorg-server/hw/xfree86/dri/Makefile.in
index 592bb760c..ecabb043c 100644
--- a/xorg-server/hw/xfree86/dri/Makefile.in
+++ b/xorg-server/hw/xfree86/dri/Makefile.in
@@ -153,6 +153,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -284,6 +285,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/dri2/Makefile.in b/xorg-server/hw/xfree86/dri2/Makefile.in
index ea77660c5..0e46951e8 100644
--- a/xorg-server/hw/xfree86/dri2/Makefile.in
+++ b/xorg-server/hw/xfree86/dri2/Makefile.in
@@ -152,6 +152,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -283,6 +284,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c
index 787544c20..48618e1a5 100644
--- a/xorg-server/hw/xfree86/dri2/dri2.c
+++ b/xorg-server/hw/xfree86/dri2/dri2.c
@@ -1,934 +1,938 @@
-/*
- * Copyright © 2007, 2008 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Soft-
- * ware"), to deal in the Software without restriction, including without
- * limitation the rights to use, copy, modify, merge, publish, distribute,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, provided that the above copyright
- * notice(s) and this permission notice appear in all copies of the Soft-
- * ware and that both the above copyright notice(s) and this permission
- * notice appear in supporting documentation.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
- * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
- * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
- * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
- * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
- * MANCE OF THIS SOFTWARE.
- *
- * Except as contained in this notice, the name of a copyright holder shall
- * not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization of
- * the copyright holder.
- *
- * Authors:
- * Kristian Høgsberg (krh@redhat.com)
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <errno.h>
-#include <xf86drm.h>
-#include "xf86Module.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "dixstruct.h"
-#include "dri2.h"
-#include "xf86VGAarbiter.h"
-
-#include "xf86.h"
-
-static int dri2ScreenPrivateKeyIndex;
-static DevPrivateKey dri2ScreenPrivateKey = &dri2ScreenPrivateKeyIndex;
-static int dri2WindowPrivateKeyIndex;
-static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKeyIndex;
-static int dri2PixmapPrivateKeyIndex;
-static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKeyIndex;
-
-typedef struct _DRI2Drawable {
- unsigned int refCount;
- int width;
- int height;
- DRI2BufferPtr *buffers;
- int bufferCount;
- unsigned int swapsPending;
- ClientPtr blockedClient;
- int swap_interval;
- CARD64 swap_count;
- CARD64 target_sbc; /* -1 means no SBC wait outstanding */
- CARD64 last_swap_target; /* most recently queued swap target */
- int swap_limit; /* for N-buffering */
-} DRI2DrawableRec, *DRI2DrawablePtr;
-
-typedef struct _DRI2Screen *DRI2ScreenPtr;
-
-typedef struct _DRI2Screen {
- unsigned int numDrivers;
- const char **driverNames;
- const char *deviceName;
- int fd;
- unsigned int lastSequence;
-
- DRI2CreateBufferProcPtr CreateBuffer;
- DRI2DestroyBufferProcPtr DestroyBuffer;
- DRI2CopyRegionProcPtr CopyRegion;
- DRI2ScheduleSwapProcPtr ScheduleSwap;
- DRI2GetMSCProcPtr GetMSC;
- DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
-
- HandleExposuresProcPtr HandleExposures;
-} DRI2ScreenRec;
-
-static DRI2ScreenPtr
-DRI2GetScreen(ScreenPtr pScreen)
-{
- return dixLookupPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey);
-}
-
-static DRI2DrawablePtr
-DRI2GetDrawable(DrawablePtr pDraw)
-{
- WindowPtr pWin;
- PixmapPtr pPixmap;
-
- if (!pDraw)
- return NULL;
-
- if (pDraw->type == DRAWABLE_WINDOW)
- {
- pWin = (WindowPtr) pDraw;
- return dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
- }
- else
- {
- pPixmap = (PixmapPtr) pDraw;
- return dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
- }
-}
-
-int
-DRI2CreateDrawable(DrawablePtr pDraw)
-{
- WindowPtr pWin;
- PixmapPtr pPixmap;
- DRI2DrawablePtr pPriv;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv != NULL)
- {
- pPriv->refCount++;
- return Success;
- }
-
- pPriv = xalloc(sizeof *pPriv);
- if (pPriv == NULL)
- return BadAlloc;
-
- pPriv->refCount = 1;
- pPriv->width = pDraw->width;
- pPriv->height = pDraw->height;
- pPriv->buffers = NULL;
- pPriv->bufferCount = 0;
- pPriv->swapsPending = 0;
- pPriv->blockedClient = NULL;
- pPriv->swap_count = 0;
- pPriv->target_sbc = -1;
- pPriv->swap_interval = 1;
- pPriv->last_swap_target = -1;
- pPriv->swap_limit = 1; /* default to double buffering */
-
- if (pDraw->type == DRAWABLE_WINDOW)
- {
- pWin = (WindowPtr) pDraw;
- dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv);
- }
- else
- {
- pPixmap = (PixmapPtr) pDraw;
- dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, pPriv);
- }
-
- return Success;
-}
-
-static void
-DRI2FreeDrawable(DrawablePtr pDraw)
-{
- DRI2DrawablePtr pPriv;
- WindowPtr pWin;
- PixmapPtr pPixmap;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL)
- return;
-
- xfree(pPriv);
-
- if (pDraw->type == DRAWABLE_WINDOW)
- {
- pWin = (WindowPtr) pDraw;
- dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
- }
- else
- {
- pPixmap = (PixmapPtr) pDraw;
- dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
- }
-}
-
-static int
-find_attachment(DRI2DrawablePtr pPriv, unsigned attachment)
-{
- int i;
-
- if (pPriv->buffers == NULL) {
- return -1;
- }
-
- for (i = 0; i < pPriv->bufferCount; i++) {
- if ((pPriv->buffers[i] != NULL)
- && (pPriv->buffers[i]->attachment == attachment)) {
- return i;
- }
- }
-
- return -1;
-}
-
-static DRI2BufferPtr
-allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds,
- DRI2DrawablePtr pPriv,
- unsigned int attachment, unsigned int format,
- int dimensions_match)
-{
- DRI2BufferPtr buffer;
- int old_buf;
-
- old_buf = find_attachment(pPriv, attachment);
-
- if ((old_buf < 0)
- || !dimensions_match
- || (pPriv->buffers[old_buf]->format != format)) {
- buffer = (*ds->CreateBuffer)(pDraw, attachment, format);
- } else {
- buffer = pPriv->buffers[old_buf];
- pPriv->buffers[old_buf] = NULL;
- }
-
- return buffer;
-}
-
-static DRI2BufferPtr *
-do_get_buffers(DrawablePtr pDraw, int *width, int *height,
- unsigned int *attachments, int count, int *out_count,
- int has_format)
-{
- DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
- DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
- DRI2BufferPtr *buffers;
- int need_real_front = 0;
- int need_fake_front = 0;
- int have_fake_front = 0;
- int front_format = 0;
- int dimensions_match;
- int i;
-
- if (!pPriv) {
- *width = pDraw->width;
- *height = pDraw->height;
- *out_count = 0;
- return NULL;
- }
-
- dimensions_match = (pDraw->width == pPriv->width)
- && (pDraw->height == pPriv->height);
-
- buffers = xalloc((count + 1) * sizeof(buffers[0]));
-
- for (i = 0; i < count; i++) {
- const unsigned attachment = *(attachments++);
- const unsigned format = (has_format) ? *(attachments++) : 0;
-
- buffers[i] = allocate_or_reuse_buffer(pDraw, ds, pPriv, attachment,
- format, dimensions_match);
-
- /* If the drawable is a window and the front-buffer is requested,
- * silently add the fake front-buffer to the list of requested
- * attachments. The counting logic in the loop accounts for the case
- * where the client requests both the fake and real front-buffer.
- */
- if (attachment == DRI2BufferBackLeft) {
- need_real_front++;
- front_format = format;
- }
-
- if (attachment == DRI2BufferFrontLeft) {
- need_real_front--;
- front_format = format;
-
- if (pDraw->type == DRAWABLE_WINDOW) {
- need_fake_front++;
- }
- }
-
- if (pDraw->type == DRAWABLE_WINDOW) {
- if (attachment == DRI2BufferFakeFrontLeft) {
- need_fake_front--;
- have_fake_front = 1;
- }
- }
- }
-
- if (need_real_front > 0) {
- buffers[i++] = allocate_or_reuse_buffer(pDraw, ds, pPriv,
- DRI2BufferFrontLeft,
- front_format, dimensions_match);
- }
-
- if (need_fake_front > 0) {
- buffers[i++] = allocate_or_reuse_buffer(pDraw, ds, pPriv,
- DRI2BufferFakeFrontLeft,
- front_format, dimensions_match);
- have_fake_front = 1;
- }
-
- *out_count = i;
-
-
- if (pPriv->buffers != NULL) {
- for (i = 0; i < pPriv->bufferCount; i++) {
- if (pPriv->buffers[i] != NULL) {
- (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
- }
- }
-
- xfree(pPriv->buffers);
- }
-
- pPriv->buffers = buffers;
- pPriv->bufferCount = *out_count;
- pPriv->width = pDraw->width;
- pPriv->height = pDraw->height;
- *width = pPriv->width;
- *height = pPriv->height;
-
-
- /* If the client is getting a fake front-buffer, pre-fill it with the
- * contents of the real front-buffer. This ensures correct operation of
- * applications that call glXWaitX before calling glDrawBuffer.
- */
- if (have_fake_front) {
- BoxRec box;
- RegionRec region;
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pPriv->width;
- box.y2 = pPriv->height;
- REGION_INIT(pDraw->pScreen, &region, &box, 0);
-
- DRI2CopyRegion(pDraw, &region, DRI2BufferFakeFrontLeft,
- DRI2BufferFrontLeft);
- }
-
- return pPriv->buffers;
-}
-
-DRI2BufferPtr *
-DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
- unsigned int *attachments, int count, int *out_count)
-{
- return do_get_buffers(pDraw, width, height, attachments, count,
- out_count, FALSE);
-}
-
-DRI2BufferPtr *
-DRI2GetBuffersWithFormat(DrawablePtr pDraw, int *width, int *height,
- unsigned int *attachments, int count, int *out_count)
-{
- return do_get_buffers(pDraw, width, height, attachments, count,
- out_count, TRUE);
-}
-
-/*
- * In the direct rendered case, we throttle the clients that have more
- * than their share of outstanding swaps (and thus busy buffers) when a
- * new GetBuffers request is received. In the AIGLX case, we allow the
- * client to get the new buffers, but throttle when the next GLX request
- * comes in (see __glXDRIcontextWait()).
- */
-Bool
-DRI2ThrottleClient(ClientPtr client, DrawablePtr pDraw)
-{
- DRI2DrawablePtr pPriv;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL)
- return FALSE;
-
- /* Throttle to swap limit */
- if ((pPriv->swapsPending >= pPriv->swap_limit) &&
- !pPriv->blockedClient) {
- ResetCurrentRequest(client);
- client->sequence--;
- IgnoreClient(client);
- pPriv->blockedClient = client;
- return TRUE;
- }
-
- return FALSE;
-}
-
-void
-DRI2BlockClient(ClientPtr client, DrawablePtr pDraw)
-{
- DRI2DrawablePtr pPriv;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL)
- return;
-
- if (pPriv->blockedClient == NULL) {
- IgnoreClient(client);
- pPriv->blockedClient = client;
- }
-}
-
-int
-DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
- unsigned int dest, unsigned int src)
-{
- DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
- DRI2DrawablePtr pPriv;
- DRI2BufferPtr pDestBuffer, pSrcBuffer;
- int i;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL)
- return BadDrawable;
-
- pDestBuffer = NULL;
- pSrcBuffer = NULL;
- for (i = 0; i < pPriv->bufferCount; i++)
- {
- if (pPriv->buffers[i]->attachment == dest)
- pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i];
- if (pPriv->buffers[i]->attachment == src)
- pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i];
- }
- if (pSrcBuffer == NULL || pDestBuffer == NULL)
- return BadValue;
-
- (*ds->CopyRegion)(pDraw, pRegion, pDestBuffer, pSrcBuffer);
-
- return Success;
-}
-
-/* Can this drawable be page flipped? */
-Bool
-DRI2CanFlip(DrawablePtr pDraw)
-{
- ScreenPtr pScreen = pDraw->pScreen;
- WindowPtr pWin, pRoot;
- PixmapPtr pWinPixmap, pRootPixmap;
-
- if (pDraw->type == DRAWABLE_PIXMAP)
- return TRUE;
-
- pRoot = WindowTable[pScreen->myNum];
- pRootPixmap = pScreen->GetWindowPixmap(pRoot);
-
- pWin = (WindowPtr) pDraw;
- pWinPixmap = pScreen->GetWindowPixmap(pWin);
- if (pRootPixmap != pWinPixmap)
- return FALSE;
- if (!REGION_EQUAL(pScreen, &pWin->clipList, &pRoot->winSize))
- return FALSE;
-
- return TRUE;
-}
-
-/* Can we do a pixmap exchange instead of a blit? */
-Bool
-DRI2CanExchange(DrawablePtr pDraw)
-{
- return FALSE;
-}
-
-void
-DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw, int frame,
- unsigned int tv_sec, unsigned int tv_usec)
-{
- DRI2DrawablePtr pPriv;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL)
- return;
-
- ProcDRI2WaitMSCReply(client, ((CARD64)tv_sec * 1000000) + tv_usec,
- frame, pPriv->swap_count);
-
- if (pPriv->blockedClient)
- AttendClient(pPriv->blockedClient);
-
- pPriv->blockedClient = NULL;
-}
-
-static void
-DRI2WakeClient(ClientPtr client, DrawablePtr pDraw, int frame,
- unsigned int tv_sec, unsigned int tv_usec)
-{
- ScreenPtr pScreen = pDraw->pScreen;
- DRI2DrawablePtr pPriv;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: bad drawable\n", __func__);
- return;
- }
-
- /*
- * Swap completed. Either wake up an SBC waiter or a client that was
- * blocked due to GLX activity during a swap.
- */
- if (pPriv->target_sbc != -1 &&
- pPriv->target_sbc >= pPriv->swap_count) {
- ProcDRI2WaitMSCReply(client, ((CARD64)tv_sec * 1000000) + tv_usec,
- frame, pPriv->swap_count);
- pPriv->target_sbc = -1;
-
- AttendClient(pPriv->blockedClient);
- pPriv->blockedClient = NULL;
- } else if (pPriv->target_sbc == -1) {
- if (pPriv->blockedClient)
- AttendClient(pPriv->blockedClient);
- pPriv->blockedClient = NULL;
- }
-}
-
-void
-DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw, int frame,
- unsigned int tv_sec, unsigned int tv_usec, int type,
- DRI2SwapEventPtr swap_complete, void *swap_data)
-{
- ScreenPtr pScreen = pDraw->pScreen;
- DRI2DrawablePtr pPriv;
- CARD64 ust = 0;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: bad drawable\n", __func__);
- return;
- }
-
- if (pPriv->refCount == 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: bad drawable refcount\n", __func__);
- DRI2FreeDrawable(pDraw);
- return;
- }
-
- ust = ((CARD64)tv_sec * 1000000) + tv_usec;
- if (swap_complete)
- swap_complete(client, swap_data, type, ust, frame, pPriv->swap_count);
-
- pPriv->swapsPending--;
- pPriv->swap_count++;
-
- DRI2WakeClient(client, pDraw, frame, tv_sec, tv_usec);
-}
-
-Bool
-DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable)
-{
- DRI2DrawablePtr pPriv = DRI2GetDrawable(pDrawable);
-
- /* If we're currently waiting for a swap on this drawable, reset
- * the request and suspend the client. We only support one
- * blocked client per drawable. */
- if ((pPriv->swapsPending) &&
- pPriv->blockedClient == NULL) {
- ResetCurrentRequest(client);
- client->sequence--;
- DRI2BlockClient(client, pDrawable);
- return TRUE;
- }
-
- return FALSE;
-}
-
-int
-DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
- CARD64 divisor, CARD64 remainder, CARD64 *swap_target,
- DRI2SwapEventPtr func, void *data)
-{
- ScreenPtr pScreen = pDraw->pScreen;
- DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
- DRI2DrawablePtr pPriv;
- DRI2BufferPtr pDestBuffer = NULL, pSrcBuffer = NULL;
- CARD64 ust;
- int ret, i;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: bad drawable\n", __func__);
- return BadDrawable;
- }
-
- for (i = 0; i < pPriv->bufferCount; i++) {
- if (pPriv->buffers[i]->attachment == DRI2BufferFrontLeft)
- pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i];
- if (pPriv->buffers[i]->attachment == DRI2BufferBackLeft)
- pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i];
- }
- if (pSrcBuffer == NULL || pDestBuffer == NULL) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: drawable has no back or front?\n", __func__);
- return BadDrawable;
- }
-
- /* Old DDX, just blit */
- if (!ds->ScheduleSwap) {
- BoxRec box;
- RegionRec region;
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pDraw->width;
- box.y2 = pDraw->height;
- REGION_INIT(pScreen, &region, &box, 0);
-
- pPriv->swapsPending++;
-
- (*ds->CopyRegion)(pDraw, &region, pDestBuffer, pSrcBuffer);
- DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE,
- func, data);
- return Success;
- }
-
- /*
- * In the simple glXSwapBuffers case, all params will be 0, and we just
- * need to schedule a swap for the last swap target + the swap interval.
- * If the last swap target hasn't been set yet, call into the driver
- * to get the current count.
- */
- if (target_msc == 0 && divisor == 0 && remainder == 0 &&
- pPriv->last_swap_target < 0) {
- ret = (*ds->GetMSC)(pDraw, &ust, &target_msc);
- if (!ret) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: driver failed to return current MSC\n",
- __func__);
- return BadDrawable;
- }
- }
-
- /* First swap needs to initialize last_swap_target */
- if (pPriv->last_swap_target < 0)
- pPriv->last_swap_target = target_msc;
-
- /*
- * Swap target for this swap is last swap target + swap interval since
- * we have to account for the current swap count, interval, and the
- * number of pending swaps.
- */
- *swap_target = pPriv->last_swap_target + pPriv->swap_interval;
-
- ret = (*ds->ScheduleSwap)(client, pDraw, pDestBuffer, pSrcBuffer,
- swap_target, divisor, remainder, func, data);
- if (!ret) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: driver failed to schedule swap\n", __func__);
- return BadDrawable;
- }
-
- pPriv->swapsPending++;
- pPriv->last_swap_target = *swap_target;
-
- return Success;
-}
-
-void
-DRI2SwapInterval(DrawablePtr pDrawable, int interval)
-{
- DRI2DrawablePtr pPriv = DRI2GetDrawable(pDrawable);
-
- /* fixme: check against arbitrary max? */
-
- pPriv->swap_interval = interval;
-}
-
-int
-DRI2GetMSC(DrawablePtr pDraw, CARD64 *ust, CARD64 *msc, CARD64 *sbc)
-{
- ScreenPtr pScreen = pDraw->pScreen;
- DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
- DRI2DrawablePtr pPriv;
- Bool ret;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[DRI2] %s: bad drawable\n", __func__);
- return BadDrawable;
- }
-
- if (!ds->GetMSC) {
- *ust = 0;
- *msc = 0;
- *sbc = pPriv->swap_count;
- return Success;
- }
-
- /*
- * Spec needs to be updated to include unmapped or redirected
- * drawables
- */
-
- ret = (*ds->GetMSC)(pDraw, ust, msc);
- if (!ret)
- return BadDrawable;
-
- *sbc = pPriv->swap_count;
-
- return Success;
-}
-
-int
-DRI2WaitMSC(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
- CARD64 divisor, CARD64 remainder)
-{
- DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
- DRI2DrawablePtr pPriv;
- Bool ret;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL)
- return BadDrawable;
-
- /* Old DDX just completes immediately */
- if (!ds->ScheduleWaitMSC) {
- DRI2WaitMSCComplete(client, pDraw, target_msc, 0, 0);
-
- return Success;
- }
-
- ret = (*ds->ScheduleWaitMSC)(client, pDraw, target_msc, divisor, remainder);
- if (!ret)
- return BadDrawable;
-
- return Success;
-}
-
-int
-DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw, CARD64 target_sbc,
- CARD64 *ust, CARD64 *msc, CARD64 *sbc)
-{
- DRI2DrawablePtr pPriv;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL)
- return BadDrawable;
-
- if (pPriv->swap_count >= target_sbc)
- return Success;
-
- pPriv->target_sbc = target_sbc;
- DRI2BlockClient(client, pDraw);
-
- return Success;
-}
-
-void
-DRI2DestroyDrawable(DrawablePtr pDraw)
-{
- DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
- DRI2DrawablePtr pPriv;
-
- pPriv = DRI2GetDrawable(pDraw);
- if (pPriv == NULL)
- return;
-
- pPriv->refCount--;
- if (pPriv->refCount > 0)
- return;
-
- if (pPriv->buffers != NULL) {
- int i;
-
- for (i = 0; i < pPriv->bufferCount; i++)
- (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
-
- xfree(pPriv->buffers);
- }
-
- /* If the window is destroyed while we have a swap pending, don't
- * actually free the priv yet. We'll need it in the DRI2SwapComplete()
- * callback and we'll free it there once we're done. */
- if (!pPriv->swapsPending)
- DRI2FreeDrawable(pDraw);
-}
-
-Bool
-DRI2Connect(ScreenPtr pScreen, unsigned int driverType, int *fd,
- const char **driverName, const char **deviceName)
-{
- DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
-
- if (ds == NULL || driverType >= ds->numDrivers ||
- !ds->driverNames[driverType])
- return FALSE;
-
- *fd = ds->fd;
- *driverName = ds->driverNames[driverType];
- *deviceName = ds->deviceName;
-
- return TRUE;
-}
-
-Bool
-DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic)
-{
- DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
-
- if (ds == NULL || drmAuthMagic(ds->fd, magic))
- return FALSE;
-
- return TRUE;
-}
-
-Bool
-DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
-{
- DRI2ScreenPtr ds;
- const char* driverTypeNames[] = {
- "DRI", /* DRI2DriverDRI */
- "VDPAU", /* DRI2DriverVDPAU */
- };
- unsigned int i;
-
- if (info->version < 3)
- return FALSE;
-
- if (!xf86VGAarbiterAllowDRI(pScreen)) {
- xf86DrvMsg(pScreen->myNum, X_WARNING,
- "[DRI2] Direct rendering is not supported when VGA arb is necessary for the device\n");
- return FALSE;
- }
-
- ds = xcalloc(1, sizeof *ds);
- if (!ds)
- return FALSE;
-
- ds->fd = info->fd;
- ds->deviceName = info->deviceName;
-
- ds->CreateBuffer = info->CreateBuffer;
- ds->DestroyBuffer = info->DestroyBuffer;
- ds->CopyRegion = info->CopyRegion;
-
- if (info->version >= 4) {
- ds->ScheduleSwap = info->ScheduleSwap;
- ds->ScheduleWaitMSC = info->ScheduleWaitMSC;
- ds->GetMSC = info->GetMSC;
- }
-
- if (info->version == 3 || info->numDrivers == 0) {
- /* Driver too old: use the old-style driverName field */
- ds->numDrivers = 1;
- ds->driverNames = xalloc(sizeof(*ds->driverNames));
- if (!ds->driverNames) {
- xfree(ds);
- return FALSE;
- }
- ds->driverNames[0] = info->driverName;
- } else {
- ds->numDrivers = info->numDrivers;
- ds->driverNames = xalloc(info->numDrivers * sizeof(*ds->driverNames));
- if (!ds->driverNames) {
- xfree(ds);
- return FALSE;
- }
- memcpy(ds->driverNames, info->driverNames,
- info->numDrivers * sizeof(*ds->driverNames));
- }
-
- dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds);
-
- xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n");
- for (i = 0; i < sizeof(driverTypeNames) / sizeof(driverTypeNames[0]); i++) {
- if (i < ds->numDrivers && ds->driverNames[i]) {
- xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] %s driver: %s\n",
- driverTypeNames[i], ds->driverNames[i]);
- }
- }
-
- return TRUE;
-}
-
-void
-DRI2CloseScreen(ScreenPtr pScreen)
-{
- DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
-
- xfree(ds->driverNames);
- xfree(ds);
- dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL);
-}
-
-extern ExtensionModule dri2ExtensionModule;
-
-static pointer
-DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- static Bool setupDone = FALSE;
-
- if (!setupDone)
- {
- setupDone = TRUE;
- LoadExtension(&dri2ExtensionModule, FALSE);
- }
- else
- {
- if (errmaj)
- *errmaj = LDR_ONCEONLY;
- }
-
- return (pointer) 1;
-}
-
-static XF86ModuleVersionInfo DRI2VersRec =
-{
- "dri2",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 2, 0,
- ABI_CLASS_EXTENSION,
- ABI_EXTENSION_VERSION,
- MOD_CLASS_NONE,
- { 0, 0, 0, 0 }
-};
-
-_X_EXPORT XF86ModuleData dri2ModuleData = { &DRI2VersRec, DRI2Setup, NULL };
-
-void
-DRI2Version(int *major, int *minor)
-{
- if (major != NULL)
- *major = DRI2VersRec.majorversion;
-
- if (minor != NULL)
- *minor = DRI2VersRec.minorversion;
-}
+/*
+ * Copyright © 2007, 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Soft-
+ * ware"), to deal in the Software without restriction, including without
+ * limitation the rights to use, copy, modify, merge, publish, distribute,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, provided that the above copyright
+ * notice(s) and this permission notice appear in all copies of the Soft-
+ * ware and that both the above copyright notice(s) and this permission
+ * notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
+ * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+ * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
+ * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
+ * MANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization of
+ * the copyright holder.
+ *
+ * Authors:
+ * Kristian Høgsberg (krh@redhat.com)
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <errno.h>
+#include <xf86drm.h>
+#include "xf86Module.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "dixstruct.h"
+#include "dri2.h"
+#include "xf86VGAarbiter.h"
+
+#include "xf86.h"
+
+static int dri2ScreenPrivateKeyIndex;
+static DevPrivateKey dri2ScreenPrivateKey = &dri2ScreenPrivateKeyIndex;
+static int dri2WindowPrivateKeyIndex;
+static DevPrivateKey dri2WindowPrivateKey = &dri2WindowPrivateKeyIndex;
+static int dri2PixmapPrivateKeyIndex;
+static DevPrivateKey dri2PixmapPrivateKey = &dri2PixmapPrivateKeyIndex;
+
+typedef struct _DRI2Drawable {
+ unsigned int refCount;
+ int width;
+ int height;
+ DRI2BufferPtr *buffers;
+ int bufferCount;
+ unsigned int swapsPending;
+ ClientPtr blockedClient;
+ int swap_interval;
+ CARD64 swap_count;
+ CARD64 target_sbc; /* -1 means no SBC wait outstanding */
+ CARD64 last_swap_target; /* most recently queued swap target */
+ int swap_limit; /* for N-buffering */
+} DRI2DrawableRec, *DRI2DrawablePtr;
+
+typedef struct _DRI2Screen *DRI2ScreenPtr;
+
+typedef struct _DRI2Screen {
+ unsigned int numDrivers;
+ const char **driverNames;
+ const char *deviceName;
+ int fd;
+ unsigned int lastSequence;
+
+ DRI2CreateBufferProcPtr CreateBuffer;
+ DRI2DestroyBufferProcPtr DestroyBuffer;
+ DRI2CopyRegionProcPtr CopyRegion;
+ DRI2ScheduleSwapProcPtr ScheduleSwap;
+ DRI2GetMSCProcPtr GetMSC;
+ DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
+
+ HandleExposuresProcPtr HandleExposures;
+} DRI2ScreenRec;
+
+static DRI2ScreenPtr
+DRI2GetScreen(ScreenPtr pScreen)
+{
+ return dixLookupPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey);
+}
+
+static DRI2DrawablePtr
+DRI2GetDrawable(DrawablePtr pDraw)
+{
+ WindowPtr pWin;
+ PixmapPtr pPixmap;
+
+ if (!pDraw)
+ return NULL;
+
+ if (pDraw->type == DRAWABLE_WINDOW)
+ {
+ pWin = (WindowPtr) pDraw;
+ return dixLookupPrivate(&pWin->devPrivates, dri2WindowPrivateKey);
+ }
+ else
+ {
+ pPixmap = (PixmapPtr) pDraw;
+ return dixLookupPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey);
+ }
+}
+
+int
+DRI2CreateDrawable(DrawablePtr pDraw)
+{
+ WindowPtr pWin;
+ PixmapPtr pPixmap;
+ DRI2DrawablePtr pPriv;
+
+ pPriv = DRI2GetDrawable(pDraw);
+ if (pPriv != NULL)
+ {
+ pPriv->refCount++;
+ return Success;
+ }
+
+ pPriv = xalloc(sizeof *pPriv);
+ if (pPriv == NULL)
+ return BadAlloc;
+
+ pPriv->refCount = 1;
+ pPriv->width = pDraw->width;
+ pPriv->height = pDraw->height;
+ pPriv->buffers = NULL;
+ pPriv->bufferCount = 0;
+ pPriv->swapsPending = 0;
+ pPriv->blockedClient = NULL;
+ pPriv->swap_count = 0;
+ pPriv->target_sbc = -1;
+ pPriv->swap_interval = 1;
+ pPriv->last_swap_target = -1;
+ pPriv->swap_limit = 1; /* default to double buffering */
+
+ if (pDraw->type == DRAWABLE_WINDOW)
+ {
+ pWin = (WindowPtr) pDraw;
+ dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, pPriv);
+ }
+ else
+ {
+ pPixmap = (PixmapPtr) pDraw;
+ dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, pPriv);
+ }
+
+ return Success;
+}
+
+static void
+DRI2FreeDrawable(DrawablePtr pDraw)
+{
+ DRI2DrawablePtr pPriv;
+ WindowPtr pWin;
+ PixmapPtr pPixmap;
+
+ pPriv = DRI2GetDrawable(pDraw);
+ if (pPriv == NULL)
+ return;
+
+ xfree(pPriv);
+
+ if (pDraw->type == DRAWABLE_WINDOW)
+ {
+ pWin = (WindowPtr) pDraw;
+ dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
+ }
+ else
+ {
+ pPixmap = (PixmapPtr) pDraw;
+ dixSetPrivate(&pPixmap->devPrivates, dri2PixmapPrivateKey, NULL);
+ }
+}
+
+static int
+find_attachment(DRI2DrawablePtr pPriv, unsigned attachment)
+{
+ int i;
+
+ if (pPriv->buffers == NULL) {
+ return -1;
+ }
+
+ for (i = 0; i < pPriv->bufferCount; i++) {
+ if ((pPriv->buffers[i] != NULL)
+ && (pPriv->buffers[i]->attachment == attachment)) {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+static Bool
+allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds,
+ DRI2DrawablePtr pPriv,
+ unsigned int attachment, unsigned int format,
+ int dimensions_match, DRI2BufferPtr *buffer)
+{
+ int old_buf = find_attachment(pPriv, attachment);
+
+ if ((old_buf < 0)
+ || !dimensions_match
+ || (pPriv->buffers[old_buf]->format != format)) {
+ *buffer = (*ds->CreateBuffer)(pDraw, attachment, format);
+ return TRUE;
+
+ } else {
+ *buffer = pPriv->buffers[old_buf];
+ pPriv->buffers[old_buf] = NULL;
+ return FALSE;
+ }
+}
+
+static DRI2BufferPtr *
+do_get_buffers(DrawablePtr pDraw, int *width, int *height,
+ unsigned int *attachments, int count, int *out_count,
+ int has_format)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+ DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
+ DRI2BufferPtr *buffers;
+ int need_real_front = 0;
+ int need_fake_front = 0;
+ int have_fake_front = 0;
+ int front_format = 0;
+ int dimensions_match;
+ int buffers_changed = 0;
+ int i;
+
+ if (!pPriv) {
+ *width = pDraw->width;
+ *height = pDraw->height;
+ *out_count = 0;
+ return NULL;
+ }
+
+ dimensions_match = (pDraw->width == pPriv->width)
+ && (pDraw->height == pPriv->height);
+
+ buffers = xalloc((count + 1) * sizeof(buffers[0]));
+
+ for (i = 0; i < count; i++) {
+ const unsigned attachment = *(attachments++);
+ const unsigned format = (has_format) ? *(attachments++) : 0;
+
+ if (allocate_or_reuse_buffer(pDraw, ds, pPriv, attachment,
+ format, dimensions_match,
+ &buffers[i]))
+ buffers_changed = 1;
+
+ /* If the drawable is a window and the front-buffer is requested,
+ * silently add the fake front-buffer to the list of requested
+ * attachments. The counting logic in the loop accounts for the case
+ * where the client requests both the fake and real front-buffer.
+ */
+ if (attachment == DRI2BufferBackLeft) {
+ need_real_front++;
+ front_format = format;
+ }
+
+ if (attachment == DRI2BufferFrontLeft) {
+ need_real_front--;
+ front_format = format;
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ need_fake_front++;
+ }
+ }
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ if (attachment == DRI2BufferFakeFrontLeft) {
+ need_fake_front--;
+ have_fake_front = 1;
+ }
+ }
+ }
+
+ if (need_real_front > 0) {
+ if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFrontLeft,
+ front_format, dimensions_match,
+ &buffers[i++]))
+ buffers_changed = 1;
+ }
+
+ if (need_fake_front > 0) {
+ if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFakeFrontLeft,
+ front_format, dimensions_match,
+ &buffers[i++]))
+ buffers_changed = 1;
+
+ have_fake_front = 1;
+ }
+
+ *out_count = i;
+
+
+ if (pPriv->buffers != NULL) {
+ for (i = 0; i < pPriv->bufferCount; i++) {
+ if (pPriv->buffers[i] != NULL) {
+ (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
+ }
+ }
+
+ xfree(pPriv->buffers);
+ }
+
+ pPriv->buffers = buffers;
+ pPriv->bufferCount = *out_count;
+ pPriv->width = pDraw->width;
+ pPriv->height = pDraw->height;
+ *width = pPriv->width;
+ *height = pPriv->height;
+
+
+ /* If the client is getting a fake front-buffer, pre-fill it with the
+ * contents of the real front-buffer. This ensures correct operation of
+ * applications that call glXWaitX before calling glDrawBuffer.
+ */
+ if (have_fake_front && buffers_changed) {
+ BoxRec box;
+ RegionRec region;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pPriv->width;
+ box.y2 = pPriv->height;
+ REGION_INIT(pDraw->pScreen, &region, &box, 0);
+
+ DRI2CopyRegion(pDraw, &region, DRI2BufferFakeFrontLeft,
+ DRI2BufferFrontLeft);
+ }
+
+ return pPriv->buffers;
+}
+
+DRI2BufferPtr *
+DRI2GetBuffers(DrawablePtr pDraw, int *width, int *height,
+ unsigned int *attachments, int count, int *out_count)
+{
+ return do_get_buffers(pDraw, width, height, attachments, count,
+ out_count, FALSE);
+}
+
+DRI2BufferPtr *
+DRI2GetBuffersWithFormat(DrawablePtr pDraw, int *width, int *height,
+ unsigned int *attachments, int count, int *out_count)
+{
+ return do_get_buffers(pDraw, width, height, attachments, count,
+ out_count, TRUE);
+}
+
+/*
+ * In the direct rendered case, we throttle the clients that have more
+ * than their share of outstanding swaps (and thus busy buffers) when a
+ * new GetBuffers request is received. In the AIGLX case, we allow the
+ * client to get the new buffers, but throttle when the next GLX request
+ * comes in (see __glXDRIcontextWait()).
+ */
+Bool
+DRI2ThrottleClient(ClientPtr client, DrawablePtr pDraw)
+{
+ DRI2DrawablePtr pPriv;
+
+ pPriv = DRI2GetDrawable(pDraw);
+ if (pPriv == NULL)
+ return FALSE;
+
+ /* Throttle to swap limit */
+ if ((pPriv->swapsPending >= pPriv->swap_limit) &&
+ !pPriv->blockedClient) {
+ ResetCurrentRequest(client);
+ client->sequence--;
+ IgnoreClient(client);
+ pPriv->blockedClient = client;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+void
+DRI2BlockClient(ClientPtr client, DrawablePtr pDraw)
+{
+ DRI2DrawablePtr pPriv;
+
+ pPriv = DRI2GetDrawable(pDraw);
+ if (pPriv == NULL)
+ return;
+
+ if (pPriv->blockedClient == NULL) {
+ IgnoreClient(client);
+ pPriv->blockedClient = client;
+ }
+}
+
+int
+DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
+ unsigned int dest, unsigned int src)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+ DRI2DrawablePtr pPriv;
+ DRI2BufferPtr pDestBuffer, pSrcBuffer;
+ int i;
+
+ pPriv = DRI2GetDrawable(pDraw);
+ if (pPriv == NULL)
+ return BadDrawable;
+
+ pDestBuffer = NULL;
+ pSrcBuffer = NULL;
+ for (i = 0; i < pPriv->bufferCount; i++)
+ {
+ if (pPriv->buffers[i]->attachment == dest)
+ pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i];
+ if (pPriv->buffers[i]->attachment == src)
+ pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i];
+ }
+ if (pSrcBuffer == NULL || pDestBuffer == NULL)
+ return BadValue;
+
+ (*ds->CopyRegion)(pDraw, pRegion, pDestBuffer, pSrcBuffer);
+
+ return Success;
+}
+
+/* Can this drawable be page flipped? */
+Bool
+DRI2CanFlip(DrawablePtr pDraw)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ WindowPtr pWin, pRoot;
+ PixmapPtr pWinPixmap, pRootPixmap;
+
+ if (pDraw->type == DRAWABLE_PIXMAP)
+ return TRUE;
+
+ pRoot = WindowTable[pScreen->myNum];
+ pRootPixmap = pScreen->GetWindowPixmap(pRoot);
+
+ pWin = (WindowPtr) pDraw;
+ pWinPixmap = pScreen->GetWindowPixmap(pWin);
+ if (pRootPixmap != pWinPixmap)
+ return FALSE;
+ if (!REGION_EQUAL(pScreen, &pWin->clipList, &pRoot->winSize))
+ return FALSE;
+
+ return TRUE;
+}
+
+/* Can we do a pixmap exchange instead of a blit? */
+Bool
+DRI2CanExchange(DrawablePtr pDraw)
+{
+ return FALSE;
+}
+
+void
+DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw, int frame,
+ unsigned int tv_sec, unsigned int tv_usec)
+{
+ DRI2DrawablePtr pPriv;
+
+ pPriv = DRI2GetDrawable(pDraw);
+ if (pPriv == NULL)
+ return;
+
+ ProcDRI2WaitMSCReply(client, ((CARD64)tv_sec * 1000000) + tv_usec,
+ frame, pPriv->swap_count);
+
+ if (pPriv->blockedClient)
+ AttendClient(pPriv->blockedClient);
+
+ pPriv->blockedClient = NULL;
+}
+
+static void
+DRI2WakeClient(ClientPtr client, DrawablePtr pDraw, int frame,
+ unsigned int tv_sec, unsigned int tv_usec)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ DRI2DrawablePtr pPriv;
+
+ pPriv = DRI2GetDrawable(pDraw);
+ if (pPriv == NULL) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI2] %s: bad drawable\n", __func__);
+ return;
+ }
+
+ /*
+ * Swap completed. Either wake up an SBC waiter or a client that was
+ * blocked due to GLX activity during a swap.
+ */
+ if (pPriv->target_sbc != -1 &&
+ pPriv->target_sbc >= pPriv->swap_count) {
+ ProcDRI2WaitMSCReply(client, ((CARD64)tv_sec * 1000000) + tv_usec,
+ frame, pPriv->swap_count);
+ pPriv->target_sbc = -1;
+
+ AttendClient(pPriv->blockedClient);
+ pPriv->blockedClient = NULL;
+ } else if (pPriv->target_sbc == -1) {
+ if (pPriv->blockedClient)
+ AttendClient(pPriv->blockedClient);
+ pPriv->blockedClient = NULL;
+ }
+}
+
+void
+DRI2SwapComplete(ClientPtr client, DrawablePtr pDraw, int frame,
+ unsigned int tv_sec, unsigned int tv_usec, int type,
+ DRI2SwapEventPtr swap_complete, void *swap_data)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ DRI2DrawablePtr pPriv;
+ CARD64 ust = 0;
+
+ pPriv = DRI2GetDrawable(pDraw);
+ if (pPriv == NULL) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI2] %s: bad drawable\n", __func__);
+ return;
+ }
+
+ if (pPriv->refCount == 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI2] %s: bad drawable refcount\n", __func__);
+ DRI2FreeDrawable(pDraw);
+ return;
+ }
+
+ ust = ((CARD64)tv_sec * 1000000) + tv_usec;
+ if (swap_complete)
+ swap_complete(client, swap_data, type, ust, frame, pPriv->swap_count);
+
+ pPriv->swapsPending--;
+ pPriv->swap_count++;
+
+ DRI2WakeClient(client, pDraw, frame, tv_sec, tv_usec);
+}
+
+Bool
+DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable)
+{
+ DRI2DrawablePtr pPriv = DRI2GetDrawable(pDrawable);
+
+ /* If we're currently waiting for a swap on this drawable, reset
+ * the request and suspend the client. We only support one
+ * blocked client per drawable. */
+ if ((pPriv->swapsPending) &&
+ pPriv->blockedClient == NULL) {
+ ResetCurrentRequest(client);
+ client->sequence--;
+ DRI2BlockClient(client, pDrawable);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+int
+DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
+ CARD64 divisor, CARD64 remainder, CARD64 *swap_target,
+ DRI2SwapEventPtr func, void *data)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+ DRI2DrawablePtr pPriv;
+ DRI2BufferPtr pDestBuffer = NULL, pSrcBuffer = NULL;
+ CARD64 ust;
+ int ret, i;
+
+ pPriv = DRI2GetDrawable(pDraw);
+ if (pPriv == NULL) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI2] %s: bad drawable\n", __func__);
+ return BadDrawable;
+ }
+
+ for (i = 0; i < pPriv->bufferCount; i++) {
+ if (pPriv->buffers[i]->attachment == DRI2BufferFrontLeft)
+ pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i];
+ if (pPriv->buffers[i]->attachment == DRI2BufferBackLeft)
+ pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i];
+ }
+ if (pSrcBuffer == NULL || pDestBuffer == NULL) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI2] %s: drawable has no back or front?\n", __func__);
+ return BadDrawable;
+ }
+
+ /* Old DDX, just blit */
+ if (!ds->ScheduleSwap) {
+ BoxRec box;
+ RegionRec region;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pDraw->width;
+ box.y2 = pDraw->height;
+ REGION_INIT(pScreen, &region, &box, 0);
+
+ pPriv->swapsPending++;
+
+ (*ds->CopyRegion)(pDraw, &region, pDestBuffer, pSrcBuffer);
+ DRI2SwapComplete(client, pDraw, target_msc, 0, 0, DRI2_BLIT_COMPLETE,
+ func, data);
+ return Success;
+ }
+
+ /*
+ * In the simple glXSwapBuffers case, all params will be 0, and we just
+ * need to schedule a swap for the last swap target + the swap interval.
+ * If the last swap target hasn't been set yet, call into the driver
+ * to get the current count.
+ */
+ if (target_msc == 0 && divisor == 0 && remainder == 0 &&
+ pPriv->last_swap_target < 0) {
+ ret = (*ds->GetMSC)(pDraw, &ust, &target_msc);
+ if (!ret) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI2] %s: driver failed to return current MSC\n",
+ __func__);
+ return BadDrawable;
+ }
+ }
+
+ /* First swap needs to initialize last_swap_target */
+ if (pPriv->last_swap_target < 0)
+ pPriv->last_swap_target = target_msc;
+
+ /*
+ * Swap target for this swap is last swap target + swap interval since
+ * we have to account for the current swap count, interval, and the
+ * number of pending swaps.
+ */
+ *swap_target = pPriv->last_swap_target + pPriv->swap_interval;
+
+ ret = (*ds->ScheduleSwap)(client, pDraw, pDestBuffer, pSrcBuffer,
+ swap_target, divisor, remainder, func, data);
+ if (!ret) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI2] %s: driver failed to schedule swap\n", __func__);
+ return BadDrawable;
+ }
+
+ pPriv->swapsPending++;
+ pPriv->last_swap_target = *swap_target;
+
+ return Success;
+}
+
+void
+DRI2SwapInterval(DrawablePtr pDrawable, int interval)
+{
+ DRI2DrawablePtr pPriv = DRI2GetDrawable(pDrawable);
+
+ /* fixme: check against arbitrary max? */
+
+ pPriv->swap_interval = interval;
+}
+
+int
+DRI2GetMSC(DrawablePtr pDraw, CARD64 *ust, CARD64 *msc, CARD64 *sbc)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+ DRI2DrawablePtr pPriv;
+ Bool ret;
+
+ pPriv = DRI2GetDrawable(pDraw);
+ if (pPriv == NULL) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
+ "[DRI2] %s: bad drawable\n", __func__);
+ return BadDrawable;
+ }
+
+ if (!ds->GetMSC) {
+ *ust = 0;
+ *msc = 0;
+ *sbc = pPriv->swap_count;
+ return Success;
+ }
+
+ /*
+ * Spec needs to be updated to include unmapped or redirected
+ * drawables
+ */
+
+ ret = (*ds->GetMSC)(pDraw, ust, msc);
+ if (!ret)
+ return BadDrawable;
+
+ *sbc = pPriv->swap_count;
+
+ return Success;
+}
+
+int
+DRI2WaitMSC(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
+ CARD64 divisor, CARD64 remainder)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+ DRI2DrawablePtr pPriv;
+ Bool ret;
+
+ pPriv = DRI2GetDrawable(pDraw);
+ if (pPriv == NULL)
+ return BadDrawable;
+
+ /* Old DDX just completes immediately */
+ if (!ds->ScheduleWaitMSC) {
+ DRI2WaitMSCComplete(client, pDraw, target_msc, 0, 0);
+
+ return Success;
+ }
+
+ ret = (*ds->ScheduleWaitMSC)(client, pDraw, target_msc, divisor, remainder);
+ if (!ret)
+ return BadDrawable;
+
+ return Success;
+}
+
+int
+DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw, CARD64 target_sbc,
+ CARD64 *ust, CARD64 *msc, CARD64 *sbc)
+{
+ DRI2DrawablePtr pPriv;
+
+ pPriv = DRI2GetDrawable(pDraw);
+ if (pPriv == NULL)
+ return BadDrawable;
+
+ if (pPriv->swap_count >= target_sbc)
+ return Success;
+
+ pPriv->target_sbc = target_sbc;
+ DRI2BlockClient(client, pDraw);
+
+ return Success;
+}
+
+void
+DRI2DestroyDrawable(DrawablePtr pDraw)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
+ DRI2DrawablePtr pPriv;
+
+ pPriv = DRI2GetDrawable(pDraw);
+ if (pPriv == NULL)
+ return;
+
+ pPriv->refCount--;
+ if (pPriv->refCount > 0)
+ return;
+
+ if (pPriv->buffers != NULL) {
+ int i;
+
+ for (i = 0; i < pPriv->bufferCount; i++)
+ (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
+
+ xfree(pPriv->buffers);
+ }
+
+ /* If the window is destroyed while we have a swap pending, don't
+ * actually free the priv yet. We'll need it in the DRI2SwapComplete()
+ * callback and we'll free it there once we're done. */
+ if (!pPriv->swapsPending)
+ DRI2FreeDrawable(pDraw);
+}
+
+Bool
+DRI2Connect(ScreenPtr pScreen, unsigned int driverType, int *fd,
+ const char **driverName, const char **deviceName)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
+ if (ds == NULL || driverType >= ds->numDrivers ||
+ !ds->driverNames[driverType])
+ return FALSE;
+
+ *fd = ds->fd;
+ *driverName = ds->driverNames[driverType];
+ *deviceName = ds->deviceName;
+
+ return TRUE;
+}
+
+Bool
+DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
+ if (ds == NULL || drmAuthMagic(ds->fd, magic))
+ return FALSE;
+
+ return TRUE;
+}
+
+Bool
+DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
+{
+ DRI2ScreenPtr ds;
+ const char* driverTypeNames[] = {
+ "DRI", /* DRI2DriverDRI */
+ "VDPAU", /* DRI2DriverVDPAU */
+ };
+ unsigned int i;
+
+ if (info->version < 3)
+ return FALSE;
+
+ if (!xf86VGAarbiterAllowDRI(pScreen)) {
+ xf86DrvMsg(pScreen->myNum, X_WARNING,
+ "[DRI2] Direct rendering is not supported when VGA arb is necessary for the device\n");
+ return FALSE;
+ }
+
+ ds = xcalloc(1, sizeof *ds);
+ if (!ds)
+ return FALSE;
+
+ ds->fd = info->fd;
+ ds->deviceName = info->deviceName;
+
+ ds->CreateBuffer = info->CreateBuffer;
+ ds->DestroyBuffer = info->DestroyBuffer;
+ ds->CopyRegion = info->CopyRegion;
+
+ if (info->version >= 4) {
+ ds->ScheduleSwap = info->ScheduleSwap;
+ ds->ScheduleWaitMSC = info->ScheduleWaitMSC;
+ ds->GetMSC = info->GetMSC;
+ }
+
+ if (info->version == 3 || info->numDrivers == 0) {
+ /* Driver too old: use the old-style driverName field */
+ ds->numDrivers = 1;
+ ds->driverNames = xalloc(sizeof(*ds->driverNames));
+ if (!ds->driverNames) {
+ xfree(ds);
+ return FALSE;
+ }
+ ds->driverNames[0] = info->driverName;
+ } else {
+ ds->numDrivers = info->numDrivers;
+ ds->driverNames = xalloc(info->numDrivers * sizeof(*ds->driverNames));
+ if (!ds->driverNames) {
+ xfree(ds);
+ return FALSE;
+ }
+ memcpy(ds->driverNames, info->driverNames,
+ info->numDrivers * sizeof(*ds->driverNames));
+ }
+
+ dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds);
+
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n");
+ for (i = 0; i < sizeof(driverTypeNames) / sizeof(driverTypeNames[0]); i++) {
+ if (i < ds->numDrivers && ds->driverNames[i]) {
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] %s driver: %s\n",
+ driverTypeNames[i], ds->driverNames[i]);
+ }
+ }
+
+ return TRUE;
+}
+
+void
+DRI2CloseScreen(ScreenPtr pScreen)
+{
+ DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
+
+ xfree(ds->driverNames);
+ xfree(ds);
+ dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL);
+}
+
+extern ExtensionModule dri2ExtensionModule;
+
+static pointer
+DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
+{
+ static Bool setupDone = FALSE;
+
+ if (!setupDone)
+ {
+ setupDone = TRUE;
+ LoadExtension(&dri2ExtensionModule, FALSE);
+ }
+ else
+ {
+ if (errmaj)
+ *errmaj = LDR_ONCEONLY;
+ }
+
+ return (pointer) 1;
+}
+
+static XF86ModuleVersionInfo DRI2VersRec =
+{
+ "dri2",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ 1, 2, 0,
+ ABI_CLASS_EXTENSION,
+ ABI_EXTENSION_VERSION,
+ MOD_CLASS_NONE,
+ { 0, 0, 0, 0 }
+};
+
+_X_EXPORT XF86ModuleData dri2ModuleData = { &DRI2VersRec, DRI2Setup, NULL };
+
+void
+DRI2Version(int *major, int *minor)
+{
+ if (major != NULL)
+ *major = DRI2VersRec.majorversion;
+
+ if (minor != NULL)
+ *minor = DRI2VersRec.minorversion;
+}
diff --git a/xorg-server/hw/xfree86/dri2/dri2ext.c b/xorg-server/hw/xfree86/dri2/dri2ext.c
index 3e6b03e4e..bd92fd304 100644
--- a/xorg-server/hw/xfree86/dri2/dri2ext.c
+++ b/xorg-server/hw/xfree86/dri2/dri2ext.c
@@ -353,10 +353,12 @@ DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc,
CARD64 sbc)
{
xDRI2BufferSwapComplete event;
+ DrawablePtr pDrawable = data;
event.type = DRI2EventBase + DRI2_BufferSwapComplete;
event.sequenceNumber = client->sequence;
event.event_type = type;
+ event.drawable = pDrawable->id;
event.ust_hi = (CARD64)ust >> 32;
event.ust_lo = ust & 0xffffffff;
event.msc_hi = (CARD64)msc >> 32;
diff --git a/xorg-server/hw/xfree86/exa/Makefile.in b/xorg-server/hw/xfree86/exa/Makefile.in
index b3eb780d4..22c176a08 100644
--- a/xorg-server/hw/xfree86/exa/Makefile.in
+++ b/xorg-server/hw/xfree86/exa/Makefile.in
@@ -156,6 +156,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -287,6 +288,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = sed
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/fbdevhw/Makefile.in b/xorg-server/hw/xfree86/fbdevhw/Makefile.in
index 3ededbb5c..207d083b7 100644
--- a/xorg-server/hw/xfree86/fbdevhw/Makefile.in
+++ b/xorg-server/hw/xfree86/fbdevhw/Makefile.in
@@ -161,6 +161,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -292,6 +293,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = sed
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/i2c/Makefile.in b/xorg-server/hw/xfree86/i2c/Makefile.in
index 9b93a76e2..2850c0f42 100644
--- a/xorg-server/hw/xfree86/i2c/Makefile.in
+++ b/xorg-server/hw/xfree86/i2c/Makefile.in
@@ -202,6 +202,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -333,6 +334,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/int10/Makefile.in b/xorg-server/hw/xfree86/int10/Makefile.in
index 51c81e1e1..04a42eebc 100644
--- a/xorg-server/hw/xfree86/int10/Makefile.in
+++ b/xorg-server/hw/xfree86/int10/Makefile.in
@@ -166,6 +166,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -297,6 +298,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/loader/Makefile.in b/xorg-server/hw/xfree86/loader/Makefile.in
index 807676bf4..37726d5dc 100644
--- a/xorg-server/hw/xfree86/loader/Makefile.in
+++ b/xorg-server/hw/xfree86/loader/Makefile.in
@@ -126,6 +126,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -257,6 +258,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/loader/sdksyms.c b/xorg-server/hw/xfree86/loader/sdksyms.c
index 66eb840cf..ade24a12d 100644
--- a/xorg-server/hw/xfree86/loader/sdksyms.c
+++ b/xorg-server/hw/xfree86/loader/sdksyms.c
@@ -390,6 +390,7 @@ _X_HIDDEN void *xorg_symbols[] = {
(void *) &OsVendorInit,
(void *) &OsBlockSignals,
(void *) &OsReleaseSignals,
+ (void *) &OsAbort,
(void *) &System,
(void *) &Popen,
(void *) &Pclose,
@@ -593,6 +594,7 @@ _X_HIDDEN void *xorg_symbols[] = {
(void *) &LegalModifier,
(void *) &ProcessInputEvents,
(void *) &InitInput,
+ (void *) &CloseInput,
(void *) &GetMaximumEventsNum,
(void *) &GetEventList,
(void *) &InitEventList,
@@ -1660,6 +1662,7 @@ _X_HIDDEN void *xorg_symbols[] = {
(void *) &xf86QueryLargestOffscreenArea,
(void *) &xf86QueryLargestOffscreenLinear,
(void *) &inputInfo,
+ (void *) &syncEvents,
(void *) &CloseInputDevice,
(void *) &AddOtherInputDevices,
(void *) &OpenInputDevice,
diff --git a/xorg-server/hw/xfree86/modes/Makefile.in b/xorg-server/hw/xfree86/modes/Makefile.in
index 62ce86e1c..ad64acf56 100644
--- a/xorg-server/hw/xfree86/modes/Makefile.in
+++ b/xorg-server/hw/xfree86/modes/Makefile.in
@@ -156,6 +156,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -287,6 +288,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index 9b1ff280b..860e520ad 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -1495,12 +1495,16 @@ GuessRangeFromModes(MonPtr mon, DisplayModePtr mode)
mon->vrefresh[0].lo = 58.0;
}
+enum det_monrec_source {
+ sync_config, sync_edid, sync_default
+};
+
struct det_monrec_parameter {
MonRec *mon_rec;
int *max_clock;
Bool set_hsync;
Bool set_vrefresh;
- enum { sync_config, sync_edid, sync_default } *sync_source;
+ enum det_monrec_source *sync_source;
};
static void handle_detailed_monrec(struct detailed_monitor_section *det_mon,
@@ -1563,7 +1567,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
Bool add_default_modes = TRUE;
Bool debug_modes = config->debug_modes ||
xf86Initialising;
- enum { sync_config, sync_edid, sync_default } sync_source = sync_default;
+ enum det_monrec_source sync_source = sync_default;
while (output->probed_modes != NULL)
xf86DeleteMode(&output->probed_modes, output->probed_modes);
@@ -2591,8 +2595,8 @@ xf86SetDesiredModes (ScrnInfoPtr scrn)
if (!crtc->enabled)
continue;
- if (config->output[config->compat_output]->crtc == crtc)
- output = config->output[config->compat_output];
+ if (xf86CompatOutput(scrn) && xf86CompatCrtc(scrn) == crtc)
+ output = xf86CompatOutput(scrn);
else
{
for (o = 0; o < config->num_output; o++)
@@ -2712,14 +2716,16 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
Bool ok = TRUE;
- xf86OutputPtr compat_output = config->output[config->compat_output];
- DisplayModePtr compat_mode;
+ xf86OutputPtr compat_output;
+ DisplayModePtr compat_mode = NULL;
int c;
/*
* Let the compat output drive the final mode selection
*/
- compat_mode = xf86OutputFindClosestMode (compat_output, desired);
+ compat_output = xf86CompatOutput(pScrn);
+ if (compat_output)
+ compat_mode = xf86OutputFindClosestMode (compat_output, desired);
if (compat_mode)
desired = compat_mode;
@@ -2943,7 +2949,7 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
}
/* Set the DDC properties for the 'compat' output */
- if (output == config->output[config->compat_output])
+ if (output == xf86CompatOutput(scrn))
xf86SetDDCproperties(scrn, edid_mon);
#ifdef RANDR_12_INTERFACE
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.h b/xorg-server/hw/xfree86/modes/xf86Crtc.h
index 9baa956a3..68a968cc2 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.h
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.h
@@ -689,6 +689,32 @@ extern _X_EXPORT int xf86CrtcConfigPrivateIndex;
#define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr))
+static _X_INLINE xf86OutputPtr
+xf86CompatOutput(ScrnInfoPtr pScrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ return config->output[config->compat_output];
+}
+
+static _X_INLINE xf86CrtcPtr
+xf86CompatCrtc(ScrnInfoPtr pScrn)
+{
+ xf86OutputPtr compat_output = xf86CompatOutput(pScrn);
+ if (!compat_output)
+ return NULL;
+ return compat_output->crtc;
+}
+
+static _X_INLINE RRCrtcPtr
+xf86CompatRRCrtc(ScrnInfoPtr pScrn)
+{
+ xf86CrtcPtr compat_crtc = xf86CompatCrtc(pScrn);
+ if (!compat_crtc)
+ return NULL;
+ return compat_crtc->randr_crtc;
+}
+
+
/*
* Initialize xf86CrtcConfig structure
*/
diff --git a/xorg-server/hw/xfree86/modes/xf86Cursors.c b/xorg-server/hw/xfree86/modes/xf86Cursors.c
index 385848b7a..e2e174e59 100644
--- a/xorg-server/hw/xfree86/modes/xf86Cursors.c
+++ b/xorg-server/hw/xfree86/modes/xf86Cursors.c
@@ -461,11 +461,11 @@ xf86_use_hw_cursor (ScreenPtr screen, CursorPtr cursor)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ ++cursor->refcnt;
if (xf86_config->cursor)
FreeCursor (xf86_config->cursor, None);
xf86_config->cursor = cursor;
- ++cursor->refcnt;
-
+
if (cursor->bits->width > cursor_info->MaxWidth ||
cursor->bits->height> cursor_info->MaxHeight)
return FALSE;
diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c
index 1fc63c4dc..7ba09b6fe 100644
--- a/xorg-server/hw/xfree86/modes/xf86RandR12.c
+++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c
@@ -805,9 +805,10 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
}
else
{
- xf86OutputPtr output = config->output[config->compat_output];
+ xf86OutputPtr output = xf86CompatOutput(pScrn);
- if (output->conf_monitor &&
+ if (output &&
+ output->conf_monitor &&
(output->conf_monitor->mon_width > 0 &&
output->conf_monitor->mon_height > 0))
{
@@ -1719,10 +1720,13 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
{
CARD16 *points, *red, *green, *blue;
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
- int size = max(0, crtc->gammaSize);
+ RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
+ int size;
+ if (!crtc)
+ return Success;
+
+ size = max(0, crtc->gammaSize);
if (!size)
return Success;
diff --git a/xorg-server/hw/xfree86/os-support/Makefile.in b/xorg-server/hw/xfree86/os-support/Makefile.in
index fa650625b..7899c0909 100644
--- a/xorg-server/hw/xfree86/os-support/Makefile.in
+++ b/xorg-server/hw/xfree86/os-support/Makefile.in
@@ -187,6 +187,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -318,6 +319,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/os-support/bsd/Makefile.in b/xorg-server/hw/xfree86/os-support/bsd/Makefile.in
index 74bf6456c..f218ed9ea 100644
--- a/xorg-server/hw/xfree86/os-support/bsd/Makefile.in
+++ b/xorg-server/hw/xfree86/os-support/bsd/Makefile.in
@@ -150,6 +150,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -281,6 +282,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/os-support/bus/Makefile.in b/xorg-server/hw/xfree86/os-support/bus/Makefile.in
index baad9df02..b81101e36 100644
--- a/xorg-server/hw/xfree86/os-support/bus/Makefile.in
+++ b/xorg-server/hw/xfree86/os-support/bus/Makefile.in
@@ -158,6 +158,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -289,6 +290,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/os-support/hurd/Makefile.in b/xorg-server/hw/xfree86/os-support/hurd/Makefile.in
index 06d32f0ab..fe16508f3 100644
--- a/xorg-server/hw/xfree86/os-support/hurd/Makefile.in
+++ b/xorg-server/hw/xfree86/os-support/hurd/Makefile.in
@@ -126,6 +126,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -257,6 +258,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/os-support/linux/Makefile.in b/xorg-server/hw/xfree86/os-support/linux/Makefile.in
index 8758a6eea..446af9ba4 100644
--- a/xorg-server/hw/xfree86/os-support/linux/Makefile.in
+++ b/xorg-server/hw/xfree86/os-support/linux/Makefile.in
@@ -151,6 +151,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -282,6 +283,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/os-support/misc/Makefile.in b/xorg-server/hw/xfree86/os-support/misc/Makefile.in
index 31c246b36..106cf4b96 100644
--- a/xorg-server/hw/xfree86/os-support/misc/Makefile.in
+++ b/xorg-server/hw/xfree86/os-support/misc/Makefile.in
@@ -124,6 +124,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -255,6 +256,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/os-support/sco/Makefile.in b/xorg-server/hw/xfree86/os-support/sco/Makefile.in
index ef97c1e13..85304ea42 100644
--- a/xorg-server/hw/xfree86/os-support/sco/Makefile.in
+++ b/xorg-server/hw/xfree86/os-support/sco/Makefile.in
@@ -98,6 +98,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -229,6 +230,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/os-support/solaris/Makefile.in b/xorg-server/hw/xfree86/os-support/solaris/Makefile.in
index 03946bcb1..d895b0f3c 100644
--- a/xorg-server/hw/xfree86/os-support/solaris/Makefile.in
+++ b/xorg-server/hw/xfree86/os-support/solaris/Makefile.in
@@ -173,6 +173,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -304,6 +305,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/os-support/sysv/Makefile.in b/xorg-server/hw/xfree86/os-support/sysv/Makefile.in
index a5e8a1bf9..58c3e40d8 100644
--- a/xorg-server/hw/xfree86/os-support/sysv/Makefile.in
+++ b/xorg-server/hw/xfree86/os-support/sysv/Makefile.in
@@ -98,6 +98,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -229,6 +230,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/parser/Makefile.in b/xorg-server/hw/xfree86/parser/Makefile.in
index 1b31c622d..e4a5e8aa4 100644
--- a/xorg-server/hw/xfree86/parser/Makefile.in
+++ b/xorg-server/hw/xfree86/parser/Makefile.in
@@ -182,6 +182,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -313,6 +314,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/ramdac/Makefile.in b/xorg-server/hw/xfree86/ramdac/Makefile.in
index a1b5a3c37..c3e8e893a 100644
--- a/xorg-server/hw/xfree86/ramdac/Makefile.in
+++ b/xorg-server/hw/xfree86/ramdac/Makefile.in
@@ -150,6 +150,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -281,6 +282,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
index 6b71f4677..7f23d9ef3 100644
--- a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
+++ b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
@@ -129,6 +129,9 @@ xf86CursorCloseScreen(int i, ScreenPtr pScreen)
if (ScreenPriv->isUp && pScrn->vtSema)
xf86SetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
+ if (ScreenPriv->CurrentCursor)
+ FreeCursor(ScreenPriv->CurrentCursor, None);
+
pScreen->CloseScreen = ScreenPriv->CloseScreen;
pScreen->QueryBestSize = ScreenPriv->QueryBestSize;
pScreen->RecolorCursor = ScreenPriv->RecolorCursor;
@@ -317,6 +320,9 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
if (pDev == inputInfo.pointer ||
(!IsMaster(pDev) && pDev->u.master == inputInfo.pointer))
{
+ pCurs->refcnt++;
+ if (ScreenPriv->CurrentCursor)
+ FreeCursor(ScreenPriv->CurrentCursor, None);
ScreenPriv->CurrentCursor = pCurs;
ScreenPriv->x = x;
ScreenPriv->y = y;
diff --git a/xorg-server/hw/xfree86/shadowfb/Makefile.in b/xorg-server/hw/xfree86/shadowfb/Makefile.in
index 1bdd31c55..5bae8c586 100644
--- a/xorg-server/hw/xfree86/shadowfb/Makefile.in
+++ b/xorg-server/hw/xfree86/shadowfb/Makefile.in
@@ -153,6 +153,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -284,6 +285,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/utils/Makefile.in b/xorg-server/hw/xfree86/utils/Makefile.in
index d882aed24..714adea6e 100644
--- a/xorg-server/hw/xfree86/utils/Makefile.in
+++ b/xorg-server/hw/xfree86/utils/Makefile.in
@@ -138,6 +138,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -269,6 +270,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/utils/cvt/Makefile.in b/xorg-server/hw/xfree86/utils/cvt/Makefile.in
index 8a865b245..e270da0d2 100644
--- a/xorg-server/hw/xfree86/utils/cvt/Makefile.in
+++ b/xorg-server/hw/xfree86/utils/cvt/Makefile.in
@@ -180,6 +180,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -311,6 +312,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = sed
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/utils/gtf/Makefile.in b/xorg-server/hw/xfree86/utils/gtf/Makefile.in
index 24fba799b..0d92df052 100644
--- a/xorg-server/hw/xfree86/utils/gtf/Makefile.in
+++ b/xorg-server/hw/xfree86/utils/gtf/Makefile.in
@@ -179,6 +179,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -310,6 +311,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = sed
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/vbe/Makefile.in b/xorg-server/hw/xfree86/vbe/Makefile.in
index 74c500562..02ff89807 100644
--- a/xorg-server/hw/xfree86/vbe/Makefile.in
+++ b/xorg-server/hw/xfree86/vbe/Makefile.in
@@ -152,6 +152,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -283,6 +284,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/vgahw/Makefile.in b/xorg-server/hw/xfree86/vgahw/Makefile.in
index e6d74eb33..06c88aef6 100644
--- a/xorg-server/hw/xfree86/vgahw/Makefile.in
+++ b/xorg-server/hw/xfree86/vgahw/Makefile.in
@@ -152,6 +152,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -283,6 +284,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/x86emu/Makefile.in b/xorg-server/hw/xfree86/x86emu/Makefile.in
index b05b1539e..776232047 100644
--- a/xorg-server/hw/xfree86/x86emu/Makefile.in
+++ b/xorg-server/hw/xfree86/x86emu/Makefile.in
@@ -126,6 +126,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -257,6 +258,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/x86emu/sys.c b/xorg-server/hw/xfree86/x86emu/sys.c
index e15fb0931..602b0bbee 100644
--- a/xorg-server/hw/xfree86/x86emu/sys.c
+++ b/xorg-server/hw/xfree86/x86emu/sys.c
@@ -48,168 +48,104 @@
#ifndef NO_SYS_HEADERS
#include <string.h>
#endif
-/*------------------------- Global Variables ------------------------------*/
-X86EMU_sysEnv _X86EMU_env; /* Global emulator machine state */
-X86EMU_intrFuncs _X86EMU_intrTab[256];
+# ifndef NO_INLINE
+# ifdef __GNUC__
-/*----------------------------- Implementation ----------------------------*/
-#if defined(__alpha__) || defined(__alpha)
-/* to cope with broken egcs-1.1.2 :-(((( */
-
-#define ALPHA_UALOADS
-/*
- * inline functions to do unaligned accesses
- * from linux/include/asm-alpha/unaligned.h
- */
-
-/*
- * EGCS 1.1 knows about arbitrary unaligned loads. Define some
- * packed structures to talk about such things with.
- */
-
-#if defined(__GNUC__)
-struct __una_u64 { unsigned long x __attribute__((packed)); };
-struct __una_u32 { unsigned int x __attribute__((packed)); };
-struct __una_u16 { unsigned short x __attribute__((packed)); };
-#endif
+/* Define some packed structures to use with unaligned accesses */
+
+struct __una_u64 { u64 x __attribute__((packed)); };
+struct __una_u32 { u32 x __attribute__((packed)); };
+struct __una_u16 { u16 x __attribute__((packed)); };
-static __inline__ unsigned long ldq_u(unsigned long * r11)
+/* Elemental unaligned loads */
+
+static __inline__ u64 ldq_u(u64 *p)
{
-#if defined(__GNUC__)
- const struct __una_u64 *ptr = (const struct __una_u64 *) r11;
+ const struct __una_u64 *ptr = (const struct __una_u64 *) p;
return ptr->x;
-#else
- unsigned long r1,r2;
- __asm__("ldq_u %0,%3\n\t"
- "ldq_u %1,%4\n\t"
- "extql %0,%2,%0\n\t"
- "extqh %1,%2,%1"
- :"=&r" (r1), "=&r" (r2)
- :"r" (r11),
- "m" (*r11),
- "m" (*(const unsigned long *)(7+(char *) r11)));
- return r1 | r2;
-#endif
}
-static __inline__ unsigned long ldl_u(unsigned int * r11)
+static __inline__ u32 ldl_u(u32 *p)
{
-#if defined(__GNUC__)
- const struct __una_u32 *ptr = (const struct __una_u32 *) r11;
+ const struct __una_u32 *ptr = (const struct __una_u32 *) p;
return ptr->x;
-#else
- unsigned long r1,r2;
- __asm__("ldq_u %0,%3\n\t"
- "ldq_u %1,%4\n\t"
- "extll %0,%2,%0\n\t"
- "extlh %1,%2,%1"
- :"=&r" (r1), "=&r" (r2)
- :"r" (r11),
- "m" (*r11),
- "m" (*(const unsigned long *)(3+(char *) r11)));
- return r1 | r2;
-#endif
}
-static __inline__ unsigned long ldw_u(unsigned short * r11)
+static __inline__ u16 ldw_u(u16 *p)
{
-#if defined(__GNUC__)
- const struct __una_u16 *ptr = (const struct __una_u16 *) r11;
+ const struct __una_u16 *ptr = (const struct __una_u16 *) p;
return ptr->x;
-#else
- unsigned long r1,r2;
- __asm__("ldq_u %0,%3\n\t"
- "ldq_u %1,%4\n\t"
- "extwl %0,%2,%0\n\t"
- "extwh %1,%2,%1"
- :"=&r" (r1), "=&r" (r2)
- :"r" (r11),
- "m" (*r11),
- "m" (*(const unsigned long *)(1+(char *) r11)));
- return r1 | r2;
-#endif
}
-/*
- * Elemental unaligned stores
- */
+/* Elemental unaligned stores */
-static __inline__ void stq_u(unsigned long r5, unsigned long * r11)
+static __inline__ void stq_u(u64 val, u64 *p)
{
-#if defined(__GNUC__)
- struct __una_u64 *ptr = (struct __una_u64 *) r11;
- ptr->x = r5;
-#else
- unsigned long r1,r2,r3,r4;
-
- __asm__("ldq_u %3,%1\n\t"
- "ldq_u %2,%0\n\t"
- "insqh %6,%7,%5\n\t"
- "insql %6,%7,%4\n\t"
- "mskqh %3,%7,%3\n\t"
- "mskql %2,%7,%2\n\t"
- "bis %3,%5,%3\n\t"
- "bis %2,%4,%2\n\t"
- "stq_u %3,%1\n\t"
- "stq_u %2,%0"
- :"=m" (*r11),
- "=m" (*(unsigned long *)(7+(char *) r11)),
- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
- :"r" (r5), "r" (r11));
-#endif
+ struct __una_u64 *ptr = (struct __una_u64 *) p;
+ ptr->x = val;
}
-static __inline__ void stl_u(unsigned long r5, unsigned int * r11)
+static __inline__ void stl_u(u32 val, u32 *p)
{
-#if defined(__GNUC__)
- struct __una_u32 *ptr = (struct __una_u32 *) r11;
- ptr->x = r5;
-#else
- unsigned long r1,r2,r3,r4;
-
- __asm__("ldq_u %3,%1\n\t"
- "ldq_u %2,%0\n\t"
- "inslh %6,%7,%5\n\t"
- "insll %6,%7,%4\n\t"
- "msklh %3,%7,%3\n\t"
- "mskll %2,%7,%2\n\t"
- "bis %3,%5,%3\n\t"
- "bis %2,%4,%2\n\t"
- "stq_u %3,%1\n\t"
- "stq_u %2,%0"
- :"=m" (*r11),
- "=m" (*(unsigned long *)(3+(char *) r11)),
- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
- :"r" (r5), "r" (r11));
-#endif
+ struct __una_u32 *ptr = (struct __una_u32 *) p;
+ ptr->x = val;
}
-static __inline__ void stw_u(unsigned long r5, unsigned short * r11)
+static __inline__ void stw_u(u16 val, u16 *p)
{
-#if defined(__GNUC__)
- struct __una_u16 *ptr = (struct __una_u16 *) r11;
- ptr->x = r5;
-#else
- unsigned long r1,r2,r3,r4;
-
- __asm__("ldq_u %3,%1\n\t"
- "ldq_u %2,%0\n\t"
- "inswh %6,%7,%5\n\t"
- "inswl %6,%7,%4\n\t"
- "mskwh %3,%7,%3\n\t"
- "mskwl %2,%7,%2\n\t"
- "bis %3,%5,%3\n\t"
- "bis %2,%4,%2\n\t"
- "stq_u %3,%1\n\t"
- "stq_u %2,%0"
- :"=m" (*r11),
- "=m" (*(unsigned long *)(1+(char *) r11)),
- "=&r" (r1), "=&r" (r2), "=&r" (r3), "=&r" (r4)
- :"r" (r5), "r" (r11));
-#endif
+ struct __una_u16 *ptr = (struct __una_u16 *) p;
+ ptr->x = val;
+}
+# else /* !__GNUC__ */
+
+static __inline__ u64 ldq_u(u64 *p)
+{
+ u64 ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
}
-#endif
+
+static __inline__ u32 ldl_u(u32 *p)
+{
+ u32 ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+}
+
+static __inline__ u16 ldw_u(u16 *p)
+{
+ u16 ret;
+ memmove(&ret, p, sizeof(*p));
+ return ret;
+}
+
+static __inline__ void stq_u(u64 val, u64 *p)
+{
+ u64 tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+}
+
+static __inline__ void stl_u(u32 val, u32 *p)
+{
+ u32 tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+}
+
+static __inline__ void stw_u(u16 val, u16 *p)
+{
+ u16 tmp = val;
+ memmove(p, &tmp, sizeof(*p));
+}
+
+# endif /* __GNUC__ */
+# endif /* NO_INLINE */
+/*------------------------- Global Variables ------------------------------*/
+
+X86EMU_sysEnv _X86EMU_env; /* Global emulator machine state */
+X86EMU_intrFuncs _X86EMU_intrTab[256];
+
+/*----------------------------- Implementation ----------------------------*/
/****************************************************************************
PARAMETERS:
@@ -262,13 +198,7 @@ u16 X86API rdw(
}
else
#endif
-#if defined(ALPHA_UALOADS)
val = ldw_u((u16*)(M.mem_base + addr));
-#elif defined(IA64_UALOADS)
- val = uldw((u16*)(M.mem_base + addr));
-#else
- val = *(u16*)(M.mem_base + addr);
-#endif
DB( if (DEBUG_MEM_TRACE())
printk("%#08x 2 -> %#x\n", addr, val);)
return val;
@@ -301,13 +231,7 @@ u32 X86API rdl(
}
else
#endif
-#if defined(ALPHA_UALOADS)
val = ldl_u((u32*)(M.mem_base + addr));
-#elif defined(IA64_UALOADS)
- val = uldl((u32*)(M.mem_base + addr));
-#else
- val = *(u32*)(M.mem_base + addr);
-#endif
DB( if (DEBUG_MEM_TRACE())
printk("%#08x 4 -> %#x\n", addr, val);)
return val;
@@ -359,13 +283,7 @@ DB( if (DEBUG_MEM_TRACE())
}
else
#endif
-#if defined(ALPHA_UALOADS)
stw_u(val,(u16*)(M.mem_base + addr));
-#elif defined(IA64_UALOADS)
- ustw(val,(u16*)(M.mem_base + addr));
-#else
- *(u16*)(M.mem_base + addr) = val;
-#endif
}
/****************************************************************************
@@ -395,13 +313,7 @@ DB( if (DEBUG_MEM_TRACE())
}
else
#endif
-#if defined(ALPHA_UALOADS)
stl_u(val,(u32*)(M.mem_base + addr));
-#elif defined(IA64_UALOADS)
- ustl(val,(u32*)(M.mem_base + addr));
-#else
- *(u32*)(M.mem_base + addr) = val;
-#endif
}
/****************************************************************************
diff --git a/xorg-server/hw/xfree86/xaa/Makefile.in b/xorg-server/hw/xfree86/xaa/Makefile.in
index 3f628e5dc..9728388dd 100644
--- a/xorg-server/hw/xfree86/xaa/Makefile.in
+++ b/xorg-server/hw/xfree86/xaa/Makefile.in
@@ -172,6 +172,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -303,6 +304,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xfree86/xf8_16bpp/Makefile.in b/xorg-server/hw/xfree86/xf8_16bpp/Makefile.in
index 237259c90..9912be485 100644
--- a/xorg-server/hw/xfree86/xf8_16bpp/Makefile.in
+++ b/xorg-server/hw/xfree86/xf8_16bpp/Makefile.in
@@ -153,6 +153,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -284,6 +285,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xnest/Makefile.in b/xorg-server/hw/xnest/Makefile.in
index 5a07e1b2b..508ed1685 100644
--- a/xorg-server/hw/xnest/Makefile.in
+++ b/xorg-server/hw/xnest/Makefile.in
@@ -174,6 +174,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -305,6 +306,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = sed
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xquartz/GL/Makefile.am b/xorg-server/hw/xquartz/GL/Makefile.am
index 9b61305d6..af890776e 100644
--- a/xorg-server/hw/xquartz/GL/Makefile.am
+++ b/xorg-server/hw/xquartz/GL/Makefile.am
@@ -1,5 +1,5 @@
noinst_LTLIBRARIES = libCGLCore.la
-AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CFLAGS = $(DIX_CFLAGS)
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/glx \
diff --git a/xorg-server/hw/xquartz/GL/Makefile.in b/xorg-server/hw/xquartz/GL/Makefile.in
index 9fd961d42..df3c91eae 100644
--- a/xorg-server/hw/xquartz/GL/Makefile.in
+++ b/xorg-server/hw/xquartz/GL/Makefile.in
@@ -125,6 +125,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -256,6 +257,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
@@ -393,7 +396,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_LTLIBRARIES = libCGLCore.la
-AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CFLAGS = $(DIX_CFLAGS)
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/glx \
diff --git a/xorg-server/hw/xquartz/GL/capabilities.c b/xorg-server/hw/xquartz/GL/capabilities.c
index 5f1f87013..2c5ec658c 100644
--- a/xorg-server/hw/xquartz/GL/capabilities.c
+++ b/xorg-server/hw/xquartz/GL/capabilities.c
@@ -31,6 +31,10 @@
#include "capabilities.h"
+#define Cursor X_Cursor
+#include "os.h"
+#undef Cursor
+
static void handleBufferModes(struct glCapabilitiesConfig *c, GLint bufferModes) {
if(bufferModes & kCGLStereoscopicBit) {
c->stereo = true;
diff --git a/xorg-server/hw/xquartz/GL/indirect.c b/xorg-server/hw/xquartz/GL/indirect.c
index 44380ffa0..c092c1d17 100644
--- a/xorg-server/hw/xquartz/GL/indirect.c
+++ b/xorg-server/hw/xquartz/GL/indirect.c
@@ -471,7 +471,7 @@ static int __glXAquaContextForceCurrent(__GLXcontext *baseContext)
}
/* Drawing surface notification callbacks */
-static GLboolean __glXAquaDrawableSwapBuffers(__GLXdrawable *base) {
+static GLboolean __glXAquaDrawableSwapBuffers(ClientPtr client, __GLXdrawable *base) {
CGLError err;
__GLXAquaDrawable *drawable;
diff --git a/xorg-server/hw/xquartz/Makefile.am b/xorg-server/hw/xquartz/Makefile.am
index 65c70b076..96b139f97 100644
--- a/xorg-server/hw/xquartz/Makefile.am
+++ b/xorg-server/hw/xquartz/Makefile.am
@@ -1,6 +1,6 @@
noinst_LTLIBRARIES = libXquartz.la
-AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
-AM_OBJCFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CFLAGS = $(DIX_CFLAGS)
+AM_OBJCFLAGS = $(DIX_CFLAGS)
AM_CPPFLAGS = \
-DBUILD_DATE=\"$(BUILD_DATE)\" \
-DXSERVER_VERSION=\"$(VERSION)\" \
diff --git a/xorg-server/hw/xquartz/Makefile.in b/xorg-server/hw/xquartz/Makefile.in
index 22b6a1b43..f0de38d58 100644
--- a/xorg-server/hw/xquartz/Makefile.in
+++ b/xorg-server/hw/xquartz/Makefile.in
@@ -178,6 +178,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -309,6 +310,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
@@ -446,8 +449,8 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_LTLIBRARIES = libXquartz.la
-AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
-AM_OBJCFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CFLAGS = $(DIX_CFLAGS)
+AM_OBJCFLAGS = $(DIX_CFLAGS)
AM_CPPFLAGS = \
-DBUILD_DATE=\"$(BUILD_DATE)\" \
-DXSERVER_VERSION=\"$(VERSION)\" \
diff --git a/xorg-server/hw/xquartz/bundle/Makefile.in b/xorg-server/hw/xquartz/bundle/Makefile.in
index 087331e5a..b093e7242 100644
--- a/xorg-server/hw/xquartz/bundle/Makefile.in
+++ b/xorg-server/hw/xquartz/bundle/Makefile.in
@@ -131,6 +131,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -262,6 +263,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xquartz/darwin.c b/xorg-server/hw/xquartz/darwin.c
index fc8179394..066f5a596 100644
--- a/xorg-server/hw/xquartz/darwin.c
+++ b/xorg-server/hw/xquartz/darwin.c
@@ -1,908 +1,914 @@
-/**************************************************************
- *
- * Xquartz initialization code
- *
- * Copyright (c) 2007-2008 Apple Inc.
- * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
- *
- * 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, 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 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
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) 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.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "os.h"
-#include "servermd.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "mibstore.h" // mi backing store implementation
-#include "mipointer.h" // mi software cursor
-#include "micmap.h" // mi colormap code
-#include "fb.h" // fb framebuffer code
-#include "site.h"
-#include "globals.h"
-#include "dix.h"
-
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "exevents.h"
-#include "extinit.h"
-
-#include "xserver-properties.h"
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/syslimits.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#define HAS_UTSNAME 1
-#include <sys/utsname.h>
-
-#define NO_CFPLUGIN
-#include <IOKit/hidsystem/IOHIDLib.h>
-
-#ifdef MITSHM
-#include "shmint.h"
-#endif
-
-#include "darwin.h"
-#include "darwinEvents.h"
-#include "quartzKeyboard.h"
-#include "quartz.h"
-
-#ifdef ENABLE_DEBUG_LOG
-FILE *debug_log_fp = NULL;
-#endif
-
-/*
- * X server shared global variables
- */
-int darwinScreensFound = 0;
-static int darwinScreenKeyIndex;
-DevPrivateKey darwinScreenKey = &darwinScreenKeyIndex;
-io_connect_t darwinParamConnect = 0;
-int darwinEventReadFD = -1;
-int darwinEventWriteFD = -1;
-// int darwinMouseAccelChange = 1;
-int darwinFakeButtons = 0;
-
-// location of X11's (0,0) point in global screen coordinates
-int darwinMainScreenX = 0;
-int darwinMainScreenY = 0;
-
-// parameters read from the command line or user preferences
-int darwinDesiredDepth = -1;
-int darwinSyncKeymap = FALSE;
-
-// modifier masks for faking mouse buttons - ANY of these bits trigger it (not all)
-#ifdef NX_DEVICELCMDKEYMASK
-int darwinFakeMouse2Mask = NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK;
-int darwinFakeMouse3Mask = NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK;
-#else
-int darwinFakeMouse2Mask = NX_ALTERNATEMASK;
-int darwinFakeMouse3Mask = NX_COMMANDMASK;
-#endif
-
-// Modifier mask for overriding event delivery to appkit (might be useful to set this to rcommand for input menu
-unsigned int darwinAppKitModMask = 0; // Any of these bits
-
-// Modifier mask for items in the Window menu (0 and -1 cause shortcuts to be disabled)
-unsigned int windowItemModMask = NX_COMMANDMASK;
-
-// devices
-DeviceIntPtr darwinKeyboard = NULL;
-DeviceIntPtr darwinPointer = NULL;
-DeviceIntPtr darwinTabletCurrent = NULL;
-DeviceIntPtr darwinTabletStylus = NULL;
-DeviceIntPtr darwinTabletCursor = NULL;
-DeviceIntPtr darwinTabletEraser = NULL;
-
-// Common pixmap formats
-static PixmapFormatRec formats[] = {
- { 1, 1, BITMAP_SCANLINE_PAD },
- { 4, 8, BITMAP_SCANLINE_PAD },
- { 8, 8, BITMAP_SCANLINE_PAD },
- { 15, 16, BITMAP_SCANLINE_PAD },
- { 16, 16, BITMAP_SCANLINE_PAD },
- { 24, 32, BITMAP_SCANLINE_PAD },
- { 32, 32, BITMAP_SCANLINE_PAD }
-};
-const int NUMFORMATS = sizeof(formats)/sizeof(formats[0]);
-
-#ifndef OSNAME
-#define OSNAME " Darwin"
-#endif
-#ifndef OSVENDOR
-#define OSVENDOR ""
-#endif
-#ifndef PRE_RELEASE
-#define PRE_RELEASE XORG_VERSION_SNAP
-#endif
-#ifndef BUILD_DATE
-#define BUILD_DATE ""
-#endif
-#ifndef XORG_RELEASE
-#define XORG_RELEASE "?"
-#endif
-
-void
-DarwinPrintBanner(void)
-{
- // this should change depending on which specific server we are building
- ErrorF("Xquartz starting:\n");
- ErrorF("X.Org X Server %s\nBuild Date: %s\n", XSERVER_VERSION, BUILD_DATE );
-}
-
-
-/*
- * DarwinSaveScreen
- * X screensaver support. Not implemented.
- */
-static Bool DarwinSaveScreen(ScreenPtr pScreen, int on)
-{
- // FIXME
- if (on == SCREEN_SAVER_FORCER) {
- } else if (on == SCREEN_SAVER_ON) {
- } else {
- }
- return TRUE;
-}
-
-/*
- * DarwinScreenInit
- * This is a callback from dix during AddScreen() from InitOutput().
- * Initialize the screen and communicate information about it back to dix.
- */
-static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) {
- int dpi;
- static int foundIndex = 0;
- Bool ret;
- DarwinFramebufferPtr dfb;
-
- // reset index of found screens for each server generation
- if (index == 0) {
- foundIndex = 0;
-
- // reset the visual list
- miClearVisualTypes();
- }
-
- // allocate space for private per screen storage
- dfb = xalloc(sizeof(DarwinFramebufferRec));
-
- // SCREEN_PRIV(pScreen) = dfb;
- dixSetPrivate(&pScreen->devPrivates, darwinScreenKey, dfb);
-
- // setup hardware/mode specific details
- ret = QuartzAddScreen(foundIndex, pScreen);
- foundIndex++;
- if (! ret)
- return FALSE;
-
- // setup a single visual appropriate for our pixel type
- if(!miSetVisualTypesAndMasks(dfb->depth, dfb->visuals, dfb->bitsPerRGB,
- dfb->preferredCVC, dfb->redMask,
- dfb->greenMask, dfb->blueMask)) {
- return FALSE;
- }
-
-// TODO: Make PseudoColor visuals not suck in TrueColor mode
-// if(dfb->depth > 8)
-// miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0);
- if(dfb->depth > 15)
- miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor, RM_ARGB(0,5,5,5), GM_ARGB(0,5,5,5), BM_ARGB(0,5,5,5));
- if(dfb->depth > 24)
- miSetVisualTypesAndMasks(24, TrueColorMask, 8, TrueColor, RM_ARGB(0,8,8,8), GM_ARGB(0,8,8,8), BM_ARGB(0,8,8,8));
-
- miSetPixmapDepths();
-
- // machine independent screen init
- // setup _Screen structure in pScreen
- if (monitorResolution)
- dpi = monitorResolution;
- else
- dpi = 96;
-
- // initialize fb
- if (! fbScreenInit(pScreen,
- dfb->framebuffer, // pointer to screen bitmap
- dfb->width, dfb->height, // screen size in pixels
- dpi, dpi, // dots per inch
- dfb->pitch/(dfb->bitsPerPixel/8), // pixel width of framebuffer
- dfb->bitsPerPixel)) // bits per pixel for screen
- {
- return FALSE;
- }
-
-#ifdef RENDER
- if (! fbPictureInit(pScreen, 0, 0)) {
- return FALSE;
- }
-#endif
-
-#ifdef MITSHM
- ShmRegisterFbFuncs(pScreen);
-#endif
-
- // this must be initialized (why doesn't X have a default?)
- pScreen->SaveScreen = DarwinSaveScreen;
-
- // finish mode dependent screen setup including cursor support
- if (!QuartzSetupScreen(index, pScreen)) {
- return FALSE;
- }
-
- // create and install the default colormap and
- // set pScreen->blackPixel / pScreen->white
- if (!miCreateDefColormap( pScreen )) {
- return FALSE;
- }
-
- dixScreenOrigins[index].x = dfb->x;
- dixScreenOrigins[index].y = dfb->y;
-
- /* ErrorF("Screen %d added: %dx%d @ (%d,%d)\n",
- index, dfb->width, dfb->height, dfb->x, dfb->y); */
-
- return TRUE;
-}
-
-/*
- =============================================================================
-
- mouse and keyboard callbacks
-
- =============================================================================
-*/
-
-/*
- * DarwinMouseProc: Handle the initialization, etc. of a mouse
- */
-static int DarwinMouseProc(DeviceIntPtr pPointer, int what) {
-#define NBUTTONS 7
-#define NAXES 2
- // 7 buttons: left, right, middle, then four scroll wheel "buttons"
- CARD8 map[NBUTTONS + 1] = {0, 1, 2, 3, 4, 5, 6, 7};
- Atom btn_labels[NBUTTONS] = {0};
- Atom axes_labels[NAXES] = {0};
-
- switch (what) {
- case DEVICE_INIT:
- pPointer->public.on = FALSE;
-
- btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
- btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
- btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
- btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
- btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
- btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
- btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
-
- axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
- axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
-
-
- // Set button map.
- InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS,
- btn_labels,
- (PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), NAXES,
- axes_labels);
- pPointer->valuator->mode = Absolute; // Relative
- InitAbsoluteClassDeviceStruct(pPointer);
-// InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
-// InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- break;
- case DEVICE_ON:
- pPointer->public.on = TRUE;
- AddEnabledDevice( darwinEventReadFD );
- return Success;
- case DEVICE_CLOSE:
- case DEVICE_OFF:
- pPointer->public.on = FALSE;
- RemoveEnabledDevice(darwinEventReadFD);
- return Success;
- }
-
- return Success;
-#undef NBUTTONS
-#undef NAXES
-}
-
-static int DarwinTabletProc(DeviceIntPtr pPointer, int what) {
-#define NBUTTONS 3
-#define NAXES 5
- CARD8 map[NBUTTONS + 1] = {0, 1, 2, 3};
- Atom btn_labels[NBUTTONS] = {0};
- Atom axes_labels[NAXES] = {0};
-
- switch (what) {
- case DEVICE_INIT:
- pPointer->public.on = FALSE;
-
- btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
- btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
- btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
-
- axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
- axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
- axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE);
- axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_X);
- axes_labels[4] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_Y);
-
- // Set button map.
- InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS,
- btn_labels,
- (PtrCtrlProcPtr)NoopDDA,
- GetMotionHistorySize(), NAXES,
- axes_labels);
- pPointer->valuator->mode = Absolute; // Relative
- InitProximityClassDeviceStruct(pPointer);
- InitAbsoluteClassDeviceStruct(pPointer);
-
- InitValuatorAxisStruct(pPointer, 0, axes_labels[0], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 1, axes_labels[1], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 2, axes_labels[2], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 3, axes_labels[3], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
- InitValuatorAxisStruct(pPointer, 4, axes_labels[4], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
-// pPointer->use = IsXExtensionDevice;
- break;
- case DEVICE_ON:
- pPointer->public.on = TRUE;
- AddEnabledDevice( darwinEventReadFD );
- return Success;
- case DEVICE_CLOSE:
- case DEVICE_OFF:
- pPointer->public.on = FALSE;
- RemoveEnabledDevice(darwinEventReadFD);
- return Success;
- }
- return Success;
-#undef NBUTTONS
-#undef NAXES
-}
-
-/*
- * DarwinKeybdProc
- * Callback from X
- */
-static int DarwinKeybdProc( DeviceIntPtr pDev, int onoff )
-{
- switch ( onoff ) {
- case DEVICE_INIT:
- DarwinKeyboardInit( pDev );
- break;
- case DEVICE_ON:
- pDev->public.on = TRUE;
- AddEnabledDevice( darwinEventReadFD );
- break;
- case DEVICE_OFF:
- pDev->public.on = FALSE;
- RemoveEnabledDevice( darwinEventReadFD );
- break;
- case DEVICE_CLOSE:
- break;
- }
-
- return Success;
-}
-
-/*
-===========================================================================
-
- Utility routines
-
-===========================================================================
-*/
-
-/*
- * DarwinParseModifierList
- * Parse a list of modifier names and return a corresponding modifier mask
- */
-int DarwinParseModifierList(const char *constmodifiers, int separatelr)
-{
- int result = 0;
-
- if (constmodifiers) {
- char *modifiers = strdup(constmodifiers);
- char *modifier;
- int nxkey;
- char *p = modifiers;
-
- while (p) {
- modifier = strsep(&p, " ,+&|/"); // allow lots of separators
- nxkey = DarwinModifierStringToNXMask(modifier, separatelr);
- if(nxkey)
- result |= nxkey;
- else
- ErrorF("fakebuttons: Unknown modifier \"%s\"\n", modifier);
- }
- free(modifiers);
- }
- return result;
-}
-
-/*
-===========================================================================
-
- Functions needed to link against device independent X
-
-===========================================================================
-*/
-
-/*
- * InitInput
- * Register the keyboard and mouse devices
- */
-void InitInput( int argc, char **argv )
-{
- darwinKeyboard = AddInputDevice(serverClient, DarwinKeybdProc, TRUE);
- RegisterKeyboardDevice( darwinKeyboard );
- darwinKeyboard->name = strdup("keyboard");
-
- /* here's the snippet from the current gdk sources:
- if (!strcmp (tmp_name, "pointer"))
- gdkdev->info.source = GDK_SOURCE_MOUSE;
- else if (!strcmp (tmp_name, "wacom") ||
- !strcmp (tmp_name, "pen"))
- gdkdev->info.source = GDK_SOURCE_PEN;
- else if (!strcmp (tmp_name, "eraser"))
- gdkdev->info.source = GDK_SOURCE_ERASER;
- else if (!strcmp (tmp_name, "cursor"))
- gdkdev->info.source = GDK_SOURCE_CURSOR;
- else
- gdkdev->info.source = GDK_SOURCE_PEN;
- */
-
- darwinPointer = AddInputDevice(serverClient, DarwinMouseProc, TRUE);
- RegisterPointerDevice( darwinPointer );
- darwinPointer->name = strdup("pointer");
-
- darwinTabletStylus = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
- RegisterPointerDevice( darwinTabletStylus );
- darwinTabletStylus->name = strdup("pen");
-
- darwinTabletCursor = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
- RegisterPointerDevice( darwinTabletCursor );
- darwinTabletCursor->name = strdup("cursor");
-
- darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
- RegisterPointerDevice( darwinTabletEraser );
- darwinTabletEraser->name = strdup("eraser");
-
- darwinTabletCurrent = darwinTabletStylus;
-
- DarwinEQInit();
-
- QuartzInitInput(argc, argv);
-}
-
-
-/*
- * DarwinAdjustScreenOrigins
- * Shift all screens so the X11 (0, 0) coordinate is at the top
- * left of the global screen coordinates.
- *
- * Screens can be arranged so the top left isn't on any screen, so
- * instead use the top left of the leftmost screen as (0,0). This
- * may mean some screen space is in -y, but it's better that (0,0)
- * be onscreen, or else default xterms disappear. It's better that
- * -y be used than -x, because when popup menus are forced
- * "onscreen" by dumb window managers like twm, they'll shift the
- * menus down instead of left, which still looks funny but is an
- * easier target to hit.
- */
-void
-DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo)
-{
- int i, left, top;
-
- left = dixScreenOrigins[0].x;
- top = dixScreenOrigins[0].y;
-
- /* Find leftmost screen. If there's a tie, take the topmost of the two. */
- for (i = 1; i < pScreenInfo->numScreens; i++) {
- if (dixScreenOrigins[i].x < left ||
- (dixScreenOrigins[i].x == left && dixScreenOrigins[i].y < top))
- {
- left = dixScreenOrigins[i].x;
- top = dixScreenOrigins[i].y;
- }
- }
-
- darwinMainScreenX = left;
- darwinMainScreenY = top;
-
- DEBUG_LOG("top = %d, left=%d\n", top, left);
-
- /* Shift all screens so that there is a screen whose top left
- * is at X11 (0,0) and at global screen coordinate
- * (darwinMainScreenX, darwinMainScreenY).
- */
-
- if (darwinMainScreenX != 0 || darwinMainScreenY != 0) {
- for (i = 0; i < pScreenInfo->numScreens; i++) {
- dixScreenOrigins[i].x -= darwinMainScreenX;
- dixScreenOrigins[i].y -= darwinMainScreenY;
- DEBUG_LOG("Screen %d placed at X11 coordinate (%d,%d).\n",
- i, dixScreenOrigins[i].x, dixScreenOrigins[i].y);
- }
- }
-}
-
-
-/*
- * InitOutput
- * Initialize screenInfo for all actually accessible framebuffers.
- *
- * The display mode dependent code gets called three times. The mode
- * specific InitOutput routines are expected to discover the number
- * of potentially useful screens and cache routes to them internally.
- * Inside DarwinScreenInit are two other mode specific calls.
- * A mode specific AddScreen routine is called for each screen to
- * actually initialize the screen with the ScreenPtr structure.
- * After other screen setup has been done, a mode specific
- * SetupScreen function can be called to finalize screen setup.
- */
-void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv )
-{
- int i;
-
- pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
- pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
- pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
- pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
-
- // List how we want common pixmap formats to be padded
- pScreenInfo->numPixmapFormats = NUMFORMATS;
- for (i = 0; i < NUMFORMATS; i++)
- pScreenInfo->formats[i] = formats[i];
-
- // Discover screens and do mode specific initialization
- QuartzInitOutput(argc, argv);
-
- // Add screens
- for (i = 0; i < darwinScreensFound; i++) {
- AddScreen(DarwinScreenInit, argc, argv);
- }
-
- DarwinAdjustScreenOrigins(pScreenInfo);
-}
-
-
-/*
- * OsVendorFataError
- */
-void OsVendorFatalError( void )
-{
- ErrorF( " OsVendorFatalError\n" );
-}
-
-
-/*
- * OsVendorInit
- * Initialization of Darwin OS support.
- */
-void OsVendorInit(void)
-{
- if (serverGeneration == 1) {
- DarwinPrintBanner();
-#ifdef ENABLE_DEBUG_LOG
- {
- char *home_dir=NULL, *log_file_path=NULL;
- home_dir = getenv("HOME");
- if (home_dir) asprintf(&log_file_path, "%s/%s", home_dir, DEBUG_LOG_NAME);
- if (log_file_path) {
- if (!access(log_file_path, F_OK)) {
- debug_log_fp = fopen(log_file_path, "a");
- if (debug_log_fp) ErrorF("Debug logging enabled to %s\n", log_file_path);
- }
- free(log_file_path);
- }
- }
-#endif
- }
-}
-
-
-/*
- * ddxProcessArgument
- * Process device-dependent command line args. Returns 0 if argument is
- * not device dependent, otherwise Count of number of elements of argv
- * that are part of a device dependent commandline option.
- */
-int ddxProcessArgument( int argc, char *argv[], int i )
-{
-// if ( !strcmp( argv[i], "-fullscreen" ) ) {
-// ErrorF( "Running full screen in parallel with Mac OS X Quartz window server.\n" );
-// return 1;
-// }
-
-// if ( !strcmp( argv[i], "-rootless" ) ) {
-// ErrorF( "Running rootless inside Mac OS X window server.\n" );
-// return 1;
-// }
-
- // This command line arg is passed when launched from the Aqua GUI.
- if ( !strncmp( argv[i], "-psn_", 5 ) ) {
- return 1;
- }
-
- if ( !strcmp( argv[i], "-fakebuttons" ) ) {
- darwinFakeButtons = TRUE;
- ErrorF( "Faking a three button mouse\n" );
- return 1;
- }
-
- if ( !strcmp( argv[i], "-nofakebuttons" ) ) {
- darwinFakeButtons = FALSE;
- ErrorF( "Not faking a three button mouse\n" );
- return 1;
- }
-
- if (!strcmp( argv[i], "-fakemouse2" ) ) {
- if ( i == argc-1 ) {
- FatalError( "-fakemouse2 must be followed by a modifer list\n" );
- }
- if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], ""))
- darwinFakeMouse2Mask = 0;
- else
- darwinFakeMouse2Mask = DarwinParseModifierList(argv[i+1], 1);
- ErrorF("Modifier mask to fake mouse button 2 = 0x%x\n",
- darwinFakeMouse2Mask);
- return 2;
- }
-
- if (!strcmp( argv[i], "-fakemouse3" ) ) {
- if ( i == argc-1 ) {
- FatalError( "-fakemouse3 must be followed by a modifer list\n" );
- }
- if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], ""))
- darwinFakeMouse3Mask = 0;
- else
- darwinFakeMouse3Mask = DarwinParseModifierList(argv[i+1], 1);
- ErrorF("Modifier mask to fake mouse button 3 = 0x%x\n",
- darwinFakeMouse3Mask);
- return 2;
- }
-
- if ( !strcmp( argv[i], "+synckeymap" ) ) {
- darwinSyncKeymap = TRUE;
- return 1;
- }
-
- if ( !strcmp( argv[i], "-synckeymap" ) ) {
- darwinSyncKeymap = FALSE;
- return 1;
- }
-
- if ( !strcmp( argv[i], "-depth" ) ) {
- if ( i == argc-1 ) {
- FatalError( "-depth must be followed by a number\n" );
- }
- darwinDesiredDepth = atoi( argv[i+1] );
- if(darwinDesiredDepth != -1 &&
- darwinDesiredDepth != 8 &&
- darwinDesiredDepth != 15 &&
- darwinDesiredDepth != 24) {
- FatalError( "Unsupported pixel depth. Use 8, 15, or 24 bits\n" );
- }
-
- ErrorF( "Attempting to use pixel depth of %i\n", darwinDesiredDepth );
- return 2;
- }
-
- if (!strcmp( argv[i], "-showconfig" ) || !strcmp( argv[i], "-version" )) {
- DarwinPrintBanner();
- exit(0);
- }
-
- return 0;
-}
-
-
-/*
- * ddxUseMsg --
- * Print out correct use of device dependent commandline options.
- * Maybe the user now knows what really to do ...
- */
-void ddxUseMsg( void )
-{
- ErrorF("\n");
- ErrorF("\n");
- ErrorF("Device Dependent Usage:\n");
- ErrorF("\n");
- ErrorF("-depth <8,15,24> : use this bit depth.\n");
- ErrorF("-fakebuttons : fake a three button mouse with Command and Option keys.\n");
- ErrorF("-nofakebuttons : don't fake a three button mouse.\n");
- ErrorF("-fakemouse2 <modifiers> : fake middle mouse button with modifier keys.\n");
- ErrorF("-fakemouse3 <modifiers> : fake right mouse button with modifier keys.\n");
- ErrorF(" ex: -fakemouse2 \"option,shift\" = option-shift-click is middle button.\n");
- ErrorF("-version : show the server version.\n");
- ErrorF("\n");
-}
-
-
-/*
- * ddxGiveUp --
- * Device dependent cleanup. Called by dix before normal server death.
- */
-void ddxGiveUp( void )
-{
- ErrorF( "Quitting Xquartz...\n" );
-}
-
-
-/*
- * AbortDDX --
- * DDX - specific abort routine. Called by AbortServer(). The attempt is
- * made to restore all original setting of the displays. Also all devices
- * are closed.
- */
-void AbortDDX( void )
-{
- ErrorF( " AbortDDX\n" );
- /*
- * This is needed for a abnormal server exit, since the normal exit stuff
- * MUST also be performed (i.e. the vt must be left in a defined state)
- */
- ddxGiveUp();
-}
-
-#include "mivalidate.h" // for union _Validate used by windowstr.h
-#include "windowstr.h" // for struct _Window
-#include "scrnintstr.h" // for struct _Screen
-
-// This is copied from Xserver/hw/xfree86/common/xf86Helper.c.
-// Quartz mode uses this when switching in and out of Quartz.
-// Quartz or IOKit can use this when waking from sleep.
-// Copyright (c) 1997-1998 by The XFree86 Project, Inc.
-
-/*
- * xf86SetRootClip --
- * Enable or disable rendering to the screen by
- * setting the root clip list and revalidating
- * all of the windows
- */
-
-void
-xf86SetRootClip (ScreenPtr pScreen, int enable)
-{
- WindowPtr pWin = WindowTable[pScreen->myNum];
- WindowPtr pChild;
- Bool WasViewable = (Bool)(pWin->viewable);
- Bool anyMarked = TRUE;
- RegionPtr pOldClip = NULL, bsExposed;
- WindowPtr pLayerWin;
- BoxRec box;
-
- if (WasViewable)
- {
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
- {
- (void) (*pScreen->MarkOverlappedWindows)(pChild,
- pChild,
- &pLayerWin);
- }
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- if (pWin->valdata)
- {
- if (HasBorder (pWin))
- {
- RegionPtr borderVisible;
-
- borderVisible = REGION_CREATE(pScreen, NullBox, 1);
- REGION_SUBTRACT(pScreen, borderVisible,
- &pWin->borderClip, &pWin->winSize);
- pWin->valdata->before.borderVisible = borderVisible;
- }
- pWin->valdata->before.resized = TRUE;
- }
- }
-
- /*
- * Use REGION_BREAK to avoid optimizations in ValidateTree
- * that assume the root borderClip can't change well, normally
- * it doesn't...)
- */
- if (enable)
- {
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = pScreen->width;
- box.y2 = pScreen->height;
- REGION_RESET(pScreen, &pWin->borderClip, &box);
- REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
- }
- else
- {
- REGION_EMPTY(pScreen, &pWin->borderClip);
- REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
- }
-
- ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
-
- if (WasViewable)
- {
- if (pWin->backStorage)
- {
- pOldClip = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, pOldClip, &pWin->clipList);
- }
-
- if (pWin->firstChild)
- {
- anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
- pWin->firstChild,
- (WindowPtr *)NULL);
- }
- else
- {
- (*pScreen->MarkWindow) (pWin);
- anyMarked = TRUE;
- }
-
-
- if (anyMarked)
- (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
- }
-
- if (pWin->backStorage &&
- ((pWin->backingStore == Always) || WasViewable))
- {
- if (!WasViewable)
- pOldClip = &pWin->clipList; /* a convenient empty region */
- bsExposed = (*pScreen->TranslateBackingStore)
- (pWin, 0, 0, pOldClip,
- pWin->drawable.x, pWin->drawable.y);
- if (WasViewable)
- REGION_DESTROY(pScreen, pOldClip);
- if (bsExposed)
- {
- RegionPtr valExposed = NullRegion;
-
- if (pWin->valdata)
- valExposed = &pWin->valdata->after.exposed;
- (*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
- if (valExposed)
- REGION_EMPTY(pScreen, valExposed);
- REGION_DESTROY(pScreen, bsExposed);
- }
- }
- if (WasViewable)
- {
- if (anyMarked)
- (*pScreen->HandleExposures)(pWin);
- if (anyMarked && pScreen->PostValidateTree)
- (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
- }
- if (pWin->realized)
- WindowsRestructured ();
- FlushAllOutput ();
-}
+/**************************************************************
+ *
+ * Xquartz initialization code
+ *
+ * Copyright (c) 2007-2008 Apple Inc.
+ * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
+ *
+ * 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, 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 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
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) 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.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "os.h"
+#include "servermd.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "mibstore.h" // mi backing store implementation
+#include "mipointer.h" // mi software cursor
+#include "micmap.h" // mi colormap code
+#include "fb.h" // fb framebuffer code
+#include "site.h"
+#include "globals.h"
+#include "dix.h"
+#include "xkbsrv.h"
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "exevents.h"
+#include "extinit.h"
+
+#include "xserver-properties.h"
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/syslimits.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#define HAS_UTSNAME 1
+#include <sys/utsname.h>
+
+#define NO_CFPLUGIN
+#include <IOKit/hidsystem/IOHIDLib.h>
+
+#ifdef MITSHM
+#include "shmint.h"
+#endif
+
+#include "darwin.h"
+#include "darwinEvents.h"
+#include "quartzKeyboard.h"
+#include "quartz.h"
+
+#ifdef ENABLE_DEBUG_LOG
+FILE *debug_log_fp = NULL;
+#endif
+
+/*
+ * X server shared global variables
+ */
+int darwinScreensFound = 0;
+static int darwinScreenKeyIndex;
+DevPrivateKey darwinScreenKey = &darwinScreenKeyIndex;
+io_connect_t darwinParamConnect = 0;
+int darwinEventReadFD = -1;
+int darwinEventWriteFD = -1;
+// int darwinMouseAccelChange = 1;
+int darwinFakeButtons = 0;
+
+// location of X11's (0,0) point in global screen coordinates
+int darwinMainScreenX = 0;
+int darwinMainScreenY = 0;
+
+// parameters read from the command line or user preferences
+int darwinDesiredDepth = -1;
+int darwinSyncKeymap = FALSE;
+
+// modifier masks for faking mouse buttons - ANY of these bits trigger it (not all)
+#ifdef NX_DEVICELCMDKEYMASK
+int darwinFakeMouse2Mask = NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK;
+int darwinFakeMouse3Mask = NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK;
+#else
+int darwinFakeMouse2Mask = NX_ALTERNATEMASK;
+int darwinFakeMouse3Mask = NX_COMMANDMASK;
+#endif
+
+// Modifier mask for overriding event delivery to appkit (might be useful to set this to rcommand for input menu
+unsigned int darwinAppKitModMask = 0; // Any of these bits
+
+// Modifier mask for items in the Window menu (0 and -1 cause shortcuts to be disabled)
+unsigned int windowItemModMask = NX_COMMANDMASK;
+
+// devices
+DeviceIntPtr darwinKeyboard = NULL;
+DeviceIntPtr darwinPointer = NULL;
+DeviceIntPtr darwinTabletCurrent = NULL;
+DeviceIntPtr darwinTabletStylus = NULL;
+DeviceIntPtr darwinTabletCursor = NULL;
+DeviceIntPtr darwinTabletEraser = NULL;
+
+// Common pixmap formats
+static PixmapFormatRec formats[] = {
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 4, 8, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 15, 16, BITMAP_SCANLINE_PAD },
+ { 16, 16, BITMAP_SCANLINE_PAD },
+ { 24, 32, BITMAP_SCANLINE_PAD },
+ { 32, 32, BITMAP_SCANLINE_PAD }
+};
+const int NUMFORMATS = sizeof(formats)/sizeof(formats[0]);
+
+#ifndef OSNAME
+#define OSNAME " Darwin"
+#endif
+#ifndef OSVENDOR
+#define OSVENDOR ""
+#endif
+#ifndef PRE_RELEASE
+#define PRE_RELEASE XORG_VERSION_SNAP
+#endif
+#ifndef BUILD_DATE
+#define BUILD_DATE ""
+#endif
+#ifndef XORG_RELEASE
+#define XORG_RELEASE "?"
+#endif
+
+void
+DarwinPrintBanner(void)
+{
+ // this should change depending on which specific server we are building
+ ErrorF("Xquartz starting:\n");
+ ErrorF("X.Org X Server %s\nBuild Date: %s\n", XSERVER_VERSION, BUILD_DATE );
+}
+
+
+/*
+ * DarwinSaveScreen
+ * X screensaver support. Not implemented.
+ */
+static Bool DarwinSaveScreen(ScreenPtr pScreen, int on)
+{
+ // FIXME
+ if (on == SCREEN_SAVER_FORCER) {
+ } else if (on == SCREEN_SAVER_ON) {
+ } else {
+ }
+ return TRUE;
+}
+
+/*
+ * DarwinScreenInit
+ * This is a callback from dix during AddScreen() from InitOutput().
+ * Initialize the screen and communicate information about it back to dix.
+ */
+static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) {
+ int dpi;
+ static int foundIndex = 0;
+ Bool ret;
+ DarwinFramebufferPtr dfb;
+
+ // reset index of found screens for each server generation
+ if (index == 0) {
+ foundIndex = 0;
+
+ // reset the visual list
+ miClearVisualTypes();
+ }
+
+ // allocate space for private per screen storage
+ dfb = xalloc(sizeof(DarwinFramebufferRec));
+
+ // SCREEN_PRIV(pScreen) = dfb;
+ dixSetPrivate(&pScreen->devPrivates, darwinScreenKey, dfb);
+
+ // setup hardware/mode specific details
+ ret = QuartzAddScreen(foundIndex, pScreen);
+ foundIndex++;
+ if (! ret)
+ return FALSE;
+
+ // setup a single visual appropriate for our pixel type
+ if(!miSetVisualTypesAndMasks(dfb->depth, dfb->visuals, dfb->bitsPerRGB,
+ dfb->preferredCVC, dfb->redMask,
+ dfb->greenMask, dfb->blueMask)) {
+ return FALSE;
+ }
+
+// TODO: Make PseudoColor visuals not suck in TrueColor mode
+// if(dfb->depth > 8)
+// miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0);
+ if(dfb->depth > 15)
+ miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor, RM_ARGB(0,5,5,5), GM_ARGB(0,5,5,5), BM_ARGB(0,5,5,5));
+ if(dfb->depth > 24)
+ miSetVisualTypesAndMasks(24, TrueColorMask, 8, TrueColor, RM_ARGB(0,8,8,8), GM_ARGB(0,8,8,8), BM_ARGB(0,8,8,8));
+
+ miSetPixmapDepths();
+
+ // machine independent screen init
+ // setup _Screen structure in pScreen
+ if (monitorResolution)
+ dpi = monitorResolution;
+ else
+ dpi = 96;
+
+ // initialize fb
+ if (! fbScreenInit(pScreen,
+ dfb->framebuffer, // pointer to screen bitmap
+ dfb->width, dfb->height, // screen size in pixels
+ dpi, dpi, // dots per inch
+ dfb->pitch/(dfb->bitsPerPixel/8), // pixel width of framebuffer
+ dfb->bitsPerPixel)) // bits per pixel for screen
+ {
+ return FALSE;
+ }
+
+#ifdef RENDER
+ if (! fbPictureInit(pScreen, 0, 0)) {
+ return FALSE;
+ }
+#endif
+
+#ifdef MITSHM
+ ShmRegisterFbFuncs(pScreen);
+#endif
+
+ // this must be initialized (why doesn't X have a default?)
+ pScreen->SaveScreen = DarwinSaveScreen;
+
+ // finish mode dependent screen setup including cursor support
+ if (!QuartzSetupScreen(index, pScreen)) {
+ return FALSE;
+ }
+
+ // create and install the default colormap and
+ // set pScreen->blackPixel / pScreen->white
+ if (!miCreateDefColormap( pScreen )) {
+ return FALSE;
+ }
+
+ dixScreenOrigins[index].x = dfb->x;
+ dixScreenOrigins[index].y = dfb->y;
+
+ /* ErrorF("Screen %d added: %dx%d @ (%d,%d)\n",
+ index, dfb->width, dfb->height, dfb->x, dfb->y); */
+
+ return TRUE;
+}
+
+/*
+ =============================================================================
+
+ mouse and keyboard callbacks
+
+ =============================================================================
+*/
+
+/*
+ * DarwinMouseProc: Handle the initialization, etc. of a mouse
+ */
+static int DarwinMouseProc(DeviceIntPtr pPointer, int what) {
+#define NBUTTONS 7
+#define NAXES 2
+ // 7 buttons: left, right, middle, then four scroll wheel "buttons"
+ CARD8 map[NBUTTONS + 1] = {0, 1, 2, 3, 4, 5, 6, 7};
+ Atom btn_labels[NBUTTONS] = {0};
+ Atom axes_labels[NAXES] = {0};
+
+ switch (what) {
+ case DEVICE_INIT:
+ pPointer->public.on = FALSE;
+
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
+
+
+ // Set button map.
+ InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS,
+ btn_labels,
+ (PtrCtrlProcPtr)NoopDDA,
+ GetMotionHistorySize(), NAXES,
+ axes_labels);
+ pPointer->valuator->mode = Absolute; // Relative
+ InitAbsoluteClassDeviceStruct(pPointer);
+// InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+// InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ break;
+ case DEVICE_ON:
+ pPointer->public.on = TRUE;
+ AddEnabledDevice( darwinEventReadFD );
+ return Success;
+ case DEVICE_CLOSE:
+ case DEVICE_OFF:
+ pPointer->public.on = FALSE;
+ RemoveEnabledDevice(darwinEventReadFD);
+ return Success;
+ }
+
+ return Success;
+#undef NBUTTONS
+#undef NAXES
+}
+
+static int DarwinTabletProc(DeviceIntPtr pPointer, int what) {
+#define NBUTTONS 3
+#define NAXES 5
+ CARD8 map[NBUTTONS + 1] = {0, 1, 2, 3};
+ Atom btn_labels[NBUTTONS] = {0};
+ Atom axes_labels[NAXES] = {0};
+
+ switch (what) {
+ case DEVICE_INIT:
+ pPointer->public.on = FALSE;
+
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
+ axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE);
+ axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_X);
+ axes_labels[4] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_Y);
+
+ // Set button map.
+ InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS,
+ btn_labels,
+ (PtrCtrlProcPtr)NoopDDA,
+ GetMotionHistorySize(), NAXES,
+ axes_labels);
+ pPointer->valuator->mode = Absolute; // Relative
+ InitProximityClassDeviceStruct(pPointer);
+ InitAbsoluteClassDeviceStruct(pPointer);
+
+ InitValuatorAxisStruct(pPointer, 0, axes_labels[0], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 1, axes_labels[1], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 2, axes_labels[2], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 3, axes_labels[3], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+ InitValuatorAxisStruct(pPointer, 4, axes_labels[4], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
+// pPointer->use = IsXExtensionDevice;
+ break;
+ case DEVICE_ON:
+ pPointer->public.on = TRUE;
+ AddEnabledDevice( darwinEventReadFD );
+ return Success;
+ case DEVICE_CLOSE:
+ case DEVICE_OFF:
+ pPointer->public.on = FALSE;
+ RemoveEnabledDevice(darwinEventReadFD);
+ return Success;
+ }
+ return Success;
+#undef NBUTTONS
+#undef NAXES
+}
+
+/*
+ * DarwinKeybdProc
+ * Callback from X
+ */
+static int DarwinKeybdProc( DeviceIntPtr pDev, int onoff )
+{
+ switch ( onoff ) {
+ case DEVICE_INIT:
+ DarwinKeyboardInit( pDev );
+ break;
+ case DEVICE_ON:
+ pDev->public.on = TRUE;
+ AddEnabledDevice( darwinEventReadFD );
+ break;
+ case DEVICE_OFF:
+ pDev->public.on = FALSE;
+ RemoveEnabledDevice( darwinEventReadFD );
+ break;
+ case DEVICE_CLOSE:
+ break;
+ }
+
+ return Success;
+}
+
+/*
+===========================================================================
+
+ Utility routines
+
+===========================================================================
+*/
+
+/*
+ * DarwinParseModifierList
+ * Parse a list of modifier names and return a corresponding modifier mask
+ */
+int DarwinParseModifierList(const char *constmodifiers, int separatelr)
+{
+ int result = 0;
+
+ if (constmodifiers) {
+ char *modifiers = strdup(constmodifiers);
+ char *modifier;
+ int nxkey;
+ char *p = modifiers;
+
+ while (p) {
+ modifier = strsep(&p, " ,+&|/"); // allow lots of separators
+ nxkey = DarwinModifierStringToNXMask(modifier, separatelr);
+ if(nxkey)
+ result |= nxkey;
+ else
+ ErrorF("fakebuttons: Unknown modifier \"%s\"\n", modifier);
+ }
+ free(modifiers);
+ }
+ return result;
+}
+
+/*
+===========================================================================
+
+ Functions needed to link against device independent X
+
+===========================================================================
+*/
+
+/*
+ * InitInput
+ * Register the keyboard and mouse devices
+ */
+void InitInput( int argc, char **argv )
+{
+ XkbRMLVOSet rmlvo = { .rules = "base", .model = "empty", .layout = "empty",
+ .variant = NULL, .options = NULL };
+ /* We need to really have rules... or something... */
+ XkbSetRulesDflts(&rmlvo);
+
+ darwinKeyboard = AddInputDevice(serverClient, DarwinKeybdProc, TRUE);
+ RegisterKeyboardDevice( darwinKeyboard );
+ darwinKeyboard->name = strdup("keyboard");
+
+ /* here's the snippet from the current gdk sources:
+ if (!strcmp (tmp_name, "pointer"))
+ gdkdev->info.source = GDK_SOURCE_MOUSE;
+ else if (!strcmp (tmp_name, "wacom") ||
+ !strcmp (tmp_name, "pen"))
+ gdkdev->info.source = GDK_SOURCE_PEN;
+ else if (!strcmp (tmp_name, "eraser"))
+ gdkdev->info.source = GDK_SOURCE_ERASER;
+ else if (!strcmp (tmp_name, "cursor"))
+ gdkdev->info.source = GDK_SOURCE_CURSOR;
+ else
+ gdkdev->info.source = GDK_SOURCE_PEN;
+ */
+
+ darwinPointer = AddInputDevice(serverClient, DarwinMouseProc, TRUE);
+ RegisterPointerDevice( darwinPointer );
+ darwinPointer->name = strdup("pointer");
+
+ darwinTabletStylus = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
+ RegisterPointerDevice( darwinTabletStylus );
+ darwinTabletStylus->name = strdup("pen");
+
+ darwinTabletCursor = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
+ RegisterPointerDevice( darwinTabletCursor );
+ darwinTabletCursor->name = strdup("cursor");
+
+ darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
+ RegisterPointerDevice( darwinTabletEraser );
+ darwinTabletEraser->name = strdup("eraser");
+
+ darwinTabletCurrent = darwinTabletStylus;
+
+ DarwinEQInit();
+
+ QuartzInitInput(argc, argv);
+}
+
+
+/*
+ * DarwinAdjustScreenOrigins
+ * Shift all screens so the X11 (0, 0) coordinate is at the top
+ * left of the global screen coordinates.
+ *
+ * Screens can be arranged so the top left isn't on any screen, so
+ * instead use the top left of the leftmost screen as (0,0). This
+ * may mean some screen space is in -y, but it's better that (0,0)
+ * be onscreen, or else default xterms disappear. It's better that
+ * -y be used than -x, because when popup menus are forced
+ * "onscreen" by dumb window managers like twm, they'll shift the
+ * menus down instead of left, which still looks funny but is an
+ * easier target to hit.
+ */
+void
+DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo)
+{
+ int i, left, top;
+
+ left = dixScreenOrigins[0].x;
+ top = dixScreenOrigins[0].y;
+
+ /* Find leftmost screen. If there's a tie, take the topmost of the two. */
+ for (i = 1; i < pScreenInfo->numScreens; i++) {
+ if (dixScreenOrigins[i].x < left ||
+ (dixScreenOrigins[i].x == left && dixScreenOrigins[i].y < top))
+ {
+ left = dixScreenOrigins[i].x;
+ top = dixScreenOrigins[i].y;
+ }
+ }
+
+ darwinMainScreenX = left;
+ darwinMainScreenY = top;
+
+ DEBUG_LOG("top = %d, left=%d\n", top, left);
+
+ /* Shift all screens so that there is a screen whose top left
+ * is at X11 (0,0) and at global screen coordinate
+ * (darwinMainScreenX, darwinMainScreenY).
+ */
+
+ if (darwinMainScreenX != 0 || darwinMainScreenY != 0) {
+ for (i = 0; i < pScreenInfo->numScreens; i++) {
+ dixScreenOrigins[i].x -= darwinMainScreenX;
+ dixScreenOrigins[i].y -= darwinMainScreenY;
+ DEBUG_LOG("Screen %d placed at X11 coordinate (%d,%d).\n",
+ i, dixScreenOrigins[i].x, dixScreenOrigins[i].y);
+ }
+ }
+}
+
+
+/*
+ * InitOutput
+ * Initialize screenInfo for all actually accessible framebuffers.
+ *
+ * The display mode dependent code gets called three times. The mode
+ * specific InitOutput routines are expected to discover the number
+ * of potentially useful screens and cache routes to them internally.
+ * Inside DarwinScreenInit are two other mode specific calls.
+ * A mode specific AddScreen routine is called for each screen to
+ * actually initialize the screen with the ScreenPtr structure.
+ * After other screen setup has been done, a mode specific
+ * SetupScreen function can be called to finalize screen setup.
+ */
+void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv )
+{
+ int i;
+
+ pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
+ pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
+
+ // List how we want common pixmap formats to be padded
+ pScreenInfo->numPixmapFormats = NUMFORMATS;
+ for (i = 0; i < NUMFORMATS; i++)
+ pScreenInfo->formats[i] = formats[i];
+
+ // Discover screens and do mode specific initialization
+ QuartzInitOutput(argc, argv);
+
+ // Add screens
+ for (i = 0; i < darwinScreensFound; i++) {
+ AddScreen(DarwinScreenInit, argc, argv);
+ }
+
+ DarwinAdjustScreenOrigins(pScreenInfo);
+}
+
+
+/*
+ * OsVendorFataError
+ */
+void OsVendorFatalError( void )
+{
+ ErrorF( " OsVendorFatalError\n" );
+}
+
+
+/*
+ * OsVendorInit
+ * Initialization of Darwin OS support.
+ */
+void OsVendorInit(void)
+{
+ if (serverGeneration == 1) {
+ DarwinPrintBanner();
+#ifdef ENABLE_DEBUG_LOG
+ {
+ char *home_dir=NULL, *log_file_path=NULL;
+ home_dir = getenv("HOME");
+ if (home_dir) asprintf(&log_file_path, "%s/%s", home_dir, DEBUG_LOG_NAME);
+ if (log_file_path) {
+ if (!access(log_file_path, F_OK)) {
+ debug_log_fp = fopen(log_file_path, "a");
+ if (debug_log_fp) ErrorF("Debug logging enabled to %s\n", log_file_path);
+ }
+ free(log_file_path);
+ }
+ }
+#endif
+ }
+}
+
+
+/*
+ * ddxProcessArgument
+ * Process device-dependent command line args. Returns 0 if argument is
+ * not device dependent, otherwise Count of number of elements of argv
+ * that are part of a device dependent commandline option.
+ */
+int ddxProcessArgument( int argc, char *argv[], int i )
+{
+// if ( !strcmp( argv[i], "-fullscreen" ) ) {
+// ErrorF( "Running full screen in parallel with Mac OS X Quartz window server.\n" );
+// return 1;
+// }
+
+// if ( !strcmp( argv[i], "-rootless" ) ) {
+// ErrorF( "Running rootless inside Mac OS X window server.\n" );
+// return 1;
+// }
+
+ // This command line arg is passed when launched from the Aqua GUI.
+ if ( !strncmp( argv[i], "-psn_", 5 ) ) {
+ return 1;
+ }
+
+ if ( !strcmp( argv[i], "-fakebuttons" ) ) {
+ darwinFakeButtons = TRUE;
+ ErrorF( "Faking a three button mouse\n" );
+ return 1;
+ }
+
+ if ( !strcmp( argv[i], "-nofakebuttons" ) ) {
+ darwinFakeButtons = FALSE;
+ ErrorF( "Not faking a three button mouse\n" );
+ return 1;
+ }
+
+ if (!strcmp( argv[i], "-fakemouse2" ) ) {
+ if ( i == argc-1 ) {
+ FatalError( "-fakemouse2 must be followed by a modifer list\n" );
+ }
+ if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], ""))
+ darwinFakeMouse2Mask = 0;
+ else
+ darwinFakeMouse2Mask = DarwinParseModifierList(argv[i+1], 1);
+ ErrorF("Modifier mask to fake mouse button 2 = 0x%x\n",
+ darwinFakeMouse2Mask);
+ return 2;
+ }
+
+ if (!strcmp( argv[i], "-fakemouse3" ) ) {
+ if ( i == argc-1 ) {
+ FatalError( "-fakemouse3 must be followed by a modifer list\n" );
+ }
+ if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], ""))
+ darwinFakeMouse3Mask = 0;
+ else
+ darwinFakeMouse3Mask = DarwinParseModifierList(argv[i+1], 1);
+ ErrorF("Modifier mask to fake mouse button 3 = 0x%x\n",
+ darwinFakeMouse3Mask);
+ return 2;
+ }
+
+ if ( !strcmp( argv[i], "+synckeymap" ) ) {
+ darwinSyncKeymap = TRUE;
+ return 1;
+ }
+
+ if ( !strcmp( argv[i], "-synckeymap" ) ) {
+ darwinSyncKeymap = FALSE;
+ return 1;
+ }
+
+ if ( !strcmp( argv[i], "-depth" ) ) {
+ if ( i == argc-1 ) {
+ FatalError( "-depth must be followed by a number\n" );
+ }
+ darwinDesiredDepth = atoi( argv[i+1] );
+ if(darwinDesiredDepth != -1 &&
+ darwinDesiredDepth != 8 &&
+ darwinDesiredDepth != 15 &&
+ darwinDesiredDepth != 24) {
+ FatalError( "Unsupported pixel depth. Use 8, 15, or 24 bits\n" );
+ }
+
+ ErrorF( "Attempting to use pixel depth of %i\n", darwinDesiredDepth );
+ return 2;
+ }
+
+ if (!strcmp( argv[i], "-showconfig" ) || !strcmp( argv[i], "-version" )) {
+ DarwinPrintBanner();
+ exit(0);
+ }
+
+ return 0;
+}
+
+
+/*
+ * ddxUseMsg --
+ * Print out correct use of device dependent commandline options.
+ * Maybe the user now knows what really to do ...
+ */
+void ddxUseMsg( void )
+{
+ ErrorF("\n");
+ ErrorF("\n");
+ ErrorF("Device Dependent Usage:\n");
+ ErrorF("\n");
+ ErrorF("-depth <8,15,24> : use this bit depth.\n");
+ ErrorF("-fakebuttons : fake a three button mouse with Command and Option keys.\n");
+ ErrorF("-nofakebuttons : don't fake a three button mouse.\n");
+ ErrorF("-fakemouse2 <modifiers> : fake middle mouse button with modifier keys.\n");
+ ErrorF("-fakemouse3 <modifiers> : fake right mouse button with modifier keys.\n");
+ ErrorF(" ex: -fakemouse2 \"option,shift\" = option-shift-click is middle button.\n");
+ ErrorF("-version : show the server version.\n");
+ ErrorF("\n");
+}
+
+
+/*
+ * ddxGiveUp --
+ * Device dependent cleanup. Called by dix before normal server death.
+ */
+void ddxGiveUp( void )
+{
+ ErrorF( "Quitting Xquartz...\n" );
+}
+
+
+/*
+ * AbortDDX --
+ * DDX - specific abort routine. Called by AbortServer(). The attempt is
+ * made to restore all original setting of the displays. Also all devices
+ * are closed.
+ */
+void AbortDDX( void )
+{
+ ErrorF( " AbortDDX\n" );
+ /*
+ * This is needed for a abnormal server exit, since the normal exit stuff
+ * MUST also be performed (i.e. the vt must be left in a defined state)
+ */
+ ddxGiveUp();
+}
+
+#include "mivalidate.h" // for union _Validate used by windowstr.h
+#include "windowstr.h" // for struct _Window
+#include "scrnintstr.h" // for struct _Screen
+
+// This is copied from Xserver/hw/xfree86/common/xf86Helper.c.
+// Quartz mode uses this when switching in and out of Quartz.
+// Quartz or IOKit can use this when waking from sleep.
+// Copyright (c) 1997-1998 by The XFree86 Project, Inc.
+
+/*
+ * xf86SetRootClip --
+ * Enable or disable rendering to the screen by
+ * setting the root clip list and revalidating
+ * all of the windows
+ */
+
+void
+xf86SetRootClip (ScreenPtr pScreen, int enable)
+{
+ WindowPtr pWin = WindowTable[pScreen->myNum];
+ WindowPtr pChild;
+ Bool WasViewable = (Bool)(pWin->viewable);
+ Bool anyMarked = TRUE;
+ RegionPtr pOldClip = NULL, bsExposed;
+ WindowPtr pLayerWin;
+ BoxRec box;
+
+ if (WasViewable)
+ {
+ for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
+ {
+ (void) (*pScreen->MarkOverlappedWindows)(pChild,
+ pChild,
+ &pLayerWin);
+ }
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ if (pWin->valdata)
+ {
+ if (HasBorder (pWin))
+ {
+ RegionPtr borderVisible;
+
+ borderVisible = REGION_CREATE(pScreen, NullBox, 1);
+ REGION_SUBTRACT(pScreen, borderVisible,
+ &pWin->borderClip, &pWin->winSize);
+ pWin->valdata->before.borderVisible = borderVisible;
+ }
+ pWin->valdata->before.resized = TRUE;
+ }
+ }
+
+ /*
+ * Use REGION_BREAK to avoid optimizations in ValidateTree
+ * that assume the root borderClip can't change well, normally
+ * it doesn't...)
+ */
+ if (enable)
+ {
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+ REGION_RESET(pScreen, &pWin->borderClip, &box);
+ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+ }
+ else
+ {
+ REGION_EMPTY(pScreen, &pWin->borderClip);
+ REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
+ }
+
+ ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
+
+ if (WasViewable)
+ {
+ if (pWin->backStorage)
+ {
+ pOldClip = REGION_CREATE(pScreen, NullBox, 1);
+ REGION_COPY(pScreen, pOldClip, &pWin->clipList);
+ }
+
+ if (pWin->firstChild)
+ {
+ anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
+ pWin->firstChild,
+ (WindowPtr *)NULL);
+ }
+ else
+ {
+ (*pScreen->MarkWindow) (pWin);
+ anyMarked = TRUE;
+ }
+
+
+ if (anyMarked)
+ (*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
+ }
+
+ if (pWin->backStorage &&
+ ((pWin->backingStore == Always) || WasViewable))
+ {
+ if (!WasViewable)
+ pOldClip = &pWin->clipList; /* a convenient empty region */
+ bsExposed = (*pScreen->TranslateBackingStore)
+ (pWin, 0, 0, pOldClip,
+ pWin->drawable.x, pWin->drawable.y);
+ if (WasViewable)
+ REGION_DESTROY(pScreen, pOldClip);
+ if (bsExposed)
+ {
+ RegionPtr valExposed = NullRegion;
+
+ if (pWin->valdata)
+ valExposed = &pWin->valdata->after.exposed;
+ (*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
+ if (valExposed)
+ REGION_EMPTY(pScreen, valExposed);
+ REGION_DESTROY(pScreen, bsExposed);
+ }
+ }
+ if (WasViewable)
+ {
+ if (anyMarked)
+ (*pScreen->HandleExposures)(pWin);
+ if (anyMarked && pScreen->PostValidateTree)
+ (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
+ }
+ if (pWin->realized)
+ WindowsRestructured ();
+ FlushAllOutput ();
+}
diff --git a/xorg-server/hw/xquartz/doc/Makefile.in b/xorg-server/hw/xquartz/doc/Makefile.in
index d253509c7..1ffce504c 100644
--- a/xorg-server/hw/xquartz/doc/Makefile.in
+++ b/xorg-server/hw/xquartz/doc/Makefile.in
@@ -127,6 +127,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -258,6 +259,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = sed
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xquartz/mach-startup/Makefile.am b/xorg-server/hw/xquartz/mach-startup/Makefile.am
index 334f06d43..4dff45aa8 100644
--- a/xorg-server/hw/xquartz/mach-startup/Makefile.am
+++ b/xorg-server/hw/xquartz/mach-startup/Makefile.am
@@ -3,7 +3,7 @@ AM_CPPFLAGS = \
-DXSERVER_VERSION=\"$(VERSION)\" \
-DX11BINDIR=\"$(bindir)\"
-AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CFLAGS = $(DIX_CFLAGS)
x11appdir = $(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app/Contents/MacOS
x11app_PROGRAMS = X11.bin
diff --git a/xorg-server/hw/xquartz/mach-startup/Makefile.in b/xorg-server/hw/xquartz/mach-startup/Makefile.in
index 799c5e626..d0d468cbb 100644
--- a/xorg-server/hw/xquartz/mach-startup/Makefile.in
+++ b/xorg-server/hw/xquartz/mach-startup/Makefile.in
@@ -162,6 +162,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -293,6 +294,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
@@ -434,7 +437,7 @@ AM_CPPFLAGS = \
-DXSERVER_VERSION=\"$(VERSION)\" \
-DX11BINDIR=\"$(bindir)\"
-AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CFLAGS = $(DIX_CFLAGS)
x11appdir = $(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app/Contents/MacOS
dist_X11_bin_SOURCES = \
bundle-main.c
diff --git a/xorg-server/hw/xquartz/pbproxy/Makefile.in b/xorg-server/hw/xquartz/pbproxy/Makefile.in
index 093fdf1b7..485dccc46 100644
--- a/xorg-server/hw/xquartz/pbproxy/Makefile.in
+++ b/xorg-server/hw/xquartz/pbproxy/Makefile.in
@@ -153,6 +153,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -284,6 +285,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/hw/xquartz/quartzKeyboard.c b/xorg-server/hw/xquartz/quartzKeyboard.c
index 3b4eac31c..7e36a9aa3 100644
--- a/xorg-server/hw/xquartz/quartzKeyboard.c
+++ b/xorg-server/hw/xquartz/quartzKeyboard.c
@@ -301,9 +301,6 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
// for a kIOHIDParamConnectType connection.
assert(darwinParamConnect = NXOpenEventStatus());
- /* We need to really have rules... or something... */
- //XkbSetRulesDflts("base", "pc105", "us", NULL, NULL);
-
InitKeyboardDeviceStruct(pDev, NULL, DarwinKeyboardBell, DarwinChangeKeyboardControl);
DarwinKeyboardReloadHandler();
@@ -775,12 +772,9 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
#endif
}
- // There seems to be an issue with this in 1.5+, shift-space is not
- // producing space, it's sending NoSymbol... ?
- //if (k[3] == k[2]) k[3] = NoSymbol;
- //if (k[1] == k[0]) k[1] = NoSymbol;
- //if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
- //if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] = NoSymbol;
+ if (k[3] == k[2]) k[3] = NoSymbol;
+ if (k[1] == k[0]) k[1] = NoSymbol;
+ if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
}
/* Fix up some things that are normally missing.. */
@@ -791,7 +785,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
if (k[0] == NoSymbol && k[1] == NoSymbol
&& k[2] == NoSymbol && k[3] == NoSymbol)
- k[0] = k[1] = k[2] = k[3] = known_keys[i].keysym;
+ k[0] = known_keys[i].keysym;
}
}
@@ -804,7 +798,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
k = info->keyMap + known_numeric_keys[i].keycode * GLYPHS_PER_KEY;
if (k[0] == known_numeric_keys[i].normal)
- k[0] = k[1] = k[2] = k[3] = known_numeric_keys[i].keypad;
+ k[0] = known_numeric_keys[i].keypad;
}
}
diff --git a/xorg-server/hw/xquartz/xpr/Makefile.am b/xorg-server/hw/xquartz/xpr/Makefile.am
index ba7b25890..763a7cd5c 100644
--- a/xorg-server/hw/xquartz/xpr/Makefile.am
+++ b/xorg-server/hw/xquartz/xpr/Makefile.am
@@ -1,6 +1,6 @@
noinst_LTLIBRARIES = libXquartzXpr.la
-AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CFLAGS = $(DIX_CFLAGS)
AM_CPPFLAGS = \
-I$(srcdir) -I$(srcdir)/.. \
-I$(top_srcdir)/miext \
diff --git a/xorg-server/hw/xquartz/xpr/Makefile.in b/xorg-server/hw/xquartz/xpr/Makefile.in
index 484898d77..2bcbf2bdf 100644
--- a/xorg-server/hw/xquartz/xpr/Makefile.in
+++ b/xorg-server/hw/xquartz/xpr/Makefile.in
@@ -126,6 +126,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -257,6 +258,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
@@ -394,7 +397,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_LTLIBRARIES = libXquartzXpr.la
-AM_CFLAGS = $(XSERVER_CFLAGS) $(DIX_CFLAGS)
+AM_CFLAGS = $(DIX_CFLAGS)
AM_CPPFLAGS = \
-I$(srcdir) -I$(srcdir)/.. \
-I$(top_srcdir)/miext \
diff --git a/xorg-server/hw/xwin/Makefile.in b/xorg-server/hw/xwin/Makefile.in
index 1d7fb3b20..cbd49134b 100644
--- a/xorg-server/hw/xwin/Makefile.in
+++ b/xorg-server/hw/xwin/Makefile.in
@@ -75,9 +75,9 @@ am__XWin_SOURCES_DIST = InitInput.c InitOutput.c winallpriv.c \
winscrinit.c winshaddd.c winshadddnl.c winshadgdi.c \
wintrayicon.c winvalargs.c winwakeup.c winwindow.c \
winwndproc.c ddraw.h winclipboard.h winconfig.h win.h \
- winkeybd.h winkeymap.h winkeynames.h winlayouts.h \
- winmessages.h winmsg.h winms.h winmultiwindowclass.h \
- winprefs.h winpriv.h winresource.h winwindow.h XWin.rc \
+ winkeybd.h winkeynames.h winlayouts.h winmessages.h winmsg.h \
+ winms.h winmultiwindowclass.h winprefs.h winpriv.h \
+ winresource.h winwindow.h XWin.rc \
$(top_srcdir)/Xext/dpmsstubs.c $(top_srcdir)/Xi/stubs.c \
$(top_srcdir)/mi/miinitext.c $(top_srcdir)/fb/fbcmap_mi.c \
winclipboardinit.c winclipboardtextconv.c winclipboardthread.c \
@@ -241,6 +241,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = $(DEFS_CLIPBOARD) \
@@ -380,6 +381,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = sed
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
@@ -609,7 +612,6 @@ SRCS = InitInput.c \
winconfig.h \
win.h \
winkeybd.h \
- winkeymap.h \
winkeynames.h \
winlayouts.h \
winmessages.h \
diff --git a/xorg-server/include/Makefile.am b/xorg-server/include/Makefile.am
index d684f9c2b..eddc86cb3 100644
--- a/xorg-server/include/Makefile.am
+++ b/xorg-server/include/Makefile.am
@@ -27,6 +27,7 @@ sdk_HEADERS = \
globals.h \
input.h \
inputstr.h \
+ list.h \
misc.h \
miscstruct.h \
opaque.h \
diff --git a/xorg-server/include/Makefile.in b/xorg-server/include/Makefile.in
index 3fe3a0519..e1d16195f 100644
--- a/xorg-server/include/Makefile.in
+++ b/xorg-server/include/Makefile.in
@@ -90,12 +90,12 @@ am__sdk_HEADERS_DIST = XIstubs.h bstore.h bstorestr.h closestr.h \
cursorstr.h dix.h dixaccess.h dixevents.h dixfont.h \
dixfontstr.h dixgrabs.h dixstruct.h events.h exevents.h \
extension.h extinit.h extnsionst.h gc.h gcstruct.h globals.h \
- input.h inputstr.h misc.h miscstruct.h opaque.h os.h pixmap.h \
- pixmapstr.h privates.h property.h propertyst.h ptrveloc.h \
- region.h regionstr.h registry.h resource.h rgb.h screenint.h \
- scrnintstr.h selection.h servermd.h site.h swaprep.h swapreq.h \
- validate.h window.h windowstr.h xkbfile.h xkbsrv.h xkbstr.h \
- xkbrules.h xserver-properties.h
+ input.h inputstr.h list.h misc.h miscstruct.h opaque.h os.h \
+ pixmap.h pixmapstr.h privates.h property.h propertyst.h \
+ ptrveloc.h region.h regionstr.h registry.h resource.h rgb.h \
+ screenint.h scrnintstr.h selection.h servermd.h site.h \
+ swaprep.h swapreq.h validate.h window.h windowstr.h xkbfile.h \
+ xkbsrv.h xkbstr.h xkbrules.h xserver-properties.h
HEADERS = $(nodist_sdk_HEADERS) $(sdk_HEADERS)
ETAGS = etags
CTAGS = ctags
@@ -135,6 +135,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -266,6 +267,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
@@ -430,6 +433,7 @@ top_srcdir = @top_srcdir@
@XORG_TRUE@ globals.h \
@XORG_TRUE@ input.h \
@XORG_TRUE@ inputstr.h \
+@XORG_TRUE@ list.h \
@XORG_TRUE@ misc.h \
@XORG_TRUE@ miscstruct.h \
@XORG_TRUE@ opaque.h \
diff --git a/xorg-server/include/do-not-use-config.h.in b/xorg-server/include/do-not-use-config.h.in
new file mode 100644
index 000000000..859638a20
--- /dev/null
+++ b/xorg-server/include/do-not-use-config.h.in
@@ -0,0 +1,779 @@
+/* include/do-not-use-config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
+/* Build AIGLX loader */
+#undef AIGLX
+
+/* Default base font path */
+#undef BASE_FONT_PATH
+
+/* Support BigRequests extension */
+#undef BIGREQS
+
+/* Define to 1 if `struct sockaddr_in' has a `sin_len' member */
+#undef BSD44SOCKETS
+
+/* Builder address */
+#undef BUILDERADDR
+
+/* Builder string */
+#undef BUILDERSTRING
+
+/* Default font path */
+#undef COMPILEDDEFAULTFONTPATH
+
+/* Support Composite Extension */
+#undef COMPOSITE
+
+/* Use the D-Bus input configuration API */
+#undef CONFIG_DBUS_API
+
+/* Use the HAL hotplug API */
+#undef CONFIG_HAL
+
+/* Use D-Bus for input hotplug */
+#undef CONFIG_NEED_DBUS
+
+/* Use libudev for input hotplug */
+#undef CONFIG_UDEV
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+#undef CRAY_STACKSEG_END
+
+/* System is BSD-like */
+#undef CSRG_BASED
+
+/* Simple debug messages */
+#undef CYGDEBUG
+
+/* Debug window manager */
+#undef CYGMULTIWINDOW_DEBUG
+
+/* Debug messages for window handling */
+#undef CYGWINDOWING_DEBUG
+
+/* Define to 1 if using `alloca.c'. */
+#undef C_ALLOCA
+
+/* Support Damage extension */
+#undef DAMAGE
+
+/* Support DBE extension */
+#undef DBE
+
+/* Use ddxBeforeReset */
+#undef DDXBEFORERESET
+
+/* Use OsVendorVErrorF */
+#undef DDXOSVERRORF
+
+/* Enable debugging code */
+#undef DEBUG
+
+/* Default library install path */
+#undef DEFAULT_LIBRARY_PATH
+
+/* Default log location */
+#undef DEFAULT_LOGDIR
+
+/* Default log location */
+#undef DEFAULT_LOGPREFIX
+
+/* Default module search path */
+#undef DEFAULT_MODULE_PATH
+
+/* Support DGA extension */
+#undef DGA
+
+/* Support DPMS extension */
+#undef DPMSExtension
+
+/* Build DRI2 extension */
+#undef DRI2
+
+/* Build DRI2 AIGLX loader */
+#undef DRI2_AIGLX
+
+/* Default DRI driver path */
+#undef DRI_DRIVER_PATH
+
+/* Build GLX extension */
+#undef GLXEXT
+
+/* Support XDM-AUTH*-1 */
+#undef HASXDMAUTH
+
+/* System has /dev/xf86 aperture driver */
+#undef HAS_APERTURE_DRV
+
+/* Cygwin has /dev/windows for signaling new win32 messages */
+#undef HAS_DEVWINDOWS
+
+/* Have the 'getdtablesize' function. */
+#undef HAS_GETDTABLESIZE
+
+/* Have the 'getifaddrs' function. */
+#undef HAS_GETIFADDRS
+
+/* Have the 'getpeereid' function. */
+#undef HAS_GETPEEREID
+
+/* Have the 'getpeerucred' function. */
+#undef HAS_GETPEERUCRED
+
+/* Have the 'mmap' function. */
+#undef HAS_MMAP
+
+/* Define to 1 if NetBSD built-in MTRR support is available */
+#undef HAS_MTRR_BUILTIN
+
+/* MTRR support available */
+#undef HAS_MTRR_SUPPORT
+
+/* Support SHM */
+#undef HAS_SHM
+
+/* Have the 'strlcpy' function */
+#undef HAS_STRLCPY
+
+/* Use Windows sockets */
+#undef HAS_WINSOCK
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+#undef HAVE_ALLOCA_H
+
+/* Define to 1 if you have the <asm/mtrr.h> header file. */
+#undef HAVE_ASM_MTRR_H
+
+/* Define to 1 if you have the `authdes_create' function. */
+#undef HAVE_AUTHDES_CREATE
+
+/* Define to 1 if you have the `authdes_seccreate' function. */
+#undef HAVE_AUTHDES_SECCREATE
+
+/* Has backtrace support */
+#undef HAVE_BACKTRACE
+
+/* Define to 1 if you have the <byteswap.h> header file. */
+#undef HAVE_BYTESWAP_H
+
+/* Have the 'cbrt' function */
+#undef HAVE_CBRT
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#undef HAVE_CLOCK_GETTIME
+
+/* Define to 1 if you have the <dbm.h> header file. */
+#undef HAVE_DBM_H
+
+/* Have D-Bus support */
+#undef HAVE_DBUS
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Have execinfo.h */
+#undef HAVE_EXECINFO_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `ffs' function. */
+#undef HAVE_FFS
+
+/* Define to 1 if you have the <fnmatch.h> header file. */
+#undef HAVE_FNMATCH_H
+
+/* Define to 1 if you have the `geteuid' function. */
+#undef HAVE_GETEUID
+
+/* Define to 1 if you have the `getisax' function. */
+#undef HAVE_GETISAX
+
+/* Define to 1 if you have the `getopt' function. */
+#undef HAVE_GETOPT
+
+/* Define to 1 if you have the `getopt_long' function. */
+#undef HAVE_GETOPT_LONG
+
+/* Define to 1 if you have the `getuid' function. */
+#undef HAVE_GETUID
+
+/* Define to 1 if you have the `getzoneid' function. */
+#undef HAVE_GETZONEID
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `audit' library (-laudit). */
+#undef HAVE_LIBAUDIT
+
+/* Define to 1 if you have the <libaudit.h> header file. */
+#undef HAVE_LIBAUDIT_H
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the `ws2_32' library (-lws2_32). */
+#undef HAVE_LIBWS2_32
+
+/* Define to 1 if you have the `link' function. */
+#undef HAVE_LINK
+
+/* Define to 1 if you have the <linux/agpgart.h> header file. */
+#undef HAVE_LINUX_AGPGART_H
+
+/* Define to 1 if you have the <linux/apm_bios.h> header file. */
+#undef HAVE_LINUX_APM_BIOS_H
+
+/* Define to 1 if you have the <linux/fb.h> header file. */
+#undef HAVE_LINUX_FB_H
+
+/* Define to 1 if you have the <machine/mtrr.h> header file. */
+#undef HAVE_MACHINE_MTRR_H
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the `mkstemp' function. */
+#undef HAVE_MKSTEMP
+
+/* Define to 1 if you have the <ndbm.h> header file. */
+#undef HAVE_NDBM_H
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
+
+/* Define to 1 if you have the `pci_device_enable' function. */
+#undef HAVE_PCI_DEVICE_ENABLE
+
+/* Define to 1 if you have the `pci_device_is_boot_vga' function. */
+#undef HAVE_PCI_DEVICE_IS_BOOT_VGA
+
+/* Define to 1 if you have the `pci_device_vgaarb_init' function. */
+#undef HAVE_PCI_DEVICE_VGAARB_INIT
+
+/* Define to 1 if you have the `pci_system_init_dev_mem' function. */
+#undef HAVE_PCI_SYSTEM_INIT_DEV_MEM
+
+/* Define to 1 if you have the <rpcsvc/dbm.h> header file. */
+#undef HAVE_RPCSVC_DBM_H
+
+/* Use CommonCrypto SHA1 functions */
+#undef HAVE_SHA1_IN_COMMONCRYPTO
+
+/* Use libc SHA1 functions */
+#undef HAVE_SHA1_IN_LIBC
+
+/* Use libgcrypt SHA1 functions */
+#undef HAVE_SHA1_IN_LIBGCRYPT
+
+/* Use libmd SHA1 functions */
+#undef HAVE_SHA1_IN_LIBMD
+
+/* Use libsha1 for SHA1 */
+#undef HAVE_SHA1_IN_LIBSHA1
+
+/* Define to 1 if you have the `shmctl64' function. */
+#undef HAVE_SHMCTL64
+
+/* Define to 1 if the system has the type `socklen_t'. */
+#undef HAVE_SOCKLEN_T
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasestr' function. */
+#undef HAVE_STRCASESTR
+
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <stropts.h> header file. */
+#undef HAVE_STROPTS_H
+
+/* Define to 1 if you have the `strrchr' function. */
+#undef HAVE_STRRCHR
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if SYSV IPC is available */
+#undef HAVE_SYSV_IPC
+
+/* Define to 1 if you have the <sys/agpgart.h> header file. */
+#undef HAVE_SYS_AGPGART_H
+
+/* Define to 1 if you have the <sys/agpio.h> header file. */
+#undef HAVE_SYS_AGPIO_H
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_DIR_H
+
+/* Define to 1 if you have the <sys/io.h> header file. */
+#undef HAVE_SYS_IO_H
+
+/* Define to 1 if you have the <sys/kd.h> header file. */
+#undef HAVE_SYS_KD_H
+
+/* Define to 1 if you have the <sys/linker.h> header file. */
+#undef HAVE_SYS_LINKER_H
+
+/* Define to 1 if you have the <sys/memrange.h> header file. */
+#undef HAVE_SYS_MEMRANGE_H
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_NDIR_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/vm86.h> header file. */
+#undef HAVE_SYS_VM86_H
+
+/* Define to 1 if you have the <sys/vt.h> header file. */
+#undef HAVE_SYS_VT_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#undef HAVE_VSNPRINTF
+
+/* Define to 1 if you have the `walkcontext' function. */
+#undef HAVE_WALKCONTEXT
+
+/* Support IPv6 for TCP connections */
+#undef IPv6
+
+/* Build kdrive ddx */
+#undef KDRIVEDDXACTIONS
+
+/* Build fbdev-based kdrive server */
+#undef KDRIVEFBDEV
+
+/* Build Kdrive X server */
+#undef KDRIVESERVER
+
+/* Enable KDrive evdev driver */
+#undef KDRIVE_EVDEV
+
+/* Enable KDrive kbd driver */
+#undef KDRIVE_KBD
+
+/* Enable KDrive mouse driver */
+#undef KDRIVE_MOUSE
+
+/* Prefix to use for launchd identifiers */
+#undef LAUNCHD_ID_PREFIX
+
+/* Support os-specific local connections */
+#undef LOCALCONN
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Support MIT-SHM extension */
+#undef MITSHM
+
+/* Have monotonic clock from clock_gettime() */
+#undef MONOTONIC_CLOCK
+
+/* Build Multibuffer extension */
+#undef MULTIBUFFER
+
+/* Do not have 'strcasecmp'. */
+#undef NEED_STRCASECMP
+
+/* Do not have 'strcasestr'. */
+#undef NEED_STRCASESTR
+
+/* Do not have 'strncasecmp'. */
+#undef NEED_STRNCASECMP
+
+/* Need XFree86 helper functions */
+#undef NEED_XF86_PROTOTYPES
+
+/* Need XFree86 typedefs */
+#undef NEED_XF86_TYPES
+
+/* Define to 1 if modules should avoid the libcwrapper */
+#undef NO_LIBCWRAPPER
+
+/* Operating System Name */
+#undef OSNAME
+
+/* Operating System Vendor */
+#undef OSVENDOR
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Major version of this package */
+#undef PACKAGE_VERSION_MAJOR
+
+/* Minor version of this package */
+#undef PACKAGE_VERSION_MINOR
+
+/* Patch version of this package */
+#undef PACKAGE_VERSION_PATCHLEVEL
+
+/* Internal define for Xinerama */
+#undef PANORAMIX
+
+/* System has PC console */
+#undef PCCONS_SUPPORT
+
+/* Default PCI text file ID path */
+#undef PCI_TXT_IDS_PATH
+
+/* System has PC console */
+#undef PCVT_SUPPORT
+
+/* Overall prefix */
+#undef PROJECTROOT
+
+/* Support RANDR extension */
+#undef RANDR
+
+/* Make PROJECT_ROOT relative to the xserver location */
+#undef RELOCATE_PROJECTROOT
+
+/* Support RENDER extension */
+#undef RENDER
+
+/* Support X resource extension */
+#undef RES
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* Build Rootless code */
+#undef ROOTLESS
+
+/* Support MIT-SCREEN-SAVER extension */
+#undef SCREENSAVER
+
+/* Support Secure RPC ("SUN-DES-1") authentication for X11 clients */
+#undef SECURE_RPC
+
+/* Server miscellaneous config path */
+#undef SERVER_MISC_CONFIG_PATH
+
+/* Support SHAPE extension */
+#undef SHAPE
+
+/* The size of `unsigned long', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_LONG
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at runtime.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
+/* Build a standalone xpbproxy */
+#undef STANDALONE_XPBPROXY
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Support PC98 */
+#undef SUPPORT_PC98
+
+/* Define to 1 on systems derived from System V Release 4 */
+#undef SVR4
+
+/* Location of system.XWinrc */
+#undef SYSCONFDIR
+
+/* System has syscons console */
+#undef SYSCONS_SUPPORT
+
+/* Support TCP socket connections */
+#undef TCPCONN
+
+/* Have tslib support */
+#undef TSLIB
+
+/* Enable unit tests */
+#undef UNITTESTS
+
+/* Support UNIX socket connections */
+#undef UNIXCONN
+
+/* NetBSD PIO alpha IO */
+#undef USE_ALPHA_PIO
+
+/* BSD AMD64 iopl */
+#undef USE_AMD64_IOPL
+
+/* BSD /dev/io */
+#undef USE_DEV_IO
+
+/* BSD i386 iopl */
+#undef USE_I386_IOPL
+
+/* Use SIGIO handlers for input device events by default */
+#undef USE_SIGIO_BY_DEFAULT
+
+/* Define to use byteswap macros from <sys/endian.h> */
+#undef USE_SYS_ENDIAN_H
+
+/* Vendor man version */
+#undef VENDOR_MAN_VERSION
+
+/* Vendor name */
+#undef VENDOR_NAME
+
+/* Vendor name */
+#undef VENDOR_NAME_SHORT
+
+/* Vendor release */
+#undef VENDOR_RELEASE
+
+/* Version number of package */
+#undef VERSION
+
+/* Building vgahw module */
+#undef WITH_VGAHW
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#endif
+
+/* System has wscons console */
+#undef WSCONS_SUPPORT
+
+/* Build X-ACE extension */
+#undef XACE
+
+/* Build XCalibrate extension */
+#undef XCALIBRATE
+
+/* Support XCMisc extension */
+#undef XCMISC
+
+/* Build Security extension */
+#undef XCSECURITY
+
+/* Support XDM Control Protocol */
+#undef XDMCP
+
+/* Support XF86 Big font extension */
+#undef XF86BIGFONT
+
+/* Name of configuration file */
+#undef XF86CONFIGFILE
+
+/* Build DRI extension */
+#undef XF86DRI
+
+/* Support XFree86 Video Mode extension */
+#undef XF86VIDMODE
+
+/* Support XFixes extension */
+#undef XFIXES
+
+/* Building loadable XFree86 server */
+#undef XFree86LOADER
+
+/* Building XFree86 server */
+#undef XFree86Server
+
+/* Build XDGA support */
+#undef XFreeXDGA
+
+/* Support Xinerama extension */
+#undef XINERAMA
+
+/* Path to XKB data */
+#undef XKB_BASE_DIRECTORY
+
+/* Path to XKB bin dir */
+#undef XKB_BIN_DIRECTORY
+
+/* Default XKB layout */
+#undef XKB_DFLT_LAYOUT
+
+/* Default XKB model */
+#undef XKB_DFLT_MODEL
+
+/* Default XKB options */
+#undef XKB_DFLT_OPTIONS
+
+/* Default XKB ruleset */
+#undef XKB_DFLT_RULES
+
+/* Default XKB variant */
+#undef XKB_DFLT_VARIANT
+
+/* Path to XKB output dir */
+#undef XKM_OUTPUT_DIR
+
+/* Building Xorg server */
+#undef XORGSERVER
+
+/* Vendor release */
+#undef XORG_DATE
+
+/* Vendor man version */
+#undef XORG_MAN_VERSION
+
+/* Building Xorg server */
+#undef XORG_SERVER
+
+/* Current Xorg version */
+#undef XORG_VERSION_CURRENT
+
+/* Have Quartz */
+#undef XQUARTZ
+
+/* Support application updating through sparkle. */
+#undef XQUARTZ_SPARKLE
+
+/* Support Record extension */
+#undef XRECORD
+
+/* Build registry module */
+#undef XREGISTRY
+
+/* Build SELinux extension */
+#undef XSELINUX
+
+/* Define to 1 if the DTrace Xserver provider probes should be built in. */
+#undef XSERVER_DTRACE
+
+/* Use libpciaccess for all pci manipulation */
+#undef XSERVER_LIBPCIACCESS
+
+/* Support XSync extension */
+#undef XSYNC
+
+/* Support XTest extension */
+#undef XTEST
+
+/* Support Xv extension */
+#undef XV
+
+/* Vendor name */
+#undef XVENDORNAME
+
+/* Short vendor name */
+#undef XVENDORNAMESHORT
+
+/* Build Xv extension */
+#undef XvExtension
+
+/* Build XvMC extension */
+#undef XvMCExtension
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+ `char[]'. */
+#undef YYTEXT_POINTER
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Enable GNU and other extensions to the C environment for glibc */
+#undef _GNU_SOURCE
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to 1 if unsigned long is 64 bits. */
+#undef _XSERVER64
+
+/* Vendor web address for support */
+#undef __VENDORDWEBSUPPORT__
+
+/* Name of configuration directory */
+#undef __XCONFIGDIR__
+
+/* Name of configuration file */
+#undef __XCONFIGFILE__
+
+/* Name of X server */
+#undef __XSERVERNAME__
+
+/* Define to 16-bit byteswap macro */
+#undef bswap_16
+
+/* Define to 32-bit byteswap macro */
+#undef bswap_32
+
+/* Define to 64-bit byteswap macro */
+#undef bswap_64
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
diff --git a/xorg-server/include/list.h b/xorg-server/include/list.h
new file mode 100644
index 000000000..a126a652d
--- /dev/null
+++ b/xorg-server/include/list.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright © 2010 Intel Corporation
+ * Copyright © 2010 Francisco Jerez <currojerez@riseup.net>
+ *
+ * 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, 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 NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
+ *
+ */
+
+#ifndef _LIST_H_
+#define _LIST_H_
+
+/* classic doubly-link circular list */
+struct list {
+ struct list *next, *prev;
+};
+
+static void
+list_init(struct list *list)
+{
+ list->next = list->prev = list;
+}
+
+static inline void
+__list_add(struct list *entry,
+ struct list *prev,
+ struct list *next)
+{
+ next->prev = entry;
+ entry->next = next;
+ entry->prev = prev;
+ prev->next = entry;
+}
+
+static inline void
+list_add(struct list *entry, struct list *head)
+{
+ __list_add(entry, head, head->next);
+}
+
+static inline void
+__list_del(struct list *prev, struct list *next)
+{
+ next->prev = prev;
+ prev->next = next;
+}
+
+static inline void
+list_del(struct list *entry)
+{
+ __list_del(entry->prev, entry->next);
+ list_init(entry);
+}
+
+static inline Bool
+list_is_empty(struct list *head)
+{
+ return head->next == head;
+}
+
+#ifndef container_of
+#define container_of(ptr, type, member) \
+ (type *)((char *)(ptr) - (char *) &((type *)0)->member)
+#endif
+
+#define list_entry(ptr, type, member) \
+ container_of(ptr, type, member)
+
+#define list_first_entry(ptr, type, member) \
+ list_entry((ptr)->next, type, member)
+
+#define __container_of(ptr, sample, member) \
+ (void *)((char *)(ptr) \
+ - ((char *)&(sample)->member - (char *)(sample)))
+
+#define list_for_each_entry(pos, head, member) \
+ for (pos = __container_of((head)->next, pos, member); \
+ &pos->member != (head); \
+ pos = __container_of(pos->member.next, pos, member))
+
+#endif
diff --git a/xorg-server/include/scrnintstr.h b/xorg-server/include/scrnintstr.h
index ab50e7a32..c42119d0d 100644
--- a/xorg-server/include/scrnintstr.h
+++ b/xorg-server/include/scrnintstr.h
@@ -399,6 +399,15 @@ typedef void (* PostChangeSaveUnderProcPtr)(
WindowPtr /*pLayerWin*/,
WindowPtr /*firstChild*/);
+typedef void (* ConfigNotifyProcPtr)(
+ WindowPtr /*pWin*/,
+ int /*x*/,
+ int /*y*/,
+ int /*w*/,
+ int /*h*/,
+ int /*bw*/,
+ WindowPtr /*pSib*/);
+
typedef void (* MoveWindowProcPtr)(
WindowPtr /*pWin*/,
int /*x*/,
@@ -581,6 +590,7 @@ typedef struct _Screen {
MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
ChangeSaveUnderProcPtr ChangeSaveUnder;
PostChangeSaveUnderProcPtr PostChangeSaveUnder;
+ ConfigNotifyProcPtr ConfigNotify;
MoveWindowProcPtr MoveWindow;
ResizeWindowProcPtr ResizeWindow;
GetLayerWindowProcPtr GetLayerWindow;
diff --git a/xorg-server/include/xwin-config.h.in b/xorg-server/include/xwin-config.h.in
index 21ceb29cf..13b51ca7f 100644
--- a/xorg-server/include/xwin-config.h.in
+++ b/xorg-server/include/xwin-config.h.in
@@ -32,3 +32,5 @@
/* Location of system.XWinrc */
#undef SYSCONFDIR
+/* Default log location */
+#undef DEFAULT_LOGDIR
diff --git a/xorg-server/mi/Makefile.in b/xorg-server/mi/Makefile.in
index 45481aef6..11c37d7b4 100644
--- a/xorg-server/mi/Makefile.in
+++ b/xorg-server/mi/Makefile.in
@@ -160,6 +160,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -291,6 +292,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/miext/Makefile.in b/xorg-server/miext/Makefile.in
index f55fc91b6..32fc259cc 100644
--- a/xorg-server/miext/Makefile.in
+++ b/xorg-server/miext/Makefile.in
@@ -140,6 +140,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -271,6 +272,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/miext/cw/Makefile.in b/xorg-server/miext/cw/Makefile.in
index 1bd4802e0..bf731f9cc 100644
--- a/xorg-server/miext/cw/Makefile.in
+++ b/xorg-server/miext/cw/Makefile.in
@@ -124,6 +124,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -255,6 +256,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/miext/damage/Makefile.in b/xorg-server/miext/damage/Makefile.in
index 7cadcb06c..f703d2ce2 100644
--- a/xorg-server/miext/damage/Makefile.in
+++ b/xorg-server/miext/damage/Makefile.in
@@ -150,6 +150,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -281,6 +282,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/miext/rootless/Makefile.in b/xorg-server/miext/rootless/Makefile.in
index 60288a06b..3151f340b 100644
--- a/xorg-server/miext/rootless/Makefile.in
+++ b/xorg-server/miext/rootless/Makefile.in
@@ -125,6 +125,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -256,6 +257,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/miext/shadow/Makefile.in b/xorg-server/miext/shadow/Makefile.in
index a920666b0..0ae5748d0 100644
--- a/xorg-server/miext/shadow/Makefile.in
+++ b/xorg-server/miext/shadow/Makefile.in
@@ -155,6 +155,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -286,6 +287,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/os/Makefile.in b/xorg-server/os/Makefile.in
index 542e24340..1e41399ca 100644
--- a/xorg-server/os/Makefile.in
+++ b/xorg-server/os/Makefile.in
@@ -149,6 +149,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -280,6 +281,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/randr/Makefile.in b/xorg-server/randr/Makefile.in
index d3e3390b0..39a29d714 100644
--- a/xorg-server/randr/Makefile.in
+++ b/xorg-server/randr/Makefile.in
@@ -159,6 +159,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -290,6 +291,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/record/Makefile.in b/xorg-server/record/Makefile.in
index 363455a7f..6da3bfeef 100644
--- a/xorg-server/record/Makefile.in
+++ b/xorg-server/record/Makefile.in
@@ -124,6 +124,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -255,6 +256,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/render/Makefile.in b/xorg-server/render/Makefile.in
index b221ab8cd..42b8de705 100644
--- a/xorg-server/render/Makefile.in
+++ b/xorg-server/render/Makefile.in
@@ -153,6 +153,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -284,6 +285,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/test/Makefile.in b/xorg-server/test/Makefile.in
index 782a11ec0..474d29caa 100644
--- a/xorg-server/test/Makefile.in
+++ b/xorg-server/test/Makefile.in
@@ -195,6 +195,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -326,6 +327,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/test/xi2/Makefile.in b/xorg-server/test/xi2/Makefile.in
index ec6d86e7b..2daf7a40c 100644
--- a/xorg-server/test/xi2/Makefile.in
+++ b/xorg-server/test/xi2/Makefile.in
@@ -262,6 +262,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -393,6 +394,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/xfixes/Makefile.in b/xorg-server/xfixes/Makefile.in
index b04317732..e8a819f8a 100644
--- a/xorg-server/xfixes/Makefile.in
+++ b/xorg-server/xfixes/Makefile.in
@@ -151,6 +151,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -282,6 +283,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@
diff --git a/xorg-server/xkb/Makefile.in b/xorg-server/xkb/Makefile.in
index 27420e6e7..5e75b5ff5 100644
--- a/xorg-server/xkb/Makefile.in
+++ b/xorg-server/xkb/Makefile.in
@@ -160,6 +160,7 @@ DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
DEFS = @DEFS@
@@ -291,6 +292,8 @@ RANLIB = @RANLIB@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SHA1_CFLAGS = @SHA1_CFLAGS@