summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2007-03-28 08:08:04 -0700
committerIan Romanick <idr@us.ibm.com>2007-03-28 08:08:04 -0700
commit2c6d47108880584f1221ff86c6c8947627f9f607 (patch)
tree64a042f58df056433c430fb0c99735d9e8c0904d
parentc4fe1bcce1c1e4822e688959b331b47a051d6e0a (diff)
parent85220446359a75ea2c359b418b4051c04eea739c (diff)
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into pci-rework
Conflicts: hw/xfree86/Makefile.am hw/xfree86/dri/dri.c
-rw-r--r--GL/Makefile.am12
-rw-r--r--GL/apple/Makefile.am15
-rw-r--r--GL/apple/indirect.c2144
-rw-r--r--GL/glx/glxbyteorder.h5
-rw-r--r--GL/glx/glxcmdsswap.c4
-rw-r--r--GL/glx/glxdri.c1
-rw-r--r--GL/mesa/main/Makefile.am1
-rw-r--r--GL/mesa/shader/Makefile.am13
-rw-r--r--GL/mesa/shader/slang/Makefile.am22
-rw-r--r--GL/mesa/swrast/Makefile.am3
-rw-r--r--GL/mesa/tnl/Makefile.am1
-rw-r--r--Xext/appgroup.c52
-rw-r--r--Xext/appgroup.h22
-rw-r--r--Xext/panoramiX.c48
-rw-r--r--Xext/panoramiX.h12
-rw-r--r--Xext/panoramiXh.h5
-rw-r--r--Xext/panoramiXsrv.h3
-rw-r--r--Xext/saver.c4
-rw-r--r--Xext/security.c3
-rw-r--r--Xext/securitysrv.h9
-rw-r--r--Xext/shm.c23
-rw-r--r--Xext/xace.c4
-rw-r--r--Xext/xace.h10
-rw-r--r--Xext/xevie.c4
-rw-r--r--Xext/xtest.c2
-rw-r--r--Xi/chgfctl.c261
-rw-r--r--Xi/chgfctl.h42
-rw-r--r--Xi/chgptr.h8
-rw-r--r--Xi/closedev.c92
-rw-r--r--Xi/closedev.h10
-rw-r--r--Xi/exevents.c58
-rw-r--r--Xi/exglobals.h2
-rw-r--r--Xi/extinit.c384
-rw-r--r--Xi/getdctl.c213
-rw-r--r--Xi/getdctl.h24
-rw-r--r--Xi/getfctl.c198
-rw-r--r--Xi/getfctl.h30
-rw-r--r--Xi/listdev.c224
-rw-r--r--Xi/listdev.h38
-rw-r--r--afb/afb.h124
-rw-r--r--afb/afbbitblt.c146
-rw-r--r--afb/afbcmap.c18
-rw-r--r--afb/afbgc.c266
-rw-r--r--afb/afbimage.c31
-rw-r--r--afb/afbpixmap.c14
-rw-r--r--afb/afbscrinit.c50
-rw-r--r--afb/afbsetsp.c18
-rw-r--r--cfb/cfbpixmap.c4
-rw-r--r--composite/compalloc.c2
-rw-r--r--composite/compext.c40
-rw-r--r--composite/compinit.c2
-rw-r--r--composite/compint.h15
-rw-r--r--config/config.c6
-rw-r--r--configure.ac220
-rwxr-xr-xdamageext/damageext.c18
-rw-r--r--damageext/damageextint.h14
-rw-r--r--dbe/dbe.c31
-rw-r--r--dbe/dbestruct.h5
-rw-r--r--dbe/midbe.c25
-rw-r--r--dix/atom.c8
-rw-r--r--dix/colormap.c56
-rw-r--r--dix/cursor.c8
-rw-r--r--dix/devices.c86
-rw-r--r--dix/dispatch.c305
-rw-r--r--dix/dixfonts.c7
-rw-r--r--dix/dixutils.c16
-rw-r--r--dix/events.c192
-rw-r--r--dix/extension.c95
-rw-r--r--dix/gc.c81
-rw-r--r--dix/getevents.c2
-rw-r--r--dix/glyphcurs.c8
-rw-r--r--dix/grabs.c8
-rw-r--r--dix/main.c6
-rw-r--r--dix/pixmap.c4
-rw-r--r--dix/privates.c8
-rw-r--r--dix/property.c6
-rw-r--r--dix/resource.c70
-rw-r--r--dix/swaprep.c199
-rw-r--r--dix/swapreq.c276
-rw-r--r--dix/window.c320
-rw-r--r--doc/Makefile.am16
-rw-r--r--doc/SecurityPolicy.man.pre258
-rw-r--r--doc/Xserver.man.pre221
-rw-r--r--exa/exa.c4
-rw-r--r--fb/fbpixmap.c4
-rw-r--r--hw/Makefile.am13
-rw-r--r--hw/darwin/Makefile.am387
-rw-r--r--hw/darwin/README.apple35
-rw-r--r--hw/darwin/apple/English.lproj/InfoPlist.stringsbin0 -> 276 bytes
-rw-r--r--hw/darwin/apple/English.lproj/main.nib/.svn/entries65
-rw-r--r--hw/darwin/apple/English.lproj/main.nib/.svn/format1
-rw-r--r--hw/darwin/apple/English.lproj/main.nib/.svn/prop-base/keyedobjects.nib.svn-base5
-rw-r--r--hw/darwin/apple/English.lproj/main.nib/.svn/text-base/classes.nib.svn-base318
-rw-r--r--hw/darwin/apple/English.lproj/main.nib/.svn/text-base/info.nib.svn-base18
-rw-r--r--hw/darwin/apple/English.lproj/main.nib/.svn/text-base/keyedobjects.nib.svn-basebin0 -> 30865 bytes
-rw-r--r--hw/darwin/apple/English.lproj/main.nib/classes.nib318
-rw-r--r--hw/darwin/apple/English.lproj/main.nib/info.nib18
-rw-r--r--hw/darwin/apple/English.lproj/main.nib/keyedobjects.nibbin0 -> 30865 bytes
-rw-r--r--hw/darwin/apple/Info.plist71
-rw-r--r--hw/darwin/apple/X11.icnsbin0 -> 28104 bytes
-rw-r--r--hw/darwin/apple/X11.xcodeproj/project.pbxproj320
-rw-r--r--hw/darwin/apple/X11Application.h104
-rw-r--r--hw/darwin/apple/X11Application.m926
-rw-r--r--hw/darwin/apple/X11Controller.h86
-rw-r--r--hw/darwin/apple/X11Controller.m752
-rw-r--r--hw/darwin/apple/Xquartz.man158
-rw-r--r--hw/darwin/apple/bundle-main.c912
-rw-r--r--hw/darwin/bundle/Dutch.lproj/Makefile.am35
-rw-r--r--hw/darwin/bundle/English.lproj/Makefile.am35
-rw-r--r--hw/darwin/bundle/French.lproj/Makefile.am38
-rw-r--r--hw/darwin/bundle/German.lproj/Makefile.am36
-rw-r--r--hw/darwin/bundle/Info.plist66
-rw-r--r--hw/darwin/bundle/Japanese.lproj/Makefile.am37
-rw-r--r--hw/darwin/bundle/Makefile.am38
-rw-r--r--hw/darwin/bundle/Portuguese.lproj/Makefile.am36
-rw-r--r--hw/darwin/bundle/Spanish.lproj/Makefile.am36
-rw-r--r--hw/darwin/bundle/Swedish.lproj/Makefile.am36
-rw-r--r--hw/darwin/bundle/ko.lproj/Makefile.am37
-rw-r--r--hw/darwin/darwin.c14
-rw-r--r--hw/darwin/darwin.h5
-rw-r--r--hw/darwin/darwinEvents.c352
-rw-r--r--hw/darwin/darwinKeyboard.c2
-rw-r--r--hw/darwin/darwinKeyboard.h2
-rw-r--r--hw/darwin/iokit/Makefile.am17
-rw-r--r--hw/darwin/iokit/xfIOKit.c5
-rw-r--r--hw/darwin/iokit/xfIOKitCursor.c5
-rw-r--r--hw/darwin/iokit/xfIOKitStartup.c11
-rw-r--r--hw/darwin/quartz/Makefile.am54
-rw-r--r--hw/darwin/quartz/Preferences.m6
-rw-r--r--hw/darwin/quartz/XDarwin.pbproj/project.pbxproj2
-rw-r--r--hw/darwin/quartz/XDarwinStartup.c4
-rw-r--r--hw/darwin/quartz/XServer.m18
-rw-r--r--hw/darwin/quartz/applewm.c27
-rw-r--r--hw/darwin/quartz/cr/XView.m4
-rw-r--r--hw/darwin/quartz/cr/crAppleWM.m14
-rw-r--r--hw/darwin/quartz/cr/crFrame.m10
-rw-r--r--hw/darwin/quartz/cr/crScreen.m18
-rw-r--r--hw/darwin/quartz/fullscreen/fullscreen.c10
-rw-r--r--hw/darwin/quartz/fullscreen/quartzCursor.c8
-rw-r--r--hw/darwin/quartz/pseudoramiX.c4
-rw-r--r--hw/darwin/quartz/quartz.c12
-rw-r--r--hw/darwin/quartz/quartzAudio.c5
-rw-r--r--hw/darwin/quartz/quartzCocoa.m3
-rw-r--r--hw/darwin/quartz/quartzCursor.c5
-rw-r--r--hw/darwin/quartz/quartzCursor.h1
-rw-r--r--hw/darwin/quartz/quartzKeyboard.c5
-rw-r--r--hw/darwin/quartz/quartzPasteboard.c3
-rw-r--r--hw/darwin/quartz/quartzStartup.c87
-rw-r--r--hw/darwin/quartz/xpr/appledri.c3
-rw-r--r--hw/darwin/quartz/xpr/appledri.h107
-rw-r--r--hw/darwin/quartz/xpr/appledristr.h176
-rw-r--r--hw/darwin/quartz/xpr/dri.c3
-rw-r--r--hw/darwin/quartz/xpr/x-hash.c4
-rw-r--r--hw/darwin/quartz/xpr/x-hook.c4
-rw-r--r--hw/darwin/quartz/xpr/x-list.c4
-rw-r--r--hw/darwin/quartz/xpr/xprAppleWM.c7
-rw-r--r--hw/darwin/quartz/xpr/xprCursor.c6
-rw-r--r--hw/darwin/quartz/xpr/xprFrame.c6
-rw-r--r--hw/darwin/quartz/xpr/xprScreen.c27
-rw-r--r--hw/darwin/utils/Makefile.am11
-rw-r--r--hw/dmx/dmxclient.h4
-rw-r--r--hw/dmx/dmxpixmap.c4
-rw-r--r--hw/dmx/dmxscrinit.c6
-rw-r--r--hw/kdrive/ephyr/ephyr.c2
-rw-r--r--hw/kdrive/ephyr/ephyrinit.c2
-rw-r--r--hw/kdrive/ephyr/hostx.c6
-rw-r--r--hw/kdrive/ephyr/hostx.h2
-rw-r--r--hw/kdrive/src/kinput.c27
-rw-r--r--hw/xfree86/Makefile.am18
-rw-r--r--hw/xfree86/common/xf86Bus.c31
-rw-r--r--hw/xfree86/common/xf86Bus.h3
-rw-r--r--hw/xfree86/common/xf86Config.c30
-rw-r--r--hw/xfree86/common/xf86Config.h1
-rw-r--r--hw/xfree86/common/xf86Configure.c2
-rw-r--r--hw/xfree86/common/xf86DGA.c180
-rw-r--r--hw/xfree86/common/xf86Events.c4
-rw-r--r--hw/xfree86/common/xf86Globals.c1
-rw-r--r--hw/xfree86/common/xf86Helper.c13
-rw-r--r--hw/xfree86/common/xf86Init.c1
-rw-r--r--hw/xfree86/common/xf86Mode.c10
-rw-r--r--hw/xfree86/common/xf86Priv.h2
-rw-r--r--hw/xfree86/common/xf86XKB.c2
-rw-r--r--hw/xfree86/common/xf86Xinput.c46
-rw-r--r--hw/xfree86/common/xf86Xinput.h8
-rw-r--r--hw/xfree86/common/xf86fbman.c2
-rw-r--r--hw/xfree86/common/xf86xv.c2
-rw-r--r--hw/xfree86/ddc/Makefile.am8
-rw-r--r--hw/xfree86/ddc/ddcProperty.c1
-rw-r--r--hw/xfree86/ddc/xf86DDC.c49
-rw-r--r--hw/xfree86/dixmods/Makefile.am19
-rw-r--r--hw/xfree86/dixmods/extmod/dgaproc.h5
-rw-r--r--hw/xfree86/dixmods/glxmodule.c4
-rw-r--r--hw/xfree86/dixmods/xkbKillSrv.c2
-rw-r--r--hw/xfree86/dixmods/xkbPrivate.c2
-rw-r--r--hw/xfree86/dixmods/xkbVT.c2
-rw-r--r--hw/xfree86/doc/README.modes474
-rw-r--r--hw/xfree86/doc/man/xorg.conf.man.pre79
-rw-r--r--hw/xfree86/dri/dri.c137
-rw-r--r--hw/xfree86/dri/dri.h5
-rw-r--r--hw/xfree86/dri/dristruct.h3
-rw-r--r--hw/xfree86/i2c/Makefile.am5
-rw-r--r--hw/xfree86/i2c/uda1380_module.c2
-rw-r--r--hw/xfree86/i2c/xf86i2cmodule.c36
-rw-r--r--hw/xfree86/loader/Makefile.am3
-rw-r--r--hw/xfree86/loader/dixsym.c4
-rw-r--r--hw/xfree86/loader/loader.c116
-rw-r--r--hw/xfree86/loader/loaderProcs.h4
-rw-r--r--hw/xfree86/loader/loadmod.c123
-rw-r--r--hw/xfree86/loader/misym.c3
-rw-r--r--hw/xfree86/loader/xf86sym.c94
-rw-r--r--hw/xfree86/modes/Makefile.am29
-rw-r--r--hw/xfree86/modes/xf86Crtc.c2040
-rw-r--r--hw/xfree86/modes/xf86Crtc.h740
-rw-r--r--hw/xfree86/modes/xf86Cursors.c607
-rw-r--r--hw/xfree86/modes/xf86DiDGA.c286
-rw-r--r--hw/xfree86/modes/xf86EdidModes.c490
-rw-r--r--hw/xfree86/modes/xf86Modes.c664
-rw-r--r--hw/xfree86/modes/xf86Modes.h98
-rw-r--r--hw/xfree86/modes/xf86RandR12.c1088
-rw-r--r--hw/xfree86/modes/xf86RandR12.h37
-rw-r--r--hw/xfree86/modes/xf86Rename.h84
-rw-r--r--hw/xfree86/modes/xf86Rotate.c464
-rw-r--r--hw/xfree86/modes/xf86cvt.c308
-rw-r--r--hw/xfree86/os-support/bus/axpPci.c5
-rw-r--r--hw/xfree86/os-support/shared/libc_wrapper.c2
-rw-r--r--hw/xfree86/os-support/solaris/Makefile.am4
-rw-r--r--hw/xfree86/os-support/solaris/sun_apm.c232
-rw-r--r--hw/xfree86/os-support/xf86_OSlib.h2
-rw-r--r--hw/xfree86/parser/DRI.c31
-rw-r--r--hw/xfree86/parser/Flags.c9
-rw-r--r--hw/xfree86/parser/Layout.c38
-rw-r--r--hw/xfree86/parser/Makefile.am4
-rw-r--r--hw/xfree86/parser/Module.c2
-rw-r--r--hw/xfree86/parser/Monitor.c32
-rw-r--r--hw/xfree86/parser/Screen.c2
-rw-r--r--hw/xfree86/parser/Vendor.c15
-rw-r--r--hw/xfree86/parser/Video.c34
-rw-r--r--hw/xfree86/parser/configProcs.h16
-rw-r--r--hw/xfree86/parser/read.c38
-rw-r--r--hw/xfree86/parser/scan.c16
-rw-r--r--hw/xfree86/parser/xf86Parser.h1
-rw-r--r--hw/xfree86/ramdac/Makefile.am6
-rw-r--r--hw/xfree86/ramdac/xf86Cursor.c3
-rw-r--r--hw/xfree86/ramdac/xf86Cursor.h3
-rw-r--r--hw/xfree86/ramdac/xf86RamDacMod.c46
-rw-r--r--hw/xfree86/x86emu/prim_ops.c4
-rw-r--r--hw/xfree86/xaa/Makefile.am1
-rw-r--r--hw/xfree86/xaa/xaaInit.c8
-rw-r--r--hw/xfree86/xf4bpp/Makefile.am1
-rw-r--r--hw/xfree86/xf4bpp/offscreen.c19
-rw-r--r--hw/xfree86/xf4bpp/ppcGC.c9
-rw-r--r--hw/xfree86/xf4bpp/ppcPixmap.c4
-rw-r--r--hw/xfree86/xf4bpp/ppcPolyRec.c130
-rw-r--r--hw/xfree86/xf4bpp/xf4bpp.h8
-rw-r--r--hw/xgl/egl/kinput.c2
-rw-r--r--hw/xgl/glx/xglx.c2
-rw-r--r--hw/xnest/Display.c2
-rw-r--r--hw/xnest/Keyboard.c2
-rw-r--r--hw/xnest/Pixmap.c6
-rw-r--r--hw/xnest/Screen.c6
-rw-r--r--hw/xnest/XNPixmap.h7
-rw-r--r--hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.am10
-rw-r--r--hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.am10
-rw-r--r--hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am7
-rw-r--r--hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Bold.pmf (renamed from hw/xprint/config/C/print/models/PSdefault/fonts/NewCenturySchlbk-Bold.pmf)bin6644 -> 6644 bytes
-rw-r--r--hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-BoldItal.pmf (renamed from hw/xprint/config/C/print/models/PSdefault/fonts/NewCenturySchlbk-BoldItalic.pmf)bin6656 -> 6656 bytes
-rw-r--r--hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Ital.pmf (renamed from hw/xprint/config/C/print/models/PSdefault/fonts/NewCenturySchlbk-Italic.pmf)bin6652 -> 6652 bytes
-rw-r--r--hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Roman.pmf (renamed from hw/xprint/config/C/print/models/PSdefault/fonts/NewCenturySchlbk-Roman.pmf)bin6648 -> 6648 bytes
-rw-r--r--hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.am2
-rw-r--r--hw/xwin/InitOutput.c2
-rw-r--r--hw/xwin/winconfig.c2
-rw-r--r--hw/xwin/winkeybd.c2
-rw-r--r--include/dix-config.h.in15
-rw-r--r--include/dix.h75
-rw-r--r--include/exevents.h16
-rw-r--r--include/extinit.h119
-rw-r--r--include/extnsionst.h35
-rw-r--r--include/gc.h5
-rw-r--r--include/globals.h4
-rw-r--r--include/inputstr.h2
-rw-r--r--include/os.h14
-rw-r--r--include/pixmapstr.h2
-rw-r--r--include/screenint.h4
-rw-r--r--include/scrnintstr.h2
-rw-r--r--include/swaprep.h18
-rw-r--r--include/window.h19
-rw-r--r--include/windowstr.h6
-rw-r--r--include/xkbsrv.h1022
-rw-r--r--include/xorg-server.h.in12
-rw-r--r--mfb/mfbpixmap.c4
-rw-r--r--mi/mi.h54
-rw-r--r--mi/miarc.c111
-rw-r--r--mi/mibitblt.c22
-rw-r--r--mi/mibstore.c62
-rw-r--r--mi/micmap.c18
-rw-r--r--mi/midash.c193
-rw-r--r--mi/mieq.c24
-rw-r--r--mi/miexpose.c32
-rw-r--r--mi/mifillarc.c70
-rw-r--r--mi/mifillarc.h24
-rw-r--r--mi/mifillrct.c20
-rw-r--r--mi/mifpolycon.c8
-rw-r--r--mi/miglblt.c20
-rw-r--r--mi/miinitext.c27
-rw-r--r--mi/miline.h2
-rw-r--r--mi/mioverlay.c14
-rw-r--r--mi/mipointer.c73
-rw-r--r--mi/mipointer.h15
-rw-r--r--mi/mipoly.c8
-rw-r--r--mi/mipoly.h8
-rw-r--r--mi/mipolycon.c8
-rw-r--r--mi/mipolygen.c12
-rw-r--r--mi/mipolypnt.c2
-rw-r--r--mi/mipolytext.c51
-rw-r--r--mi/mipolyutil.c52
-rw-r--r--mi/mipushpxl.c10
-rw-r--r--mi/miregion.c327
-rw-r--r--mi/miscrinit.c14
-rw-r--r--mi/mispans.c82
-rw-r--r--mi/mispans.h16
-rw-r--r--mi/misprite.c10
-rw-r--r--mi/mivaltree.c30
-rw-r--r--mi/miwideline.c245
-rw-r--r--mi/miwideline.h42
-rw-r--r--mi/miwindow.c48
-rw-r--r--mi/mizerarc.c32
-rw-r--r--mi/mizerarc.h6
-rw-r--r--miext/Makefile.am3
-rw-r--r--miext/cw/cw.c24
-rw-r--r--miext/cw/cw.h4
-rwxr-xr-xmiext/damage/damage.c28
-rwxr-xr-xmiext/damage/damagestr.h6
-rw-r--r--miext/rootless/Makefile.am29
-rw-r--r--miext/rootless/accel/Makefile.am18
-rw-r--r--miext/rootless/accel/rlBlt.c1
-rw-r--r--miext/rootless/rootlessCommon.c3
-rw-r--r--miext/rootless/rootlessGC.c1
-rw-r--r--miext/rootless/rootlessValTree.c1
-rw-r--r--miext/rootless/rootlessWindow.c6
-rw-r--r--miext/rootless/safeAlpha/Makefile.am12
-rw-r--r--miext/rootless/safeAlpha/safeAlphaPicture.c6
-rw-r--r--miext/rootless/safeAlpha/safeAlphaWindow.c4
-rw-r--r--os/access.c6
-rw-r--r--os/auth.c20
-rw-r--r--os/connection.c12
-rw-r--r--os/io.c23
-rw-r--r--os/osdep.h14
-rw-r--r--os/utils.c15
-rw-r--r--os/xdmcp.c72
-rw-r--r--randr/mirandr.c28
-rw-r--r--randr/randr.c2
-rw-r--r--randr/randrstr.h66
-rw-r--r--randr/rrcrtc.c212
-rw-r--r--randr/rrdispatch.c7
-rw-r--r--randr/rrinfo.c17
-rw-r--r--randr/rrmode.c217
-rw-r--r--randr/rroutput.c152
-rw-r--r--randr/rrpointer.c2
-rw-r--r--randr/rrproperty.c186
-rw-r--r--randr/rrscreen.c78
-rw-r--r--record/set.c8
-rw-r--r--render/animcur.c4
-rw-r--r--render/glyph.c6
-rw-r--r--render/glyphstr.h2
-rw-r--r--render/picture.c2
-rwxr-xr-xxfixes/cursor.c3
-rwxr-xr-xxfixes/select.c4
-rwxr-xr-xxfixes/xfixes.c8
-rwxr-xr-xxfixes/xfixesint.h3
-rw-r--r--xkb/Makefile.am3
-rw-r--r--xkb/XKBAlloc.c157
-rw-r--r--xkb/XKBGAlloc.c2
-rw-r--r--xkb/XKBMAlloc.c82
-rw-r--r--xkb/XKBMisc.c183
-rw-r--r--xkb/ddxBeep.c2
-rw-r--r--xkb/ddxCtrls.c2
-rw-r--r--xkb/ddxDevBtn.c2
-rw-r--r--xkb/ddxFakeBtn.c2
-rw-r--r--xkb/ddxFakeMtn.c2
-rw-r--r--xkb/ddxInit.c2
-rw-r--r--xkb/ddxKeyClick.c2
-rw-r--r--xkb/ddxKillSrv.c2
-rw-r--r--xkb/ddxLEDs.c4
-rw-r--r--xkb/ddxList.c2
-rw-r--r--xkb/ddxLoad.c8
-rw-r--r--xkb/ddxPrivate.c2
-rw-r--r--xkb/ddxVT.c2
-rw-r--r--xkb/maprules.c2
-rw-r--r--xkb/xkb.c63
-rw-r--r--xkb/xkb.h42
-rw-r--r--xkb/xkbAccessX.c8
-rw-r--r--xkb/xkbActions.c8
-rw-r--r--xkb/xkbDflts.h37
-rw-r--r--xkb/xkbEvents.c46
-rw-r--r--xkb/xkbInit.c26
-rw-r--r--xkb/xkbLEDs.c453
-rw-r--r--xkb/xkbPrKeyEv.c2
-rw-r--r--xkb/xkbSwap.c2
-rw-r--r--xkb/xkbUtils.c64
-rw-r--r--xkb/xkberrs.c31
-rw-r--r--xkb/xkbfmisc.c109
-rw-r--r--xkb/xkbout.c126
-rw-r--r--xkb/xkbtext.c96
-rw-r--r--xkb/xkmread.c14
404 files changed, 20687 insertions, 8022 deletions
diff --git a/GL/Makefile.am b/GL/Makefile.am
index b9337ba69..df9f533e2 100644
--- a/GL/Makefile.am
+++ b/GL/Makefile.am
@@ -1,16 +1,16 @@
-SUBDIRS = glx mesa
-
# someone could get really crazy someday and add support for the SI...
# xwin/darwin/xfree86 have their accel support under the DDX
-APPLE_EXTRAS = \
- apple/aglGlx.c \
- apple/indirect.c
+if BUILD_DARWIN
+DARWIN_SUBDIRS = apple
+endif
+SUBDIRS = glx mesa $(DARWIN_SUBDIRS)
+
WINDOWS_EXTRAS = \
windows/ChangeLog \
windows/glwindows.h \
windows/glwrap.c \
windows/indirect.c
-EXTRA_DIST = symlink-mesa.sh $(APPLE_EXTRAS) $(WINDOWS_EXTRAS)
+EXTRA_DIST = symlink-mesa.sh $(WINDOWS_EXTRAS)
diff --git a/GL/apple/Makefile.am b/GL/apple/Makefile.am
new file mode 100644
index 000000000..2b2d10cbc
--- /dev/null
+++ b/GL/apple/Makefile.am
@@ -0,0 +1,15 @@
+AM_CFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/hw/darwin/quartz \
+ -I$(top_srcdir)/GL/glx \
+ -I$(top_srcdir)/hw/darwin/quartz/cr \
+ -I$(top_srcdir)/GL/include
+
+if HAVE_AGL_FRAMEWORK
+noinst_LIBRARIES = libAGLcore.a
+libAGLcore_a_SOURCES = aglGlx.c \
+ $(top_srcdir)/hw/darwin/quartz/xpr/x-list.c \
+ $(top_srcdir)/hw/darwin/quartz/xpr/x-list.h \
+ $(top_srcdir)/hw/darwin/quartz/xpr/x-hash.c \
+ $(top_srcdir)/hw/darwin/quartz/xpr/x-hash.h \
+ $(top_srcdir)/hw/dmx/glxProxy/compsize.c
+endif
diff --git a/GL/apple/indirect.c b/GL/apple/indirect.c
index 8cba1c63d..ba541862e 100644
--- a/GL/apple/indirect.c
+++ b/GL/apple/indirect.c
@@ -1,11 +1,10 @@
/*
* GLX implementation that uses Apple's OpenGL.framework
* (Indirect rendering path)
- */
-/*
- * Copyright (c) 2002 Greg Parker. All Rights Reserved.
- * Copyright (c) 2002 Apple Computer, Inc.
+ *
+ * Copyright (c) 2007 Apple Inc.
* Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved.
+ * Copyright (c) 2002 Greg Parker. All Rights Reserved.
*
* Portions of this file are copied from Mesa's xf86glx.c,
* which contains the following copyright:
@@ -39,11 +38,12 @@
#include "dri.h"
#include "quartz.h"
-#include <CoreGraphics/CoreGraphics.h>
+//#include <CoreGraphics/CoreGraphics.h>
#include <OpenGL/OpenGL.h>
#include <OpenGL/CGLContext.h>
// X11 and X11's glx
+#include <GL/gl.h>
#include <miscstruct.h>
#include <windowstr.h>
#include <resource.h>
@@ -61,11 +61,16 @@
#include "x-hash.h"
#include "x-list.h"
+#include <dispatch.h>
+
#include "glcontextmodes.h"
+#include <glapi.h>
+#include <glapitable.h>
// ggs: needed to call back to glx with visual configs
extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs);
+#define GLAQUA_DEBUG 1
// Write debugging output, or not
#ifdef GLAQUA_DEBUG
@@ -74,182 +79,163 @@ extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void *
#define GLAQUA_DEBUG_MSG(a, ...)
#endif
-
-// The following GL functions don't have an EXT suffix in OpenGL.framework.
-GLboolean glAreTexturesResidentEXT(GLsizei a, const GLuint *b, GLboolean *c) {
- return glAreTexturesResident(a, b, c);
-}
-void glDeleteTexturesEXT(GLsizei d, const GLuint *e) {
- glDeleteTextures(d, e);
-}
-void glGenTexturesEXT(GLsizei f, GLuint *g) {
- glGenTextures(f, g);
-}
-GLboolean glIsTextureEXT(GLuint h) {
- return glIsTexture(h);
-}
+static void setup_dispatch_table(void);
// some prototypes
-static Bool glAquaScreenProbe(int screen);
+static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen);
static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
int *nvisualp, int *ndepthp,
int *rootDepthp, VisualID *defaultVisp,
unsigned long sizes, int bitsPerRGB);
static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
void **privates);
+
static __GLinterface *glAquaCreateContext(__GLimports *imports,
__GLcontextModes *mode,
__GLinterface *shareGC);
-static void glAquaCreateBuffer(__GLXdrawablePrivate *glxPriv);
static void glAquaResetExtension(void);
-
-/*
- * This structure is statically allocated in the __glXScreens[]
- * structure. This struct is not used anywhere other than in
- * __glXScreenInit to initialize each of the active screens
- * (__glXActiveScreens[]). Several of the fields must be initialized by
- * the screenProbe routine before they are copied to the active screens
- * struct. In particular, the contextCreate, modes, numVisuals,
- * and numUsableVisuals fields must be initialized.
- */
-static __GLXscreenInfo __glDDXScreenInfo = {
- glAquaScreenProbe, /* Must be generic and handle all screens */
- glAquaCreateContext, /* Substitute screen's createContext routine */
- glAquaCreateBuffer, /* Substitute screen's createBuffer routine */
- NULL, /* Set up modes in probe */
- NULL, /* Set up pVisualPriv in probe */
- 0, /* Set up numVisuals in probe */
- 0, /* Set up numUsableVisuals in probe */
- "Vendor String", /* GLXvendor is overwritten by __glXScreenInit */
- "Version String", /* GLXversion is overwritten by __glXScreenInit */
- "Extensions String", /* GLXextensions is overwritten by __glXScreenInit */
- NULL /* WrappedPositionWindow is overwritten */
-};
-
-void *__glXglDDXScreenInfo(void) {
- return &__glDDXScreenInfo;
-}
-
-static __GLXextensionInfo __glDDXExtensionInfo = {
- GL_CORE_APPLE,
- glAquaResetExtension,
- glAquaInitVisuals,
- glAquaSetVisualConfigs
+static void __glXAquaContextDestroy(__GLXcontext *baseContext);
+static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext);
+static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext);
+static int __glXAquaContextForceCurrent(__GLXcontext *baseContext);
+static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask);
+static __GLXdrawable * __glXAquaContextCreateDrawable(__GLXcontext *context, DrawablePtr pDraw, XID drawId);
+
+static CGLPixelFormatObj makeFormat(__GLcontextModes *mode);
+
+__GLXprovider __glXMesaProvider = {
+ __glXAquaScreenProbe,
+ "Core OpenGL",
+ NULL
};
-void *__glXglDDXExtensionInfo(void) {
- return &__glDDXExtensionInfo;
+__GLXprovider *
+GlxGetMesaProvider (void)
+{
+ ErrorF("GlxGetMesaProvider\n");
+ return &__glXMesaProvider;
}
-// prototypes
+typedef struct __GLXAquaScreen __GLXAquaScreen;
+typedef struct __GLXAquaContext __GLXAquaContext;
+typedef struct __GLXAquaDrawable __GLXAquaDrawable;
-static GLboolean glAquaDestroyContext(__GLcontext *gc);
-static GLboolean glAquaLoseCurrent(__GLcontext *gc);
-static GLboolean glAquaMakeCurrent(__GLcontext *gc);
-static GLboolean glAquaShareContext(__GLcontext *gc, __GLcontext *gcShare);
-static GLboolean glAquaCopyContext(__GLcontext *dst, const __GLcontext *src,
- GLuint mask);
-static GLboolean glAquaForceCurrent(__GLcontext *gc);
-
-/* Drawing surface notification callbacks */
-static GLboolean glAquaNotifyResize(__GLcontext *gc);
-static void glAquaNotifyDestroy(__GLcontext *gc);
-static void glAquaNotifySwapBuffers(__GLcontext *gc);
-
-/* Dispatch table override control for external agents like libGLS */
-static struct __GLdispatchStateRec* glAquaDispatchExec(__GLcontext *gc);
-static void glAquaBeginDispatchOverride(__GLcontext *gc);
-static void glAquaEndDispatchOverride(__GLcontext *gc);
-
-static __GLexports glAquaExports = {
- glAquaDestroyContext,
- glAquaLoseCurrent,
- glAquaMakeCurrent,
- glAquaShareContext,
- glAquaCopyContext,
- glAquaForceCurrent,
-
- glAquaNotifyResize,
- glAquaNotifyDestroy,
- glAquaNotifySwapBuffers,
-
- glAquaDispatchExec,
- glAquaBeginDispatchOverride,
- glAquaEndDispatchOverride
-};
-
-typedef struct {
+struct __GLXAquaScreen {
+ __GLXscreen base;
+ int index;
int num_vis;
__GLcontextModes *modes;
- void **priv;
+};
- // wrapped screen functions
- RealizeWindowProcPtr RealizeWindow;
- UnrealizeWindowProcPtr UnrealizeWindow;
-} glAquaScreenRec;
+static __GLXAquaScreen glAquaScreens[MAXSCREENS];
-static glAquaScreenRec glAquaScreens[MAXSCREENS];
+struct __GLXAquaContext {
+ __GLXcontext base;
+ CGLContextObj ctx;
+ CGLPixelFormatObj pixelFormat;
+ xp_surface_id sid;
+ unsigned isAttached :1;
+};
-// __GLdrawablePrivate->private
-typedef struct {
+struct __GLXAquaDrawable {
+ __GLXdrawable base;
DrawablePtr pDraw;
xp_surface_id sid;
-} GLAquaDrawableRec;
-
-struct __GLcontextRec {
- struct __GLinterfaceRec interface; // required to be first
-
- CGLContextObj ctx;
- CGLPixelFormatObj pixelFormat;
+};
- /* set when attached */
- xp_surface_id sid;
+static __GLXcontext *
+__glXAquaScreenCreateContext(__GLXscreen *screen,
+ __GLcontextModes *modes,
+ __GLXcontext *baseShareContext)
+{
+ __GLXAquaContext *context;
+ __GLXAquaContext *shareContext = (__GLXAquaContext *) baseShareContext;
+ CGLError gl_err;
+
+ GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n");
+
+ context = malloc (sizeof (__GLXAquaContext));
+ if (context == NULL) return NULL;
+
+ memset(context, 0, sizeof *context);
+
+ context->base.pGlxScreen = screen;
+ context->base.modes = modes;
+
+ context->base.destroy = __glXAquaContextDestroy;
+ context->base.makeCurrent = __glXAquaContextMakeCurrent;
+ context->base.loseCurrent = __glXAquaContextLoseCurrent;
+ context->base.copy = __glXAquaContextCopy;
+ context->base.forceCurrent = __glXAquaContextForceCurrent;
+ context->base.createDrawable = __glXAquaContextCreateDrawable;
+
+ context->pixelFormat = makeFormat(modes);
+ if (!context->pixelFormat) {
+ free(context);
+ return NULL;
+ }
+
+ context->ctx = NULL;
+ gl_err = CGLCreateContext(context->pixelFormat,
+ shareContext ? shareContext->ctx : NULL,
+ &context->ctx);
+
+ if (gl_err != 0) {
+ ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err));
+ CGLDestroyPixelFormat(context->pixelFormat);
+ free(context);
+ return NULL;
+ }
+ setup_dispatch_table();
+ GLAQUA_DEBUG_MSG("glAquaCreateContext done\n");
+ return &context->base;
+}
- unsigned isAttached :1;
+static __GLXextensionInfo __glDDXExtensionInfo = {
+ GL_CORE_APPLE,
+ glAquaResetExtension,
+ glAquaInitVisuals,
+ glAquaSetVisualConfigs
};
+void *__glXglDDXExtensionInfo(void) {
+ GLAQUA_DEBUG_MSG("glXAglDDXExtensionInfo\n");
+ return &__glDDXExtensionInfo;
+}
+
/* maps from surface id -> list of __GLcontext */
static x_hash_table *surface_hash;
-
-// Context manipulation; return GL_FALSE on failure
-static GLboolean glAquaDestroyContext(__GLcontext *gc)
-{
+static void __glXAquaContextDestroy(__GLXcontext *baseContext) {
x_list *lst;
- GLAQUA_DEBUG_MSG("glAquaDestroyContext (ctx 0x%x)\n",
- (unsigned int) gc->ctx);
+ __GLXAquaContext *context = (__GLXAquaContext *) baseContext;
- if (gc != NULL)
- {
- if (gc->sid != 0 && surface_hash != NULL)
- {
- lst = x_hash_table_lookup(surface_hash, (void *) gc->sid, NULL);
- lst = x_list_remove(lst, gc);
- x_hash_table_insert(surface_hash, (void *) gc->sid, lst);
- }
-
- if (gc->ctx != NULL)
- CGLDestroyContext(gc->ctx);
+ GLAQUA_DEBUG_MSG("glAquaContextDestroy (ctx 0x%x)\n",
+ (unsigned int) baseContext);
+ if (context != NULL) {
+ if (context->sid != 0 && surface_hash != NULL) {
+ lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL);
+ lst = x_list_remove(lst, context);
+ x_hash_table_insert(surface_hash, (void *) context->sid, lst);
+ }
- if (gc->pixelFormat != NULL)
- CGLDestroyPixelFormat(gc->pixelFormat);
+ if (context->ctx != NULL) CGLDestroyContext(context->ctx);
- free(gc);
+ if (context->pixelFormat != NULL) CGLDestroyPixelFormat(context->pixelFormat);
+
+ free(context);
}
-
- return GL_TRUE;
}
-static GLboolean glAquaLoseCurrent(__GLcontext *gc)
-{
+static int __glXAquaContextLoseCurrent(__GLXcontext *baseContext) {
CGLError gl_err;
- GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%x)\n", (unsigned int) gc->ctx);
+ GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%p)\n", baseContext);
gl_err = CGLSetCurrentContext(NULL);
if (gl_err != 0)
- ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err));
+ ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err));
__glXLastContext = NULL; // Mesa does this; why?
@@ -258,141 +244,139 @@ static GLboolean glAquaLoseCurrent(__GLcontext *gc)
/* Called when a surface is destroyed as a side effect of destroying
the window it's attached to. */
-static void surface_notify(void *_arg, void *data)
-{
- DRISurfaceNotifyArg *arg = _arg;
- GLAquaDrawableRec *aquaPriv = data;
- __GLcontext *gc;
+static void surface_notify(void *_arg, void *data) {
+ DRISurfaceNotifyArg *arg = (DRISurfaceNotifyArg *)_arg;
+ __GLXAquaDrawable *draw = (__GLXAquaDrawable *)data;
+ __GLXAquaContext *context;
x_list *lst;
-
- switch (arg->kind)
- {
+ if(_arg == NULL || data == NULL) {
+ ErrorF("surface_notify called with bad params");
+ return;
+ }
+
+ GLAQUA_DEBUG_MSG("surface_notify(%p, %p)\n", _arg, data);
+ switch (arg->kind) {
case AppleDRISurfaceNotifyDestroyed:
if (surface_hash != NULL)
x_hash_table_remove(surface_hash, (void *) arg->id);
-
- aquaPriv->pDraw = NULL;
- aquaPriv->sid = 0;
+ draw->base->pDraw = NULL;
+ draw->sid = 0;
break;
case AppleDRISurfaceNotifyChanged:
- if (surface_hash != NULL)
- {
+ if (surface_hash != NULL) {
lst = x_hash_table_lookup(surface_hash, (void *) arg->id, NULL);
for (; lst != NULL; lst = lst->next)
{
- gc = lst->data;
- xp_update_gl_context(gc->ctx);
+ context = lst->data;
+ xp_update_gl_context(context->ctx);
}
}
break;
+ default:
+ ErrorF("surface_notify: unknown kind %d\n", arg->kind);
+ break;
}
}
-static void unattach(__GLcontext *gc)
-{
- x_list *lst;
-
- if (gc->isAttached)
- {
- GLAQUA_DEBUG_MSG("unattaching\n");
-
- if (surface_hash != NULL)
- {
- lst = x_hash_table_lookup(surface_hash, (void *) gc->sid, NULL);
- lst = x_list_remove(lst, gc);
- x_hash_table_insert(surface_hash, (void *) gc->sid, lst);
- }
-
- CGLClearDrawable(gc->ctx);
- gc->isAttached = FALSE;
- gc->sid = 0;
- }
-}
-
-static void attach(__GLcontext *gc, __GLdrawablePrivate *glPriv)
-{
- __GLXdrawablePrivate *glxPriv;
- GLAquaDrawableRec *aquaPriv;
+static void attach(__GLXAquaContext *context, __GLXAquaDrawable *draw) {
DrawablePtr pDraw;
-
- glxPriv = (__GLXdrawablePrivate *)glPriv->other;
- aquaPriv = (GLAquaDrawableRec *)glPriv->private;
- pDraw = glxPriv->pDraw;
-
- if (aquaPriv->sid == 0)
- {
- if (!quartzProcs->CreateSurface(pDraw->pScreen, pDraw->id, pDraw,
- 0, &aquaPriv->sid, NULL,
- surface_notify, aquaPriv))
- {
+ GLAQUA_DEBUG_MSG("attach(%p, %p)\n", context, draw);
+ pDraw = draw->base.pDraw;
+
+ if (draw->sid == 0) {
+// if (!quartzProcs->CreateSurface(pDraw->pScreen, pDraw->id, pDraw,
+ if (!DRICreateSurface(pDraw->pScreen, pDraw->id, pDraw,
+ 0, &draw->sid, NULL,
+ surface_notify, draw))
return;
- }
- aquaPriv->pDraw = pDraw;
- }
+ draw->pDraw = pDraw;
+ }
- if (!gc->isAttached || gc->sid != aquaPriv->sid)
- {
+ if (!context->isAttached || context->sid != draw->sid) {
x_list *lst;
- if (xp_attach_gl_context(gc->ctx, aquaPriv->sid) != Success)
- {
- quartzProcs->DestroySurface(pDraw->pScreen, pDraw->id, pDraw,
- surface_notify, aquaPriv);
+ if (xp_attach_gl_context(context->ctx, draw->sid) != Success) {
+// quartzProcs->DestroySurface(pDraw->pScreen, pDraw->id, pDraw,
+ DRIDestroySurface(pDraw->pScreen, pDraw->id, pDraw,
+ surface_notify, draw);
if (surface_hash != NULL)
- x_hash_table_remove(surface_hash, (void *) aquaPriv->sid);
+ x_hash_table_remove(surface_hash, (void *) draw->sid);
- aquaPriv->sid = 0;
+ draw->sid = 0;
return;
}
- gc->isAttached = TRUE;
- gc->sid = aquaPriv->sid;
+ context->isAttached = TRUE;
+ context->sid = draw->sid;
if (surface_hash == NULL)
surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL);
- lst = x_hash_table_lookup(surface_hash, (void *) gc->sid, NULL);
- if (x_list_find(lst, gc) == NULL)
- {
- lst = x_list_prepend(lst, gc);
- x_hash_table_insert(surface_hash, (void *) gc->sid, lst);
+ lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL);
+ if (x_list_find(lst, context) == NULL) {
+ lst = x_list_prepend(lst, context);
+ x_hash_table_insert(surface_hash, (void *) context->sid, lst);
}
GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", (unsigned int) pDraw->id,
- (unsigned int) aquaPriv->sid);
+ (unsigned int) draw->sid);
+ }
+}
+
+static void unattach(__GLXAquaContext *context) {
+ x_list *lst;
+ GLAQUA_DEBUG_MSG("unattach\n");
+ if (context == NULL) {
+ ErrorF("Tried to unattach a null context\n");
+ return;
+ }
+ if (context->isAttached) {
+ GLAQUA_DEBUG_MSG("unattaching\n");
+
+ if (surface_hash != NULL) {
+ lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL);
+ lst = x_list_remove(lst, context);
+ x_hash_table_insert(surface_hash, (void *) context->sid, lst);
+ }
+
+ CGLClearDrawable(context->ctx);
+ context->isAttached = FALSE;
+ context->sid = 0;
}
}
-static GLboolean glAquaMakeCurrent(__GLcontext *gc)
-{
- __GLdrawablePrivate *glPriv = gc->interface.imports.getDrawablePrivate(gc);
+static int __glXAquaContextMakeCurrent(__GLXcontext *baseContext) {
CGLError gl_err;
+ __GLXAquaContext *context = (__GLXAquaContext *) baseContext;
+ __GLXAquaDrawable *drawPriv = (__GLXAquaDrawable *) context->base.drawPriv;
+ __GLXAquaDrawable *readPriv = (__GLXAquaDrawable *) context->base.readPriv;
- GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%x)\n", (unsigned int) gc->ctx);
-
- attach(gc, glPriv);
+ GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%p)\n", baseContext);
+
+ attach(context, drawPriv);
- gl_err = CGLSetCurrentContext(gc->ctx);
+ gl_err = CGLSetCurrentContext(context->ctx);
if (gl_err != 0)
ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err));
-
+
return gl_err == 0;
}
static GLboolean glAquaShareContext(__GLcontext *gc, __GLcontext *gcShare)
{
GLAQUA_DEBUG_MSG("glAquaShareContext unimplemented\n");
-
return GL_TRUE;
}
-static GLboolean glAquaCopyContext(__GLcontext *dst, const __GLcontext *src,
- GLuint mask)
+static int __glXAquaContextCopy(__GLXcontext *baseDst, __GLXcontext *baseSrc, unsigned long mask)
{
CGLError gl_err;
- GLAQUA_DEBUG_MSG("glAquaCopyContext\n");
+ __GLXAquaContext *dst = (__GLXAquaContext *) baseDst;
+ __GLXAquaContext *src = (__GLXAquaContext *) baseSrc;
+
+ GLAQUA_DEBUG_MSG("GLXAquaContextCopy\n");
gl_err = CGLCopyContext(src->ctx, dst->ctx, mask);
if (gl_err != 0)
@@ -401,14 +385,13 @@ static GLboolean glAquaCopyContext(__GLcontext *dst, const __GLcontext *src,
return gl_err == 0;
}
-static GLboolean glAquaForceCurrent(__GLcontext *gc)
+static int __glXAquaContextForceCurrent(__GLXcontext *baseContext)
{
CGLError gl_err;
+ __GLXAquaContext *context = (__GLXAquaContext *) baseContext;
+ GLAQUA_DEBUG_MSG("glAquaForceCurrent (ctx %p)\n", context->ctx);
- GLAQUA_DEBUG_MSG("glAquaForceCurrent (ctx 0x%x)\n",
- (unsigned int) gc->ctx);
-
- gl_err = CGLSetCurrentContext(gc->ctx);
+ gl_err = CGLSetCurrentContext(context->ctx);
if (gl_err != 0)
ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err));
@@ -417,45 +400,41 @@ static GLboolean glAquaForceCurrent(__GLcontext *gc)
/* Drawing surface notification callbacks */
-static GLboolean glAquaNotifyResize(__GLcontext *gc)
-{
- GLAQUA_DEBUG_MSG("unimplemented glAquaNotifyResize");
+static GLboolean __glXAquaDrawableResize(__GLXdrawable *base) {
+ GLAQUA_DEBUG_MSG("unimplemented glAquaDrawableResize\n");
return GL_TRUE;
}
-static void glAquaNotifyDestroy(__GLcontext *gc)
-{
+static void glAquaNotifyDestroy(__GLcontext *gc) {
GLAQUA_DEBUG_MSG("unimplemented glAquaNotifyDestroy");
}
-static void glAquaNotifySwapBuffers(__GLcontext *gc)
-{
- GLAQUA_DEBUG_MSG("unimplemented glAquaNotifySwapBuffers");
-}
-
-/* Dispatch table override control for external agents like libGLS */
-static struct __GLdispatchStateRec* glAquaDispatchExec(__GLcontext *gc)
-{
- GLAQUA_DEBUG_MSG("unimplemented glAquaDispatchExec");
- return NULL;
-}
-
-static void glAquaBeginDispatchOverride(__GLcontext *gc)
-{
- GLAQUA_DEBUG_MSG("unimplemented glAquaBeginDispatchOverride");
-}
-
-static void glAquaEndDispatchOverride(__GLcontext *gc)
-{
- GLAQUA_DEBUG_MSG("unimplemented glAquaEndDispatchOverride");
+static GLboolean __glXAquaDrawableSwapBuffers(__GLXdrawable *base) {
+ __GLXAquaDrawable *glxPriv = (__GLXAquaDrawable *) base;
+ CGLError gl_err;
+ __GLXAquaContext * drawableCtx;
+// GLAQUA_DEBUG_MSG("glAquaDrawableSwapBuffers(%p)\n",base);
+
+ if(!base) {
+ ErrorF("glXAquaDrawbleSwapBuffers passed NULL\n");
+ return GL_FALSE;
+ }
+
+ drawableCtx = (__GLXAquaContext *)base->drawGlxc;
+
+ if (drawableCtx != NULL && drawableCtx->ctx != NULL) {
+ gl_err = CGLFlushDrawable(drawableCtx->ctx);
+ if (gl_err != 0)
+ ErrorF("CGLFlushDrawable error: %s\n", CGLErrorString(gl_err));
+ }
+ return GL_TRUE;
}
-static CGLPixelFormatObj makeFormat(__GLcontextModes *mode)
-{
+static CGLPixelFormatObj makeFormat(__GLcontextModes *mode) {
int i;
CGLPixelFormatAttribute attr[64]; // currently uses max of 30
CGLPixelFormatObj result;
- long n_formats;
+ GLint n_formats;
CGLError gl_err;
GLAQUA_DEBUG_MSG("makeFormat\n");
@@ -491,10 +470,12 @@ static CGLPixelFormatObj makeFormat(__GLcontextModes *mode)
attr[i++] = mode->accumRedBits + mode->accumGreenBits
+ mode->accumBlueBits + mode->accumAlphaBits;
}
+
if (mode->haveDepthBuffer) {
attr[i++] = kCGLPFADepthSize;
attr[i++] = mode->depthBits;
}
+
if (mode->haveStencilBuffer) {
attr[i++] = kCGLPFAStencilSize;
attr[i++] = mode->stencilBits;
@@ -521,129 +502,6 @@ static CGLPixelFormatObj makeFormat(__GLcontextModes *mode)
return result;
}
-static __GLinterface *glAquaCreateContext(__GLimports *imports,
- __GLcontextModes *mode,
- __GLinterface *shareGC)
-{
- __GLcontext *result;
- __GLcontext *sharectx = (__GLcontext *)shareGC;
- CGLError gl_err;
-
- GLAQUA_DEBUG_MSG("glAquaCreateContext\n");
-
- result = (__GLcontext *)calloc(1, sizeof(__GLcontext));
- if (!result) return NULL;
-
- result->interface.imports = *imports;
- result->interface.exports = glAquaExports;
-
- result->pixelFormat = makeFormat(mode);
- if (!result->pixelFormat) {
- free(result);
- return NULL;
- }
-
- result->ctx = NULL;
- gl_err = CGLCreateContext(result->pixelFormat,
- sharectx ? sharectx->ctx : NULL,
- &result->ctx);
-
- if (gl_err != 0) {
- ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err));
- CGLDestroyPixelFormat(result->pixelFormat);
- free(result);
- return NULL;
- }
-
- GLAQUA_DEBUG_MSG("glAquaCreateContext done\n");
- return (__GLinterface *)result;
-}
-
-Bool
-glAquaRealizeWindow(WindowPtr pWin)
-{
- // If this window has GL contexts, tell them to reattach
- Bool result;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- glAquaScreenRec *screenPriv = &glAquaScreens[pScreen->myNum];
- __GLXdrawablePrivate *glxPriv;
-
- GLAQUA_DEBUG_MSG("glAquaRealizeWindow\n");
-
- // Allow the window to be created (RootlessRealizeWindow is inside our wrap)
- pScreen->RealizeWindow = screenPriv->RealizeWindow;
- result = pScreen->RealizeWindow(pWin);
- pScreen->RealizeWindow = glAquaRealizeWindow;
-
- // The Aqua window will already have been created (windows are
- // realized from top down)
-
- // Re-attach this window's GL contexts, if any.
- glxPriv = __glXFindDrawablePrivate(pWin->drawable.id);
- if (glxPriv) {
- __GLXcontext *gx;
- __GLcontext *gc;
- __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
- GLAQUA_DEBUG_MSG("glAquaRealizeWindow is GL drawable!\n");
-
- // GL contexts bound to this window for drawing
- for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) {
- gc = (__GLcontext *)gx->gc;
- attach(gc, glPriv);
- }
-
- // GL contexts bound to this window for reading
- for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) {
- gc = (__GLcontext *)gx->gc;
- attach(gc, glPriv);
- }
- }
-
- return result;
-}
-
-Bool
-glAquaUnrealizeWindow(WindowPtr pWin)
-{
- // If this window has GL contexts, tell them to unattach
- Bool result;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- glAquaScreenRec *screenPriv = &glAquaScreens[pScreen->myNum];
- __GLXdrawablePrivate *glxPriv;
-
- GLAQUA_DEBUG_MSG("glAquaUnrealizeWindow\n");
-
- // The Aqua window may have already been destroyed (windows
- // are unrealized from top down)
-
- // Unattach this window's GL contexts, if any.
- glxPriv = __glXFindDrawablePrivate(pWin->drawable.id);
- if (glxPriv) {
- __GLXcontext *gx;
- __GLcontext *gc;
- GLAQUA_DEBUG_MSG("glAquaUnealizeWindow is GL drawable!\n");
-
- // GL contexts bound to this window for drawing
- for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) {
- gc = (__GLcontext *)gx->gc;
- unattach(gc);
- }
-
- // GL contexts bound to this window for reading
- for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) {
- gc = (__GLcontext *)gx->gc;
- unattach(gc);
- }
- }
-
- pScreen->UnrealizeWindow = screenPriv->UnrealizeWindow;
- result = pScreen->UnrealizeWindow(pWin);
- pScreen->UnrealizeWindow = glAquaUnrealizeWindow;
-
- return result;
-}
-
-
// Originally copied from Mesa
static int numConfigs = 0;
@@ -821,15 +679,15 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
/* Alloc space for the list of new GLX visuals */
pNewVisualConfigs = (__GLXvisualConfig *)
- __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig));
+ malloc(numNewConfigs * sizeof(__GLXvisualConfig));
if (!pNewVisualConfigs) {
return FALSE;
}
/* Alloc space for the list of new GLX visual privates */
- pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *));
+ pNewVisualPriv = (void **) malloc(numNewConfigs * sizeof(void *));
if (!pNewVisualPriv) {
- __glXFree(pNewVisualConfigs);
+ free(pNewVisualConfigs);
return FALSE;
}
@@ -879,40 +737,40 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
numConfigs = 0;
/* Alloc temp space for the list of orig VisualIDs for each new visual */
- orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID));
+ orig_vid = (VisualID *)malloc(numNewVisuals * sizeof(VisualID));
if (!orig_vid) {
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
return FALSE;
}
/* Alloc space for the list of glXVisuals */
modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes));
if (modes == NULL) {
- __glXFree(orig_vid);
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
+ free(orig_vid);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
return FALSE;
}
/* Alloc space for the list of glXVisualPrivates */
- glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *));
+ glXVisualPriv = (void **)malloc(numNewVisuals * sizeof(void *));
if (!glXVisualPriv) {
_gl_context_modes_destroy( modes );
- __glXFree(orig_vid);
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
+ free(orig_vid);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
return FALSE;
}
/* Alloc space for the new list of the X server's visuals */
- pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec));
+ pVisualNew = (VisualPtr)malloc(numNewVisuals * sizeof(VisualRec));
if (!pVisualNew) {
- __glXFree(glXVisualPriv);
+ free(glXVisualPriv);
_gl_context_modes_destroy( modes );
- __glXFree(orig_vid);
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
+ free(orig_vid);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
return FALSE;
}
@@ -1007,7 +865,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
/* Save the GLX visuals in the screen structure */
glAquaScreens[screenInfo.numScreens-1].num_vis = numNewVisuals;
- glAquaScreens[screenInfo.numScreens-1].priv = glXVisualPriv;
+ // glAquaScreens[screenInfo.numScreens-1].priv = glXVisualPriv;
/* Set up depth's VisualIDs */
for (i = 0; i < ndepth; i++) {
@@ -1022,7 +880,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
numVids++;
/* Allocate a new list of VisualIDs for this depth */
- pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID));
+ pVids = (VisualID *)malloc(numVids * sizeof(VisualID));
/* Initialize the new list of VisualIDs for this depth */
for (j = 0; j < pdepth[i].numVids; j++)
@@ -1031,7 +889,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
pVids[n++] = pVisualNew[k].vid;
/* Update this depth's list of VisualIDs */
- __glXFree(pdepth[i].vids);
+ free(pdepth[i].vids);
pdepth[i].vids = pVids;
pdepth[i].numVids = numVids;
}
@@ -1041,21 +899,22 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
*visualp = pVisualNew;
/* Free the old list of the X server's visuals */
- __glXFree(pVisual);
+ free(pVisual);
/* Clean up temporary allocations */
- __glXFree(orig_vid);
- __glXFree(pNewVisualPriv);
- __glXFree(pNewVisualConfigs);
+ free(orig_vid);
+ free(pNewVisualPriv);
+ free(pNewVisualConfigs);
/* Free the private list created by DDX HW driver */
if (visualPrivates)
- xfree(visualPrivates);
+ free(visualPrivates);
visualPrivates = NULL;
return TRUE;
}
+Bool enable_stereo = FALSE;
/* based on code in i830_dri.c
This ends calling glAquaSetVisualConfigs to set the static
numconfigs, etc. */
@@ -1066,20 +925,22 @@ glAquaInitVisualConfigs(void)
__GLXvisualConfig *lclVisualConfigs = NULL;
void **lclVisualPrivates = NULL;
- int depth, aux, buffers, stencil, accum;
+ int stereo, depth, aux, buffers, stencil, accum;
int i = 0;
GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs ");
/* count num configs:
+ 2 stereo (on, off) (optional)
2 Z buffer (0, 24 bit)
2 AUX buffer (0, 2)
2 buffers (single, double)
2 stencil (0, 8 bit)
2 accum (0, 64 bit)
- = 32 configs */
+ = 64 configs with stereo, or 32 without */
- lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */
+ if (enable_stereo) lclNumConfigs = 2 * 2 * 2 * 2 * 2 * 2; /* 64 */
+ else lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */
/* alloc */
lclVisualConfigs = xcalloc(sizeof(__GLXvisualConfig), lclNumConfigs);
@@ -1088,54 +949,55 @@ glAquaInitVisualConfigs(void)
/* fill in configs */
if (NULL != lclVisualConfigs) {
i = 0; /* current buffer */
- for (depth = 0; depth < 2; depth++) {
+ for (stereo = 0; stereo < (enable_stereo ? 2 : 1); stereo++) {
+ for (depth = 0; depth < 2; depth++) {
for (aux = 0; aux < 2; aux++) {
- for (buffers = 0; buffers < 2; buffers++) {
- for (stencil = 0; stencil < 2; stencil++) {
- for (accum = 0; accum < 2; accum++) {
- lclVisualConfigs[i].vid = -1;
- lclVisualConfigs[i].class = -1;
- lclVisualConfigs[i].rgba = TRUE;
- lclVisualConfigs[i].redSize = -1;
- lclVisualConfigs[i].greenSize = -1;
- lclVisualConfigs[i].blueSize = -1;
- lclVisualConfigs[i].redMask = -1;
- lclVisualConfigs[i].greenMask = -1;
- lclVisualConfigs[i].blueMask = -1;
- lclVisualConfigs[i].alphaMask = 0;
- if (accum) {
- lclVisualConfigs[i].accumRedSize = 16;
- lclVisualConfigs[i].accumGreenSize = 16;
- lclVisualConfigs[i].accumBlueSize = 16;
- lclVisualConfigs[i].accumAlphaSize = 16;
- }
- else {
- lclVisualConfigs[i].accumRedSize = 0;
- lclVisualConfigs[i].accumGreenSize = 0;
- lclVisualConfigs[i].accumBlueSize = 0;
- lclVisualConfigs[i].accumAlphaSize = 0;
- }
- lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE;
- lclVisualConfigs[i].stereo = FALSE;
- lclVisualConfigs[i].bufferSize = -1;
-
- lclVisualConfigs[i].depthSize = depth? 24 : 0;
- lclVisualConfigs[i].stencilSize = stencil ? 8 : 0;
- lclVisualConfigs[i].auxBuffers = aux ? 2 : 0;
- lclVisualConfigs[i].level = 0;
- lclVisualConfigs[i].visualRating = GLX_NONE_EXT;
- lclVisualConfigs[i].transparentPixel = 0;
- lclVisualConfigs[i].transparentRed = 0;
- lclVisualConfigs[i].transparentGreen = 0;
- lclVisualConfigs[i].transparentBlue = 0;
- lclVisualConfigs[i].transparentAlpha = 0;
- lclVisualConfigs[i].transparentIndex = 0;
- i++;
- }
- }
- }
+ for (buffers = 0; buffers < 2; buffers++) {
+ for (stencil = 0; stencil < 2; stencil++) {
+ for (accum = 0; accum < 2; accum++) {
+ lclVisualConfigs[i].vid = -1;
+ lclVisualConfigs[i].class = -1;
+ lclVisualConfigs[i].rgba = TRUE;
+ lclVisualConfigs[i].redSize = -1;
+ lclVisualConfigs[i].greenSize = -1;
+ lclVisualConfigs[i].blueSize = -1;
+ lclVisualConfigs[i].redMask = -1;
+ lclVisualConfigs[i].greenMask = -1;
+ lclVisualConfigs[i].blueMask = -1;
+ lclVisualConfigs[i].alphaMask = 0;
+ if (accum) {
+ lclVisualConfigs[i].accumRedSize = 16;
+ lclVisualConfigs[i].accumGreenSize = 16;
+ lclVisualConfigs[i].accumBlueSize = 16;
+ lclVisualConfigs[i].accumAlphaSize = 16;
+ } else {
+ lclVisualConfigs[i].accumRedSize = 0;
+ lclVisualConfigs[i].accumGreenSize = 0;
+ lclVisualConfigs[i].accumBlueSize = 0;
+ lclVisualConfigs[i].accumAlphaSize = 0;
+ }
+ lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE;
+ lclVisualConfigs[i].stereo = stereo ? TRUE : FALSE;
+ lclVisualConfigs[i].bufferSize = -1;
+
+ lclVisualConfigs[i].depthSize = depth? 24 : 0;
+ lclVisualConfigs[i].stencilSize = stencil ? 8 : 0;
+ lclVisualConfigs[i].auxBuffers = aux ? 2 : 0;
+ lclVisualConfigs[i].level = 0;
+ lclVisualConfigs[i].visualRating = GLX_NONE_EXT;
+ lclVisualConfigs[i].transparentPixel = 0;
+ lclVisualConfigs[i].transparentRed = 0;
+ lclVisualConfigs[i].transparentGreen = 0;
+ lclVisualConfigs[i].transparentBlue = 0;
+ lclVisualConfigs[i].transparentAlpha = 0;
+ lclVisualConfigs[i].transparentIndex = 0;
+ i++;
+ }
+ }
+ }
}
- }
+ }
+ }
}
if (i != lclNumConfigs)
GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs failed to alloc visual configs");
@@ -1171,7 +1033,7 @@ static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
*ndepthp, *depthp, *rootDepthp);
}
-
+#if 0
static void fixup_visuals(int screen)
{
ScreenPtr pScreen = screenInfo.screens[screen];
@@ -1204,27 +1066,35 @@ static void fixup_visuals(int screen)
}
}
}
+#endif
+static void __glXAquaScreenDestroy(__GLXscreen *screen) {
-static void init_screen_visuals(int screen)
-{
- ScreenPtr pScreen = screenInfo.screens[screen];
- __GLcontextModes *modes;
- int *used;
- int i, j;
+ GLAQUA_DEBUG_MSG("glXAquaScreenDestroy(%p)\n", screen);
+ __glXScreenDestroy(screen);
+ free(screen);
+}
+
+static void init_screen_visuals(__GLXAquaScreen *screen) {
+ ScreenPtr pScreen = screen->base.pScreen;
+
+ __GLcontextModes *modes;
+ int *used;
+ int i, j;
+
GLAQUA_DEBUG_MSG("init_screen_visuals\n");
/* FIXME: Change 'used' to be a array of bits (rather than of ints),
* FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less
* FIXME: than 64 or 128 the stack array can be used instead of calling
- * FIXME: __glXMalloc / __glXFree. If nothing else, convert 'used' to
+ * FIXME: malloc / free. If nothing else, convert 'used' to
* FIXME: array of bytes instead of ints!
*/
- used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int));
- __glXMemset(used, 0, pScreen->numVisuals * sizeof(int));
+ used = (int *)malloc(pScreen->numVisuals * sizeof(int));
+ memset(used, 0, pScreen->numVisuals * sizeof(int));
i = 0;
- for ( modes = glAquaScreens[screen].modes
+ for ( modes = screen -> base.modes
; modes != NULL
; modes = modes->next ) {
const int vis_class = _gl_convert_to_x_visual_type( modes->visualType );
@@ -1261,102 +1131,70 @@ static void init_screen_visuals(int screen)
i++;
}
- __glXFree(used);
+ free(used);
}
-static Bool glAquaScreenProbe(int screen)
-{
- ScreenPtr pScreen;
- glAquaScreenRec *screenPriv;
-
- GLAQUA_DEBUG_MSG("glAquaScreenProbe\n");
+static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
+ __GLXAquaScreen *screen;
+ GLAQUA_DEBUG_MSG("glXAquaScreenProbe\n");
+ if (screen == NULL) return NULL;
- /*
- * Set up the current screen's visuals.
- */
- __glDDXScreenInfo.modes = glAquaScreens[screen].modes;
- __glDDXScreenInfo.pVisualPriv = glAquaScreens[screen].priv;
- __glDDXScreenInfo.numVisuals =
- __glDDXScreenInfo.numUsableVisuals = glAquaScreens[screen].num_vis;
+ screen = malloc(sizeof *screen);
- /*
- * Set the current screen's createContext routine. This could be
- * wrapped by a DDX GLX context creation routine.
- */
- __glDDXScreenInfo.createContext = glAquaCreateContext;
+ __glXScreenInit(&screen->base, pScreen);
- /*
- * The ordering of the rgb compenents might have been changed by the
- * driver after mi initialized them.
- */
- fixup_visuals(screen);
+ screen->base.destroy = __glXAquaScreenDestroy;
+ screen->base.createContext = __glXAquaScreenCreateContext;
+ screen->base.pScreen = pScreen;
- /*
- * Find the GLX visuals that are supported by this screen and create
- * XMesa's visuals.
- */
- init_screen_visuals(screen);
+ init_screen_visuals(screen);
- /*
- * Wrap RealizeWindow and UnrealizeWindow on this screen
- */
- pScreen = screenInfo.screens[screen];
- screenPriv = &glAquaScreens[screen];
- screenPriv->RealizeWindow = pScreen->RealizeWindow;
- pScreen->RealizeWindow = glAquaRealizeWindow;
- screenPriv->UnrealizeWindow = pScreen->UnrealizeWindow;
- pScreen->UnrealizeWindow = glAquaUnrealizeWindow;
-
- return TRUE;
-}
-
-static GLboolean glAquaSwapBuffers(__GLXdrawablePrivate *glxPriv)
-{
- // swap buffers on only *one* of the contexts
- // (e.g. the last one for drawing)
- __GLcontext *gc = (__GLcontext *)glxPriv->drawGlxc->gc;
- CGLError gl_err;
-
- GLAQUA_DEBUG_MSG("glAquaSwapBuffers\n");
-
- if (gc != NULL && gc->ctx != NULL)
- {
- gl_err = CGLFlushDrawable(gc->ctx);
- if (gl_err != 0)
- ErrorF("CGLFlushDrawable error: %s\n", CGLErrorString(gl_err));
- }
-
- return GL_TRUE;
+ return &screen->base;
}
-static void glAquaDestroyDrawablePrivate(__GLdrawablePrivate *glPriv)
-{
+static void __glXAquaDrawableDestroy(__GLXdrawable *base) {
GLAQUA_DEBUG_MSG("glAquaDestroyDrawablePrivate\n");
/* It doesn't work to call DRIDestroySurface here, the drawable's
already gone.. But dri.c notices the window destruction and
frees the surface itself. */
- free(glPriv->private);
- glPriv->private = NULL;
+ free(base);
}
-static void glAquaCreateBuffer(__GLXdrawablePrivate *glxPriv)
+static __GLXdrawable *
+__glXAquaContextCreateDrawable(__GLXcontext *context,
+ DrawablePtr pDraw,
+ XID drawId)
{
- GLAquaDrawableRec *aquaPriv = malloc(sizeof(GLAquaDrawableRec));
- __GLdrawablePrivate *glPriv = &glxPriv->glPriv;
+ __GLXAquaDrawable *glxPriv;
+ __GLXscreen *pGlxScreen;
+
+ GLAQUA_DEBUG_MSG("glAquaContextCreateDrawable(%p,%p,%d)\n", context, pDraw, drawId);
+ if (glxPriv == NULL) return NULL;
+ glxPriv = xalloc(sizeof *glxPriv);
+
+ memset(glxPriv, 0, sizeof *glxPriv);
- aquaPriv->sid = 0;
- aquaPriv->pDraw = NULL;
+ if (!__glXDrawableInit(&glxPriv->base, context, pDraw, drawId)) {
+ xfree(glxPriv);
+ return NULL;
+ }
+
+ glxPriv->base.destroy = __glXAquaDrawableDestroy;
+ glxPriv->base.resize = __glXAquaDrawableResize;
+ glxPriv->base.swapBuffers = __glXAquaDrawableSwapBuffers;
+
+ pGlxScreen = __glXActiveScreens[pDraw->pScreen->myNum];
- GLAQUA_DEBUG_MSG("glAquaCreateBuffer\n");
+ if (glxPriv->base.type == DRAWABLE_WINDOW) {
+ VisualID vid = wVisual((WindowPtr)pDraw);
- // replace swapBuffers (original is never called)
- glxPriv->swapBuffers = glAquaSwapBuffers;
+ glxPriv->base.modes = _gl_context_modes_find_visual(pGlxScreen->modes, vid);
+ } else
+ glxPriv->base.modes = glxPriv->base.pGlxPixmap->modes;
- // stash private data
- glPriv->private = aquaPriv;
- glPriv->freePrivate = glAquaDestroyDrawablePrivate;
+ return &glxPriv->base;
}
static void glAquaResetExtension(void)
@@ -1377,3 +1215,1239 @@ GLuint __glFloorLog2(GLuint val)
}
return c;
}
+
+static void setup_dispatch_table(void) {
+ struct _glapi_table *disp=_glapi_get_dispatch();
+
+ SET_NewList(disp, glNewList);
+ SET_EndList(disp, glEndList);
+ SET_CallList(disp, glCallList);
+ SET_CallLists(disp, glCallLists);
+ SET_DeleteLists(disp, glDeleteLists);
+ SET_GenLists(disp, glGenLists);
+ SET_ListBase(disp, glListBase);
+ SET_Begin(disp, glBegin);
+ SET_Bitmap(disp, glBitmap);
+ SET_Color3b(disp, glColor3b);
+ SET_Color3bv(disp, glColor3bv);
+ SET_Color3d(disp, glColor3d);
+ SET_Color3dv(disp, glColor3dv);
+ SET_Color3f(disp, glColor3f);
+ SET_Color3fv(disp, glColor3fv);
+ SET_Color3i(disp, glColor3i);
+ SET_Color3iv(disp, glColor3iv);
+ SET_Color3s(disp, glColor3s);
+ SET_Color3sv(disp, glColor3sv);
+ SET_Color3ub(disp, glColor3ub);
+ SET_Color3ubv(disp, glColor3ubv);
+ SET_Color3ui(disp, glColor3ui);
+ SET_Color3uiv(disp, glColor3uiv);
+ SET_Color3us(disp, glColor3us);
+ SET_Color3usv(disp, glColor3usv);
+ SET_Color4b(disp, glColor4b);
+ SET_Color4bv(disp, glColor4bv);
+ SET_Color4d(disp, glColor4d);
+ SET_Color4dv(disp, glColor4dv);
+ SET_Color4f(disp, glColor4f);
+ SET_Color4fv(disp, glColor4fv);
+ SET_Color4i(disp, glColor4i);
+ SET_Color4iv(disp, glColor4iv);
+ SET_Color4s(disp, glColor4s);
+ SET_Color4sv(disp, glColor4sv);
+ SET_Color4ub(disp, glColor4ub);
+ SET_Color4ubv(disp, glColor4ubv);
+ SET_Color4ui(disp, glColor4ui);
+ SET_Color4uiv(disp, glColor4uiv);
+ SET_Color4us(disp, glColor4us);
+ SET_Color4usv(disp, glColor4usv);
+ SET_EdgeFlag(disp, glEdgeFlag);
+ SET_EdgeFlagv(disp, glEdgeFlagv);
+ SET_End(disp, glEnd);
+ SET_Indexd(disp, glIndexd);
+ SET_Indexdv(disp, glIndexdv);
+ SET_Indexf(disp, glIndexf);
+ SET_Indexfv(disp, glIndexfv);
+ SET_Indexi(disp, glIndexi);
+ SET_Indexiv(disp, glIndexiv);
+ SET_Indexs(disp, glIndexs);
+ SET_Indexsv(disp, glIndexsv);
+ SET_Normal3b(disp, glNormal3b);
+ SET_Normal3bv(disp, glNormal3bv);
+ SET_Normal3d(disp, glNormal3d);
+ SET_Normal3dv(disp, glNormal3dv);
+ SET_Normal3f(disp, glNormal3f);
+ SET_Normal3fv(disp, glNormal3fv);
+ SET_Normal3i(disp, glNormal3i);
+ SET_Normal3iv(disp, glNormal3iv);
+ SET_Normal3s(disp, glNormal3s);
+ SET_Normal3sv(disp, glNormal3sv);
+ SET_RasterPos2d(disp, glRasterPos2d);
+ SET_RasterPos2dv(disp, glRasterPos2dv);
+ SET_RasterPos2f(disp, glRasterPos2f);
+ SET_RasterPos2fv(disp, glRasterPos2fv);
+ SET_RasterPos2i(disp, glRasterPos2i);
+ SET_RasterPos2iv(disp, glRasterPos2iv);
+ SET_RasterPos2s(disp, glRasterPos2s);
+ SET_RasterPos2sv(disp, glRasterPos2sv);
+ SET_RasterPos3d(disp, glRasterPos3d);
+ SET_RasterPos3dv(disp, glRasterPos3dv);
+ SET_RasterPos3f(disp, glRasterPos3f);
+ SET_RasterPos3fv(disp, glRasterPos3fv);
+ SET_RasterPos3i(disp, glRasterPos3i);
+ SET_RasterPos3iv(disp, glRasterPos3iv);
+ SET_RasterPos3s(disp, glRasterPos3s);
+ SET_RasterPos3sv(disp, glRasterPos3sv);
+ SET_RasterPos4d(disp, glRasterPos4d);
+ SET_RasterPos4dv(disp, glRasterPos4dv);
+ SET_RasterPos4f(disp, glRasterPos4f);
+ SET_RasterPos4fv(disp, glRasterPos4fv);
+ SET_RasterPos4i(disp, glRasterPos4i);
+ SET_RasterPos4iv(disp, glRasterPos4iv);
+ SET_RasterPos4s(disp, glRasterPos4s);
+ SET_RasterPos4sv(disp, glRasterPos4sv);
+ SET_Rectd(disp, glRectd);
+ SET_Rectdv(disp, glRectdv);
+ SET_Rectf(disp, glRectf);
+ SET_Rectfv(disp, glRectfv);
+ SET_Recti(disp, glRecti);
+ SET_Rectiv(disp, glRectiv);
+ SET_Rects(disp, glRects);
+ SET_Rectsv(disp, glRectsv);
+ SET_TexCoord1d(disp, glTexCoord1d);
+ SET_TexCoord1dv(disp, glTexCoord1dv);
+ SET_TexCoord1f(disp, glTexCoord1f);
+ SET_TexCoord1fv(disp, glTexCoord1fv);
+ SET_TexCoord1i(disp, glTexCoord1i);
+ SET_TexCoord1iv(disp, glTexCoord1iv);
+ SET_TexCoord1s(disp, glTexCoord1s);
+ SET_TexCoord1sv(disp, glTexCoord1sv);
+ SET_TexCoord2d(disp, glTexCoord2d);
+ SET_TexCoord2dv(disp, glTexCoord2dv);
+ SET_TexCoord2f(disp, glTexCoord2f);
+ SET_TexCoord2fv(disp, glTexCoord2fv);
+ SET_TexCoord2i(disp, glTexCoord2i);
+ SET_TexCoord2iv(disp, glTexCoord2iv);
+ SET_TexCoord2s(disp, glTexCoord2s);
+ SET_TexCoord2sv(disp, glTexCoord2sv);
+ SET_TexCoord3d(disp, glTexCoord3d);
+ SET_TexCoord3dv(disp, glTexCoord3dv);
+ SET_TexCoord3f(disp, glTexCoord3f);
+ SET_TexCoord3fv(disp, glTexCoord3fv);
+ SET_TexCoord3i(disp, glTexCoord3i);
+ SET_TexCoord3iv(disp, glTexCoord3iv);
+ SET_TexCoord3s(disp, glTexCoord3s);
+ SET_TexCoord3sv(disp, glTexCoord3sv);
+ SET_TexCoord4d(disp, glTexCoord4d);
+ SET_TexCoord4dv(disp, glTexCoord4dv);
+ SET_TexCoord4f(disp, glTexCoord4f);
+ SET_TexCoord4fv(disp, glTexCoord4fv);
+ SET_TexCoord4i(disp, glTexCoord4i);
+ SET_TexCoord4iv(disp, glTexCoord4iv);
+ SET_TexCoord4s(disp, glTexCoord4s);
+ SET_TexCoord4sv(disp, glTexCoord4sv);
+ SET_Vertex2d(disp, glVertex2d);
+ SET_Vertex2dv(disp, glVertex2dv);
+ SET_Vertex2f(disp, glVertex2f);
+ SET_Vertex2fv(disp, glVertex2fv);
+ SET_Vertex2i(disp, glVertex2i);
+ SET_Vertex2iv(disp, glVertex2iv);
+ SET_Vertex2s(disp, glVertex2s);
+ SET_Vertex2sv(disp, glVertex2sv);
+ SET_Vertex3d(disp, glVertex3d);
+ SET_Vertex3dv(disp, glVertex3dv);
+ SET_Vertex3f(disp, glVertex3f);
+ SET_Vertex3fv(disp, glVertex3fv);
+ SET_Vertex3i(disp, glVertex3i);
+ SET_Vertex3iv(disp, glVertex3iv);
+ SET_Vertex3s(disp, glVertex3s);
+ SET_Vertex3sv(disp, glVertex3sv);
+ SET_Vertex4d(disp, glVertex4d);
+ SET_Vertex4dv(disp, glVertex4dv);
+ SET_Vertex4f(disp, glVertex4f);
+ SET_Vertex4fv(disp, glVertex4fv);
+ SET_Vertex4i(disp, glVertex4i);
+ SET_Vertex4iv(disp, glVertex4iv);
+ SET_Vertex4s(disp, glVertex4s);
+ SET_Vertex4sv(disp, glVertex4sv);
+ SET_ClipPlane(disp, glClipPlane);
+ SET_ColorMaterial(disp, glColorMaterial);
+ SET_CullFace(disp, glCullFace);
+ SET_Fogf(disp, glFogf);
+ SET_Fogfv(disp, glFogfv);
+ SET_Fogi(disp, glFogi);
+ SET_Fogiv(disp, glFogiv);
+ SET_FrontFace(disp, glFrontFace);
+ SET_Hint(disp, glHint);
+ SET_Lightf(disp, glLightf);
+ SET_Lightfv(disp, glLightfv);
+ SET_Lighti(disp, glLighti);
+ SET_Lightiv(disp, glLightiv);
+ SET_LightModelf(disp, glLightModelf);
+ SET_LightModelfv(disp, glLightModelfv);
+ SET_LightModeli(disp, glLightModeli);
+ SET_LightModeliv(disp, glLightModeliv);
+ SET_LineStipple(disp, glLineStipple);
+ SET_LineWidth(disp, glLineWidth);
+ SET_Materialf(disp, glMaterialf);
+ SET_Materialfv(disp, glMaterialfv);
+ SET_Materiali(disp, glMateriali);
+ SET_Materialiv(disp, glMaterialiv);
+ SET_PointSize(disp, glPointSize);
+ SET_PolygonMode(disp, glPolygonMode);
+ SET_PolygonStipple(disp, glPolygonStipple);
+ SET_Scissor(disp, glScissor);
+ SET_ShadeModel(disp, glShadeModel);
+ SET_TexParameterf(disp, glTexParameterf);
+ SET_TexParameterfv(disp, glTexParameterfv);
+ SET_TexParameteri(disp, glTexParameteri);
+ SET_TexParameteriv(disp, glTexParameteriv);
+ SET_TexImage1D(disp, glTexImage1D);
+ SET_TexImage2D(disp, glTexImage2D);
+ SET_TexEnvf(disp, glTexEnvf);
+ SET_TexEnvfv(disp, glTexEnvfv);
+ SET_TexEnvi(disp, glTexEnvi);
+ SET_TexEnviv(disp, glTexEnviv);
+ SET_TexGend(disp, glTexGend);
+ SET_TexGendv(disp, glTexGendv);
+ SET_TexGenf(disp, glTexGenf);
+ SET_TexGenfv(disp, glTexGenfv);
+ SET_TexGeni(disp, glTexGeni);
+ SET_TexGeniv(disp, glTexGeniv);
+ SET_FeedbackBuffer(disp, glFeedbackBuffer);
+ SET_SelectBuffer(disp, glSelectBuffer);
+ SET_RenderMode(disp, glRenderMode);
+ SET_InitNames(disp, glInitNames);
+ SET_LoadName(disp, glLoadName);
+ SET_PassThrough(disp, glPassThrough);
+ SET_PopName(disp, glPopName);
+ SET_PushName(disp, glPushName);
+ SET_DrawBuffer(disp, glDrawBuffer);
+ SET_Clear(disp, glClear);
+ SET_ClearAccum(disp, glClearAccum);
+ SET_ClearIndex(disp, glClearIndex);
+ SET_ClearColor(disp, glClearColor);
+ SET_ClearStencil(disp, glClearStencil);
+ SET_ClearDepth(disp, glClearDepth);
+ SET_StencilMask(disp, glStencilMask);
+ SET_ColorMask(disp, glColorMask);
+ SET_DepthMask(disp, glDepthMask);
+ SET_IndexMask(disp, glIndexMask);
+ SET_Accum(disp, glAccum);
+ SET_Disable(disp, glDisable);
+ SET_Enable(disp, glEnable);
+ SET_Finish(disp, glFinish);
+ SET_Flush(disp, glFlush);
+ SET_PopAttrib(disp, glPopAttrib);
+ SET_PushAttrib(disp, glPushAttrib);
+ SET_Map1d(disp, glMap1d);
+ SET_Map1f(disp, glMap1f);
+ SET_Map2d(disp, glMap2d);
+ SET_Map2f(disp, glMap2f);
+ SET_MapGrid1d(disp, glMapGrid1d);
+ SET_MapGrid1f(disp, glMapGrid1f);
+ SET_MapGrid2d(disp, glMapGrid2d);
+ SET_MapGrid2f(disp, glMapGrid2f);
+ SET_EvalCoord1d(disp, glEvalCoord1d);
+ SET_EvalCoord1dv(disp, glEvalCoord1dv);
+ SET_EvalCoord1f(disp, glEvalCoord1f);
+ SET_EvalCoord1fv(disp, glEvalCoord1fv);
+ SET_EvalCoord2d(disp, glEvalCoord2d);
+ SET_EvalCoord2dv(disp, glEvalCoord2dv);
+ SET_EvalCoord2f(disp, glEvalCoord2f);
+ SET_EvalCoord2fv(disp, glEvalCoord2fv);
+ SET_EvalMesh1(disp, glEvalMesh1);
+ SET_EvalPoint1(disp, glEvalPoint1);
+ SET_EvalMesh2(disp, glEvalMesh2);
+ SET_EvalPoint2(disp, glEvalPoint2);
+ SET_AlphaFunc(disp, glAlphaFunc);
+ SET_BlendFunc(disp, glBlendFunc);
+ SET_LogicOp(disp, glLogicOp);
+ SET_StencilFunc(disp, glStencilFunc);
+ SET_StencilOp(disp, glStencilOp);
+ SET_DepthFunc(disp, glDepthFunc);
+ SET_PixelZoom(disp, glPixelZoom);
+ SET_PixelTransferf(disp, glPixelTransferf);
+ SET_PixelTransferi(disp, glPixelTransferi);
+ SET_PixelStoref(disp, glPixelStoref);
+ SET_PixelStorei(disp, glPixelStorei);
+ SET_PixelMapfv(disp, glPixelMapfv);
+ SET_PixelMapuiv(disp, glPixelMapuiv);
+ SET_PixelMapusv(disp, glPixelMapusv);
+ SET_ReadBuffer(disp, glReadBuffer);
+ SET_CopyPixels(disp, glCopyPixels);
+ SET_ReadPixels(disp, glReadPixels);
+ SET_DrawPixels(disp, glDrawPixels);
+ SET_GetBooleanv(disp, glGetBooleanv);
+ SET_GetClipPlane(disp, glGetClipPlane);
+ SET_GetDoublev(disp, glGetDoublev);
+ SET_GetError(disp, glGetError);
+ SET_GetFloatv(disp, glGetFloatv);
+ SET_GetIntegerv(disp, glGetIntegerv);
+ SET_GetLightfv(disp, glGetLightfv);
+ SET_GetLightiv(disp, glGetLightiv);
+ SET_GetMapdv(disp, glGetMapdv);
+ SET_GetMapfv(disp, glGetMapfv);
+ SET_GetMapiv(disp, glGetMapiv);
+ SET_GetMaterialfv(disp, glGetMaterialfv);
+ SET_GetMaterialiv(disp, glGetMaterialiv);
+ SET_GetPixelMapfv(disp, glGetPixelMapfv);
+ SET_GetPixelMapuiv(disp, glGetPixelMapuiv);
+ SET_GetPixelMapusv(disp, glGetPixelMapusv);
+ SET_GetPolygonStipple(disp, glGetPolygonStipple);
+ SET_GetString(disp, glGetString);
+ SET_GetTexEnvfv(disp, glGetTexEnvfv);
+ SET_GetTexEnviv(disp, glGetTexEnviv);
+ SET_GetTexGendv(disp, glGetTexGendv);
+ SET_GetTexGenfv(disp, glGetTexGenfv);
+ SET_GetTexGeniv(disp, glGetTexGeniv);
+ SET_GetTexImage(disp, glGetTexImage);
+ SET_GetTexParameterfv(disp, glGetTexParameterfv);
+ SET_GetTexParameteriv(disp, glGetTexParameteriv);
+ SET_GetTexLevelParameterfv(disp, glGetTexLevelParameterfv);
+ SET_GetTexLevelParameteriv(disp, glGetTexLevelParameteriv);
+ SET_IsEnabled(disp, glIsEnabled);
+ SET_IsList(disp, glIsList);
+ SET_DepthRange(disp, glDepthRange);
+ SET_Frustum(disp, glFrustum);
+ SET_LoadIdentity(disp, glLoadIdentity);
+ SET_LoadMatrixf(disp, glLoadMatrixf);
+ SET_LoadMatrixd(disp, glLoadMatrixd);
+ SET_MatrixMode(disp, glMatrixMode);
+ SET_MultMatrixf(disp, glMultMatrixf);
+ SET_MultMatrixd(disp, glMultMatrixd);
+ SET_Ortho(disp, glOrtho);
+ SET_PopMatrix(disp, glPopMatrix);
+ SET_PushMatrix(disp, glPushMatrix);
+ SET_Rotated(disp, glRotated);
+ SET_Rotatef(disp, glRotatef);
+ SET_Scaled(disp, glScaled);
+ SET_Scalef(disp, glScalef);
+ SET_Translated(disp, glTranslated);
+ SET_Translatef(disp, glTranslatef);
+ SET_Viewport(disp, glViewport);
+ SET_ArrayElement(disp, glArrayElement);
+ SET_BindTexture(disp, glBindTexture);
+ SET_ColorPointer(disp, glColorPointer);
+ SET_DisableClientState(disp, glDisableClientState);
+ SET_DrawArrays(disp, glDrawArrays);
+ SET_DrawElements(disp, glDrawElements);
+ SET_EdgeFlagPointer(disp, glEdgeFlagPointer);
+ SET_EnableClientState(disp, glEnableClientState);
+ SET_IndexPointer(disp, glIndexPointer);
+ SET_Indexub(disp, glIndexub);
+ SET_Indexubv(disp, glIndexubv);
+ SET_InterleavedArrays(disp, glInterleavedArrays);
+ SET_NormalPointer(disp, glNormalPointer);
+ SET_PolygonOffset(disp, glPolygonOffset);
+ SET_TexCoordPointer(disp, glTexCoordPointer);
+ SET_VertexPointer(disp, glVertexPointer);
+ SET_AreTexturesResident(disp, glAreTexturesResident);
+ SET_CopyTexImage1D(disp, glCopyTexImage1D);
+ SET_CopyTexImage2D(disp, glCopyTexImage2D);
+ SET_CopyTexSubImage1D(disp, glCopyTexSubImage1D);
+ SET_CopyTexSubImage2D(disp, glCopyTexSubImage2D);
+ SET_DeleteTextures(disp, glDeleteTextures);
+ SET_GenTextures(disp, glGenTextures);
+ SET_GetPointerv(disp, glGetPointerv);
+ SET_IsTexture(disp, glIsTexture);
+ SET_PrioritizeTextures(disp, glPrioritizeTextures);
+ SET_TexSubImage1D(disp, glTexSubImage1D);
+ SET_TexSubImage2D(disp, glTexSubImage2D);
+ SET_PopClientAttrib(disp, glPopClientAttrib);
+ SET_PushClientAttrib(disp, glPushClientAttrib);
+ SET_BlendColor(disp, glBlendColor);
+ SET_BlendEquation(disp, glBlendEquation);
+ SET_DrawRangeElements(disp, glDrawRangeElements);
+ SET_ColorTable(disp, glColorTable);
+ SET_ColorTableParameterfv(disp, glColorTableParameterfv);
+ SET_ColorTableParameteriv(disp, glColorTableParameteriv);
+ SET_CopyColorTable(disp, glCopyColorTable);
+ SET_GetColorTable(disp, glGetColorTable);
+ SET_GetColorTableParameterfv(disp, glGetColorTableParameterfv);
+ SET_GetColorTableParameteriv(disp, glGetColorTableParameteriv);
+ SET_ColorSubTable(disp, glColorSubTable);
+ SET_CopyColorSubTable(disp, glCopyColorSubTable);
+ SET_ConvolutionFilter1D(disp, glConvolutionFilter1D);
+ SET_ConvolutionFilter2D(disp, glConvolutionFilter2D);
+ SET_ConvolutionParameterf(disp, glConvolutionParameterf);
+ SET_ConvolutionParameterfv(disp, glConvolutionParameterfv);
+ SET_ConvolutionParameteri(disp, glConvolutionParameteri);
+ SET_ConvolutionParameteriv(disp, glConvolutionParameteriv);
+ SET_CopyConvolutionFilter1D(disp, glCopyConvolutionFilter1D);
+ SET_CopyConvolutionFilter2D(disp, glCopyConvolutionFilter2D);
+ SET_GetConvolutionFilter(disp, glGetConvolutionFilter);
+ SET_GetConvolutionParameterfv(disp, glGetConvolutionParameterfv);
+ SET_GetConvolutionParameteriv(disp, glGetConvolutionParameteriv);
+ SET_GetSeparableFilter(disp, glGetSeparableFilter);
+ SET_SeparableFilter2D(disp, glSeparableFilter2D);
+ SET_GetHistogram(disp, glGetHistogram);
+ SET_GetHistogramParameterfv(disp, glGetHistogramParameterfv);
+ SET_GetHistogramParameteriv(disp, glGetHistogramParameteriv);
+ SET_GetMinmax(disp, glGetMinmax);
+ SET_GetMinmaxParameterfv(disp, glGetMinmaxParameterfv);
+ SET_GetMinmaxParameteriv(disp, glGetMinmaxParameteriv);
+ SET_Histogram(disp, glHistogram);
+ SET_Minmax(disp, glMinmax);
+ SET_ResetHistogram(disp, glResetHistogram);
+ SET_ResetMinmax(disp, glResetMinmax);
+ SET_TexImage3D(disp, glTexImage3D);
+ SET_TexSubImage3D(disp, glTexSubImage3D);
+ SET_CopyTexSubImage3D(disp, glCopyTexSubImage3D);
+ SET_ActiveTextureARB(disp, glActiveTextureARB);
+ SET_ClientActiveTextureARB(disp, glClientActiveTextureARB);
+ SET_MultiTexCoord1dARB(disp, glMultiTexCoord1dARB);
+ SET_MultiTexCoord1dvARB(disp, glMultiTexCoord1dvARB);
+ SET_MultiTexCoord1fARB(disp, glMultiTexCoord1fARB);
+ SET_MultiTexCoord1fvARB(disp, glMultiTexCoord1fvARB);
+ SET_MultiTexCoord1iARB(disp, glMultiTexCoord1iARB);
+ SET_MultiTexCoord1ivARB(disp, glMultiTexCoord1ivARB);
+ SET_MultiTexCoord1sARB(disp, glMultiTexCoord1sARB);
+ SET_MultiTexCoord1svARB(disp, glMultiTexCoord1svARB);
+ SET_MultiTexCoord2dARB(disp, glMultiTexCoord2dARB);
+ SET_MultiTexCoord2dvARB(disp, glMultiTexCoord2dvARB);
+ SET_MultiTexCoord2fARB(disp, glMultiTexCoord2fARB);
+ SET_MultiTexCoord2fvARB(disp, glMultiTexCoord2fvARB);
+ SET_MultiTexCoord2iARB(disp, glMultiTexCoord2iARB);
+ SET_MultiTexCoord2ivARB(disp, glMultiTexCoord2ivARB);
+ SET_MultiTexCoord2sARB(disp, glMultiTexCoord2sARB);
+ SET_MultiTexCoord2svARB(disp, glMultiTexCoord2svARB);
+ SET_MultiTexCoord3dARB(disp, glMultiTexCoord3dARB);
+ SET_MultiTexCoord3dvARB(disp, glMultiTexCoord3dvARB);
+ SET_MultiTexCoord3fARB(disp, glMultiTexCoord3fARB);
+ SET_MultiTexCoord3fvARB(disp, glMultiTexCoord3fvARB);
+ SET_MultiTexCoord3iARB(disp, glMultiTexCoord3iARB);
+ SET_MultiTexCoord3ivARB(disp, glMultiTexCoord3ivARB);
+ SET_MultiTexCoord3sARB(disp, glMultiTexCoord3sARB);
+ SET_MultiTexCoord3svARB(disp, glMultiTexCoord3svARB);
+ SET_MultiTexCoord4dARB(disp, glMultiTexCoord4dARB);
+ SET_MultiTexCoord4dvARB(disp, glMultiTexCoord4dvARB);
+ SET_MultiTexCoord4fARB(disp, glMultiTexCoord4fARB);
+ SET_MultiTexCoord4fvARB(disp, glMultiTexCoord4fvARB);
+ SET_MultiTexCoord4iARB(disp, glMultiTexCoord4iARB);
+ SET_MultiTexCoord4ivARB(disp, glMultiTexCoord4ivARB);
+ SET_MultiTexCoord4sARB(disp, glMultiTexCoord4sARB);
+ SET_MultiTexCoord4svARB(disp, glMultiTexCoord4svARB);
+ SET_LoadTransposeMatrixfARB(disp, glLoadTransposeMatrixfARB);
+ SET_LoadTransposeMatrixdARB(disp, glLoadTransposeMatrixdARB);
+ SET_MultTransposeMatrixfARB(disp, glMultTransposeMatrixfARB);
+ SET_MultTransposeMatrixdARB(disp, glMultTransposeMatrixdARB);
+ SET_SampleCoverageARB(disp, glSampleCoverageARB);
+ SET_DrawBuffersARB(disp, glDrawBuffersARB);
+/* SET_PolygonOffsetEXT(disp, glPolygonOffsetEXT);
+ SET_GetTexFilterFuncSGIS(disp, glGetTexFilterFuncSGIS);
+ SET_TexFilterFuncSGIS(disp, glTexFilterFuncSGIS);
+ SET_GetHistogramEXT(disp, glGetHistogramEXT);
+ SET_GetHistogramParameterfvEXT(disp, glGetHistogramParameterfvEXT);
+ SET_GetHistogramParameterivEXT(disp, glGetHistogramParameterivEXT);
+ SET_GetMinmaxEXT(disp, glGetMinmaxEXT);
+ SET_GetMinmaxParameterfvEXT(disp, glGetMinmaxParameterfvEXT);
+ SET_GetMinmaxParameterivEXT(disp, glGetMinmaxParameterivEXT);
+ SET_GetConvolutionFilterEXT(disp, glGetConvolutionFilterEXT);
+ SET_GetConvolutionParameterfvEXT(disp, glGetConvolutionParameterfvEXT);
+ SET_GetConvolutionParameterivEXT(disp, glGetConvolutionParameterivEXT);
+ SET_GetSeparableFilterEXT(disp, glGetSeparableFilterEXT);
+ SET_GetColorTableSGI(disp, glGetColorTableSGI);
+ SET_GetColorTableParameterfvSGI(disp, glGetColorTableParameterfvSGI);
+ SET_GetColorTableParameterivSGI(disp, glGetColorTableParameterivSGI);
+ SET_PixelTexGenSGIX(disp, glPixelTexGenSGIX);
+ SET_PixelTexGenParameteriSGIS(disp, glPixelTexGenParameteriSGIS);
+ SET_PixelTexGenParameterivSGIS(disp, glPixelTexGenParameterivSGIS);
+ SET_PixelTexGenParameterfSGIS(disp, glPixelTexGenParameterfSGIS);
+ SET_PixelTexGenParameterfvSGIS(disp, glPixelTexGenParameterfvSGIS);
+ SET_GetPixelTexGenParameterivSGIS(disp, glGetPixelTexGenParameterivSGIS);
+ SET_GetPixelTexGenParameterfvSGIS(disp, glGetPixelTexGenParameterfvSGIS);
+ SET_TexImage4DSGIS(disp, glTexImage4DSGIS);
+ SET_TexSubImage4DSGIS(disp, glTexSubImage4DSGIS); */
+ SET_AreTexturesResidentEXT(disp, glAreTexturesResident);
+ SET_GenTexturesEXT(disp, glGenTextures);
+ SET_IsTextureEXT(disp, glIsTexture);
+/* SET_DetailTexFuncSGIS(disp, glDetailTexFuncSGIS);
+ SET_GetDetailTexFuncSGIS(disp, glGetDetailTexFuncSGIS);
+ SET_SharpenTexFuncSGIS(disp, glSharpenTexFuncSGIS);
+ SET_GetSharpenTexFuncSGIS(disp, glGetSharpenTexFuncSGIS);
+ SET_SampleMaskSGIS(disp, glSampleMaskSGIS);
+ SET_SamplePatternSGIS(disp, glSamplePatternSGIS);
+ SET_ColorPointerEXT(disp, glColorPointerEXT);
+ SET_EdgeFlagPointerEXT(disp, glEdgeFlagPointerEXT);
+ SET_IndexPointerEXT(disp, glIndexPointerEXT);
+ SET_NormalPointerEXT(disp, glNormalPointerEXT);
+ SET_TexCoordPointerEXT(disp, glTexCoordPointerEXT);
+ SET_VertexPointerEXT(disp, glVertexPointerEXT);
+ SET_SpriteParameterfSGIX(disp, glSpriteParameterfSGIX);
+ SET_SpriteParameterfvSGIX(disp, glSpriteParameterfvSGIX);
+ SET_SpriteParameteriSGIX(disp, glSpriteParameteriSGIX);
+ SET_SpriteParameterivSGIX(disp, glSpriteParameterivSGIX);
+ SET_PointParameterfEXT(disp, glPointParameterfEXT);
+ SET_PointParameterfvEXT(disp, glPointParameterfvEXT);
+ SET_GetInstrumentsSGIX(disp, glGetInstrumentsSGIX);
+ SET_InstrumentsBufferSGIX(disp, glInstrumentsBufferSGIX);
+ SET_PollInstrumentsSGIX(disp, glPollInstrumentsSGIX);
+ SET_ReadInstrumentsSGIX(disp, glReadInstrumentsSGIX);
+ SET_StartInstrumentsSGIX(disp, glStartInstrumentsSGIX);
+ SET_StopInstrumentsSGIX(disp, glStopInstrumentsSGIX);
+ SET_FrameZoomSGIX(disp, glFrameZoomSGIX);
+ SET_TagSampleBufferSGIX(disp, glTagSampleBufferSGIX);
+ SET_ReferencePlaneSGIX(disp, glReferencePlaneSGIX);
+ SET_FlushRasterSGIX(disp, glFlushRasterSGIX);
+ SET_GetListParameterfvSGIX(disp, glGetListParameterfvSGIX);
+ SET_GetListParameterivSGIX(disp, glGetListParameterivSGIX);
+ SET_ListParameterfSGIX(disp, glListParameterfSGIX);
+ SET_ListParameterfvSGIX(disp, glListParameterfvSGIX);
+ SET_ListParameteriSGIX(disp, glListParameteriSGIX);
+ SET_ListParameterivSGIX(disp, glListParameterivSGIX);
+ SET_FragmentColorMaterialSGIX(disp, glFragmentColorMaterialSGIX);
+ SET_FragmentLightfSGIX(disp, glFragmentLightfSGIX);
+ SET_FragmentLightfvSGIX(disp, glFragmentLightfvSGIX);
+ SET_FragmentLightiSGIX(disp, glFragmentLightiSGIX);
+ SET_FragmentLightivSGIX(disp, glFragmentLightivSGIX);
+ SET_FragmentLightModelfSGIX(disp, glFragmentLightModelfSGIX);
+ SET_FragmentLightModelfvSGIX(disp, glFragmentLightModelfvSGIX);
+ SET_FragmentLightModeliSGIX(disp, glFragmentLightModeliSGIX);
+ SET_FragmentLightModelivSGIX(disp, glFragmentLightModelivSGIX);
+ SET_FragmentMaterialfSGIX(disp, glFragmentMaterialfSGIX);
+ SET_FragmentMaterialfvSGIX(disp, glFragmentMaterialfvSGIX);
+ SET_FragmentMaterialiSGIX(disp, glFragmentMaterialiSGIX);
+ SET_FragmentMaterialivSGIX(disp, glFragmentMaterialivSGIX);
+ SET_GetFragmentLightfvSGIX(disp, glGetFragmentLightfvSGIX);
+ SET_GetFragmentLightivSGIX(disp, glGetFragmentLightivSGIX);
+ SET_GetFragmentMaterialfvSGIX(disp, glGetFragmentMaterialfvSGIX);
+ SET_GetFragmentMaterialivSGIX(disp, glGetFragmentMaterialivSGIX);
+ SET_LightEnviSGIX(disp, glLightEnviSGIX);
+ SET_VertexWeightfEXT(disp, glVertexWeightfEXT);
+ SET_VertexWeightfvEXT(disp, glVertexWeightfvEXT);
+ SET_VertexWeightPointerEXT(disp, glVertexWeightPointerEXT);
+ SET_FlushVertexArrayRangeNV(disp, glFlushVertexArrayRangeNV);
+ SET_VertexArrayRangeNV(disp, glVertexArrayRangeNV);
+ SET_CombinerParameterfvNV(disp, glCombinerParameterfvNV);
+ SET_CombinerParameterfNV(disp, glCombinerParameterfNV);
+ SET_CombinerParameterivNV(disp, glCombinerParameterivNV);
+ SET_CombinerParameteriNV(disp, glCombinerParameteriNV);
+ SET_CombinerInputNV(disp, glCombinerInputNV);
+ SET_CombinerOutputNV(disp, glCombinerOutputNV);
+ SET_FinalCombinerInputNV(disp, glFinalCombinerInputNV);
+ SET_GetCombinerInputParameterfvNV(disp, glGetCombinerInputParameterfvNV);
+ SET_GetCombinerInputParameterivNV(disp, glGetCombinerInputParameterivNV);
+ SET_GetCombinerOutputParameterfvNV(disp, glGetCombinerOutputParameterfvNV);
+ SET_GetCombinerOutputParameterivNV(disp, glGetCombinerOutputParameterivNV);
+ SET_GetFinalCombinerInputParameterfvNV(disp, glGetFinalCombinerInputParameterfvNV);
+ SET_GetFinalCombinerInputParameterivNV(disp, glGetFinalCombinerInputParameterivNV);
+ SET_ResizeBuffersMESA(disp, glResizeBuffersMESA);
+ SET_WindowPos2dMESA(disp, glWindowPos2dMESA);
+ SET_WindowPos2dvMESA(disp, glWindowPos2dvMESA);
+ SET_WindowPos2fMESA(disp, glWindowPos2fMESA);
+ SET_WindowPos2fvMESA(disp, glWindowPos2fvMESA);
+ SET_WindowPos2iMESA(disp, glWindowPos2iMESA);
+ SET_WindowPos2ivMESA(disp, glWindowPos2ivMESA);
+ SET_WindowPos2sMESA(disp, glWindowPos2sMESA);
+ SET_WindowPos2svMESA(disp, glWindowPos2svMESA);
+ SET_WindowPos3dMESA(disp, glWindowPos3dMESA);
+ SET_WindowPos3dvMESA(disp, glWindowPos3dvMESA);
+ SET_WindowPos3fMESA(disp, glWindowPos3fMESA);
+ SET_WindowPos3fvMESA(disp, glWindowPos3fvMESA);
+ SET_WindowPos3iMESA(disp, glWindowPos3iMESA);
+ SET_WindowPos3ivMESA(disp, glWindowPos3ivMESA);
+ SET_WindowPos3sMESA(disp, glWindowPos3sMESA);
+ SET_WindowPos3svMESA(disp, glWindowPos3svMESA);
+ SET_WindowPos4dMESA(disp, glWindowPos4dMESA);
+ SET_WindowPos4dvMESA(disp, glWindowPos4dvMESA);
+ SET_WindowPos4fMESA(disp, glWindowPos4fMESA);
+ SET_WindowPos4fvMESA(disp, glWindowPos4fvMESA);
+ SET_WindowPos4iMESA(disp, glWindowPos4iMESA);
+ SET_WindowPos4ivMESA(disp, glWindowPos4ivMESA);
+ SET_WindowPos4sMESA(disp, glWindowPos4sMESA);
+ SET_WindowPos4svMESA(disp, glWindowPos4svMESA);
+ SET_BlendFuncSeparateEXT(disp, glBlendFuncSeparateEXT);
+ SET_IndexMaterialEXT(disp, glIndexMaterialEXT);
+ SET_IndexFuncEXT(disp, glIndexFuncEXT);
+ SET_LockArraysEXT(disp, glLockArraysEXT);
+ SET_UnlockArraysEXT(disp, glUnlockArraysEXT);
+ SET_CullParameterdvEXT(disp, glCullParameterdvEXT);
+ SET_CullParameterfvEXT(disp, glCullParameterfvEXT);
+ SET_HintPGI(disp, glHintPGI);
+ SET_FogCoordfEXT(disp, glFogCoordfEXT);
+ SET_FogCoordfvEXT(disp, glFogCoordfvEXT);
+ SET_FogCoorddEXT(disp, glFogCoorddEXT);
+ SET_FogCoorddvEXT(disp, glFogCoorddvEXT);
+ SET_FogCoordPointerEXT(disp, glFogCoordPointerEXT);
+ SET_GetColorTableEXT(disp, glGetColorTableEXT);
+ SET_GetColorTableParameterivEXT(disp, glGetColorTableParameterivEXT);
+ SET_GetColorTableParameterfvEXT(disp, glGetColorTableParameterfvEXT);
+ SET_TbufferMask3DFX(disp, glTbufferMask3DFX);
+ SET_CompressedTexImage3DARB(disp, glCompressedTexImage3DARB);
+ SET_CompressedTexImage2DARB(disp, glCompressedTexImage2DARB);
+ SET_CompressedTexImage1DARB(disp, glCompressedTexImage1DARB);
+ SET_CompressedTexSubImage3DARB(disp, glCompressedTexSubImage3DARB);
+ SET_CompressedTexSubImage2DARB(disp, glCompressedTexSubImage2DARB);
+ SET_CompressedTexSubImage1DARB(disp, glCompressedTexSubImage1DARB);
+ SET_GetCompressedTexImageARB(disp, glGetCompressedTexImageARB);
+ SET_SecondaryColor3bEXT(disp, glSecondaryColor3bEXT);
+ SET_SecondaryColor3bvEXT(disp, glSecondaryColor3bvEXT);
+ SET_SecondaryColor3dEXT(disp, glSecondaryColor3dEXT);
+ SET_SecondaryColor3dvEXT(disp, glSecondaryColor3dvEXT);
+ SET_SecondaryColor3fEXT(disp, glSecondaryColor3fEXT);
+ SET_SecondaryColor3fvEXT(disp, glSecondaryColor3fvEXT);
+ SET_SecondaryColor3iEXT(disp, glSecondaryColor3iEXT);
+ SET_SecondaryColor3ivEXT(disp, glSecondaryColor3ivEXT);
+ SET_SecondaryColor3sEXT(disp, glSecondaryColor3sEXT);
+ SET_SecondaryColor3svEXT(disp, glSecondaryColor3svEXT);
+ SET_SecondaryColor3ubEXT(disp, glSecondaryColor3ubEXT);
+ SET_SecondaryColor3ubvEXT(disp, glSecondaryColor3ubvEXT);
+ SET_SecondaryColor3uiEXT(disp, glSecondaryColor3uiEXT);
+ SET_SecondaryColor3uivEXT(disp, glSecondaryColor3uivEXT);
+ SET_SecondaryColor3usEXT(disp, glSecondaryColor3usEXT);
+ SET_SecondaryColor3usvEXT(disp, glSecondaryColor3usvEXT);
+ SET_SecondaryColorPointerEXT(disp, glSecondaryColorPointerEXT);
+ SET_AreProgramsResidentNV(disp, glAreProgramsResidentNV);
+ SET_BindProgramNV(disp, glBindProgramNV);
+ SET_DeleteProgramsNV(disp, glDeleteProgramsNV);
+ SET_ExecuteProgramNV(disp, glExecuteProgramNV);
+ SET_GenProgramsNV(disp, glGenProgramsNV);
+ SET_GetProgramParameterdvNV(disp, glGetProgramParameterdvNV);
+ SET_GetProgramParameterfvNV(disp, glGetProgramParameterfvNV);
+ SET_GetProgramivNV(disp, glGetProgramivNV);
+ SET_GetProgramStringNV(disp, glGetProgramStringNV);
+ SET_GetTrackMatrixivNV(disp, glGetTrackMatrixivNV);
+ SET_GetVertexAttribdvARB(disp, glGetVertexAttribdvARB);
+ SET_GetVertexAttribfvARB(disp, glGetVertexAttribfvARB);
+ SET_GetVertexAttribivARB(disp, glGetVertexAttribivARB);
+ SET_GetVertexAttribPointervNV(disp, glGetVertexAttribPointervNV);
+ SET_IsProgramNV(disp, glIsProgramNV);
+ SET_LoadProgramNV(disp, glLoadProgramNV);
+ SET_ProgramParameter4dNV(disp, glProgramParameter4dNV);
+ SET_ProgramParameter4dvNV(disp, glProgramParameter4dvNV);
+ SET_ProgramParameter4fNV(disp, glProgramParameter4fNV);
+ SET_ProgramParameter4fvNV(disp, glProgramParameter4fvNV);
+ SET_ProgramParameters4dvNV(disp, glProgramParameters4dvNV);
+ SET_ProgramParameters4fvNV(disp, glProgramParameters4fvNV);
+ SET_RequestResidentProgramsNV(disp, glRequestResidentProgramsNV);
+ SET_TrackMatrixNV(disp, glTrackMatrixNV);
+ SET_VertexAttribPointerNV(disp, glVertexAttribPointerNV);
+ SET_VertexAttrib1dARB(disp, glVertexAttrib1dARB);
+ SET_VertexAttrib1dvARB(disp, glVertexAttrib1dvARB);
+ SET_VertexAttrib1fARB(disp, glVertexAttrib1fARB);
+ SET_VertexAttrib1fvARB(disp, glVertexAttrib1fvARB);
+ SET_VertexAttrib1sARB(disp, glVertexAttrib1sARB);
+ SET_VertexAttrib1svARB(disp, glVertexAttrib1svARB);
+ SET_VertexAttrib2dARB(disp, glVertexAttrib2dARB);
+ SET_VertexAttrib2dvARB(disp, glVertexAttrib2dvARB);
+ SET_VertexAttrib2fARB(disp, glVertexAttrib2fARB);
+ SET_VertexAttrib2fvARB(disp, glVertexAttrib2fvARB);
+ SET_VertexAttrib2sARB(disp, glVertexAttrib2sARB);
+ SET_VertexAttrib2svARB(disp, glVertexAttrib2svARB);
+ SET_VertexAttrib3dARB(disp, glVertexAttrib3dARB);
+ SET_VertexAttrib3dvARB(disp, glVertexAttrib3dvARB);
+ SET_VertexAttrib3fARB(disp, glVertexAttrib3fARB);
+ SET_VertexAttrib3fvARB(disp, glVertexAttrib3fvARB);
+ SET_VertexAttrib3sARB(disp, glVertexAttrib3sARB);
+ SET_VertexAttrib3svARB(disp, glVertexAttrib3svARB);
+ SET_VertexAttrib4dARB(disp, glVertexAttrib4dARB);
+ SET_VertexAttrib4dvARB(disp, glVertexAttrib4dvARB);
+ SET_VertexAttrib4fARB(disp, glVertexAttrib4fARB);
+ SET_VertexAttrib4fvARB(disp, glVertexAttrib4fvARB);
+ SET_VertexAttrib4sARB(disp, glVertexAttrib4sARB);
+ SET_VertexAttrib4svARB(disp, glVertexAttrib4svARB);
+ SET_VertexAttrib4NubARB(disp, glVertexAttrib4NubARB);
+ SET_VertexAttrib4NubvARB(disp, glVertexAttrib4NubvARB);
+ SET_VertexAttribs1dvNV(disp, glVertexAttribs1dvNV);
+ SET_VertexAttribs1fvNV(disp, glVertexAttribs1fvNV);
+ SET_VertexAttribs1svNV(disp, glVertexAttribs1svNV);
+ SET_VertexAttribs2dvNV(disp, glVertexAttribs2dvNV);
+ SET_VertexAttribs2fvNV(disp, glVertexAttribs2fvNV);
+ SET_VertexAttribs2svNV(disp, glVertexAttribs2svNV);
+ SET_VertexAttribs3dvNV(disp, glVertexAttribs3dvNV);
+ SET_VertexAttribs3fvNV(disp, glVertexAttribs3fvNV);
+ SET_VertexAttribs3svNV(disp, glVertexAttribs3svNV);
+ SET_VertexAttribs4dvNV(disp, glVertexAttribs4dvNV);
+ SET_VertexAttribs4fvNV(disp, glVertexAttribs4fvNV);
+ SET_VertexAttribs4svNV(disp, glVertexAttribs4svNV);
+ SET_VertexAttribs4ubvNV(disp, glVertexAttribs4ubvNV);
+ SET_PointParameteriNV(disp, glPointParameteriNV);
+ SET_PointParameterivNV(disp, glPointParameterivNV);
+ SET_MultiDrawArraysEXT(disp, glMultiDrawArraysEXT);
+ SET_MultiDrawElementsEXT(disp, glMultiDrawElementsEXT);
+ SET_ActiveStencilFaceEXT(disp, glActiveStencilFaceEXT);
+ SET_DeleteFencesNV(disp, glDeleteFencesNV);
+ SET_GenFencesNV(disp, glGenFencesNV);
+ SET_IsFenceNV(disp, glIsFenceNV);
+ SET_TestFenceNV(disp, glTestFenceNV);
+ SET_GetFenceivNV(disp, glGetFenceivNV);
+ SET_FinishFenceNV(disp, glFinishFenceNV);
+ SET_SetFenceNV(disp, glSetFenceNV);
+ SET_VertexAttrib4bvARB(disp, glVertexAttrib4bvARB);
+ SET_VertexAttrib4ivARB(disp, glVertexAttrib4ivARB);
+ SET_VertexAttrib4ubvARB(disp, glVertexAttrib4ubvARB);
+ SET_VertexAttrib4usvARB(disp, glVertexAttrib4usvARB);
+ SET_VertexAttrib4uivARB(disp, glVertexAttrib4uivARB);
+ SET_VertexAttrib4NbvARB(disp, glVertexAttrib4NbvARB);
+ SET_VertexAttrib4NsvARB(disp, glVertexAttrib4NsvARB);
+ SET_VertexAttrib4NivARB(disp, glVertexAttrib4NivARB);
+ SET_VertexAttrib4NusvARB(disp, glVertexAttrib4NusvARB);
+ SET_VertexAttrib4NuivARB(disp, glVertexAttrib4NuivARB);
+ SET_VertexAttribPointerARB(disp, glVertexAttribPointerARB);
+ SET_EnableVertexAttribArrayARB(disp, glEnableVertexAttribArrayARB);
+ SET_DisableVertexAttribArrayARB(disp, glDisableVertexAttribArrayARB);
+ SET_ProgramStringARB(disp, glProgramStringARB);
+ SET_ProgramEnvParameter4dARB(disp, glProgramEnvParameter4dARB);
+ SET_ProgramEnvParameter4dvARB(disp, glProgramEnvParameter4dvARB);
+ SET_ProgramEnvParameter4fARB(disp, glProgramEnvParameter4fARB);
+ SET_ProgramEnvParameter4fvARB(disp, glProgramEnvParameter4fvARB);
+ SET_ProgramLocalParameter4dARB(disp, glProgramLocalParameter4dARB);
+ SET_ProgramLocalParameter4dvARB(disp, glProgramLocalParameter4dvARB);
+ SET_ProgramLocalParameter4fARB(disp, glProgramLocalParameter4fARB);
+ SET_ProgramLocalParameter4fvARB(disp, glProgramLocalParameter4fvARB);
+ SET_GetProgramEnvParameterdvARB(disp, glGetProgramEnvParameterdvARB);
+ SET_GetProgramEnvParameterfvARB(disp, glGetProgramEnvParameterfvARB);
+ SET_GetProgramLocalParameterdvARB(disp, glGetProgramLocalParameterdvARB);
+ SET_GetProgramLocalParameterfvARB(disp, glGetProgramLocalParameterfvARB);
+ SET_GetProgramivARB(disp, glGetProgramivARB);
+ SET_GetProgramStringARB(disp, glGetProgramStringARB);
+ SET_ProgramNamedParameter4fNV(disp, glProgramNamedParameter4fNV);
+ SET_ProgramNamedParameter4dNV(disp, glProgramNamedParameter4dNV);
+ SET_ProgramNamedParameter4fvNV(disp, glProgramNamedParameter4fvNV);
+ SET_ProgramNamedParameter4dvNV(disp, glProgramNamedParameter4dvNV);
+ SET_GetProgramNamedParameterfvNV(disp, glGetProgramNamedParameterfvNV);
+ SET_GetProgramNamedParameterdvNV(disp, glGetProgramNamedParameterdvNV);
+ SET_BindBufferARB(disp, glBindBufferARB);
+ SET_BufferDataARB(disp, glBufferDataARB);
+ SET_BufferSubDataARB(disp, glBufferSubDataARB);
+ SET_DeleteBuffersARB(disp, glDeleteBuffersARB);
+ SET_GenBuffersARB(disp, glGenBuffersARB);
+ SET_GetBufferParameterivARB(disp, glGetBufferParameterivARB);
+ SET_GetBufferPointervARB(disp, glGetBufferPointervARB);
+ SET_GetBufferSubDataARB(disp, glGetBufferSubDataARB);
+ SET_IsBufferARB(disp, glIsBufferARB);
+ SET_MapBufferARB(disp, glMapBufferARB);
+ SET_UnmapBufferARB(disp, glUnmapBufferARB);
+ SET_DepthBoundsEXT(disp, glDepthBoundsEXT);
+ SET_GenQueriesARB(disp, glGenQueriesARB);
+ SET_DeleteQueriesARB(disp, glDeleteQueriesARB);
+ SET_IsQueryARB(disp, glIsQueryARB);
+ SET_BeginQueryARB(disp, glBeginQueryARB);
+ SET_EndQueryARB(disp, glEndQueryARB);
+ SET_GetQueryivARB(disp, glGetQueryivARB);
+ SET_GetQueryObjectivARB(disp, glGetQueryObjectivARB);
+ SET_GetQueryObjectuivARB(disp, glGetQueryObjectuivARB);
+ SET_MultiModeDrawArraysIBM(disp, glMultiModeDrawArraysIBM);
+ SET_MultiModeDrawElementsIBM(disp, glMultiModeDrawElementsIBM);
+ SET_BlendEquationSeparateEXT(disp, glBlendEquationSeparateEXT);
+ SET_DeleteObjectARB(disp, glDeleteObjectARB);
+ SET_GetHandleARB(disp, glGetHandleARB);
+ SET_DetachObjectARB(disp, glDetachObjectARB);
+ SET_CreateShaderObjectARB(disp, glCreateShaderObjectARB);
+ SET_ShaderSourceARB(disp, glShaderSourceARB);
+ SET_CompileShaderARB(disp, glCompileShaderARB);
+ SET_CreateProgramObjectARB(disp, glCreateProgramObjectARB);
+ SET_AttachObjectARB(disp, glAttachObjectARB);
+ SET_LinkProgramARB(disp, glLinkProgramARB);
+ SET_UseProgramObjectARB(disp, glUseProgramObjectARB);
+ SET_ValidateProgramARB(disp, glValidateProgramARB);
+ SET_Uniform1fARB(disp, glUniform1fARB);
+ SET_Uniform2fARB(disp, glUniform2fARB);
+ SET_Uniform3fARB(disp, glUniform3fARB);
+ SET_Uniform4fARB(disp, glUniform4fARB);
+ SET_Uniform1iARB(disp, glUniform1iARB);
+ SET_Uniform2iARB(disp, glUniform2iARB);
+ SET_Uniform3iARB(disp, glUniform3iARB);
+ SET_Uniform4iARB(disp, glUniform4iARB);
+ SET_Uniform1fvARB(disp, glUniform1fvARB);
+ SET_Uniform2fvARB(disp, glUniform2fvARB);
+ SET_Uniform3fvARB(disp, glUniform3fvARB);
+ SET_Uniform4fvARB(disp, glUniform4fvARB);
+ SET_Uniform1ivARB(disp, glUniform1ivARB);
+ SET_Uniform2ivARB(disp, glUniform2ivARB);
+ SET_Uniform3ivARB(disp, glUniform3ivARB);
+ SET_Uniform4ivARB(disp, glUniform4ivARB);
+ SET_UniformMatrix2fvARB(disp, glUniformMatrix2fvARB);
+ SET_UniformMatrix3fvARB(disp, glUniformMatrix3fvARB);
+ SET_UniformMatrix4fvARB(disp, glUniformMatrix4fvARB);
+ SET_GetObjectParameterfvARB(disp, glGetObjectParameterfvARB);
+ SET_GetObjectParameterivARB(disp, glGetObjectParameterivARB);
+ SET_GetInfoLogARB(disp, glGetInfoLogARB);
+ SET_GetAttachedObjectsARB(disp, glGetAttachedObjectsARB);
+ SET_GetUniformLocationARB(disp, glGetUniformLocationARB);
+ SET_GetActiveUniformARB(disp, glGetActiveUniformARB);
+ SET_GetUniformfvARB(disp, glGetUniformfvARB);
+ SET_GetUniformivARB(disp, glGetUniformivARB);
+ SET_GetShaderSourceARB(disp, glGetShaderSourceARB);
+ SET_BindAttribLocationARB(disp, glBindAttribLocationARB);
+ SET_GetActiveAttribARB(disp, glGetActiveAttribARB);
+ SET_GetAttribLocationARB(disp, glGetAttribLocationARB);
+ SET_GetVertexAttribdvNV(disp, glGetVertexAttribdvNV);
+ SET_GetVertexAttribfvNV(disp, glGetVertexAttribfvNV);
+ SET_GetVertexAttribivNV(disp, glGetVertexAttribivNV);
+ SET_VertexAttrib1dNV(disp, glVertexAttrib1dNV);
+ SET_VertexAttrib1dvNV(disp, glVertexAttrib1dvNV);
+ SET_VertexAttrib1fNV(disp, glVertexAttrib1fNV);
+ SET_VertexAttrib1fvNV(disp, glVertexAttrib1fvNV);
+ SET_VertexAttrib1sNV(disp, glVertexAttrib1sNV);
+ SET_VertexAttrib1svNV(disp, glVertexAttrib1svNV);
+ SET_VertexAttrib2dNV(disp, glVertexAttrib2dNV);
+ SET_VertexAttrib2dvNV(disp, glVertexAttrib2dvNV);
+ SET_VertexAttrib2fNV(disp, glVertexAttrib2fNV);
+ SET_VertexAttrib2fvNV(disp, glVertexAttrib2fvNV);
+ SET_VertexAttrib2sNV(disp, glVertexAttrib2sNV);
+ SET_VertexAttrib2svNV(disp, glVertexAttrib2svNV);
+ SET_VertexAttrib3dNV(disp, glVertexAttrib3dNV);
+ SET_VertexAttrib3dvNV(disp, glVertexAttrib3dvNV);
+ SET_VertexAttrib3fNV(disp, glVertexAttrib3fNV);
+ SET_VertexAttrib3fvNV(disp, glVertexAttrib3fvNV);
+ SET_VertexAttrib3sNV(disp, glVertexAttrib3sNV);
+ SET_VertexAttrib3svNV(disp, glVertexAttrib3svNV);
+ SET_VertexAttrib4dNV(disp, glVertexAttrib4dNV);
+ SET_VertexAttrib4dvNV(disp, glVertexAttrib4dvNV);
+ SET_VertexAttrib4fNV(disp, glVertexAttrib4fNV);
+ SET_VertexAttrib4fvNV(disp, glVertexAttrib4fvNV);
+ SET_VertexAttrib4sNV(disp, glVertexAttrib4sNV);
+ SET_VertexAttrib4svNV(disp, glVertexAttrib4svNV);
+ SET_VertexAttrib4ubNV(disp, glVertexAttrib4ubNV);
+ SET_VertexAttrib4ubvNV(disp, glVertexAttrib4ubvNV);
+ SET_GenFragmentShadersATI(disp, glGenFragmentShadersATI);
+ SET_BindFragmentShaderATI(disp, glBindFragmentShaderATI);
+ SET_DeleteFragmentShaderATI(disp, glDeleteFragmentShaderATI);
+ SET_BeginFragmentShaderATI(disp, glBeginFragmentShaderATI);
+ SET_EndFragmentShaderATI(disp, glEndFragmentShaderATI);
+ SET_PassTexCoordATI(disp, glPassTexCoordATI);
+ SET_SampleMapATI(disp, glSampleMapATI);
+ SET_ColorFragmentOp1ATI(disp, glColorFragmentOp1ATI);
+ SET_ColorFragmentOp2ATI(disp, glColorFragmentOp2ATI);
+ SET_ColorFragmentOp3ATI(disp, glColorFragmentOp3ATI);
+ SET_AlphaFragmentOp1ATI(disp, glAlphaFragmentOp1ATI);
+ SET_AlphaFragmentOp2ATI(disp, glAlphaFragmentOp2ATI);
+ SET_AlphaFragmentOp3ATI(disp, glAlphaFragmentOp3ATI);
+ SET_SetFragmentShaderConstantATI(disp, glSetFragmentShaderConstantATI);
+ SET_IsRenderbufferEXT(disp, glIsRenderbufferEXT);
+ SET_BindRenderbufferEXT(disp, glBindRenderbufferEXT);
+ SET_DeleteRenderbuffersEXT(disp, glDeleteRenderbuffersEXT);
+ SET_GenRenderbuffersEXT(disp, glGenRenderbuffersEXT);
+ SET_RenderbufferStorageEXT(disp, glRenderbufferStorageEXT);
+ SET_GetRenderbufferParameterivEXT(disp, glGetRenderbufferParameterivEXT);
+ SET_IsFramebufferEXT(disp, glIsFramebufferEXT);
+ SET_BindFramebufferEXT(disp, glBindFramebufferEXT);
+ SET_DeleteFramebuffersEXT(disp, glDeleteFramebuffersEXT);
+ SET_GenFramebuffersEXT(disp, glGenFramebuffersEXT);
+ SET_CheckFramebufferStatusEXT(disp, glCheckFramebufferStatusEXT);
+ SET_FramebufferTexture1DEXT(disp, glFramebufferTexture1DEXT);
+ SET_FramebufferTexture2DEXT(disp, glFramebufferTexture2DEXT);
+ SET_FramebufferTexture3DEXT(disp, glFramebufferTexture3DEXT);
+ SET_FramebufferRenderbufferEXT(disp, glFramebufferRenderbufferEXT);
+ SET_GetFramebufferAttachmentParameterivEXT(disp, glGetFramebufferAttachmentParameterivEXT);
+ SET_GenerateMipmapEXT(disp, glGenerateMipmapEXT);
+ SET_StencilFuncSeparate(disp, glStencilFuncSeparate);
+ SET_StencilOpSeparate(disp, glStencilOpSeparate);
+ SET_StencilMaskSeparate(disp, glStencilMaskSeparate);
+ SET_GetQueryObjecti64vEXT(disp, glGetQueryObjecti64vEXT);
+ SET_GetQueryObjectui64vEXT(disp, glGetQueryObjectui64vEXT);
+ SET_BlitFramebufferEXT(disp, glBlitFramebufferEXT);
+ SET_LoadTransposeMatrixfARB(disp, glLoadTransposeMatrixfARB);
+ SET_LoadTransposeMatrixdARB(disp, glLoadTransposeMatrixdARB);
+ SET_MultTransposeMatrixfARB(disp, glMultTransposeMatrixfARB);
+ SET_MultTransposeMatrixdARB(disp, glMultTransposeMatrixdARB);
+ SET_SampleCoverageARB(disp, glSampleCoverageARB);
+ SET_DrawBuffersARB(disp, glDrawBuffersARB);
+ SET_PolygonOffsetEXT(disp, glPolygonOffsetEXT);
+ SET_GetTexFilterFuncSGIS(disp, glGetTexFilterFuncSGIS);
+ SET_TexFilterFuncSGIS(disp, glTexFilterFuncSGIS);
+ SET_GetHistogramEXT(disp, glGetHistogramEXT);
+ SET_GetHistogramParameterfvEXT(disp, glGetHistogramParameterfvEXT);
+ SET_GetHistogramParameterivEXT(disp, glGetHistogramParameterivEXT);
+ SET_GetMinmaxEXT(disp, glGetMinmaxEXT);
+ SET_GetMinmaxParameterfvEXT(disp, glGetMinmaxParameterfvEXT);
+ SET_GetMinmaxParameterivEXT(disp, glGetMinmaxParameterivEXT);
+ SET_GetConvolutionFilterEXT(disp, glGetConvolutionFilterEXT);
+ SET_GetConvolutionParameterfvEXT(disp, glGetConvolutionParameterfvEXT);
+ SET_GetConvolutionParameterivEXT(disp, glGetConvolutionParameterivEXT);
+ SET_GetSeparableFilterEXT(disp, glGetSeparableFilterEXT);
+ SET_GetColorTableSGI(disp, glGetColorTableSGI);
+ SET_GetColorTableParameterfvSGI(disp, glGetColorTableParameterfvSGI);
+ SET_GetColorTableParameterivSGI(disp, glGetColorTableParameterivSGI);
+ SET_PixelTexGenSGIX(disp, glPixelTexGenSGIX);
+ SET_PixelTexGenParameteriSGIS(disp, glPixelTexGenParameteriSGIS);
+ SET_PixelTexGenParameterivSGIS(disp, glPixelTexGenParameterivSGIS);
+ SET_PixelTexGenParameterfSGIS(disp, glPixelTexGenParameterfSGIS);
+ SET_PixelTexGenParameterfvSGIS(disp, glPixelTexGenParameterfvSGIS);
+ SET_GetPixelTexGenParameterivSGIS(disp, glGetPixelTexGenParameterivSGIS);
+ SET_GetPixelTexGenParameterfvSGIS(disp, glGetPixelTexGenParameterfvSGIS);
+ SET_TexImage4DSGIS(disp, glTexImage4DSGIS);
+ SET_TexSubImage4DSGIS(disp, glTexSubImage4DSGIS);
+ SET_AreTexturesResidentEXT(disp, glAreTexturesResidentEXT);
+ SET_GenTexturesEXT(disp, glGenTexturesEXT);
+ SET_IsTextureEXT(disp, glIsTextureEXT);
+ SET_DetailTexFuncSGIS(disp, glDetailTexFuncSGIS);
+ SET_GetDetailTexFuncSGIS(disp, glGetDetailTexFuncSGIS);
+ SET_SharpenTexFuncSGIS(disp, glSharpenTexFuncSGIS);
+ SET_GetSharpenTexFuncSGIS(disp, glGetSharpenTexFuncSGIS);
+ SET_SampleMaskSGIS(disp, glSampleMaskSGIS);
+ SET_SamplePatternSGIS(disp, glSamplePatternSGIS);
+ SET_ColorPointerEXT(disp, glColorPointerEXT);
+ SET_EdgeFlagPointerEXT(disp, glEdgeFlagPointerEXT);
+ SET_IndexPointerEXT(disp, glIndexPointerEXT);
+ SET_NormalPointerEXT(disp, glNormalPointerEXT);
+ SET_TexCoordPointerEXT(disp, glTexCoordPointerEXT);
+ SET_VertexPointerEXT(disp, glVertexPointerEXT);
+ SET_SpriteParameterfSGIX(disp, glSpriteParameterfSGIX);
+ SET_SpriteParameterfvSGIX(disp, glSpriteParameterfvSGIX);
+ SET_SpriteParameteriSGIX(disp, glSpriteParameteriSGIX);
+ SET_SpriteParameterivSGIX(disp, glSpriteParameterivSGIX);
+ SET_PointParameterfEXT(disp, glPointParameterfEXT);
+ SET_PointParameterfvEXT(disp, glPointParameterfvEXT);
+ SET_GetInstrumentsSGIX(disp, glGetInstrumentsSGIX);
+ SET_InstrumentsBufferSGIX(disp, glInstrumentsBufferSGIX);
+ SET_PollInstrumentsSGIX(disp, glPollInstrumentsSGIX);
+ SET_ReadInstrumentsSGIX(disp, glReadInstrumentsSGIX);
+ SET_StartInstrumentsSGIX(disp, glStartInstrumentsSGIX);
+ SET_StopInstrumentsSGIX(disp, glStopInstrumentsSGIX);
+ SET_FrameZoomSGIX(disp, glFrameZoomSGIX);
+ SET_TagSampleBufferSGIX(disp, glTagSampleBufferSGIX);
+ SET_ReferencePlaneSGIX(disp, glReferencePlaneSGIX);
+ SET_FlushRasterSGIX(disp, glFlushRasterSGIX);
+ SET_GetListParameterfvSGIX(disp, glGetListParameterfvSGIX);
+ SET_GetListParameterivSGIX(disp, glGetListParameterivSGIX);
+ SET_ListParameterfSGIX(disp, glListParameterfSGIX);
+ SET_ListParameterfvSGIX(disp, glListParameterfvSGIX);
+ SET_ListParameteriSGIX(disp, glListParameteriSGIX);
+ SET_ListParameterivSGIX(disp, glListParameterivSGIX);
+ SET_FragmentColorMaterialSGIX(disp, glFragmentColorMaterialSGIX);
+ SET_FragmentLightfSGIX(disp, glFragmentLightfSGIX);
+ SET_FragmentLightfvSGIX(disp, glFragmentLightfvSGIX);
+ SET_FragmentLightiSGIX(disp, glFragmentLightiSGIX);
+ SET_FragmentLightivSGIX(disp, glFragmentLightivSGIX);
+ SET_FragmentLightModelfSGIX(disp, glFragmentLightModelfSGIX);
+ SET_FragmentLightModelfvSGIX(disp, glFragmentLightModelfvSGIX);
+ SET_FragmentLightModeliSGIX(disp, glFragmentLightModeliSGIX);
+ SET_FragmentLightModelivSGIX(disp, glFragmentLightModelivSGIX);
+ SET_FragmentMaterialfSGIX(disp, glFragmentMaterialfSGIX);
+ SET_FragmentMaterialfvSGIX(disp, glFragmentMaterialfvSGIX);
+ SET_FragmentMaterialiSGIX(disp, glFragmentMaterialiSGIX);
+ SET_FragmentMaterialivSGIX(disp, glFragmentMaterialivSGIX);
+ SET_GetFragmentLightfvSGIX(disp, glGetFragmentLightfvSGIX);
+ SET_GetFragmentLightivSGIX(disp, glGetFragmentLightivSGIX);
+ SET_GetFragmentMaterialfvSGIX(disp, glGetFragmentMaterialfvSGIX);
+ SET_GetFragmentMaterialivSGIX(disp, glGetFragmentMaterialivSGIX);
+ SET_LightEnviSGIX(disp, glLightEnviSGIX);
+ SET_VertexWeightfEXT(disp, glVertexWeightfEXT);
+ SET_VertexWeightfvEXT(disp, glVertexWeightfvEXT);
+ SET_VertexWeightPointerEXT(disp, glVertexWeightPointerEXT);
+ SET_FlushVertexArrayRangeNV(disp, glFlushVertexArrayRangeNV);
+ SET_VertexArrayRangeNV(disp, glVertexArrayRangeNV);
+ SET_CombinerParameterfvNV(disp, glCombinerParameterfvNV);
+ SET_CombinerParameterfNV(disp, glCombinerParameterfNV);
+ SET_CombinerParameterivNV(disp, glCombinerParameterivNV);
+ SET_CombinerParameteriNV(disp, glCombinerParameteriNV);
+ SET_CombinerInputNV(disp, glCombinerInputNV);
+ SET_CombinerOutputNV(disp, glCombinerOutputNV);
+ SET_FinalCombinerInputNV(disp, glFinalCombinerInputNV);
+ SET_GetCombinerInputParameterfvNV(disp, glGetCombinerInputParameterfvNV);
+ SET_GetCombinerInputParameterivNV(disp, glGetCombinerInputParameterivNV);
+ SET_GetCombinerOutputParameterfvNV(disp, glGetCombinerOutputParameterfvNV);
+ SET_GetCombinerOutputParameterivNV(disp, glGetCombinerOutputParameterivNV);
+ SET_GetFinalCombinerInputParameterfvNV(disp, glGetFinalCombinerInputParameterfvNV);
+ SET_GetFinalCombinerInputParameterivNV(disp, glGetFinalCombinerInputParameterivNV);
+ SET_ResizeBuffersMESA(disp, glResizeBuffersMESA);
+ SET_WindowPos2dMESA(disp, glWindowPos2dMESA);
+ SET_WindowPos2dvMESA(disp, glWindowPos2dvMESA);
+ SET_WindowPos2fMESA(disp, glWindowPos2fMESA);
+ SET_WindowPos2fvMESA(disp, glWindowPos2fvMESA);
+ SET_WindowPos2iMESA(disp, glWindowPos2iMESA);
+ SET_WindowPos2ivMESA(disp, glWindowPos2ivMESA);
+ SET_WindowPos2sMESA(disp, glWindowPos2sMESA);
+ SET_WindowPos2svMESA(disp, glWindowPos2svMESA);
+ SET_WindowPos3dMESA(disp, glWindowPos3dMESA);
+ SET_WindowPos3dvMESA(disp, glWindowPos3dvMESA);
+ SET_WindowPos3fMESA(disp, glWindowPos3fMESA);
+ SET_WindowPos3fvMESA(disp, glWindowPos3fvMESA);
+ SET_WindowPos3iMESA(disp, glWindowPos3iMESA);
+ SET_WindowPos3ivMESA(disp, glWindowPos3ivMESA);
+ SET_WindowPos3sMESA(disp, glWindowPos3sMESA);
+ SET_WindowPos3svMESA(disp, glWindowPos3svMESA);
+ SET_WindowPos4dMESA(disp, glWindowPos4dMESA);
+ SET_WindowPos4dvMESA(disp, glWindowPos4dvMESA);
+ SET_WindowPos4fMESA(disp, glWindowPos4fMESA);
+ SET_WindowPos4fvMESA(disp, glWindowPos4fvMESA);
+ SET_WindowPos4iMESA(disp, glWindowPos4iMESA);
+ SET_WindowPos4ivMESA(disp, glWindowPos4ivMESA);
+ SET_WindowPos4sMESA(disp, glWindowPos4sMESA);
+ SET_WindowPos4svMESA(disp, glWindowPos4svMESA);
+ SET_BlendFuncSeparateEXT(disp, glBlendFuncSeparateEXT);
+ SET_IndexMaterialEXT(disp, glIndexMaterialEXT);
+ SET_IndexFuncEXT(disp, glIndexFuncEXT);
+ SET_LockArraysEXT(disp, glLockArraysEXT);
+ SET_UnlockArraysEXT(disp, glUnlockArraysEXT);
+ SET_CullParameterdvEXT(disp, glCullParameterdvEXT);
+ SET_CullParameterfvEXT(disp, glCullParameterfvEXT);
+ SET_HintPGI(disp, glHintPGI);
+ SET_FogCoordfEXT(disp, glFogCoordfEXT);
+ SET_FogCoordfvEXT(disp, glFogCoordfvEXT);
+ SET_FogCoorddEXT(disp, glFogCoorddEXT);
+ SET_FogCoorddvEXT(disp, glFogCoorddvEXT);
+ SET_FogCoordPointerEXT(disp, glFogCoordPointerEXT);
+ SET_GetColorTableEXT(disp, glGetColorTableEXT);
+ SET_GetColorTableParameterivEXT(disp, glGetColorTableParameterivEXT);
+ SET_GetColorTableParameterfvEXT(disp, glGetColorTableParameterfvEXT);
+ SET_TbufferMask3DFX(disp, glTbufferMask3DFX);
+ SET_CompressedTexImage3DARB(disp, glCompressedTexImage3DARB);
+ SET_CompressedTexImage2DARB(disp, glCompressedTexImage2DARB);
+ SET_CompressedTexImage1DARB(disp, glCompressedTexImage1DARB);
+ SET_CompressedTexSubImage3DARB(disp, glCompressedTexSubImage3DARB);
+ SET_CompressedTexSubImage2DARB(disp, glCompressedTexSubImage2DARB);
+ SET_CompressedTexSubImage1DARB(disp, glCompressedTexSubImage1DARB);
+ SET_GetCompressedTexImageARB(disp, glGetCompressedTexImageARB);
+ SET_SecondaryColor3bEXT(disp, glSecondaryColor3bEXT);
+ SET_SecondaryColor3bvEXT(disp, glSecondaryColor3bvEXT);
+ SET_SecondaryColor3dEXT(disp, glSecondaryColor3dEXT);
+ SET_SecondaryColor3dvEXT(disp, glSecondaryColor3dvEXT);
+ SET_SecondaryColor3fEXT(disp, glSecondaryColor3fEXT);
+ SET_SecondaryColor3fvEXT(disp, glSecondaryColor3fvEXT);
+ SET_SecondaryColor3iEXT(disp, glSecondaryColor3iEXT);
+ SET_SecondaryColor3ivEXT(disp, glSecondaryColor3ivEXT);
+ SET_SecondaryColor3sEXT(disp, glSecondaryColor3sEXT);
+ SET_SecondaryColor3svEXT(disp, glSecondaryColor3svEXT);
+ SET_SecondaryColor3ubEXT(disp, glSecondaryColor3ubEXT);
+ SET_SecondaryColor3ubvEXT(disp, glSecondaryColor3ubvEXT);
+ SET_SecondaryColor3uiEXT(disp, glSecondaryColor3uiEXT);
+ SET_SecondaryColor3uivEXT(disp, glSecondaryColor3uivEXT);
+ SET_SecondaryColor3usEXT(disp, glSecondaryColor3usEXT);
+ SET_SecondaryColor3usvEXT(disp, glSecondaryColor3usvEXT);
+ SET_SecondaryColorPointerEXT(disp, glSecondaryColorPointerEXT);
+ SET_AreProgramsResidentNV(disp, glAreProgramsResidentNV);
+ SET_BindProgramNV(disp, glBindProgramNV);
+ SET_DeleteProgramsNV(disp, glDeleteProgramsNV);
+ SET_ExecuteProgramNV(disp, glExecuteProgramNV);
+ SET_GenProgramsNV(disp, glGenProgramsNV);
+ SET_GetProgramParameterdvNV(disp, glGetProgramParameterdvNV);
+ SET_GetProgramParameterfvNV(disp, glGetProgramParameterfvNV);
+ SET_GetProgramivNV(disp, glGetProgramivNV);
+ SET_GetProgramStringNV(disp, glGetProgramStringNV);
+ SET_GetTrackMatrixivNV(disp, glGetTrackMatrixivNV);
+ SET_GetVertexAttribdvARB(disp, glGetVertexAttribdvARB);
+ SET_GetVertexAttribfvARB(disp, glGetVertexAttribfvARB);
+ SET_GetVertexAttribivARB(disp, glGetVertexAttribivARB);
+ SET_GetVertexAttribPointervNV(disp, glGetVertexAttribPointervNV);
+ SET_IsProgramNV(disp, glIsProgramNV);
+ SET_LoadProgramNV(disp, glLoadProgramNV);
+ SET_ProgramParameter4dNV(disp, glProgramParameter4dNV);
+ SET_ProgramParameter4dvNV(disp, glProgramParameter4dvNV);
+ SET_ProgramParameter4fNV(disp, glProgramParameter4fNV);
+ SET_ProgramParameter4fvNV(disp, glProgramParameter4fvNV);
+ SET_ProgramParameters4dvNV(disp, glProgramParameters4dvNV);
+ SET_ProgramParameters4fvNV(disp, glProgramParameters4fvNV);
+ SET_RequestResidentProgramsNV(disp, glRequestResidentProgramsNV);
+ SET_TrackMatrixNV(disp, glTrackMatrixNV);
+ SET_VertexAttribPointerNV(disp, glVertexAttribPointerNV);
+ SET_VertexAttrib1dARB(disp, glVertexAttrib1dARB);
+ SET_VertexAttrib1dvARB(disp, glVertexAttrib1dvARB);
+ SET_VertexAttrib1fARB(disp, glVertexAttrib1fARB);
+ SET_VertexAttrib1fvARB(disp, glVertexAttrib1fvARB);
+ SET_VertexAttrib1sARB(disp, glVertexAttrib1sARB);
+ SET_VertexAttrib1svARB(disp, glVertexAttrib1svARB);
+ SET_VertexAttrib2dARB(disp, glVertexAttrib2dARB);
+ SET_VertexAttrib2dvARB(disp, glVertexAttrib2dvARB);
+ SET_VertexAttrib2fARB(disp, glVertexAttrib2fARB);
+ SET_VertexAttrib2fvARB(disp, glVertexAttrib2fvARB);
+ SET_VertexAttrib2sARB(disp, glVertexAttrib2sARB);
+ SET_VertexAttrib2svARB(disp, glVertexAttrib2svARB);
+ SET_VertexAttrib3dARB(disp, glVertexAttrib3dARB);
+ SET_VertexAttrib3dvARB(disp, glVertexAttrib3dvARB);
+ SET_VertexAttrib3fARB(disp, glVertexAttrib3fARB);
+ SET_VertexAttrib3fvARB(disp, glVertexAttrib3fvARB);
+ SET_VertexAttrib3sARB(disp, glVertexAttrib3sARB);
+ SET_VertexAttrib3svARB(disp, glVertexAttrib3svARB);
+ SET_VertexAttrib4dARB(disp, glVertexAttrib4dARB);
+ SET_VertexAttrib4dvARB(disp, glVertexAttrib4dvARB);
+ SET_VertexAttrib4fARB(disp, glVertexAttrib4fARB);
+ SET_VertexAttrib4fvARB(disp, glVertexAttrib4fvARB);
+ SET_VertexAttrib4sARB(disp, glVertexAttrib4sARB);
+ SET_VertexAttrib4svARB(disp, glVertexAttrib4svARB);
+ SET_VertexAttrib4NubARB(disp, glVertexAttrib4NubARB);
+ SET_VertexAttrib4NubvARB(disp, glVertexAttrib4NubvARB);
+ SET_VertexAttribs1dvNV(disp, glVertexAttribs1dvNV);
+ SET_VertexAttribs1fvNV(disp, glVertexAttribs1fvNV);
+ SET_VertexAttribs1svNV(disp, glVertexAttribs1svNV);
+ SET_VertexAttribs2dvNV(disp, glVertexAttribs2dvNV);
+ SET_VertexAttribs2fvNV(disp, glVertexAttribs2fvNV);
+ SET_VertexAttribs2svNV(disp, glVertexAttribs2svNV);
+ SET_VertexAttribs3dvNV(disp, glVertexAttribs3dvNV);
+ SET_VertexAttribs3fvNV(disp, glVertexAttribs3fvNV);
+ SET_VertexAttribs3svNV(disp, glVertexAttribs3svNV);
+ SET_VertexAttribs4dvNV(disp, glVertexAttribs4dvNV);
+ SET_VertexAttribs4fvNV(disp, glVertexAttribs4fvNV);
+ SET_VertexAttribs4svNV(disp, glVertexAttribs4svNV);
+ SET_VertexAttribs4ubvNV(disp, glVertexAttribs4ubvNV);
+ SET_PointParameteriNV(disp, glPointParameteriNV);
+ SET_PointParameterivNV(disp, glPointParameterivNV);
+ SET_MultiDrawArraysEXT(disp, glMultiDrawArraysEXT);
+ SET_MultiDrawElementsEXT(disp, glMultiDrawElementsEXT);
+ SET_ActiveStencilFaceEXT(disp, glActiveStencilFaceEXT);
+ SET_DeleteFencesNV(disp, glDeleteFencesNV);
+ SET_GenFencesNV(disp, glGenFencesNV);
+ SET_IsFenceNV(disp, glIsFenceNV);
+ SET_TestFenceNV(disp, glTestFenceNV);
+ SET_GetFenceivNV(disp, glGetFenceivNV);
+ SET_FinishFenceNV(disp, glFinishFenceNV);
+ SET_SetFenceNV(disp, glSetFenceNV);
+ SET_VertexAttrib4bvARB(disp, glVertexAttrib4bvARB);
+ SET_VertexAttrib4ivARB(disp, glVertexAttrib4ivARB);
+ SET_VertexAttrib4ubvARB(disp, glVertexAttrib4ubvARB);
+ SET_VertexAttrib4usvARB(disp, glVertexAttrib4usvARB);
+ SET_VertexAttrib4uivARB(disp, glVertexAttrib4uivARB);
+ SET_VertexAttrib4NbvARB(disp, glVertexAttrib4NbvARB);
+ SET_VertexAttrib4NsvARB(disp, glVertexAttrib4NsvARB);
+ SET_VertexAttrib4NivARB(disp, glVertexAttrib4NivARB);
+ SET_VertexAttrib4NusvARB(disp, glVertexAttrib4NusvARB);
+ SET_VertexAttrib4NuivARB(disp, glVertexAttrib4NuivARB);
+ SET_VertexAttribPointerARB(disp, glVertexAttribPointerARB);
+ SET_EnableVertexAttribArrayARB(disp, glEnableVertexAttribArrayARB);
+ SET_DisableVertexAttribArrayARB(disp, glDisableVertexAttribArrayARB);
+ SET_ProgramStringARB(disp, glProgramStringARB);
+ SET_ProgramEnvParameter4dARB(disp, glProgramEnvParameter4dARB);
+ SET_ProgramEnvParameter4dvARB(disp, glProgramEnvParameter4dvARB);
+ SET_ProgramEnvParameter4fARB(disp, glProgramEnvParameter4fARB);
+ SET_ProgramEnvParameter4fvARB(disp, glProgramEnvParameter4fvARB);
+ SET_ProgramLocalParameter4dARB(disp, glProgramLocalParameter4dARB);
+ SET_ProgramLocalParameter4dvARB(disp, glProgramLocalParameter4dvARB);
+ SET_ProgramLocalParameter4fARB(disp, glProgramLocalParameter4fARB);
+ SET_ProgramLocalParameter4fvARB(disp, glProgramLocalParameter4fvARB);
+ SET_GetProgramEnvParameterdvARB(disp, glGetProgramEnvParameterdvARB);
+ SET_GetProgramEnvParameterfvARB(disp, glGetProgramEnvParameterfvARB);
+ SET_GetProgramLocalParameterdvARB(disp, glGetProgramLocalParameterdvARB);
+ SET_GetProgramLocalParameterfvARB(disp, glGetProgramLocalParameterfvARB);
+ SET_GetProgramivARB(disp, glGetProgramivARB);
+ SET_GetProgramStringARB(disp, glGetProgramStringARB);
+ SET_ProgramNamedParameter4fNV(disp, glProgramNamedParameter4fNV);
+ SET_ProgramNamedParameter4dNV(disp, glProgramNamedParameter4dNV);
+ SET_ProgramNamedParameter4fvNV(disp, glProgramNamedParameter4fvNV);
+ SET_ProgramNamedParameter4dvNV(disp, glProgramNamedParameter4dvNV);
+ SET_GetProgramNamedParameterfvNV(disp, glGetProgramNamedParameterfvNV);
+ SET_GetProgramNamedParameterdvNV(disp, glGetProgramNamedParameterdvNV);
+ SET_BindBufferARB(disp, glBindBufferARB);
+ SET_BufferDataARB(disp, glBufferDataARB);
+ SET_BufferSubDataARB(disp, glBufferSubDataARB);
+ SET_DeleteBuffersARB(disp, glDeleteBuffersARB);
+ SET_GenBuffersARB(disp, glGenBuffersARB);
+ SET_GetBufferParameterivARB(disp, glGetBufferParameterivARB);
+ SET_GetBufferPointervARB(disp, glGetBufferPointervARB);
+ SET_GetBufferSubDataARB(disp, glGetBufferSubDataARB);
+ SET_IsBufferARB(disp, glIsBufferARB);
+ SET_MapBufferARB(disp, glMapBufferARB);
+ SET_UnmapBufferARB(disp, glUnmapBufferARB);
+ SET_DepthBoundsEXT(disp, glDepthBoundsEXT);
+ SET_GenQueriesARB(disp, glGenQueriesARB);
+ SET_DeleteQueriesARB(disp, glDeleteQueriesARB);
+ SET_IsQueryARB(disp, glIsQueryARB);
+ SET_BeginQueryARB(disp, glBeginQueryARB);
+ SET_EndQueryARB(disp, glEndQueryARB);
+ SET_GetQueryivARB(disp, glGetQueryivARB);
+ SET_GetQueryObjectivARB(disp, glGetQueryObjectivARB);
+ SET_GetQueryObjectuivARB(disp, glGetQueryObjectuivARB);
+ SET_MultiModeDrawArraysIBM(disp, glMultiModeDrawArraysIBM);
+ SET_MultiModeDrawElementsIBM(disp, glMultiModeDrawElementsIBM);
+ SET_BlendEquationSeparateEXT(disp, glBlendEquationSeparateEXT);
+ SET_DeleteObjectARB(disp, glDeleteObjectARB);
+ SET_GetHandleARB(disp, glGetHandleARB);
+ SET_DetachObjectARB(disp, glDetachObjectARB);
+ SET_CreateShaderObjectARB(disp, glCreateShaderObjectARB);
+ SET_ShaderSourceARB(disp, glShaderSourceARB);
+ SET_CompileShaderARB(disp, glCompileShaderARB);
+ SET_CreateProgramObjectARB(disp, glCreateProgramObjectARB);
+ SET_AttachObjectARB(disp, glAttachObjectARB);
+ SET_LinkProgramARB(disp, glLinkProgramARB);
+ SET_UseProgramObjectARB(disp, glUseProgramObjectARB);
+ SET_ValidateProgramARB(disp, glValidateProgramARB);
+ SET_Uniform1fARB(disp, glUniform1fARB);
+ SET_Uniform2fARB(disp, glUniform2fARB);
+ SET_Uniform3fARB(disp, glUniform3fARB);
+ SET_Uniform4fARB(disp, glUniform4fARB);
+ SET_Uniform1iARB(disp, glUniform1iARB);
+ SET_Uniform2iARB(disp, glUniform2iARB);
+ SET_Uniform3iARB(disp, glUniform3iARB);
+ SET_Uniform4iARB(disp, glUniform4iARB);
+ SET_Uniform1fvARB(disp, glUniform1fvARB);
+ SET_Uniform2fvARB(disp, glUniform2fvARB);
+ SET_Uniform3fvARB(disp, glUniform3fvARB);
+ SET_Uniform4fvARB(disp, glUniform4fvARB);
+ SET_Uniform1ivARB(disp, glUniform1ivARB);
+ SET_Uniform2ivARB(disp, glUniform2ivARB);
+ SET_Uniform3ivARB(disp, glUniform3ivARB);
+ SET_Uniform4ivARB(disp, glUniform4ivARB);
+ SET_UniformMatrix2fvARB(disp, glUniformMatrix2fvARB);
+ SET_UniformMatrix3fvARB(disp, glUniformMatrix3fvARB);
+ SET_UniformMatrix4fvARB(disp, glUniformMatrix4fvARB);
+ SET_GetObjectParameterfvARB(disp, glGetObjectParameterfvARB);
+ SET_GetObjectParameterivARB(disp, glGetObjectParameterivARB);
+ SET_GetInfoLogARB(disp, glGetInfoLogARB);
+ SET_GetAttachedObjectsARB(disp, glGetAttachedObjectsARB);
+ SET_GetUniformLocationARB(disp, glGetUniformLocationARB);
+ SET_GetActiveUniformARB(disp, glGetActiveUniformARB);
+ SET_GetUniformfvARB(disp, glGetUniformfvARB);
+ SET_GetUniformivARB(disp, glGetUniformivARB);
+ SET_GetShaderSourceARB(disp, glGetShaderSourceARB);
+ SET_BindAttribLocationARB(disp, glBindAttribLocationARB);
+ SET_GetActiveAttribARB(disp, glGetActiveAttribARB);
+ SET_GetAttribLocationARB(disp, glGetAttribLocationARB);
+ SET_GetVertexAttribdvNV(disp, glGetVertexAttribdvNV);
+ SET_GetVertexAttribfvNV(disp, glGetVertexAttribfvNV);
+ SET_GetVertexAttribivNV(disp, glGetVertexAttribivNV);
+ SET_VertexAttrib1dNV(disp, glVertexAttrib1dNV);
+ SET_VertexAttrib1dvNV(disp, glVertexAttrib1dvNV);
+ SET_VertexAttrib1fNV(disp, glVertexAttrib1fNV);
+ SET_VertexAttrib1fvNV(disp, glVertexAttrib1fvNV);
+ SET_VertexAttrib1sNV(disp, glVertexAttrib1sNV);
+ SET_VertexAttrib1svNV(disp, glVertexAttrib1svNV);
+ SET_VertexAttrib2dNV(disp, glVertexAttrib2dNV);
+ SET_VertexAttrib2dvNV(disp, glVertexAttrib2dvNV);
+ SET_VertexAttrib2fNV(disp, glVertexAttrib2fNV);
+ SET_VertexAttrib2fvNV(disp, glVertexAttrib2fvNV);
+ SET_VertexAttrib2sNV(disp, glVertexAttrib2sNV);
+ SET_VertexAttrib2svNV(disp, glVertexAttrib2svNV);
+ SET_VertexAttrib3dNV(disp, glVertexAttrib3dNV);
+ SET_VertexAttrib3dvNV(disp, glVertexAttrib3dvNV);
+ SET_VertexAttrib3fNV(disp, glVertexAttrib3fNV);
+ SET_VertexAttrib3fvNV(disp, glVertexAttrib3fvNV);
+ SET_VertexAttrib3sNV(disp, glVertexAttrib3sNV);
+ SET_VertexAttrib3svNV(disp, glVertexAttrib3svNV);
+ SET_VertexAttrib4dNV(disp, glVertexAttrib4dNV);
+ SET_VertexAttrib4dvNV(disp, glVertexAttrib4dvNV);
+ SET_VertexAttrib4fNV(disp, glVertexAttrib4fNV);
+ SET_VertexAttrib4fvNV(disp, glVertexAttrib4fvNV);
+ SET_VertexAttrib4sNV(disp, glVertexAttrib4sNV);
+ SET_VertexAttrib4svNV(disp, glVertexAttrib4svNV);
+ SET_VertexAttrib4ubNV(disp, glVertexAttrib4ubNV);
+ SET_VertexAttrib4ubvNV(disp, glVertexAttrib4ubvNV);
+ SET_GenFragmentShadersATI(disp, glGenFragmentShadersATI);
+ SET_BindFragmentShaderATI(disp, glBindFragmentShaderATI);
+ SET_DeleteFragmentShaderATI(disp, glDeleteFragmentShaderATI);
+ SET_BeginFragmentShaderATI(disp, glBeginFragmentShaderATI);
+ SET_EndFragmentShaderATI(disp, glEndFragmentShaderATI);
+ SET_PassTexCoordATI(disp, glPassTexCoordATI);
+ SET_SampleMapATI(disp, glSampleMapATI);
+ SET_ColorFragmentOp1ATI(disp, glColorFragmentOp1ATI);
+ SET_ColorFragmentOp2ATI(disp, glColorFragmentOp2ATI);
+ SET_ColorFragmentOp3ATI(disp, glColorFragmentOp3ATI);
+ SET_AlphaFragmentOp1ATI(disp, glAlphaFragmentOp1ATI);
+ SET_AlphaFragmentOp2ATI(disp, glAlphaFragmentOp2ATI);
+ SET_AlphaFragmentOp3ATI(disp, glAlphaFragmentOp3ATI);
+ SET_SetFragmentShaderConstantATI(disp, glSetFragmentShaderConstantATI);
+ SET_IsRenderbufferEXT(disp, glIsRenderbufferEXT);
+ SET_BindRenderbufferEXT(disp, glBindRenderbufferEXT);
+ SET_DeleteRenderbuffersEXT(disp, glDeleteRenderbuffersEXT);
+ SET_GenRenderbuffersEXT(disp, glGenRenderbuffersEXT);
+ SET_RenderbufferStorageEXT(disp, glRenderbufferStorageEXT);
+ SET_GetRenderbufferParameterivEXT(disp, glGetRenderbufferParameterivEXT);
+ SET_IsFramebufferEXT(disp, glIsFramebufferEXT);
+ SET_BindFramebufferEXT(disp, glBindFramebufferEXT);
+ SET_DeleteFramebuffersEXT(disp, glDeleteFramebuffersEXT);
+ SET_GenFramebuffersEXT(disp, glGenFramebuffersEXT);
+ SET_CheckFramebufferStatusEXT(disp, glCheckFramebufferStatusEXT);
+ SET_FramebufferTexture1DEXT(disp, glFramebufferTexture1DEXT);
+ SET_FramebufferTexture2DEXT(disp, glFramebufferTexture2DEXT);
+ SET_FramebufferTexture3DEXT(disp, glFramebufferTexture3DEXT);
+ SET_FramebufferRenderbufferEXT(disp, glFramebufferRenderbufferEXT);
+ SET_GetFramebufferAttachmentParameterivEXT(disp, glGetFramebufferAttachmentParameterivEXT);
+ SET_GenerateMipmapEXT(disp, glGenerateMipmapEXT);
+ SET_StencilFuncSeparate(disp, glStencilFuncSeparate);
+ SET_StencilOpSeparate(disp, glStencilOpSeparate);
+ SET_StencilMaskSeparate(disp, glStencilMaskSeparate);
+ SET_GetQueryObjecti64vEXT(disp, glGetQueryObjecti64vEXT);
+ SET_GetQueryObjectui64vEXT(disp, glGetQueryObjectui64vEXT);
+ SET_BlitFramebufferEXT(disp, glBlitFramebufferEXT); */
+
+}
diff --git a/GL/glx/glxbyteorder.h b/GL/glx/glxbyteorder.h
index b9d738dba..cdf6b15f0 100644
--- a/GL/glx/glxbyteorder.h
+++ b/GL/glx/glxbyteorder.h
@@ -39,6 +39,11 @@
#include <byteswap.h>
#elif defined(USE_SYS_ENDIAN_H)
#include <sys/endian.h>
+#elif defined(__APPLE__)
+#include <libkern/OSByteOrder.h>
+#define bswap_16 OSSwapInt16
+#define bswap_32 OSSwapInt32
+#define bswap_64 OSSwapInt64
#else
#define bswap_16(value) \
((((value) & 0xff) << 8) | ((value) >> 8))
diff --git a/GL/glx/glxcmdsswap.c b/GL/glx/glxcmdsswap.c
index d59dfdb4c..1857bc1eb 100644
--- a/GL/glx/glxcmdsswap.c
+++ b/GL/glx/glxcmdsswap.c
@@ -496,11 +496,11 @@ int __glXDispSwap_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
GLXDrawable *drawId;
int *buffer;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
(void) drawId;
(void) buffer;
- __GLX_DECLARE_SWAP_VARIABLES;
-
pc += __GLX_VENDPRIV_HDR_SIZE;
__GLX_SWAP_SHORT(&req->length);
diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c
index e03570468..5e683a8ab 100644
--- a/GL/glx/glxdri.c
+++ b/GL/glx/glxdri.c
@@ -495,6 +495,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
context->base.loseCurrent = __glXDRIcontextLoseCurrent;
context->base.copy = __glXDRIcontextCopy;
context->base.forceCurrent = __glXDRIcontextForceCurrent;
+ context->base.pScreen = screen->base.pScreen;
context->base.textureFromPixmap = &__glXDRItextureFromPixmap;
diff --git a/GL/mesa/main/Makefile.am b/GL/mesa/main/Makefile.am
index 20b79351e..2b838e903 100644
--- a/GL/mesa/main/Makefile.am
+++ b/GL/mesa/main/Makefile.am
@@ -68,6 +68,7 @@ nodist_libmain_la_SOURCES = accum.c \
rastpos.c \
rbadaptors.c \
renderbuffer.c \
+ shaders.c \
state.c \
stencil.c \
texcompress.c \
diff --git a/GL/mesa/shader/Makefile.am b/GL/mesa/shader/Makefile.am
index 3519545ed..abde27513 100644
--- a/GL/mesa/shader/Makefile.am
+++ b/GL/mesa/shader/Makefile.am
@@ -27,8 +27,13 @@ nodist_libshader_la_SOURCES = \
atifragshader.c \
nvfragparse.c \
nvprogram.c \
- nvvertexec.c \
- nvvertparse.c \
+ nvvertparse.c \
+ prog_debug.c \
+ prog_execute.c \
+ prog_instruction.c \
+ prog_parameter.c \
+ prog_print.c \
program.c \
- shaderobjects.c \
- shaderobjects_3dlabs.c
+ programopt.c \
+ prog_statevars.c \
+ shader_api.c
diff --git a/GL/mesa/shader/slang/Makefile.am b/GL/mesa/shader/slang/Makefile.am
index 04001c4ba..7f0cd649e 100644
--- a/GL/mesa/shader/slang/Makefile.am
+++ b/GL/mesa/shader/slang/Makefile.am
@@ -18,23 +18,23 @@ INCLUDES = -I@MESA_SOURCE@/include \
-I../.. \
-I$(top_srcdir)/hw/xfree86/os-support
-nodist_libslang_la_SOURCES = slang_analyse.c \
- slang_assemble_assignment.c \
- slang_assemble.c \
- slang_assemble_conditional.c \
- slang_assemble_constructor.c \
- slang_assemble_typeinfo.c \
+nodist_libslang_la_SOURCES = slang_builtin.c \
+ slang_codegen.c \
slang_compile.c \
slang_compile_function.c \
slang_compile_operation.c \
slang_compile_struct.c \
slang_compile_variable.c \
- slang_execute.c \
- slang_execute_x86.c \
- slang_export.c \
- slang_library_texsample.c \
+ slang_emit.c \
+ slang_ir.c \
+ slang_label.c \
slang_library_noise.c \
slang_link.c \
+ slang_log.c \
slang_preprocess.c \
+ slang_print.c \
+ slang_simplify.c \
slang_storage.c \
- slang_utility.c
+ slang_typeinfo.c \
+ slang_utility.c \
+ slang_vartable.c
diff --git a/GL/mesa/swrast/Makefile.am b/GL/mesa/swrast/Makefile.am
index 5ed657631..bffb1e7c1 100644
--- a/GL/mesa/swrast/Makefile.am
+++ b/GL/mesa/swrast/Makefile.am
@@ -23,7 +23,6 @@ nodist_libswrast_la_SOURCES = s_aaline.c \
s_aatriangle.c \
s_accum.c \
s_alpha.c \
- s_arbshader.c \
s_atifragshader.c \
s_bitmap.c \
s_blend.c \
@@ -35,11 +34,11 @@ nodist_libswrast_la_SOURCES = s_aaline.c \
s_drawpix.c \
s_feedback.c \
s_fog.c \
+ s_fragprog.c \
s_imaging.c \
s_lines.c \
s_logic.c \
s_masking.c \
- s_nvfragprog.c \
s_points.c \
s_readpix.c \
s_span.c \
diff --git a/GL/mesa/tnl/Makefile.am b/GL/mesa/tnl/Makefile.am
index 5d9bdb1e6..84301d3d8 100644
--- a/GL/mesa/tnl/Makefile.am
+++ b/GL/mesa/tnl/Makefile.am
@@ -23,7 +23,6 @@ nodist_libtnl_la_SOURCES = t_context.c \
t_pipeline.c \
t_vb_arbprogram.c \
t_vb_arbprogram_sse.c \
- t_vb_arbshader.c \
t_vb_cull.c \
t_vb_fog.c \
t_vb_light.c \
diff --git a/Xext/appgroup.c b/Xext/appgroup.c
index bb7a73ce1..7bd205587 100644
--- a/Xext/appgroup.c
+++ b/Xext/appgroup.c
@@ -116,8 +116,7 @@ int XagAppGroupFree(
return Success;
}
-/* static */
-void XagClientStateChange(
+static void XagClientStateChange(
CallbackListPtr* pcbl,
pointer nulldata,
pointer calldata)
@@ -172,21 +171,6 @@ void XagClientStateChange(
}
}
-void
-XagExtensionInit(INITARGS)
-{
- if (AddExtension (XAGNAME,
- 0,
- XagNumberErrors,
- ProcXagDispatch,
- SProcXagDispatch,
- XagResetProc,
- StandardMinorOpcode)) {
- RT_APPGROUP = CreateNewResourceType (XagAppGroupFree);
- XaceRegisterCallback(XACE_AUTH_AVAIL, XagCallClientStateChange, NULL);
- }
-}
-
/*ARGSUSED*/
static
void XagResetProc(
@@ -393,8 +377,7 @@ int AttrValidate(
return client->noClientException;
}
-/* static */
-int ProcXagCreate (
+static int ProcXagCreate (
register ClientPtr client)
{
REQUEST (xXagCreateReq);
@@ -425,8 +408,7 @@ int ProcXagCreate (
return client->noClientException;
}
-/* static */
-int ProcXagDestroy(
+static int ProcXagDestroy(
register ClientPtr client)
{
AppGroupPtr pAppGrp;
@@ -743,18 +725,7 @@ XID XagId(
return (client->appgroup ? client->appgroup->appgroupId : 0);
}
-void XagGetDeltaInfo(
- ClientPtr client,
- CARD32* buf)
-{
- *buf++ = (CARD32) client->appgroup->default_root;
- *buf++ = (CARD32) client->appgroup->root_visual;
- *buf++ = (CARD32) client->appgroup->default_colormap;
- *buf++ = (CARD32) client->appgroup->black_pixel;
- *buf = (CARD32) client->appgroup->white_pixel;
-}
-
-void XagCallClientStateChange(
+static void XagCallClientStateChange(
CallbackListPtr *pcbl,
pointer nulldata,
pointer calldata)
@@ -785,3 +756,18 @@ void XagCallClientStateChange(
XagClientStateChange (NULL, NULL, (pointer)&clientinfo);
}
}
+
+void
+XagExtensionInit(INITARGS)
+{
+ if (AddExtension (XAGNAME,
+ 0,
+ XagNumberErrors,
+ ProcXagDispatch,
+ SProcXagDispatch,
+ XagResetProc,
+ StandardMinorOpcode)) {
+ RT_APPGROUP = CreateNewResourceType (XagAppGroupFree);
+ XaceRegisterCallback(XACE_AUTH_AVAIL, XagCallClientStateChange, NULL);
+ }
+}
diff --git a/Xext/appgroup.h b/Xext/appgroup.h
index a875068fc..778da5de6 100644
--- a/Xext/appgroup.h
+++ b/Xext/appgroup.h
@@ -50,12 +50,6 @@ extern ClientPtr XagLeader(
ClientPtr /* client */
);
-extern void XagCallClientStateChange(
- CallbackListPtr * /* pcbl */,
- pointer /* nulldata */,
- pointer /* calldata */
-);
-
extern Bool XagIsControlledRoot (
ClientPtr /* client */,
WindowPtr /* pParent */
@@ -65,22 +59,6 @@ extern XID XagId (
ClientPtr /* client */
);
-extern void XagGetDeltaInfo (
- ClientPtr /* client */,
- CARD32* /* buf */
-);
-
-extern void XagClientStateChange(
- CallbackListPtr* pcbl,
- pointer nulldata,
- pointer calldata);
-
-extern int ProcXagCreate (
- register ClientPtr client);
-
-extern int ProcXagDestroy(
- register ClientPtr client);
-
_XFUNCPROTOEND
#endif /* _APPGROUP_SRV_H_ */
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 85f591356..95df04320 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -77,7 +77,7 @@ int PanoramiXPixHeight = 0;
_X_EXPORT int PanoramiXNumScreens = 0;
_X_EXPORT PanoramiXData *panoramiXdataPtr = NULL;
-RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL};
+static RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL};
static int PanoramiXNumDepths;
static DepthPtr PanoramiXDepths;
@@ -109,7 +109,6 @@ static void PanoramiXResetProc(ExtensionEntry*);
#include "panoramiXh.h"
int (* SavedProcVector[256]) (ClientPtr client) = { NULL, };
-ScreenInfo *GlobalScrInfo = NULL;
static int PanoramiXGCIndex = -1;
static int PanoramiXScreenIndex = -1;
@@ -135,7 +134,7 @@ static void XineramaChangeClip(GCPtr, int, pointer, int);
static void XineramaDestroyClip(GCPtr);
static void XineramaCopyClip(GCPtr, GCPtr);
-GCFuncs XineramaGCFuncs = {
+static GCFuncs XineramaGCFuncs = {
XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC,
XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip
};
@@ -168,7 +167,7 @@ XineramaCloseScreen (int i, ScreenPtr pScreen)
return (*pScreen->CloseScreen) (i, pScreen);
}
-Bool
+static Bool
XineramaCreateGC(GCPtr pGC)
{
ScreenPtr pScreen = pGC->pScreen;
@@ -330,8 +329,6 @@ XineramaDestroyClip(GCPtr pGC)
Xinerama_GC_FUNC_EPILOGUE (pGC);
}
-
-
_X_EXPORT int
XineramaDeleteResource(pointer data, XID id)
{
@@ -339,32 +336,11 @@ XineramaDeleteResource(pointer data, XID id)
return 1;
}
-
-static Bool
-XineramaFindIDOnAnyScreen(pointer resource, XID id, pointer privdata)
-{
- PanoramiXRes *res = (PanoramiXRes*)resource;
- int j;
-
- FOR_NSCREENS(j)
- if(res->info[j].id == *((XID*)privdata)) return TRUE;
-
- return FALSE;
-}
-
-PanoramiXRes *
-PanoramiXFindIDOnAnyScreen(RESTYPE type, XID id)
-{
- return LookupClientResourceComplex(clients[CLIENT_ID(id)], type,
- XineramaFindIDOnAnyScreen, &id);
-}
-
typedef struct {
int screen;
int id;
} PanoramiXSearchData;
-
static Bool
XineramaFindIDByScrnum(pointer resource, XID id, pointer privdata)
{
@@ -389,23 +365,6 @@ PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen)
XineramaFindIDByScrnum, &data);
}
-WindowPtr
-PanoramiXChangeWindow(int ScrnNum, WindowPtr pWin)
-{
- int num = pWin->drawable.pScreen->myNum;
-
- if(num != ScrnNum) {
- PanoramiXRes *win;
-
- win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, num);
-
- if (win)
- pWin = (WindowPtr) LookupIDByType(win->info[ScrnNum].id, RT_WINDOW);
- }
-
- return pWin;
-}
-
typedef struct _connect_callback_list {
void (*func)(void);
struct _connect_callback_list *next;
@@ -496,7 +455,6 @@ void PanoramiXExtensionInit(int argc, char *argv[])
if (noPanoramiXExtension)
return;
- GlobalScrInfo = &screenInfo; /* For debug visibility */
PanoramiXNumScreens = screenInfo.numScreens;
if (PanoramiXNumScreens == 1) { /* Only 1 screen */
noPanoramiXExtension = TRUE;
diff --git a/Xext/panoramiX.h b/Xext/panoramiX.h
index 7b3339204..3ad90fa84 100644
--- a/Xext/panoramiX.h
+++ b/Xext/panoramiX.h
@@ -94,18 +94,6 @@ typedef struct {
(a).root = WindowTable[0]->drawable.id; \
}
-#define FORCE_WIN(a) { \
- if ((win = PanoramiXFindIDOnAnyScreen(XRT_WINDOW, a))) { \
- (a) = win->info[0].id; /* Real ID */ \
- } \
-}
-
-#define FORCE_CMAP(a) { \
- if ((win = PanoramiXFindIDOnAnyScreen(XRT_COLORMAP, a))) { \
- (a) = win->info[0].id; /* Real ID */ \
- } \
-}
-
#define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared)
#define SKIP_FAKE_WINDOW(a) if(!LookupIDByType(a, XRT_WINDOW)) return
diff --git a/Xext/panoramiXh.h b/Xext/panoramiXh.h
index 6cee650ac..1a76a45cd 100644
--- a/Xext/panoramiXh.h
+++ b/Xext/panoramiXh.h
@@ -19,10 +19,10 @@ extern int PanoramiXGetGeometry(ClientPtr client);
extern int PanoramiXTranslateCoords(ClientPtr client);
extern int PanoramiXCreatePixmap(ClientPtr client);
extern int PanoramiXFreePixmap(ClientPtr client);
-extern int PanoramiXCreateGC(ClientPtr client);
extern int PanoramiXChangeGC(ClientPtr client);
extern int PanoramiXCopyGC(ClientPtr client);
extern int PanoramiXCopyColormapAndFree(ClientPtr client);
+extern int PanoramiXCreateGC(ClientPtr client);
extern int PanoramiXSetDashes(ClientPtr client);
extern int PanoramiXSetClipRectangles(ClientPtr client);
extern int PanoramiXFreeGC(ClientPtr client);
@@ -64,7 +64,6 @@ PROC_EXTERN(ProcPanoramiXGetScreenSize);
PROC_EXTERN(ProcXineramaQueryScreens);
PROC_EXTERN(ProcXineramaIsActive);
-extern Bool XineramaCreateGC(GCPtr pGC);
extern int SProcPanoramiXDispatch(ClientPtr client);
@@ -72,6 +71,4 @@ extern char *ConnectionInfo;
extern int connBlockScreenStart;
extern xConnSetupPrefix connSetupPrefix;
-extern ScreenInfo *GlobalScrInfo;
extern int (* SavedProcVector[256]) (ClientPtr client);
-
diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h
index bb032cfae..ae9024418 100644
--- a/Xext/panoramiXsrv.h
+++ b/Xext/panoramiXsrv.h
@@ -12,14 +12,11 @@ extern int PanoramiXNumScreens;
extern PanoramiXData *panoramiXdataPtr;
extern int PanoramiXPixWidth;
extern int PanoramiXPixHeight;
-extern RegionRec PanoramiXScreenRegion;
extern XID *PanoramiXVisualTable;
extern void PanoramiXConsolidate(void);
extern Bool PanoramiXCreateConnectionBlock(void);
extern PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int);
-extern PanoramiXRes * PanoramiXFindIDOnAnyScreen(RESTYPE, XID);
-extern WindowPtr PanoramiXChangeWindow(int, WindowPtr);
extern Bool XineramaRegisterConnectionBlockCallback(void (*func)(void));
extern int XineramaDeleteResource(pointer, XID);
diff --git a/Xext/saver.c b/Xext/saver.c
index 7e3ebf408..a9f1dd36c 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -66,7 +66,7 @@ static unsigned char ScreenSaverReqCode = 0;
#endif
static int ScreenSaverEventBase = 0;
-extern DISPATCH_PROC(ProcScreenSaverQueryInfo);
+static DISPATCH_PROC(ProcScreenSaverQueryInfo);
static DISPATCH_PROC(ProcScreenSaverDispatch);
static DISPATCH_PROC(ProcScreenSaverQueryVersion);
static DISPATCH_PROC(ProcScreenSaverSelectInput);
@@ -774,7 +774,7 @@ ProcScreenSaverQueryVersion (client)
return (client->noClientException);
}
-int
+static int
ProcScreenSaverQueryInfo (client)
register ClientPtr client;
{
diff --git a/Xext/security.c b/Xext/security.c
index bd397a9ab..c17a438b4 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -77,7 +77,7 @@ typedef struct {
#define AUTHID(client) \
(((SecurityClientStateRec*)STATEPTR(client))->authId)
-CallbackListPtr SecurityValidateGroupCallback = NULL; /* see security.h */
+static CallbackListPtr SecurityValidateGroupCallback = NULL;
RESTYPE SecurityAuthorizationResType; /* resource type for authorizations */
@@ -1187,6 +1187,7 @@ CALLBACK(SecurityCheckMapAccess)
if (STATEPTR(rec->client) &&
(TRUSTLEVEL(rec->client) != XSecurityClientTrusted) &&
(pWin->drawable.class == InputOnly) &&
+ pWin->parent && pWin->parent->parent &&
(TRUSTLEVEL(wClient(pWin->parent)) == XSecurityClientTrusted))
rec->rval = FALSE;
diff --git a/Xext/securitysrv.h b/Xext/securitysrv.h
index 7c6f432fe..67d864e2e 100644
--- a/Xext/securitysrv.h
+++ b/Xext/securitysrv.h
@@ -72,15 +72,6 @@ typedef struct {
struct _OtherClients *eventClients; /* clients wanting events */
} SecurityAuthorizationRec, *SecurityAuthorizationPtr;
-/* The following callback is called when a GenerateAuthorization request
- * is processed to sanity check the group argument. The call data will
- * be a pointer to a SecurityValidateGroupInfoRec (below).
- * Functions registered on this callback are expected to examine the
- * group and set the valid field to TRUE if they recognize the group as a
- * legitimate group. If they don't recognize it, they should not change the
- * valid field.
- */
-extern CallbackListPtr SecurityValidateGroupCallback;
typedef struct {
XID group; /* the group that was sent in GenerateAuthorization */
Bool valid; /* did anyone recognize it? if so, set to TRUE */
diff --git a/Xext/shm.c b/Xext/shm.c
index 7cfaa6808..ac587bef7 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -119,9 +119,7 @@ static int pixmapFormat;
static int shmPixFormat[MAXSCREENS];
static ShmFuncsPtr shmFuncs[MAXSCREENS];
static DestroyPixmapProcPtr destroyPixmap[MAXSCREENS];
-#ifdef PIXPRIV
static int shmPixmapPrivate;
-#endif
static ShmFuncs miFuncs = {NULL, miShmPutImage};
static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
@@ -237,7 +235,6 @@ ShmExtensionInit(INITARGS)
destroyPixmap[i] = screenInfo.screens[i]->DestroyPixmap;
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
}
-#ifdef PIXPRIV
shmPixmapPrivate = AllocatePixmapPrivateIndex();
for (i = 0; i < screenInfo.numScreens; i++)
{
@@ -245,7 +242,6 @@ ShmExtensionInit(INITARGS)
shmPixmapPrivate, 0))
return;
}
-#endif
}
}
ShmSegType = CreateNewResourceType(ShmDetachSegment);
@@ -299,22 +295,7 @@ ShmDestroyPixmap (PixmapPtr pPixmap)
if (pPixmap->refcnt == 1)
{
ShmDescPtr shmdesc;
-#ifdef PIXPRIV
shmdesc = (ShmDescPtr) pPixmap->devPrivates[shmPixmapPrivate].ptr;
-#else
- char *base = (char *) pPixmap->devPrivate.ptr;
-
- if (base != (pointer) (pPixmap + 1))
- {
- for (shmdesc = Shmsegs; shmdesc; shmdesc = shmdesc->next)
- {
- if (shmdesc->addr <= base && base <= shmdesc->addr + shmdesc->size)
- break;
- }
- }
- else
- shmdesc = 0;
-#endif
if (shmdesc)
ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id);
}
@@ -781,9 +762,7 @@ CreatePmap:
shmdesc->addr + stuff->offset);
if (pMap) {
-#ifdef PIXPRIV
pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
-#endif
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = newPix->info[j].id;
@@ -1097,9 +1076,7 @@ CreatePmap:
shmdesc->addr + stuff->offset);
if (pMap)
{
-#ifdef PIXPRIV
pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
-#endif
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = stuff->pid;
diff --git a/Xext/xace.c b/Xext/xace.c
index 6fc5c12ee..63856315c 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -37,10 +37,10 @@ CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0};
* from guessing extension major opcodes and using the extension even though
* the extension can't be listed or queried.
*/
-int (*UntrustedProcVector[256])(
+static int (*UntrustedProcVector[256])(
ClientPtr /*client*/
);
-int (*SwappedUntrustedProcVector[256])(
+static int (*SwappedUntrustedProcVector[256])(
ClientPtr /*client*/
);
diff --git a/Xext/xace.h b/Xext/xace.h
index 7231b04bc..4143cd42f 100644
--- a/Xext/xace.h
+++ b/Xext/xace.h
@@ -82,16 +82,6 @@ extern int XaceHook(
/* From the original Security extension...
*/
-/* Proc vectors for untrusted clients, swapped and unswapped versions.
- * These are the same as the normal proc vectors except that extensions
- * that haven't declared themselves secure will have ProcBadRequest plugged
- * in for their major opcode dispatcher. This prevents untrusted clients
- * from guessing extension major opcodes and using the extension even though
- * the extension can't be listed or queried.
- */
-extern int (*UntrustedProcVector[256])(ClientPtr client);
-extern int (*SwappedUntrustedProcVector[256])(ClientPtr client);
-
extern void XaceCensorImage(
ClientPtr client,
RegionPtr pVisibleRegion,
diff --git a/Xext/xevie.c b/Xext/xevie.c
index e979e7e4d..7922913ba 100644
--- a/Xext/xevie.c
+++ b/Xext/xevie.c
@@ -52,7 +52,7 @@ of the copyright holder.
#include "inputstr.h"
#include "windowstr.h"
#include "cursorstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include "../os/osdep.h"
@@ -105,7 +105,7 @@ typedef struct {
} xevieKeycQueueRec, *xevieKeycQueuePtr;
#define KEYC_QUEUE_SIZE 100
-xevieKeycQueueRec keycq[KEYC_QUEUE_SIZE] = {{0, NULL}};
+static xevieKeycQueueRec keycq[KEYC_QUEUE_SIZE] = {{0, NULL}};
static int keycqHead = 0, keycqTail = 0;
static int ProcDispatch (ClientPtr), SProcDispatch (ClientPtr);
diff --git a/Xext/xtest.c b/Xext/xtest.c
index c9b511e69..94d8974b6 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -441,6 +441,8 @@ ProcXTestFakeInput(client)
(root->drawable.pScreen,
ev->u.keyButtonPointer.rootX,
ev->u.keyButtonPointer.rootY, FALSE);
+ dev->valuator->lastx = ev->u.keyButtonPointer.rootX;
+ dev->valuator->lasty = ev->u.keyButtonPointer.rootY;
break;
case ButtonPress:
case ButtonRelease:
diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c
index d0acc593b..82616c694 100644
--- a/Xi/chgfctl.c
+++ b/Xi/chgfctl.c
@@ -89,137 +89,13 @@ SProcXChangeFeedbackControl(register ClientPtr client)
return (ProcXChangeFeedbackControl(client));
}
-/***********************************************************************
- *
- * Change the control attributes.
- *
- */
-
-int
-ProcXChangeFeedbackControl(ClientPtr client)
-{
- unsigned len;
- DeviceIntPtr dev;
- KbdFeedbackPtr k;
- PtrFeedbackPtr p;
- IntegerFeedbackPtr i;
- StringFeedbackPtr s;
- BellFeedbackPtr b;
- LedFeedbackPtr l;
-
- REQUEST(xChangeFeedbackControlReq);
- REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
-
- len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2);
- dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
- BadDevice);
- return Success;
- }
-
- switch (stuff->feedbackid) {
- case KbdFeedbackClass:
- if (len != (sizeof(xKbdFeedbackCtl) >> 2)) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
- 0, BadLength);
- return Success;
- }
- for (k = dev->kbdfeed; k; k = k->next)
- if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id) {
- ChangeKbdFeedback(client, dev, stuff->mask, k,
- (xKbdFeedbackCtl *) & stuff[1]);
- return Success;
- }
- break;
- case PtrFeedbackClass:
- if (len != (sizeof(xPtrFeedbackCtl) >> 2)) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
- 0, BadLength);
- return Success;
- }
- for (p = dev->ptrfeed; p; p = p->next)
- if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) {
- ChangePtrFeedback(client, dev, stuff->mask, p,
- (xPtrFeedbackCtl *) & stuff[1]);
- return Success;
- }
- break;
- case StringFeedbackClass:
- {
- register char n;
- xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]);
-
- if (client->swapped) {
- swaps(&f->num_keysyms, n);
- }
- if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
- 0, BadLength);
- return Success;
- }
- for (s = dev->stringfeed; s; s = s->next)
- if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id) {
- ChangeStringFeedback(client, dev, stuff->mask, s,
- (xStringFeedbackCtl *) & stuff[1]);
- return Success;
- }
- break;
- }
- case IntegerFeedbackClass:
- if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
- 0, BadLength);
- return Success;
- }
- for (i = dev->intfeed; i; i = i->next)
- if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id) {
- ChangeIntegerFeedback(client, dev, stuff->mask, i,
- (xIntegerFeedbackCtl *) & stuff[1]);
- return Success;
- }
- break;
- case LedFeedbackClass:
- if (len != (sizeof(xLedFeedbackCtl) >> 2)) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
- 0, BadLength);
- return Success;
- }
- for (l = dev->leds; l; l = l->next)
- if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) {
- ChangeLedFeedback(client, dev, stuff->mask, l,
- (xLedFeedbackCtl *) & stuff[1]);
- return Success;
- }
- break;
- case BellFeedbackClass:
- if (len != (sizeof(xBellFeedbackCtl) >> 2)) {
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
- 0, BadLength);
- return Success;
- }
- for (b = dev->bell; b; b = b->next)
- if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id) {
- ChangeBellFeedback(client, dev, stuff->mask, b,
- (xBellFeedbackCtl *) & stuff[1]);
- return Success;
- }
- break;
- default:
- break;
- }
-
- SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
- return Success;
-}
-
/******************************************************************************
*
* This procedure changes KbdFeedbackClass data.
*
*/
-int
+static int
ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
KbdFeedbackPtr k, xKbdFeedbackCtl * f)
{
@@ -351,7 +227,7 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
*
*/
-int
+static int
ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
PtrFeedbackPtr p, xPtrFeedbackCtl * f)
{
@@ -422,7 +298,7 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
*
*/
-int
+static int
ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev,
long unsigned int mask, IntegerFeedbackPtr i,
xIntegerFeedbackCtl * f)
@@ -445,7 +321,7 @@ ChangeIntegerFeedback(ClientPtr client, DeviceIntPtr dev,
*
*/
-int
+static int
ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
long unsigned int mask, StringFeedbackPtr s,
xStringFeedbackCtl * f)
@@ -495,7 +371,7 @@ ChangeStringFeedback(ClientPtr client, DeviceIntPtr dev,
*
*/
-int
+static int
ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
long unsigned int mask, BellFeedbackPtr b,
xBellFeedbackCtl * f)
@@ -560,7 +436,7 @@ ChangeBellFeedback(ClientPtr client, DeviceIntPtr dev,
*
*/
-int
+static int
ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
LedFeedbackPtr l, xLedFeedbackCtl * f)
{
@@ -585,3 +461,128 @@ ChangeLedFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
return Success;
}
+
+/***********************************************************************
+ *
+ * Change the control attributes.
+ *
+ */
+
+int
+ProcXChangeFeedbackControl(ClientPtr client)
+{
+ unsigned len;
+ DeviceIntPtr dev;
+ KbdFeedbackPtr k;
+ PtrFeedbackPtr p;
+ IntegerFeedbackPtr i;
+ StringFeedbackPtr s;
+ BellFeedbackPtr b;
+ LedFeedbackPtr l;
+
+ REQUEST(xChangeFeedbackControlReq);
+ REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
+
+ len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2);
+ dev = LookupDeviceIntRec(stuff->deviceid);
+ if (dev == NULL) {
+ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0,
+ BadDevice);
+ return Success;
+ }
+
+ switch (stuff->feedbackid) {
+ case KbdFeedbackClass:
+ if (len != (sizeof(xKbdFeedbackCtl) >> 2)) {
+ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
+ 0, BadLength);
+ return Success;
+ }
+ for (k = dev->kbdfeed; k; k = k->next)
+ if (k->ctrl.id == ((xKbdFeedbackCtl *) & stuff[1])->id) {
+ ChangeKbdFeedback(client, dev, stuff->mask, k,
+ (xKbdFeedbackCtl *) & stuff[1]);
+ return Success;
+ }
+ break;
+ case PtrFeedbackClass:
+ if (len != (sizeof(xPtrFeedbackCtl) >> 2)) {
+ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
+ 0, BadLength);
+ return Success;
+ }
+ for (p = dev->ptrfeed; p; p = p->next)
+ if (p->ctrl.id == ((xPtrFeedbackCtl *) & stuff[1])->id) {
+ ChangePtrFeedback(client, dev, stuff->mask, p,
+ (xPtrFeedbackCtl *) & stuff[1]);
+ return Success;
+ }
+ break;
+ case StringFeedbackClass:
+ {
+ register char n;
+ xStringFeedbackCtl *f = ((xStringFeedbackCtl *) & stuff[1]);
+
+ if (client->swapped) {
+ swaps(&f->num_keysyms, n);
+ }
+ if (len != ((sizeof(xStringFeedbackCtl) >> 2) + f->num_keysyms)) {
+ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
+ 0, BadLength);
+ return Success;
+ }
+ for (s = dev->stringfeed; s; s = s->next)
+ if (s->ctrl.id == ((xStringFeedbackCtl *) & stuff[1])->id) {
+ ChangeStringFeedback(client, dev, stuff->mask, s,
+ (xStringFeedbackCtl *) & stuff[1]);
+ return Success;
+ }
+ break;
+ }
+ case IntegerFeedbackClass:
+ if (len != (sizeof(xIntegerFeedbackCtl) >> 2)) {
+ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
+ 0, BadLength);
+ return Success;
+ }
+ for (i = dev->intfeed; i; i = i->next)
+ if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id) {
+ ChangeIntegerFeedback(client, dev, stuff->mask, i,
+ (xIntegerFeedbackCtl *) & stuff[1]);
+ return Success;
+ }
+ break;
+ case LedFeedbackClass:
+ if (len != (sizeof(xLedFeedbackCtl) >> 2)) {
+ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
+ 0, BadLength);
+ return Success;
+ }
+ for (l = dev->leds; l; l = l->next)
+ if (l->ctrl.id == ((xLedFeedbackCtl *) & stuff[1])->id) {
+ ChangeLedFeedback(client, dev, stuff->mask, l,
+ (xLedFeedbackCtl *) & stuff[1]);
+ return Success;
+ }
+ break;
+ case BellFeedbackClass:
+ if (len != (sizeof(xBellFeedbackCtl) >> 2)) {
+ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl,
+ 0, BadLength);
+ return Success;
+ }
+ for (b = dev->bell; b; b = b->next)
+ if (b->ctrl.id == ((xBellFeedbackCtl *) & stuff[1])->id) {
+ ChangeBellFeedback(client, dev, stuff->mask, b,
+ (xBellFeedbackCtl *) & stuff[1]);
+ return Success;
+ }
+ break;
+ default:
+ break;
+ }
+
+ SendErrorToClient(client, IReqCode, X_ChangeFeedbackControl, 0, BadMatch);
+ return Success;
+}
+
diff --git a/Xi/chgfctl.h b/Xi/chgfctl.h
index 81e1153ec..cfa9fc6b0 100644
--- a/Xi/chgfctl.h
+++ b/Xi/chgfctl.h
@@ -36,46 +36,4 @@ int SProcXChangeFeedbackControl(ClientPtr /* client */
int ProcXChangeFeedbackControl(ClientPtr /* client */
);
-int ChangeKbdFeedback(ClientPtr /* client */ ,
- DeviceIntPtr /* dev */ ,
- unsigned long /* mask */ ,
- KbdFeedbackPtr /* k */ ,
- xKbdFeedbackCtl * /* f */
- );
-
-int ChangePtrFeedback(ClientPtr /* client */ ,
- DeviceIntPtr /* dev */ ,
- unsigned long /* mask */ ,
- PtrFeedbackPtr /* p */ ,
- xPtrFeedbackCtl * /* f */
- );
-
-int ChangeIntegerFeedback(ClientPtr /* client */ ,
- DeviceIntPtr /* dev */ ,
- unsigned long /* mask */ ,
- IntegerFeedbackPtr /* i */ ,
- xIntegerFeedbackCtl * /* f */
- );
-
-int ChangeStringFeedback(ClientPtr /* client */ ,
- DeviceIntPtr /* dev */ ,
- unsigned long /* mask */ ,
- StringFeedbackPtr /* s */ ,
- xStringFeedbackCtl * /* f */
- );
-
-int ChangeBellFeedback(ClientPtr /* client */ ,
- DeviceIntPtr /* dev */ ,
- unsigned long /* mask */ ,
- BellFeedbackPtr /* b */ ,
- xBellFeedbackCtl * /* f */
- );
-
-int ChangeLedFeedback(ClientPtr /* client */ ,
- DeviceIntPtr /* dev */ ,
- unsigned long /* mask */ ,
- LedFeedbackPtr /* l */ ,
- xLedFeedbackCtl * /* f */
- );
-
#endif /* CHGFCTL_H */
diff --git a/Xi/chgptr.h b/Xi/chgptr.h
index fb3b5cc39..2d8ab66e5 100644
--- a/Xi/chgptr.h
+++ b/Xi/chgptr.h
@@ -45,12 +45,4 @@ void SendEventToAllWindows(DeviceIntPtr /* dev */ ,
int /* count */
);
-void FindInterestedChildren( /* FIXME: could be static? */
- DeviceIntPtr /* dev */ ,
- WindowPtr /* p1 */ ,
- Mask /* mask */ ,
- xEvent * /* ev */ ,
- int /* count */
- );
-
#endif /* CHGPTR_H */
diff --git a/Xi/closedev.c b/Xi/closedev.c
index cc83e6a5b..3d47b5fca 100644
--- a/Xi/closedev.c
+++ b/Xi/closedev.c
@@ -89,42 +89,29 @@ SProcXCloseDevice(register ClientPtr client)
/***********************************************************************
*
- * This procedure closes an input device.
+ * Clear out event selections and passive grabs from a window for the
+ * specified device.
*
*/
-int
-ProcXCloseDevice(register ClientPtr client)
+static void
+DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
{
- int i;
- WindowPtr pWin, p1;
- DeviceIntPtr d;
-
- REQUEST(xCloseDeviceReq);
- REQUEST_SIZE_MATCH(xCloseDeviceReq);
-
- d = LookupDeviceIntRec(stuff->deviceid);
- if (d == NULL) {
- SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice);
- return Success;
- }
-
- if (d->grab && SameClient(d->grab, client))
- (*d->DeactivateGrab) (d); /* release active grab */
+ InputClientsPtr others;
+ OtherInputMasks *pOthers;
+ GrabPtr grab, next;
- /* Remove event selections from all windows for events from this device
- * and selected by this client.
- * Delete passive grabs from all windows for this device. */
+ if ((pOthers = wOtherInputMasks(pWin)) != 0)
+ for (others = pOthers->inputClients; others; others = others->next)
+ if (SameClient(others, client))
+ others->mask[dev->id] = NoEventMask;
- for (i = 0; i < screenInfo.numScreens; i++) {
- pWin = WindowTable[i];
- DeleteDeviceEvents(d, pWin, client);
- p1 = pWin->firstChild;
- DeleteEventsFromChildren(d, p1, client);
+ for (grab = wPassiveGrabs(pWin); grab; grab = next) {
+ next = grab->next;
+ if ((grab->device == dev) &&
+ (client->clientAsMask == CLIENT_BITS(grab->resource)))
+ FreeResource(grab->resource, RT_NONE);
}
-
- CloseInputDevice(d, client);
- return Success;
}
/***********************************************************************
@@ -134,7 +121,7 @@ ProcXCloseDevice(register ClientPtr client)
*
*/
-void
+static void
DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client)
{
WindowPtr p2;
@@ -149,27 +136,40 @@ DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client)
/***********************************************************************
*
- * Clear out event selections and passive grabs from a window for the
- * specified device.
+ * This procedure closes an input device.
*
*/
-void
-DeleteDeviceEvents(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
+int
+ProcXCloseDevice(register ClientPtr client)
{
- InputClientsPtr others;
- OtherInputMasks *pOthers;
- GrabPtr grab, next;
+ int i;
+ WindowPtr pWin, p1;
+ DeviceIntPtr d;
- if ((pOthers = wOtherInputMasks(pWin)) != 0)
- for (others = pOthers->inputClients; others; others = others->next)
- if (SameClient(others, client))
- others->mask[dev->id] = NoEventMask;
+ REQUEST(xCloseDeviceReq);
+ REQUEST_SIZE_MATCH(xCloseDeviceReq);
- for (grab = wPassiveGrabs(pWin); grab; grab = next) {
- next = grab->next;
- if ((grab->device == dev) &&
- (client->clientAsMask == CLIENT_BITS(grab->resource)))
- FreeResource(grab->resource, RT_NONE);
+ d = LookupDeviceIntRec(stuff->deviceid);
+ if (d == NULL) {
+ SendErrorToClient(client, IReqCode, X_CloseDevice, 0, BadDevice);
+ return Success;
+ }
+
+ if (d->grab && SameClient(d->grab, client))
+ (*d->DeactivateGrab) (d); /* release active grab */
+
+ /* Remove event selections from all windows for events from this device
+ * and selected by this client.
+ * Delete passive grabs from all windows for this device. */
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ pWin = WindowTable[i];
+ DeleteDeviceEvents(d, pWin, client);
+ p1 = pWin->firstChild;
+ DeleteEventsFromChildren(d, p1, client);
}
+
+ CloseInputDevice(d, client);
+ return Success;
}
diff --git a/Xi/closedev.h b/Xi/closedev.h
index 6853d5002..400aaa60b 100644
--- a/Xi/closedev.h
+++ b/Xi/closedev.h
@@ -36,14 +36,4 @@ int SProcXCloseDevice(ClientPtr /* client */
int ProcXCloseDevice(ClientPtr /* client */
);
-void DeleteEventsFromChildren(DeviceIntPtr /* dev */ ,
- WindowPtr /* p1 */ ,
- ClientPtr /* client */
- );
-
-void DeleteDeviceEvents(DeviceIntPtr /* dev */ ,
- WindowPtr /* pWin */ ,
- ClientPtr /* client */
- );
-
#endif /* CLOSEDEV_H */
diff --git a/Xi/exevents.c b/Xi/exevents.c
index b7645f443..164fce31e 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -994,33 +994,7 @@ ChangeKeyMapping(ClientPtr client,
return client->noClientException;
}
-void
-DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources)
-{
- int i;
- DeviceIntPtr dev;
- InputClientsPtr ic;
- struct _OtherInputMasks *inputMasks;
-
- for (dev = inputInfo.devices; dev; dev = dev->next) {
- if (dev == inputInfo.pointer || dev == inputInfo.keyboard)
- continue;
- DeleteDeviceFromAnyExtEvents(pWin, dev);
- }
-
- for (dev = inputInfo.off_devices; dev; dev = dev->next)
- DeleteDeviceFromAnyExtEvents(pWin, dev);
-
- if (freeResources)
- while ((inputMasks = wOtherInputMasks(pWin)) != 0) {
- ic = inputMasks->inputClients;
- for (i = 0; i < EMASKSIZE; i++)
- inputMasks->dontPropagateMask[i] = 0;
- FreeResource(ic->resource, RT_NONE);
- }
-}
-
-void
+static void
DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev)
{
WindowPtr parent;
@@ -1085,6 +1059,32 @@ DeleteDeviceFromAnyExtEvents(WindowPtr pWin, DeviceIntPtr dev)
dev->valuator->motionHintWindow = NullWindow;
}
+void
+DeleteWindowFromAnyExtEvents(WindowPtr pWin, Bool freeResources)
+{
+ int i;
+ DeviceIntPtr dev;
+ InputClientsPtr ic;
+ struct _OtherInputMasks *inputMasks;
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (dev == inputInfo.pointer || dev == inputInfo.keyboard)
+ continue;
+ DeleteDeviceFromAnyExtEvents(pWin, dev);
+ }
+
+ for (dev = inputInfo.off_devices; dev; dev = dev->next)
+ DeleteDeviceFromAnyExtEvents(pWin, dev);
+
+ if (freeResources)
+ while ((inputMasks = wOtherInputMasks(pWin)) != 0) {
+ ic = inputMasks->inputClients;
+ for (i = 0; i < EMASKSIZE; i++)
+ inputMasks->dontPropagateMask[i] = 0;
+ FreeResource(ic->resource, RT_NONE);
+ }
+}
+
int
MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask)
{
@@ -1138,7 +1138,7 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type,
}
}
-Mask
+static Mask
DeviceEventMaskForClient(DeviceIntPtr dev, WindowPtr pWin, ClientPtr client)
{
register InputClientsPtr other;
@@ -1223,7 +1223,7 @@ ShouldFreeInputMasks(WindowPtr pWin, Bool ignoreSelectedEvents)
*
*/
-void
+static void
FindInterestedChildren(DeviceIntPtr dev, WindowPtr p1, Mask mask,
xEvent * ev, int count)
{
diff --git a/Xi/exglobals.h b/Xi/exglobals.h
index 3afd1bb9e..50bb33fdc 100644
--- a/Xi/exglobals.h
+++ b/Xi/exglobals.h
@@ -37,7 +37,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern int IReqCode;
extern int BadDevice;
-extern int BadEvent;
extern int BadMode;
extern int DeviceBusy;
extern int BadClass;
@@ -46,7 +45,6 @@ extern Mask DevicePointerMotionMask;
extern Mask DevicePointerMotionHintMask;
extern Mask DeviceFocusChangeMask;
extern Mask DeviceStateNotifyMask;
-extern Mask ChangeDeviceNotifyMask;
extern Mask DeviceMappingNotifyMask;
extern Mask DeviceOwnerGrabButtonMask;
extern Mask DeviceButtonGrabMask;
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 454883762..fed54ab37 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -116,7 +116,7 @@ int ExtEventIndex;
Mask ExtValidMasks[EMASKSIZE];
Mask ExtExclusiveMasks[EMASKSIZE];
-struct dev_type
+static struct dev_type
{
Atom type;
char *name;
@@ -152,7 +152,7 @@ XExtEventInfo EventInfo[32];
int IReqCode = 0;
int BadDevice = 0;
-int BadEvent = 1;
+static int BadEvent = 1;
int BadMode = 2;
int DeviceBusy = 3;
int BadClass = 4;
@@ -161,7 +161,7 @@ Mask DevicePointerMotionMask;
Mask DevicePointerMotionHintMask;
Mask DeviceFocusChangeMask;
Mask DeviceStateNotifyMask;
-Mask ChangeDeviceNotifyMask;
+static Mask ChangeDeviceNotifyMask;
Mask DeviceMappingNotifyMask;
Mask DeviceOwnerGrabButtonMask;
Mask DeviceButtonGrabMask;
@@ -208,51 +208,6 @@ static XExtensionVersion thisversion = { XI_Present,
XI_Add_DevicePresenceNotify_Minor
};
-/**********************************************************************
- *
- * IExtensionInit - initialize the input extension.
- *
- * Called from InitExtensions in main() or from QueryExtension() if the
- * extension is dynamically loaded.
- *
- * This extension has several events and errors.
- *
- */
-
-void
-XInputExtensionInit(void)
-{
- ExtensionEntry *extEntry;
-
- extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
- SProcIDispatch, IResetProc, StandardMinorOpcode);
- if (extEntry) {
- IReqCode = extEntry->base;
- AllExtensionVersions[IReqCode - 128] = thisversion;
- MakeDeviceTypeAtoms();
- RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone);
- FixExtensionEvents(extEntry);
- ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
- EventSwapVector[DeviceValuator] = SEventIDispatch;
- EventSwapVector[DeviceKeyPress] = SEventIDispatch;
- EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
- EventSwapVector[DeviceButtonPress] = SEventIDispatch;
- EventSwapVector[DeviceButtonRelease] = SEventIDispatch;
- EventSwapVector[DeviceMotionNotify] = SEventIDispatch;
- EventSwapVector[DeviceFocusIn] = SEventIDispatch;
- EventSwapVector[DeviceFocusOut] = SEventIDispatch;
- EventSwapVector[ProximityIn] = SEventIDispatch;
- EventSwapVector[ProximityOut] = SEventIDispatch;
- EventSwapVector[DeviceStateNotify] = SEventIDispatch;
- EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch;
- EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
- EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
- EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
- } else {
- FatalError("IExtensionInit: AddExtensions failed\n");
- }
-}
-
/*************************************************************************
*
* ProcIDispatch - main dispatch routine for requests to this extension.
@@ -260,7 +215,7 @@ XInputExtensionInit(void)
*
*/
-int
+static int
ProcIDispatch(register ClientPtr client)
{
REQUEST(xReq);
@@ -349,7 +304,7 @@ ProcIDispatch(register ClientPtr client)
*
*/
-int
+static int
SProcIDispatch(register ClientPtr client)
{
REQUEST(xReq);
@@ -441,7 +396,7 @@ SProcIDispatch(register ClientPtr client)
if (rep->RepType == X_##code) \
SRepX##code (client, len, (x##code##Reply *) rep)
-void
+static void
SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
/* All we look at is the type field */
{ /* This is common to all replies */
@@ -500,68 +455,13 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
}
}
-/*****************************************************************************
- *
- * SEventIDispatch
- *
- * Swap any events defined in this extension.
- */
-#define DO_SWAP(func,type) func ((type *)from, (type *)to)
-
-void
-SEventIDispatch(xEvent * from, xEvent * to)
-{
- int type = from->u.u.type & 0177;
-
- if (type == DeviceValuator)
- DO_SWAP(SEventDeviceValuator, deviceValuator);
- else if (type == DeviceKeyPress) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceKeyRelease) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceButtonPress) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceButtonRelease) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceMotionNotify) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceFocusIn)
- DO_SWAP(SEventFocus, deviceFocus);
- else if (type == DeviceFocusOut)
- DO_SWAP(SEventFocus, deviceFocus);
- else if (type == ProximityIn) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == ProximityOut) {
- SKeyButtonPtrEvent(from, to);
- to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
- } else if (type == DeviceStateNotify)
- DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
- else if (type == DeviceKeyStateNotify)
- DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
- else if (type == DeviceButtonStateNotify)
- DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
- else if (type == DeviceMappingNotify)
- DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
- else if (type == ChangeDeviceNotify)
- DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
- else {
- FatalError("XInputExtension: Impossible event!\n");
- }
-}
-
/************************************************************************
*
* This function swaps the DeviceValuator event.
*
*/
-void
+static void
SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
{
register char n;
@@ -577,7 +477,7 @@ SEventDeviceValuator(deviceValuator * from, deviceValuator * to)
}
}
-void
+static void
SEventFocus(deviceFocus * from, deviceFocus * to)
{
register char n;
@@ -588,7 +488,7 @@ SEventFocus(deviceFocus * from, deviceFocus * to)
swapl(&to->window, n);
}
-void
+static void
SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
{
register int i;
@@ -604,7 +504,7 @@ SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
}
}
-void
+static void
SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from,
deviceKeyStateNotify * to)
{
@@ -614,7 +514,7 @@ SDeviceKeyStateNotifyEvent(deviceKeyStateNotify * from,
swaps(&to->sequenceNumber, n);
}
-void
+static void
SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from,
deviceButtonStateNotify * to)
{
@@ -624,7 +524,7 @@ SDeviceButtonStateNotifyEvent(deviceButtonStateNotify * from,
swaps(&to->sequenceNumber, n);
}
-void
+static void
SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to)
{
register char n;
@@ -634,7 +534,7 @@ SChangeDeviceNotifyEvent(changeDeviceNotify * from, changeDeviceNotify * to)
swapl(&to->time, n);
}
-void
+static void
SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
{
register char n;
@@ -644,7 +544,7 @@ SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
swapl(&to->time, n);
}
-void
+static void
SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to)
{
register char n;
@@ -655,13 +555,106 @@ SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to
swaps(&to->control, n);
}
+/**************************************************************************
+ *
+ * Allow the specified event to have its propagation suppressed.
+ * The default is to not allow suppression of propagation.
+ *
+ */
+
+static void
+AllowPropagateSuppress(Mask mask)
+{
+ int i;
+
+ for (i = 0; i < MAX_DEVICES; i++)
+ PropagateMask[i] |= mask;
+}
+
+/**************************************************************************
+ *
+ * Return the next available extension event mask.
+ *
+ */
+
+static Mask
+GetNextExtEventMask(void)
+{
+ int i;
+ Mask mask = lastExtEventMask;
+
+ if (lastExtEventMask == 0) {
+ FatalError("GetNextExtEventMask: no more events are available.");
+ }
+ lastExtEventMask <<= 1;
+
+ for (i = 0; i < MAX_DEVICES; i++)
+ ExtValidMasks[i] |= mask;
+ return mask;
+}
+
+/**************************************************************************
+ *
+ * Record an event mask where there is no unique corresponding event type.
+ * We can't call SetMaskForEvent, since that would clobber the existing
+ * mask for that event. MotionHint and ButtonMotion are examples.
+ *
+ * Since extension event types will never be less than 64, we can use
+ * 0-63 in the EventInfo array as the "type" to be used to look up this
+ * mask. This means that the corresponding macros such as
+ * DevicePointerMotionHint must have access to the same constants.
+ *
+ */
+
+static void
+SetEventInfo(Mask mask, int constant)
+{
+ EventInfo[ExtEventIndex].mask = mask;
+ EventInfo[ExtEventIndex++].type = constant;
+}
+
+/**************************************************************************
+ *
+ * Allow the specified event to be restricted to being selected by one
+ * client at a time.
+ * The default is to allow more than one client to select the event.
+ *
+ */
+
+static void
+SetExclusiveAccess(Mask mask)
+{
+ int i;
+
+ for (i = 0; i < MAX_DEVICES; i++)
+ ExtExclusiveMasks[i] |= mask;
+}
+
+/**************************************************************************
+ *
+ * Assign the specified mask to the specified event.
+ *
+ */
+
+static void
+SetMaskForExtEvent(Mask mask, int event)
+{
+
+ EventInfo[ExtEventIndex].mask = mask;
+ EventInfo[ExtEventIndex++].type = event;
+
+ if ((event < LASTEvent) || (event >= 128))
+ FatalError("MaskForExtensionEvent: bogus event number");
+ SetMaskForEvent(mask, event);
+}
+
/************************************************************************
*
* This function sets up extension event types and masks.
*
*/
-void
+static void
FixExtensionEvents(ExtensionEntry * extEntry)
{
Mask mask;
@@ -767,7 +760,7 @@ FixExtensionEvents(ExtensionEntry * extEntry)
*
*/
-void
+static void
RestoreExtensionEvents(void)
{
int i;
@@ -815,7 +808,7 @@ RestoreExtensionEvents(void)
*
*/
-void
+static void
IResetProc(ExtensionEntry * unused)
{
@@ -859,7 +852,7 @@ AssignTypeAndName(DeviceIntPtr dev, Atom type, char *name)
*
*/
-void
+static void
MakeDeviceTypeAtoms(void)
{
int i;
@@ -892,95 +885,102 @@ LookupDeviceIntRec(CARD8 id)
return NULL;
}
-/**************************************************************************
- *
- * Allow the specified event to be restricted to being selected by one
- * client at a time.
- * The default is to allow more than one client to select the event.
- *
- */
-
-void
-SetExclusiveAccess(Mask mask)
-{
- int i;
-
- for (i = 0; i < MAX_DEVICES; i++)
- ExtExclusiveMasks[i] |= mask;
-}
-
-/**************************************************************************
- *
- * Allow the specified event to have its propagation suppressed.
- * The default is to not allow suppression of propagation.
- *
- */
-
-void
-AllowPropagateSuppress(Mask mask)
-{
- int i;
-
- for (i = 0; i < MAX_DEVICES; i++)
- PropagateMask[i] |= mask;
-}
-
-/**************************************************************************
+/*****************************************************************************
*
- * Return the next available extension event mask.
+ * SEventIDispatch
*
+ * Swap any events defined in this extension.
*/
+#define DO_SWAP(func,type) func ((type *)from, (type *)to)
-Mask
-GetNextExtEventMask(void)
+static void
+SEventIDispatch(xEvent * from, xEvent * to)
{
- int i;
- Mask mask = lastExtEventMask;
+ int type = from->u.u.type & 0177;
- if (lastExtEventMask == 0) {
- FatalError("GetNextExtEventMask: no more events are available.");
+ if (type == DeviceValuator)
+ DO_SWAP(SEventDeviceValuator, deviceValuator);
+ else if (type == DeviceKeyPress) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceKeyRelease) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceButtonPress) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceButtonRelease) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceMotionNotify) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceFocusIn)
+ DO_SWAP(SEventFocus, deviceFocus);
+ else if (type == DeviceFocusOut)
+ DO_SWAP(SEventFocus, deviceFocus);
+ else if (type == ProximityIn) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == ProximityOut) {
+ SKeyButtonPtrEvent(from, to);
+ to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
+ } else if (type == DeviceStateNotify)
+ DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
+ else if (type == DeviceKeyStateNotify)
+ DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
+ else if (type == DeviceButtonStateNotify)
+ DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
+ else if (type == DeviceMappingNotify)
+ DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
+ else if (type == ChangeDeviceNotify)
+ DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
+ else {
+ FatalError("XInputExtension: Impossible event!\n");
}
- lastExtEventMask <<= 1;
-
- for (i = 0; i < MAX_DEVICES; i++)
- ExtValidMasks[i] |= mask;
- return mask;
}
-/**************************************************************************
- *
- * Assign the specified mask to the specified event.
+/**********************************************************************
*
- */
-
-void
-SetMaskForExtEvent(Mask mask, int event)
-{
-
- EventInfo[ExtEventIndex].mask = mask;
- EventInfo[ExtEventIndex++].type = event;
-
- if ((event < LASTEvent) || (event >= 128))
- FatalError("MaskForExtensionEvent: bogus event number");
- SetMaskForEvent(mask, event);
-}
-
-/**************************************************************************
+ * IExtensionInit - initialize the input extension.
*
- * Record an event mask where there is no unique corresponding event type.
- * We can't call SetMaskForEvent, since that would clobber the existing
- * mask for that event. MotionHint and ButtonMotion are examples.
+ * Called from InitExtensions in main() or from QueryExtension() if the
+ * extension is dynamically loaded.
*
- * Since extension event types will never be less than 64, we can use
- * 0-63 in the EventInfo array as the "type" to be used to look up this
- * mask. This means that the corresponding macros such as
- * DevicePointerMotionHint must have access to the same constants.
+ * This extension has several events and errors.
*
*/
void
-SetEventInfo(Mask mask, int constant)
+XInputExtensionInit(void)
{
- EventInfo[ExtEventIndex].mask = mask;
- EventInfo[ExtEventIndex++].type = constant;
+ ExtensionEntry *extEntry;
+
+ extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
+ SProcIDispatch, IResetProc, StandardMinorOpcode);
+ if (extEntry) {
+ IReqCode = extEntry->base;
+ AllExtensionVersions[IReqCode - 128] = thisversion;
+ MakeDeviceTypeAtoms();
+ RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone);
+ FixExtensionEvents(extEntry);
+ ReplySwapVector[IReqCode] = (ReplySwapPtr) SReplyIDispatch;
+ EventSwapVector[DeviceValuator] = SEventIDispatch;
+ EventSwapVector[DeviceKeyPress] = SEventIDispatch;
+ EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
+ EventSwapVector[DeviceButtonPress] = SEventIDispatch;
+ EventSwapVector[DeviceButtonRelease] = SEventIDispatch;
+ EventSwapVector[DeviceMotionNotify] = SEventIDispatch;
+ EventSwapVector[DeviceFocusIn] = SEventIDispatch;
+ EventSwapVector[DeviceFocusOut] = SEventIDispatch;
+ EventSwapVector[ProximityIn] = SEventIDispatch;
+ EventSwapVector[ProximityOut] = SEventIDispatch;
+ EventSwapVector[DeviceStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceKeyStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceButtonStateNotify] = SEventIDispatch;
+ EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
+ EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
+ } else {
+ FatalError("IExtensionInit: AddExtensions failed\n");
+ }
}
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index d738ef83b..c264d4f8c 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -88,112 +88,11 @@ SProcXGetDeviceControl(register ClientPtr client)
/***********************************************************************
*
- * Get the state of the specified device control.
- *
- */
-
-int
-ProcXGetDeviceControl(ClientPtr client)
-{
- int total_length = 0;
- char *buf, *savbuf;
- register DeviceIntPtr dev;
- xGetDeviceControlReply rep;
-
- REQUEST(xGetDeviceControlReq);
- REQUEST_SIZE_MATCH(xGetDeviceControlReq);
-
- dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadDevice);
- return Success;
- }
-
- rep.repType = X_Reply;
- rep.RepType = X_GetDeviceControl;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- switch (stuff->control) {
- case DEVICE_RESOLUTION:
- if (!dev->valuator) {
- SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
- BadMatch);
- return Success;
- }
- total_length = sizeof(xDeviceResolutionState) +
- (3 * sizeof(int) * dev->valuator->numAxes);
- break;
- case DEVICE_ABS_CALIB:
- if (!dev->absolute) {
- SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
- BadMatch);
- return Success;
- }
-
- total_length = sizeof(xDeviceAbsCalibCtl);
- break;
- case DEVICE_ABS_AREA:
- if (!dev->absolute) {
- SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
- BadMatch);
- return Success;
- }
-
- total_length = sizeof(xDeviceAbsAreaCtl);
- break;
- case DEVICE_CORE:
- total_length = sizeof(xDeviceCoreCtl);
- break;
- case DEVICE_ENABLE:
- total_length = sizeof(xDeviceEnableCtl);
- break;
- default:
- SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue);
- return Success;
- }
-
- buf = (char *)xalloc(total_length);
- if (!buf) {
- SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadAlloc);
- return Success;
- }
- savbuf = buf;
-
- switch (stuff->control) {
- case DEVICE_RESOLUTION:
- CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
- break;
- case DEVICE_ABS_CALIB:
- CopySwapDeviceAbsCalib(client, dev->absolute, buf);
- break;
- case DEVICE_ABS_AREA:
- CopySwapDeviceAbsArea(client, dev->absolute, buf);
- break;
- case DEVICE_CORE:
- CopySwapDeviceCore(client, dev, buf);
- break;
- case DEVICE_ENABLE:
- CopySwapDeviceEnable(client, dev, buf);
- break;
- default:
- break;
- }
-
- rep.length = (total_length + 3) >> 2;
- WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
- WriteToClient(client, total_length, savbuf);
- xfree(savbuf);
- return Success;
-}
-
-/***********************************************************************
- *
* This procedure copies DeviceResolution data, swapping if necessary.
*
*/
-void
+static void
CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
int length)
{
@@ -225,7 +124,7 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
}
}
-void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts,
+static void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts,
char *buf)
{
register char n;
@@ -256,7 +155,7 @@ void CopySwapDeviceAbsCalib (ClientPtr client, AbsoluteClassPtr dts,
}
}
-void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts,
+static void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts,
char *buf)
{
register char n;
@@ -283,7 +182,7 @@ void CopySwapDeviceAbsArea (ClientPtr client, AbsoluteClassPtr dts,
}
}
-void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
+static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
{
register char n;
xDeviceCoreState *c = (xDeviceCoreState *) buf;
@@ -300,7 +199,7 @@ void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
}
}
-void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
+static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
{
register char n;
xDeviceEnableState *e = (xDeviceEnableState *) buf;
@@ -316,7 +215,6 @@ void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
}
}
-
/***********************************************************************
*
* This procedure writes the reply for the xGetDeviceControl function,
@@ -333,3 +231,104 @@ SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
swapl(&rep->length, n);
WriteToClient(client, size, (char *)rep);
}
+
+/***********************************************************************
+ *
+ * Get the state of the specified device control.
+ *
+ */
+
+int
+ProcXGetDeviceControl(ClientPtr client)
+{
+ int total_length = 0;
+ char *buf, *savbuf;
+ register DeviceIntPtr dev;
+ xGetDeviceControlReply rep;
+
+ REQUEST(xGetDeviceControlReq);
+ REQUEST_SIZE_MATCH(xGetDeviceControlReq);
+
+ dev = LookupDeviceIntRec(stuff->deviceid);
+ if (dev == NULL) {
+ SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadDevice);
+ return Success;
+ }
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GetDeviceControl;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ switch (stuff->control) {
+ case DEVICE_RESOLUTION:
+ if (!dev->valuator) {
+ SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+ total_length = sizeof(xDeviceResolutionState) +
+ (3 * sizeof(int) * dev->valuator->numAxes);
+ break;
+ case DEVICE_ABS_CALIB:
+ if (!dev->absolute) {
+ SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+
+ total_length = sizeof(xDeviceAbsCalibCtl);
+ break;
+ case DEVICE_ABS_AREA:
+ if (!dev->absolute) {
+ SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
+ BadMatch);
+ return Success;
+ }
+
+ total_length = sizeof(xDeviceAbsAreaCtl);
+ break;
+ case DEVICE_CORE:
+ total_length = sizeof(xDeviceCoreCtl);
+ break;
+ case DEVICE_ENABLE:
+ total_length = sizeof(xDeviceEnableCtl);
+ break;
+ default:
+ SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue);
+ return Success;
+ }
+
+ buf = (char *)xalloc(total_length);
+ if (!buf) {
+ SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadAlloc);
+ return Success;
+ }
+ savbuf = buf;
+
+ switch (stuff->control) {
+ case DEVICE_RESOLUTION:
+ CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
+ break;
+ case DEVICE_ABS_CALIB:
+ CopySwapDeviceAbsCalib(client, dev->absolute, buf);
+ break;
+ case DEVICE_ABS_AREA:
+ CopySwapDeviceAbsArea(client, dev->absolute, buf);
+ break;
+ case DEVICE_CORE:
+ CopySwapDeviceCore(client, dev, buf);
+ break;
+ case DEVICE_ENABLE:
+ CopySwapDeviceEnable(client, dev, buf);
+ break;
+ default:
+ break;
+ }
+
+ rep.length = (total_length + 3) >> 2;
+ WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
+ WriteToClient(client, total_length, savbuf);
+ xfree(savbuf);
+ return Success;
+}
diff --git a/Xi/getdctl.h b/Xi/getdctl.h
index 36868d8be..19c189f36 100644
--- a/Xi/getdctl.h
+++ b/Xi/getdctl.h
@@ -36,30 +36,6 @@ int SProcXGetDeviceControl(ClientPtr /* client */
int ProcXGetDeviceControl(ClientPtr /* client */
);
-void CopySwapDeviceResolution(ClientPtr /* client */ ,
- ValuatorClassPtr /* v */ ,
- char * /* buf */ ,
- int /* length */
- );
-
-void CopySwapDeviceAbsCalib (ClientPtr client,
- AbsoluteClassPtr dts,
- char *buf);
-
-void CopySwapDeviceAbsArea (ClientPtr client,
- AbsoluteClassPtr dts,
- char *buf);
-
-void CopySwapDeviceCore(ClientPtr /* client */ ,
- DeviceIntPtr /* dev */ ,
- char * /* buf */
- );
-
-void CopySwapDeviceEnable(ClientPtr /* client */ ,
- DeviceIntPtr /* dev */ ,
- char * /* buf */
- );
-
void SRepXGetDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceControlReply * /* rep */
diff --git a/Xi/getfctl.c b/Xi/getfctl.c
index 870348fbb..28360ee54 100644
--- a/Xi/getfctl.c
+++ b/Xi/getfctl.c
@@ -86,104 +86,11 @@ SProcXGetFeedbackControl(register ClientPtr client)
/***********************************************************************
*
- * Get the feedback control state.
- *
- */
-
-int
-ProcXGetFeedbackControl(ClientPtr client)
-{
- int total_length = 0;
- char *buf, *savbuf;
- register DeviceIntPtr dev;
- KbdFeedbackPtr k;
- PtrFeedbackPtr p;
- IntegerFeedbackPtr i;
- StringFeedbackPtr s;
- BellFeedbackPtr b;
- LedFeedbackPtr l;
- xGetFeedbackControlReply rep;
-
- REQUEST(xGetFeedbackControlReq);
- REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
-
- dev = LookupDeviceIntRec(stuff->deviceid);
- if (dev == NULL) {
- SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadDevice);
- return Success;
- }
-
- rep.repType = X_Reply;
- rep.RepType = X_GetFeedbackControl;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.num_feedbacks = 0;
-
- for (k = dev->kbdfeed; k; k = k->next) {
- rep.num_feedbacks++;
- total_length += sizeof(xKbdFeedbackState);
- }
- for (p = dev->ptrfeed; p; p = p->next) {
- rep.num_feedbacks++;
- total_length += sizeof(xPtrFeedbackState);
- }
- for (s = dev->stringfeed; s; s = s->next) {
- rep.num_feedbacks++;
- total_length += sizeof(xStringFeedbackState) +
- (s->ctrl.num_symbols_supported * sizeof(KeySym));
- }
- for (i = dev->intfeed; i; i = i->next) {
- rep.num_feedbacks++;
- total_length += sizeof(xIntegerFeedbackState);
- }
- for (l = dev->leds; l; l = l->next) {
- rep.num_feedbacks++;
- total_length += sizeof(xLedFeedbackState);
- }
- for (b = dev->bell; b; b = b->next) {
- rep.num_feedbacks++;
- total_length += sizeof(xBellFeedbackState);
- }
-
- if (total_length == 0) {
- SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadMatch);
- return Success;
- }
-
- buf = (char *)xalloc(total_length);
- if (!buf) {
- SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadAlloc);
- return Success;
- }
- savbuf = buf;
-
- for (k = dev->kbdfeed; k; k = k->next)
- CopySwapKbdFeedback(client, k, &buf);
- for (p = dev->ptrfeed; p; p = p->next)
- CopySwapPtrFeedback(client, p, &buf);
- for (s = dev->stringfeed; s; s = s->next)
- CopySwapStringFeedback(client, s, &buf);
- for (i = dev->intfeed; i; i = i->next)
- CopySwapIntegerFeedback(client, i, &buf);
- for (l = dev->leds; l; l = l->next)
- CopySwapLedFeedback(client, l, &buf);
- for (b = dev->bell; b; b = b->next)
- CopySwapBellFeedback(client, b, &buf);
-
- rep.length = (total_length + 3) >> 2;
- WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
- WriteToClient(client, total_length, savbuf);
- xfree(savbuf);
- return Success;
-}
-
-/***********************************************************************
- *
* This procedure copies KbdFeedbackClass data, swapping if necessary.
*
*/
-void
+static void
CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
{
int i;
@@ -218,7 +125,7 @@ CopySwapKbdFeedback(ClientPtr client, KbdFeedbackPtr k, char **buf)
*
*/
-void
+static void
CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf)
{
register char n;
@@ -246,7 +153,7 @@ CopySwapPtrFeedback(ClientPtr client, PtrFeedbackPtr p, char **buf)
*
*/
-void
+static void
CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf)
{
register char n;
@@ -274,7 +181,7 @@ CopySwapIntegerFeedback(ClientPtr client, IntegerFeedbackPtr i, char **buf)
*
*/
-void
+static void
CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf)
{
int i;
@@ -311,7 +218,7 @@ CopySwapStringFeedback(ClientPtr client, StringFeedbackPtr s, char **buf)
*
*/
-void
+static void
CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf)
{
register char n;
@@ -337,7 +244,7 @@ CopySwapLedFeedback(ClientPtr client, LedFeedbackPtr l, char **buf)
*
*/
-void
+static void
CopySwapBellFeedback(ClientPtr client, BellFeedbackPtr b, char **buf)
{
register char n;
@@ -376,3 +283,96 @@ SRepXGetFeedbackControl(ClientPtr client, int size,
swaps(&rep->num_feedbacks, n);
WriteToClient(client, size, (char *)rep);
}
+
+/***********************************************************************
+ *
+ * Get the feedback control state.
+ *
+ */
+
+int
+ProcXGetFeedbackControl(ClientPtr client)
+{
+ int total_length = 0;
+ char *buf, *savbuf;
+ register DeviceIntPtr dev;
+ KbdFeedbackPtr k;
+ PtrFeedbackPtr p;
+ IntegerFeedbackPtr i;
+ StringFeedbackPtr s;
+ BellFeedbackPtr b;
+ LedFeedbackPtr l;
+ xGetFeedbackControlReply rep;
+
+ REQUEST(xGetFeedbackControlReq);
+ REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
+
+ dev = LookupDeviceIntRec(stuff->deviceid);
+ if (dev == NULL) {
+ SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadDevice);
+ return Success;
+ }
+
+ rep.repType = X_Reply;
+ rep.RepType = X_GetFeedbackControl;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.num_feedbacks = 0;
+
+ for (k = dev->kbdfeed; k; k = k->next) {
+ rep.num_feedbacks++;
+ total_length += sizeof(xKbdFeedbackState);
+ }
+ for (p = dev->ptrfeed; p; p = p->next) {
+ rep.num_feedbacks++;
+ total_length += sizeof(xPtrFeedbackState);
+ }
+ for (s = dev->stringfeed; s; s = s->next) {
+ rep.num_feedbacks++;
+ total_length += sizeof(xStringFeedbackState) +
+ (s->ctrl.num_symbols_supported * sizeof(KeySym));
+ }
+ for (i = dev->intfeed; i; i = i->next) {
+ rep.num_feedbacks++;
+ total_length += sizeof(xIntegerFeedbackState);
+ }
+ for (l = dev->leds; l; l = l->next) {
+ rep.num_feedbacks++;
+ total_length += sizeof(xLedFeedbackState);
+ }
+ for (b = dev->bell; b; b = b->next) {
+ rep.num_feedbacks++;
+ total_length += sizeof(xBellFeedbackState);
+ }
+
+ if (total_length == 0) {
+ SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadMatch);
+ return Success;
+ }
+
+ buf = (char *)xalloc(total_length);
+ if (!buf) {
+ SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0, BadAlloc);
+ return Success;
+ }
+ savbuf = buf;
+
+ for (k = dev->kbdfeed; k; k = k->next)
+ CopySwapKbdFeedback(client, k, &buf);
+ for (p = dev->ptrfeed; p; p = p->next)
+ CopySwapPtrFeedback(client, p, &buf);
+ for (s = dev->stringfeed; s; s = s->next)
+ CopySwapStringFeedback(client, s, &buf);
+ for (i = dev->intfeed; i; i = i->next)
+ CopySwapIntegerFeedback(client, i, &buf);
+ for (l = dev->leds; l; l = l->next)
+ CopySwapLedFeedback(client, l, &buf);
+ for (b = dev->bell; b; b = b->next)
+ CopySwapBellFeedback(client, b, &buf);
+
+ rep.length = (total_length + 3) >> 2;
+ WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
+ WriteToClient(client, total_length, savbuf);
+ xfree(savbuf);
+ return Success;
+}
diff --git a/Xi/getfctl.h b/Xi/getfctl.h
index 7d2d17ab1..0ad58aa2b 100644
--- a/Xi/getfctl.h
+++ b/Xi/getfctl.h
@@ -36,36 +36,6 @@ int SProcXGetFeedbackControl(ClientPtr /* client */
int ProcXGetFeedbackControl(ClientPtr /* client */
);
-void CopySwapKbdFeedback(ClientPtr /* client */ ,
- KbdFeedbackPtr /* k */ ,
- char ** /* buf */
- );
-
-void CopySwapPtrFeedback(ClientPtr /* client */ ,
- PtrFeedbackPtr /* p */ ,
- char ** /* buf */
- );
-
-void CopySwapIntegerFeedback(ClientPtr /* client */ ,
- IntegerFeedbackPtr /* i */ ,
- char ** /* buf */
- );
-
-void CopySwapStringFeedback(ClientPtr /* client */ ,
- StringFeedbackPtr /* s */ ,
- char ** /* buf */
- );
-
-void CopySwapLedFeedback(ClientPtr /* client */ ,
- LedFeedbackPtr /* l */ ,
- char ** /* buf */
- );
-
-void CopySwapBellFeedback(ClientPtr /* client */ ,
- BellFeedbackPtr /* b */ ,
- char ** /* buf */
- );
-
void SRepXGetFeedbackControl(ClientPtr /* client */ ,
int /* size */ ,
xGetFeedbackControlReply * /* rep */
diff --git a/Xi/listdev.c b/Xi/listdev.c
index 02d55ad4c..257ee59bc 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -88,71 +88,12 @@ SProcXListInputDevices(register ClientPtr client)
/***********************************************************************
*
- * This procedure lists the input devices available to the server.
- *
- */
-
-int
-ProcXListInputDevices(register ClientPtr client)
-{
- xListInputDevicesReply rep;
- int numdevs = 0;
- int namesize = 1; /* need 1 extra byte for strcpy */
- int size = 0;
- int total_length;
- char *devbuf;
- char *classbuf;
- char *namebuf;
- char *savbuf;
- xDeviceInfo *dev;
- DeviceIntPtr d;
-
- REQUEST_SIZE_MATCH(xListInputDevicesReq);
-
- rep.repType = X_Reply;
- rep.RepType = X_ListInputDevices;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- AddOtherInputDevices();
-
- for (d = inputInfo.devices; d; d = d->next) {
- SizeDeviceInfo(d, &namesize, &size);
- numdevs++;
- }
- for (d = inputInfo.off_devices; d; d = d->next) {
- SizeDeviceInfo(d, &namesize, &size);
- numdevs++;
- }
-
- total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
- devbuf = (char *)xalloc(total_length);
- classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
- namebuf = classbuf + size;
- savbuf = devbuf;
-
- dev = (xDeviceInfoPtr) devbuf;
- for (d = inputInfo.devices; d; d = d->next, dev++)
- ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
- for (d = inputInfo.off_devices; d; d = d->next, dev++)
- ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
-
- rep.ndevices = numdevs;
- rep.length = (total_length + 3) >> 2;
- WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
- WriteToClient(client, total_length, savbuf);
- xfree(savbuf);
- return Success;
-}
-
-/***********************************************************************
- *
* This procedure calculates the size of the information to be returned
* for an input device.
*
*/
-void
+static void
SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
{
int chunks;
@@ -173,32 +114,6 @@ SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
/***********************************************************************
*
- * This procedure lists information to be returned for an input device.
- *
- */
-
-void
-ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev,
- char **devbuf, char **classbuf, char **namebuf)
-{
- CopyDeviceName(namebuf, d->name);
- CopySwapDevice(client, d, 0, devbuf);
- if (d->key != NULL) {
- CopySwapKeyClass(client, d->key, classbuf);
- dev->num_classes++;
- }
- if (d->button != NULL) {
- CopySwapButtonClass(client, d->button, classbuf);
- dev->num_classes++;
- }
- if (d->valuator != NULL) {
- dev->num_classes +=
- CopySwapValuatorClass(client, d->valuator, classbuf);
- }
-}
-
-/***********************************************************************
- *
* This procedure copies data to the DeviceInfo struct, swapping if necessary.
*
* We need the extra byte in the allocated buffer, because the trailing null
@@ -207,7 +122,7 @@ ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev,
*
*/
-void
+static void
CopyDeviceName(char **namebuf, char *name)
{
char *nameptr = (char *)*namebuf;
@@ -224,11 +139,33 @@ CopyDeviceName(char **namebuf, char *name)
/***********************************************************************
*
+ * This procedure copies ButtonClass information, swapping if necessary.
+ *
+ */
+
+static void
+CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf)
+{
+ register char n;
+ xButtonInfoPtr b2;
+
+ b2 = (xButtonInfoPtr) * buf;
+ b2->class = ButtonClass;
+ b2->length = sizeof(xButtonInfo);
+ b2->num_buttons = b->numButtons;
+ if (client->swapped) {
+ swaps(&b2->num_buttons, n); /* macro - braces are required */
+ }
+ *buf += sizeof(xButtonInfo);
+}
+
+/***********************************************************************
+ *
* This procedure copies data to the DeviceInfo struct, swapping if necessary.
*
*/
-void
+static void
CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes,
char **buf)
{
@@ -262,7 +199,7 @@ CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes,
*
*/
-void
+static void
CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf)
{
register char n;
@@ -282,28 +219,6 @@ CopySwapKeyClass(register ClientPtr client, KeyClassPtr k, char **buf)
/***********************************************************************
*
- * This procedure copies ButtonClass information, swapping if necessary.
- *
- */
-
-void
-CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf)
-{
- register char n;
- xButtonInfoPtr b2;
-
- b2 = (xButtonInfoPtr) * buf;
- b2->class = ButtonClass;
- b2->length = sizeof(xButtonInfo);
- b2->num_buttons = b->numButtons;
- if (client->swapped) {
- swaps(&b2->num_buttons, n); /* macro - braces are required */
- }
- *buf += sizeof(xButtonInfo);
-}
-
-/***********************************************************************
- *
* This procedure copies ValuatorClass information, swapping if necessary.
*
* Devices may have up to 255 valuators. The length of a ValuatorClass is
@@ -314,7 +229,7 @@ CopySwapButtonClass(register ClientPtr client, ButtonClassPtr b, char **buf)
*
*/
-int
+static int
CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf)
{
int i, j, axes, t_axes;
@@ -359,6 +274,91 @@ CopySwapValuatorClass(register ClientPtr client, ValuatorClassPtr v, char **buf)
/***********************************************************************
*
+ * This procedure lists information to be returned for an input device.
+ *
+ */
+
+static void
+ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev,
+ char **devbuf, char **classbuf, char **namebuf)
+{
+ CopyDeviceName(namebuf, d->name);
+ CopySwapDevice(client, d, 0, devbuf);
+ if (d->key != NULL) {
+ CopySwapKeyClass(client, d->key, classbuf);
+ dev->num_classes++;
+ }
+ if (d->button != NULL) {
+ CopySwapButtonClass(client, d->button, classbuf);
+ dev->num_classes++;
+ }
+ if (d->valuator != NULL) {
+ dev->num_classes +=
+ CopySwapValuatorClass(client, d->valuator, classbuf);
+ }
+}
+
+/***********************************************************************
+ *
+ * This procedure lists the input devices available to the server.
+ *
+ */
+
+int
+ProcXListInputDevices(register ClientPtr client)
+{
+ xListInputDevicesReply rep;
+ int numdevs = 0;
+ int namesize = 1; /* need 1 extra byte for strcpy */
+ int size = 0;
+ int total_length;
+ char *devbuf;
+ char *classbuf;
+ char *namebuf;
+ char *savbuf;
+ xDeviceInfo *dev;
+ DeviceIntPtr d;
+
+ REQUEST_SIZE_MATCH(xListInputDevicesReq);
+
+ rep.repType = X_Reply;
+ rep.RepType = X_ListInputDevices;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+
+ AddOtherInputDevices();
+
+ for (d = inputInfo.devices; d; d = d->next) {
+ SizeDeviceInfo(d, &namesize, &size);
+ numdevs++;
+ }
+ for (d = inputInfo.off_devices; d; d = d->next) {
+ SizeDeviceInfo(d, &namesize, &size);
+ numdevs++;
+ }
+
+ total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
+ devbuf = (char *)xalloc(total_length);
+ classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
+ namebuf = classbuf + size;
+ savbuf = devbuf;
+
+ dev = (xDeviceInfoPtr) devbuf;
+ for (d = inputInfo.devices; d; d = d->next, dev++)
+ ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
+ for (d = inputInfo.off_devices; d; d = d->next, dev++)
+ ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
+
+ rep.ndevices = numdevs;
+ rep.length = (total_length + 3) >> 2;
+ WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
+ WriteToClient(client, total_length, savbuf);
+ xfree(savbuf);
+ return Success;
+}
+
+/***********************************************************************
+ *
* This procedure writes the reply for the XListInputDevices function,
* if the client and server have a different byte ordering.
*
diff --git a/Xi/listdev.h b/Xi/listdev.h
index bdd67ce70..db376decf 100644
--- a/Xi/listdev.h
+++ b/Xi/listdev.h
@@ -36,44 +36,6 @@ int SProcXListInputDevices(ClientPtr /* client */
int ProcXListInputDevices(ClientPtr /* client */
);
-void SizeDeviceInfo(DeviceIntPtr /* d */ ,
- int * /* namesize */ ,
- int * /* size */
- );
-
-void ListDeviceInfo(ClientPtr /* client */ ,
- DeviceIntPtr /* d */ ,
- xDeviceInfoPtr /* dev */ ,
- char ** /* devbuf */ ,
- char ** /* classbuf */ ,
- char ** /* namebuf */
- );
-
-void CopyDeviceName(char ** /* namebuf */ ,
- char * /* name */
- );
-
-void CopySwapDevice(ClientPtr /* client */ ,
- DeviceIntPtr /* d */ ,
- int /* num_classes */ ,
- char ** /* buf */
- );
-
-void CopySwapKeyClass(ClientPtr /* client */ ,
- KeyClassPtr /* k */ ,
- char ** /* buf */
- );
-
-void CopySwapButtonClass(ClientPtr /* client */ ,
- ButtonClassPtr /* b */ ,
- char ** /* buf */
- );
-
-int CopySwapValuatorClass(ClientPtr /* client */ ,
- ValuatorClassPtr /* v */ ,
- char ** /* buf */
- );
-
void SRepXListInputDevices(ClientPtr /* client */ ,
int /* size */ ,
xListInputDevicesReply * /* rep */
diff --git a/afb/afb.h b/afb/afb.h
index c05cc5511..5aa2b0c92 100644
--- a/afb/afb.h
+++ b/afb/afb.h
@@ -78,27 +78,6 @@ extern void afbDoBitblt(
unsigned long /*planemask*/
);
-extern RegionPtr afbBitBlt(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- GCPtr /*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*width*/,
- int /*height*/,
- int /*dstx*/,
- int /*dsty*/,
- void (*doBitBlt)(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/
- ),
- unsigned long /*planemask*/
-);
-
extern RegionPtr afbCopyArea(
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
@@ -111,27 +90,6 @@ extern RegionPtr afbCopyArea(
int /*dsty*/
);
-extern RegionPtr afbCopyPlane(
- DrawablePtr /*pSrcDrawable*/,
- DrawablePtr /*pDstDrawable*/,
- GCPtr/*pGC*/,
- int /*srcx*/,
- int /*srcy*/,
- int /*width*/,
- int /*height*/,
- int /*dstx*/,
- int /*dsty*/,
- unsigned long /*plane*/
-);
-
-extern void afbCopy1ToN(
- DrawablePtr /*pSrc*/,
- DrawablePtr /*pDst*/,
- int /*alu*/,
- RegionPtr /*prgnDst*/,
- DDXPointPtr /*pptSrc*/,
- unsigned long /*planemask*/
-);
/* afbbltC.c */
extern void afbDoBitbltCopy(
@@ -273,23 +231,6 @@ extern Bool afbInitializeColormap(
ColormapPtr /*pmap*/
);
-extern int afbExpandDirectColors(
- ColormapPtr /*pmap*/,
- int /*ndefs*/,
- xColorItem * /*indefs*/,
- xColorItem * /*outdefs*/
-);
-
-extern Bool afbCreateDefColormap(
- ScreenPtr /*pScreen*/
-);
-
-extern Bool afbSetVisualTypes(
- int /*depth*/,
- int /*visuals*/,
- int /*bitsPerRGB*/
-);
-
extern Bool afbInitVisuals(
VisualPtr * /*visualp*/,
DepthPtr * /*depthp*/,
@@ -410,16 +351,6 @@ extern Bool afbCreateGC(
GCPtr /*pGC*/
);
-extern void afbValidateGC(
- GCPtr /*pGC*/,
- unsigned long /*changes*/,
- DrawablePtr /*pDrawable*/
-);
-
-extern void afbDestroyGC(
- GCPtr /*pGC*/
-);
-
extern void afbReduceRop(
int /*alu*/,
Pixel /*src*/,
@@ -428,19 +359,6 @@ extern void afbReduceRop(
unsigned char * /*rrops*/
);
-extern void afbReduceOpaqueStipple (
- Pixel /*fg*/,
- Pixel /*bg*/,
- unsigned long /*planemask*/,
- int /*depth*/,
- unsigned char * /*rrops*/
-);
-
-extern void afbComputeCompositeClip(
- GCPtr /*pGC*/,
- DrawablePtr /*pDrawable*/
-);
-
/* afbgetsp.c */
extern void afbGetSpans(
@@ -588,14 +506,6 @@ extern Bool afbDestroyPixmap(
PixmapPtr /*pPixmap*/
);
-extern PixmapPtr afbCopyPixmap(
- PixmapPtr /*pSrc*/
-);
-
-extern void afbPadPixmap(
- PixmapPtr /*pPixmap*/
-);
-
extern void afbXRotatePixmap(
PixmapPtr /*pPix*/,
int /*rw*/
@@ -637,20 +547,9 @@ extern void afbPushPixels(
int /*xOrg*/,
int /*yOrg*/
);
-/* afbscrclse.c */
-extern Bool afbCloseScreen(
- int /*index*/,
- ScreenPtr /*pScreen*/
-);
/* afbscrinit.c */
-extern Bool afbAllocatePrivates(
- ScreenPtr /*pScreen*/,
- int * /*pWinIndex*/,
- int * /*pGCIndex*/
-);
-
extern Bool afbScreenInit(
ScreenPtr /*pScreen*/,
pointer /*pbits*/,
@@ -661,15 +560,6 @@ extern Bool afbScreenInit(
int /*width*/
);
-extern PixmapPtr afbGetWindowPixmap(
- WindowPtr /*pWin*/
-);
-
-extern void afbSetWindowPixmap(
- WindowPtr /*pWin*/,
- PixmapPtr /*pPix*/
-);
-
/* afbseg.c */
extern void afbSegmentSS(
@@ -687,20 +577,6 @@ extern void afbSegmentSD(
);
/* afbsetsp.c */
-extern void afbSetScanline(
- int /*y*/,
- int /*xOrigin*/,
- int /*xStart*/,
- int /*xEnd*/,
- PixelType * /*psrc*/,
- int /*alu*/,
- PixelType * /*pdstBase*/,
- int /*widthDst*/,
- int /*sizeDst*/,
- int /*depthDst*/,
- int /*sizeSrc*/
-);
-
extern void afbSetSpans(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
diff --git a/afb/afbbitblt.c b/afb/afbbitblt.c
index 594e987a8..2e416e356 100644
--- a/afb/afbbitblt.c
+++ b/afb/afbbitblt.c
@@ -67,9 +67,6 @@ SOFTWARE.
#include "afb.h"
#include "maskbits.h"
-
-static unsigned char afbRropsOS[AFB_MAX_DEPTH];
-
/* CopyArea and CopyPlane for a monchrome frame buffer
@@ -126,34 +123,7 @@ afbDoBitblt(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, DDXP
typedef void (*afb_blit_func)
(DrawablePtr, DrawablePtr, int, RegionPtr, DDXPointPtr, unsigned long);
-RegionPtr
-afbCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty)
-{
- afb_blit_func doBitBlt;
-
- switch (pGC->alu) {
- case GXcopy:
- doBitBlt = afbDoBitbltCopy;
- break;
- case GXxor:
- doBitBlt = afbDoBitbltXor;
- break;
- case GXcopyInverted:
- doBitBlt = afbDoBitbltCopyInverted;
- break;
- case GXor:
- doBitBlt = afbDoBitbltOr;
- break;
- default:
- doBitBlt = afbDoBitbltGeneral;
- break;
- }
-
- return(afbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy,
- width, height, dstx, dsty, doBitBlt, pGC->planemask));
-}
-
-RegionPtr
+static RegionPtr
afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable, register GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, afb_blit_func doBitBlt, long unsigned int planemask)
{
RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
@@ -346,102 +316,28 @@ afbBitBlt(register DrawablePtr pSrcDrawable, register DrawablePtr pDstDrawable,
}
RegionPtr
-afbCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, register GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, long unsigned int plane)
+afbCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty)
{
- int alu;
- RegionPtr prgnExposed = NULL;
- unsigned long old_planemask;
-
- if (pDstDrawable->depth == 1) {
- old_planemask = pGC->planemask;
- pGC->planemask = plane;
- if ((pGC->fgPixel & 1) == 1 && (pGC->bgPixel & 1) == 0) {
- prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty);
- } else if ((pGC->fgPixel & 1) == (pGC->bgPixel & 1)) {
- unsigned char rop;
-
- afbReduceRop(pGC->alu, pGC->fgPixel, 1, 1, &rop);
- alu = pGC->alu;
- pGC->alu = rop;
- prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height, dstx,
- dsty);
- pGC->alu = alu;
- } else { /* need to invert the src */
- alu = pGC->alu;
- pGC->alu = afbInverseAlu[alu];
- prgnExposed = (*pGC->ops->CopyArea)(pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height, dstx,
- dsty);
- pGC->alu = alu;
- }
- pGC->planemask = old_planemask;
- } else {
- int free_pixmap = FALSE;
- PixmapPtr pBitmap = (PixmapPtr)pSrcDrawable;
- ScreenPtr pScreen = pSrcDrawable->pScreen;
- GCPtr pGC1 = NULL;
-
- if (pSrcDrawable == pDstDrawable ||
- pSrcDrawable->type == DRAWABLE_WINDOW || pSrcDrawable->depth != 1) {
- /* Copy a plane from source drawable to a tmp 1-bit deep pixmap */
- /* XXX: Range check width and height */
- pBitmap = (*pScreen->CreatePixmap)(pScreen, width, height, 1);
-
- if (!pBitmap)
- return(NULL);
- pGC1 = GetScratchGC(1, pScreen);
- if (!pGC1) {
- (*pScreen->DestroyPixmap)(pBitmap);
- return(NULL);
- }
- ValidateGC((DrawablePtr)pBitmap, pGC1);
- (void)afbBitBlt(pSrcDrawable, (DrawablePtr)pBitmap, pGC1, srcx, srcy,
- width, height, 0, 0, afbDoBitbltCopy, plane);
- free_pixmap = TRUE;
- }
-#if 0
- else {
- /* XXX: could cope with N-deep pixmap source case without using tmp
- * src bitmap by setting up a scratch pixmap header and fiddle
- * around with the pbits pointer.
- */
- }
-#endif
- afbReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask,
- pGC->depth, afbRropsOS);
- (void)afbBitBlt((DrawablePtr)pBitmap, pDstDrawable, pGC, 0, 0, width,
- height, dstx, dsty, afbCopy1ToN, pGC->planemask);
- if (free_pixmap) {
- (*pScreen->DestroyPixmap)(pBitmap);
- FreeScratchGC(pGC1);
- }
+ afb_blit_func doBitBlt;
- if (pGC->fExpose)
- prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx,
- srcy, width, height, dstx, dsty,
- plane);
+ switch (pGC->alu) {
+ case GXcopy:
+ doBitBlt = afbDoBitbltCopy;
+ break;
+ case GXxor:
+ doBitBlt = afbDoBitbltXor;
+ break;
+ case GXcopyInverted:
+ doBitBlt = afbDoBitbltCopyInverted;
+ break;
+ case GXor:
+ doBitBlt = afbDoBitbltOr;
+ break;
+ default:
+ doBitBlt = afbDoBitbltGeneral;
+ break;
}
- return prgnExposed;
-}
-void
-afbCopy1ToN(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, DDXPointPtr pptSrc, long unsigned int planemask)
-{
- int numRects = REGION_NUM_RECTS(prgnDst);
- BoxPtr pbox = REGION_RECTS(prgnDst);
- int r;
-
- for (r = 0; r < numRects; r++, pbox++, pptSrc++) {
- int dx = pptSrc->x;
- int dy = pptSrc->y;
-
- if (alu == GXcopy)
- afbOpaqueStippleAreaCopy(pDst, 1, pbox, alu, (PixmapPtr)pSrc, dx, dy,
- afbRropsOS, planemask);
- else
- afbOpaqueStippleAreaGeneral(pDst, 1, pbox, alu, (PixmapPtr)pSrc, dx,
- dy, afbRropsOS, planemask);
- }
+ return(afbBitBlt(pSrcDrawable, pDstDrawable, pGC, srcx, srcy,
+ width, height, dstx, dsty, doBitBlt, pGC->planemask));
}
diff --git a/afb/afbcmap.c b/afb/afbcmap.c
index e3b95fbec..9608a3653 100644
--- a/afb/afbcmap.c
+++ b/afb/afbcmap.c
@@ -70,24 +70,6 @@ afbInitializeColormap(register ColormapPtr pmap)
return miInitializeColormap(pmap);
}
-int
-afbExpandDirectColors(ColormapPtr pmap, int ndef, xColorItem *indefs, xColorItem *outdefs)
-{
- return miExpandDirectColors(pmap, ndef, indefs, outdefs);
-}
-
-Bool
-afbCreateDefColormap(ScreenPtr pScreen)
-{
- return miCreateDefColormap(pScreen);
-}
-
-Bool
-afbSetVisualTypes(int depth, int visuals, int bitsPerRGB)
-{
- return miSetVisualTypes(depth, visuals, bitsPerRGB, -1);
-}
-
/*
* Given a list of formats for a screen, create a list
* of visuals and depths for the screen which correspond to
diff --git a/afb/afbgc.c b/afb/afbgc.c
index 03475dda5..59c09e097 100644
--- a/afb/afbgc.c
+++ b/afb/afbgc.c
@@ -69,6 +69,9 @@ SOFTWARE.
#include "maskbits.h"
+static void afbDestroyGC(GCPtr);
+static void afbValidateGC(GCPtr, unsigned long, DrawablePtr);
+
static GCFuncs afbFuncs = {
afbValidateGC,
miChangeGC,
@@ -102,6 +105,33 @@ static GCOps afbGCOps = {
afbPushPixels
};
+static void
+afbReduceOpaqueStipple(PixelType fg, PixelType bg, unsigned long planemask,
+ int depth, unsigned char *rop)
+{
+ register int d;
+ register Pixel mask = 1;
+
+ bg ^= fg;
+
+ for (d = 0; d < depth; d++, mask <<= 1) {
+ if (!(planemask & mask))
+ rop[d] = RROP_NOP;
+ else if (!(bg & mask)) {
+ /* Both fg and bg have a 0 or 1 in this plane */
+ if (fg & mask)
+ rop[d] = RROP_WHITE;
+ else
+ rop[d] = RROP_BLACK;
+ } else {
+ /* Both fg and bg have different bits on this plane */
+ if (fg & mask)
+ rop[d] = RROP_COPY;
+ else
+ rop[d] = RROP_INVERT;
+ }
+ }
+}
Bool
afbCreateGC(pGC)
@@ -136,6 +166,95 @@ afbCreateGC(pGC)
return TRUE;
}
+static void
+afbComputeCompositeClip(GCPtr pGC, DrawablePtr pDrawable)
+{
+ if (pDrawable->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr) pDrawable;
+ RegionPtr pregWin;
+ Bool freeTmpClip, freeCompClip;
+
+ if (pGC->subWindowMode == IncludeInferiors) {
+ pregWin = NotClippedByChildren(pWin);
+ freeTmpClip = TRUE;
+ } else {
+ pregWin = &pWin->clipList;
+ freeTmpClip = FALSE;
+ }
+ freeCompClip = pGC->freeCompClip;
+
+ /*
+ * if there is no client clip, we can get by with just keeping the
+ * pointer we got, and remembering whether or not should destroy (or
+ * maybe re-use) it later. this way, we avoid unnecessary copying of
+ * regions. (this wins especially if many clients clip by children
+ * and have no client clip.)
+ */
+ if (pGC->clientClipType == CT_NONE) {
+ if (freeCompClip)
+ REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
+ pGC->pCompositeClip = pregWin;
+ pGC->freeCompClip = freeTmpClip;
+ } else {
+ /*
+ * we need one 'real' region to put into the composite clip. if
+ * pregWin the current composite clip are real, we can get rid of
+ * one. if pregWin is real and the current composite clip isn't,
+ * use pregWin for the composite clip. if the current composite
+ * clip is real and pregWin isn't, use the current composite
+ * clip. if neither is real, create a new region.
+ */
+
+ REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
+ pDrawable->x + pGC->clipOrg.x,
+ pDrawable->y + pGC->clipOrg.y);
+
+ if (freeCompClip) {
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin,
+ pGC->clientClip);
+ if (freeTmpClip)
+ REGION_DESTROY(pGC->pScreen, pregWin);
+ } else if (freeTmpClip) {
+ REGION_INTERSECT(pGC->pScreen, pregWin, pregWin, pGC->clientClip);
+ pGC->pCompositeClip = pregWin;
+ } else {
+ pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pregWin, pGC->clientClip);
+ }
+ pGC->freeCompClip = TRUE;
+ REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
+ -(pDrawable->x + pGC->clipOrg.x),
+ -(pDrawable->y + pGC->clipOrg.y));
+ }
+ } /* end of composite clip for a window */
+ else {
+ BoxRec pixbounds;
+
+ /* XXX should we translate by drawable.x/y here ? */
+ pixbounds.x1 = 0;
+ pixbounds.y1 = 0;
+ pixbounds.x2 = pDrawable->width;
+ pixbounds.y2 = pDrawable->height;
+
+ if (pGC->freeCompClip) {
+ REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
+ } else {
+ pGC->freeCompClip = TRUE;
+ pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
+ }
+
+ if (pGC->clientClipType == CT_REGION) {
+ REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, -pGC->clipOrg.x,
+ -pGC->clipOrg.y);
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, pGC->clipOrg.x,
+ pGC->clipOrg.y);
+ }
+ } /* end of composite clip for pixmap */
+} /* end afbComputeCompositeClip */
+
/* Clipping conventions
if the drawable is a window
CT_REGION ==> pCompositeClip really is the composite
@@ -147,7 +266,7 @@ afbCreateGC(pGC)
*/
/*ARGSUSED*/
-void
+static void
afbValidateGC(pGC, changes, pDrawable)
register GCPtr pGC;
unsigned long changes;
@@ -434,7 +553,7 @@ afbValidateGC(pGC, changes, pDrawable)
} /* end of new_fill */
}
-void
+static void
afbDestroyGC(pGC)
GCPtr pGC;
{
@@ -445,58 +564,6 @@ afbDestroyGC(pGC)
miDestroyGCOps(pGC->ops);
}
-/* table to map alu(src, dst) to alu(~src, dst) */
-int afbInverseAlu[16] = {
- GXclear,
- GXandInverted,
- GXnor,
- GXcopyInverted,
- GXand,
- GXnoop,
- GXequiv,
- GXorInverted,
- GXandReverse,
- GXxor,
- GXinvert,
- GXnand,
- GXcopy,
- GXor,
- GXorReverse,
- GXset
-};
-
-void
-afbReduceOpaqueStipple(fg, bg, planemask, depth, rop)
-register PixelType fg;
-register PixelType bg;
-register unsigned long planemask;
-int depth;
-register unsigned char *rop;
-{
- register int d;
- register Pixel mask = 1;
-
- bg ^= fg;
-
- for (d = 0; d < depth; d++, mask <<= 1) {
- if (!(planemask & mask))
- rop[d] = RROP_NOP;
- else if (!(bg & mask)) {
- /* Both fg and bg have a 0 or 1 in this plane */
- if (fg & mask)
- rop[d] = RROP_WHITE;
- else
- rop[d] = RROP_BLACK;
- } else {
- /* Both fg and bg have different bits on this plane */
- if (fg & mask)
- rop[d] = RROP_COPY;
- else
- rop[d] = RROP_INVERT;
- }
- }
-}
-
void
afbReduceRop(alu, src, planemask, depth, rop)
register int alu;
@@ -615,94 +682,3 @@ afbReduceRop(alu, src, planemask, depth, rop)
}
}
}
-
-void
-afbComputeCompositeClip(pGC, pDrawable)
- GCPtr pGC;
- DrawablePtr pDrawable;
-{
- if (pDrawable->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr) pDrawable;
- RegionPtr pregWin;
- Bool freeTmpClip, freeCompClip;
-
- if (pGC->subWindowMode == IncludeInferiors) {
- pregWin = NotClippedByChildren(pWin);
- freeTmpClip = TRUE;
- } else {
- pregWin = &pWin->clipList;
- freeTmpClip = FALSE;
- }
- freeCompClip = pGC->freeCompClip;
-
- /*
- * if there is no client clip, we can get by with just keeping the
- * pointer we got, and remembering whether or not should destroy (or
- * maybe re-use) it later. this way, we avoid unnecessary copying of
- * regions. (this wins especially if many clients clip by children
- * and have no client clip.)
- */
- if (pGC->clientClipType == CT_NONE) {
- if (freeCompClip)
- REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
- pGC->pCompositeClip = pregWin;
- pGC->freeCompClip = freeTmpClip;
- } else {
- /*
- * we need one 'real' region to put into the composite clip. if
- * pregWin the current composite clip are real, we can get rid of
- * one. if pregWin is real and the current composite clip isn't,
- * use pregWin for the composite clip. if the current composite
- * clip is real and pregWin isn't, use the current composite
- * clip. if neither is real, create a new region.
- */
-
- REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
- pDrawable->x + pGC->clipOrg.x,
- pDrawable->y + pGC->clipOrg.y);
-
- if (freeCompClip) {
- REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip, pregWin,
- pGC->clientClip);
- if (freeTmpClip)
- REGION_DESTROY(pGC->pScreen, pregWin);
- } else if (freeTmpClip) {
- REGION_INTERSECT(pGC->pScreen, pregWin, pregWin, pGC->clientClip);
- pGC->pCompositeClip = pregWin;
- } else {
- pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
- REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
- pregWin, pGC->clientClip);
- }
- pGC->freeCompClip = TRUE;
- REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
- -(pDrawable->x + pGC->clipOrg.x),
- -(pDrawable->y + pGC->clipOrg.y));
- }
- } /* end of composite clip for a window */
- else {
- BoxRec pixbounds;
-
- /* XXX should we translate by drawable.x/y here ? */
- pixbounds.x1 = 0;
- pixbounds.y1 = 0;
- pixbounds.x2 = pDrawable->width;
- pixbounds.y2 = pDrawable->height;
-
- if (pGC->freeCompClip) {
- REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
- } else {
- pGC->freeCompClip = TRUE;
- pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
- }
-
- if (pGC->clientClipType == CT_REGION) {
- REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, -pGC->clipOrg.x,
- -pGC->clipOrg.y);
- REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
- pGC->pCompositeClip, pGC->clientClip);
- REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip, pGC->clipOrg.x,
- pGC->clipOrg.y);
- }
- } /* end of composite clip for pixmap */
-} /* end afbComputeCompositeClip */
diff --git a/afb/afbimage.c b/afb/afbimage.c
index c82bb3668..81f49730a 100644
--- a/afb/afbimage.c
+++ b/afb/afbimage.c
@@ -42,39 +42,8 @@ afbPutImage(pDraw, pGC, depth, x, y, width, height, leftPad, format, pImage)
(void)(*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDraw, pGC, leftPad,
0, width, height, x, y, 1);
else {
-#if 0
- /* XXX: bit plane order wronge ! */
- pPixmap->drawable.depth = 1;
- pPixmap->drawable.bitsPerPixel = 1;
-
- switch (pGC->alu) {
- case GXcopy:
- doBitBlt = afbDoBitbltCopy;
- break;
- case GXxor:
- doBitBlt = afbDoBitbltXor;
- break;
- case GXcopyInverted:
- doBitBlt = afbDoBitbltCopyInverted;
- break;
- case GXor:
- doBitBlt = afbDoBitbltOr;
- break;
- default:
- doBitBlt = afbDoBitbltGeneral;
- break;
- }
-
- for (plane = (1L << (pPixmap->drawable.depth - 1)); plane;
- plane >>= 1) {
- (void)afbBitBlt((DrawablePtr)pPixmap, pDraw, pGC, leftPad, 0,
- width, height, x, y, doBitBlt, plane);
- /* pDraw->devKind += sizeDst; */
- }
-#else
(void)(*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDraw, pGC, leftPad,
0, width, height, x, y);
-#endif
}
pGC->fExpose = TRUE;
diff --git a/afb/afbpixmap.c b/afb/afbpixmap.c
index 6801960c6..77ba53513 100644
--- a/afb/afbpixmap.c
+++ b/afb/afbpixmap.c
@@ -102,12 +102,8 @@ afbCreatePixmap(pScreen, width, height, depth)
pPixmap->drawable.height = height;
pPixmap->devKind = paddedWidth;
pPixmap->refcnt = 1;
-#ifdef PIXPRIV
pPixmap->devPrivate.ptr = datasize ?
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
-#else
- pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
-#endif
return(pPixmap);
}
@@ -122,9 +118,8 @@ afbDestroyPixmap(pPixmap)
}
-PixmapPtr
-afbCopyPixmap(pSrc)
- register PixmapPtr pSrc;
+static PixmapPtr
+afbCopyPixmap(PixmapPtr pSrc)
{
register PixmapPtr pDst;
int size;
@@ -152,9 +147,8 @@ afbCopyPixmap(pSrc)
zero out area to be filled with replicate
left shift and or in original as many times as needed
*/
-void
-afbPadPixmap(pPixmap)
- PixmapPtr pPixmap;
+static void
+afbPadPixmap(PixmapPtr pPixmap)
{
register int width = pPixmap->drawable.width;
register int h;
diff --git a/afb/afbscrinit.c b/afb/afbscrinit.c
index 2b0867fda..7cb742345 100644
--- a/afb/afbscrinit.c
+++ b/afb/afbscrinit.c
@@ -77,7 +77,7 @@ int afbScreenPrivateIndex;
static unsigned long afbGeneration = 0;
-BSFuncRec afbBSFuncRec = {
+static BSFuncRec afbBSFuncRec = {
afbSaveAreas,
afbRestoreAreas,
(BackingStoreSetClipmaskRgnProcPtr) 0,
@@ -85,7 +85,7 @@ BSFuncRec afbBSFuncRec = {
(BackingStoreGetSpansPixmapProcPtr) 0,
};
-Bool
+static Bool
afbCloseScreen(int index, ScreenPtr pScreen)
{
int d;
@@ -119,7 +119,29 @@ afbCreateScreenResources(ScreenPtr pScreen)
return(retval);
}
-Bool
+static PixmapPtr
+afbGetWindowPixmap(WindowPtr pWin)
+{
+#ifdef PIXMAP_PER_WINDOW
+ return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr);
+#else
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ return (* pScreen->GetScreenPixmap)(pScreen);
+#endif
+}
+
+static void
+afbSetWindowPixmap(WindowPtr pWin, PixmapPtr pPix)
+{
+#ifdef PIXMAP_PER_WINDOW
+ pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix;
+#else
+ (* pWin->drawable.pScreen->SetScreenPixmap)(pPix);
+#endif
+}
+
+static Bool
afbAllocatePrivates(ScreenPtr pScreen, int *pWinIndex, int *pGCIndex)
{
if (afbGeneration != serverGeneration) {
@@ -216,25 +238,3 @@ afbScreenInit(register ScreenPtr pScreen, pointer pbits, int xsize, int ysize, i
return TRUE;
}
-
-PixmapPtr
-afbGetWindowPixmap(WindowPtr pWin)
-{
-#ifdef PIXMAP_PER_WINDOW
- return (PixmapPtr)(pWin->devPrivates[frameWindowPrivateIndex].ptr);
-#else
- ScreenPtr pScreen = pWin->drawable.pScreen;
-
- return (* pScreen->GetScreenPixmap)(pScreen);
-#endif
-}
-
-void
-afbSetWindowPixmap(WindowPtr pWin, PixmapPtr pPix)
-{
-#ifdef PIXMAP_PER_WINDOW
- pWin->devPrivates[frameWindowPrivateIndex].ptr = (pointer)pPix;
-#else
- (* pWin->drawable.pScreen->SetScreenPixmap)(pPix);
-#endif
-}
diff --git a/afb/afbsetsp.c b/afb/afbsetsp.c
index adc726620..cb36dba99 100644
--- a/afb/afbsetsp.c
+++ b/afb/afbsetsp.c
@@ -73,20 +73,10 @@ SOFTWARE.
* boxes, we may not want to start grabbing bits at psrc but at some offset
* further on.)
*/
-void
-afbSetScanline(y, xOrigin, xStart, xEnd, psrc, alu, pdstBase, widthDst,
- sizeDst, depthDst, sizeSrc)
- int y;
- int xOrigin; /* where this scanline starts */
- int xStart; /* first bit to use from scanline */
- int xEnd; /* last bit to use from scanline + 1 */
- register PixelType *psrc;
- register int alu; /* raster op */
- PixelType *pdstBase; /* start of the drawable */
- int widthDst; /* width of drawable in words */
- int sizeDst;
- int depthDst;
- int sizeSrc;
+static void
+afbSetScanline(int y, int xOrigin, int xStart, int xEnd, PixelType *psrc,
+ int alu, PixelType *pdstBase, int widthDst, int sizeDst,
+ int depthDst, int sizeSrc)
{
int w; /* width of scanline in bits */
register PixelType *pdst; /* where to put the bits */
diff --git a/cfb/cfbpixmap.c b/cfb/cfbpixmap.c
index d51c5187c..6fdf3eae6 100644
--- a/cfb/cfbpixmap.c
+++ b/cfb/cfbpixmap.c
@@ -96,12 +96,8 @@ cfbCreatePixmap (pScreen, width, height, depth)
pPixmap->drawable.height = height;
pPixmap->devKind = paddedWidth;
pPixmap->refcnt = 1;
-#ifdef PIXPRIV
pPixmap->devPrivate.ptr = datasize ?
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
-#else
- pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
-#endif
return pPixmap;
}
diff --git a/composite/compalloc.c b/composite/compalloc.c
index 5bbf0a279..ce1ef7d80 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -48,7 +48,7 @@
#include "compint.h"
-void
+static void
compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
{
WindowPtr pWin = (WindowPtr) closure;
diff --git a/composite/compext.c b/composite/compext.c
index 13936fa18..ba37e7d1f 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -50,10 +50,10 @@
#include "compint.h"
static CARD8 CompositeReqCode;
-int CompositeClientPrivateIndex;
+static int CompositeClientPrivateIndex;
RESTYPE CompositeClientWindowType;
RESTYPE CompositeClientSubwindowsType;
-RESTYPE CompositeClientOverlayType;
+static RESTYPE CompositeClientOverlayType;
static void deleteCompOverlayClient (CompOverlayClientPtr pOcToDel,
ScreenPtr pScreen);
@@ -423,7 +423,7 @@ createOverlayWindow (ScreenPtr pScreen)
return pWin;
}
-int
+static int
ProcCompositeGetOverlayWindow (ClientPtr client)
{
REQUEST(xCompositeGetOverlayWindowReq);
@@ -477,7 +477,7 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
return client->noClientException;
}
-int
+static int
ProcCompositeReleaseOverlayWindow (ClientPtr client)
{
REQUEST(xCompositeReleaseOverlayWindowReq);
@@ -515,7 +515,7 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client)
return client->noClientException;
}
-int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
+static int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
ProcCompositeQueryVersion,
ProcCompositeRedirectWindow,
ProcCompositeRedirectSubwindows,
@@ -625,7 +625,7 @@ SProcCompositeNameWindowPixmap (ClientPtr client)
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
}
-int
+static int
SProcCompositeGetOverlayWindow (ClientPtr client)
{
int n;
@@ -637,7 +637,7 @@ SProcCompositeGetOverlayWindow (ClientPtr client)
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
}
-int
+static int
SProcCompositeReleaseOverlayWindow (ClientPtr client)
{
int n;
@@ -649,7 +649,7 @@ SProcCompositeReleaseOverlayWindow (ClientPtr client)
return (*ProcCompositeVector[stuff->compositeReqType]) (client);
}
-int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
+static int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
SProcCompositeQueryVersion,
SProcCompositeRedirectWindow,
SProcCompositeRedirectSubwindows,
@@ -678,6 +678,30 @@ CompositeExtensionInit (void)
ExtensionEntry *extEntry;
int s;
+ for (s = 0; s < screenInfo.numScreens; s++) {
+ ScreenPtr pScreen = screenInfo.screens[s];
+ VisualPtr vis;
+
+ /* Composite on 8bpp pseudocolor root windows appears to fail, so
+ * just disable it on anything pseudocolor for safety.
+ */
+ for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++)
+ ;
+ if ((vis->class | DynamicClass) == PseudoColor)
+ return;
+
+ /* Ensure that Render is initialized, which is required for automatic
+ * compositing.
+ */
+ if (GetPictureScreenIfSet(pScreen) == NULL)
+ return;
+ }
+ /* Xinerama's rewriting of window drawing before Composite gets to it
+ * breaks Composite.
+ */
+ if (!noPanoramiXExtension)
+ return;
+
CompositeClientWindowType = CreateNewResourceType (FreeCompositeClientWindow);
if (!CompositeClientWindowType)
return;
diff --git a/composite/compinit.c b/composite/compinit.c
index 1d5cc7b04..27261dcad 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -51,7 +51,7 @@
int CompScreenPrivateIndex;
int CompWindowPrivateIndex;
int CompSubwindowsPrivateIndex;
-int CompGeneration;
+static int CompGeneration;
static Bool
diff --git a/composite/compint.h b/composite/compint.h
index 3958b3b31..0bd55a9a6 100644
--- a/composite/compint.h
+++ b/composite/compint.h
@@ -171,9 +171,6 @@ extern RESTYPE CompositeClientSubwindowsType;
* compalloc.c
*/
-void
-compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure);
-
Bool
compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update);
@@ -292,18 +289,6 @@ compWindowUpdate (WindowPtr pWin);
void
deleteCompOverlayClientsForScreen (ScreenPtr pScreen);
-int
-ProcCompositeGetOverlayWindow (ClientPtr client);
-
-int
-ProcCompositeReleaseOverlayWindow (ClientPtr client);
-
-int
-SProcCompositeGetOverlayWindow (ClientPtr client);
-
-int
-SProcCompositeReleaseOverlayWindow (ClientPtr client);
-
WindowPtr
CompositeRealChildHead (WindowPtr pWin);
diff --git a/config/config.c b/config/config.c
index 76191abd4..6c4014352 100644
--- a/config/config.c
+++ b/config/config.c
@@ -303,15 +303,15 @@ configSetup(void)
if (!configData)
configData = (struct config_data *) xcalloc(sizeof(struct config_data), 1);
if (!configData) {
- ErrorF("[dbus] failed to allocate data struct.\n");
+ ErrorF("[dbus] failed to allocate data struct\n");
return FALSE;
}
dbus_error_init(&error);
configData->connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
if (!configData->connection || dbus_error_is_set(&error)) {
- ErrorF("[dbus] some kind of error occurred: %s (%s)\n", error.name,
- error.message);
+ DebugF("[dbus] some kind of error occurred while connecting: %s (%s)\n",
+ error.name, error.message);
dbus_error_free(&error);
xfree(configData);
configData = NULL;
diff --git a/configure.ac b/configure.ac
index 42b88c7ad..0110df9cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,7 +25,7 @@ dnl Process this file with autoconf to create configure.
AC_PREREQ(2.57)
dnl This is the not the Xorg version number, it's the server version number.
dnl Yes, that's weird.
-AC_INIT([xorg-server], 1.2.99.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+AC_INIT([xorg-server], 1.3.99.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
AM_MAINTAINER_MODE
@@ -280,6 +280,7 @@ case $host_cpu in
use_x86_asm="yes"
I386_VIDEO=yes
case $host_os in
+ darwin*) use_x86_asm="no" ;;
*linux*) DEFAULT_INT10=vm86 ;;
*freebsd*) AC_DEFINE(USE_DEV_IO) ;;
*netbsd*) AC_DEFINE(USE_I386_IOPL)
@@ -305,6 +306,7 @@ case $host_cpu in
use_x86_asm="yes"
I386_VIDEO=yes
case $host_os in
+ darwin*) use_x86_asm="no" ;;
*freebsd*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
*netbsd*) AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
SYS_LIBS=-lx86_64
@@ -473,6 +475,10 @@ AC_ARG_WITH(rgb-path, AS_HELP_STRING([--with-rgb-path=PATH], [Path to RG
AC_ARG_WITH(dri-driver-path, AS_HELP_STRING([--with-dri-driver-path=PATH], [Path to DRI drivers (default: ${libdir}/dri)]),
[ DRI_DRIVER_PATH="$withval" ],
[ DRI_DRIVER_PATH="${libdir}/dri" ])
+APPLE_APPLICATIONS_DIR="${bindir}/Applications"
+AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: ${bindir}/Applications)]),
+ [ APPLE_APPLICATIONS_DIR="${withval}" ].
+ [ APPLE_APPLICATIONS_DIR="${bindir}/Applications" ])
AC_ARG_ENABLE(builddocs, AS_HELP_STRING([--enable-builddocs], [Build docs (default: disabled)]),
[BUILDDOCS=$enableval],
[BUILDDOCS=no])
@@ -495,6 +501,7 @@ AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes exten
AC_ARG_ENABLE(xtrap, AS_HELP_STRING([--disable-xtrap], [Build XTrap extension (default: enabled)]), [XTRAP=$enableval], [XTRAP=yes])
AC_ARG_ENABLE(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
+AC_ARG_ENABLE(quartz, AS_HELP_STRING([--enable-quartz], [Build with darwin quartz support (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
AC_ARG_ENABLE(screensaver, AS_HELP_STRING([--disable-screensaver], [Build ScreenSaver extension (default: enabled)]), [SCREENSAVER=$enableval], [SCREENSAVER=yes])
@@ -525,7 +532,7 @@ AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build
dnl DDXes.
AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
-AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto])
+AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=no])
AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
@@ -533,6 +540,10 @@ AC_ARG_ENABLE(xprint, AS_HELP_STRING([--enable-xprint], [Build Xprint ex
AC_ARG_ENABLE(xgl, AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no])
AC_ARG_ENABLE(xglx, AS_HELP_STRING([--enable-xglx], [Build Xglx xgl module (default: no)]), [XGLX=$enableval], [XGLX=no])
AC_ARG_ENABLE(xegl, AS_HELP_STRING([--enable-xegl], [Build Xegl xgl module (default: no)]), [XEGL=$enableval], [XEGL=no])
+dnl legacy fb support
+AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: enabled)]), [MFB=$enableval], [MFB=$XORG])
+AC_ARG_ENABLE(cfb, AS_HELP_STRING([--enable-cfb], [Build legacy color framebuffer support (default: enabled)]), [CFB=$enableval], [CFB=$XORG])
+AC_ARG_ENABLE(afb, AS_HELP_STRING([--enable-afb], [Build legacy advanced framebuffer support (default: enabled)]), [AFB=$enableval], [AFB=$XORG])
dnl kdrive and its subsystems
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
@@ -842,10 +853,6 @@ AC_DEFINE(DAMAGE,1,[Support Damage extension])
DAMAGE_LIB='$(top_builddir)/damageext/libdamageext.la'
DAMAGE_INC='-I$(top_srcdir)/damageext'
MIEXT_DAMAGE_LIB='$(top_builddir)/miext/damage/libdamage.la'
-dnl damage (may) need the composite wrapper when composite is enabled
-if test "$COMPOSITE" = yes; then
- MIEXT_DAMAGE_LIB="$MIEXT_DAMAGE_LIB "'$(top_builddir)/miext/cw/libcw.la'
-fi
MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'
AC_DEFINE(XINPUT, 1, [Support X Input extension])
@@ -1007,6 +1014,9 @@ if test "x$GCC" = "xyes"; then
LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
fi
case $host_os in
+ darwin*)
+ LD_EXPORT_SYMBOLS_FLAG=""
+ ;;
openbsd*)
LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
;;
@@ -1064,7 +1074,19 @@ AC_DEFINE([SVR4],1,[Define to 1 on systems derived from System V Release 4])
AC_MSG_RESULT([yes])], AC_MSG_RESULT([no]))
XSERVER_CFLAGS="$XSERVER_CFLAGS $CORE_INCS $XEXT_INC $COMPOSITE_INC $DAMAGE_INC $FIXES_INC $XI_INC $MI_INC $MIEXT_SHADOW_INC $MIEXT_LAYER_INC $MIEXT_DAMAGE_INC $RENDER_INC $RANDR_INC $FB_INC"
-AC_DEFINE_UNQUOTED(X_BYTE_ORDER,[$ENDIAN],[Endian order])
+AC_DEFINE_UNQUOTED(_X_BYTE_ORDER,[$ENDIAN],[Endian order])
+AH_VERBATIM([X_BYTE_ORDER],[
+/* Deal with multiple architecture compiles on Mac OS X */
+#ifndef __APPLE_CC__
+#define X_BYTE_ORDER _X_BYTE_ORDER
+#else
+#ifdef __BIG_ENDIAN__
+#define X_BYTE_ORDER X_BIG_ENDIAN
+#else
+#define X_BYTE_ORDER X_LITTLE_ENDIAN
+#endif
+#endif
+])
AC_SUBST([XSERVER_LIBS])
@@ -1155,7 +1177,6 @@ if test "x$XORG" = xauto; then
XORG="yes"
case $host_os in
cygwin*) XORG="no" ;;
- darwin*) XORG="no" ;;
esac
fi
AC_MSG_RESULT([$XORG])
@@ -1232,37 +1253,6 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
XORG_LIBS="$COMPOSITE_LIB $MI_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB $OS_LIB"
- if test "x$DGA" = xauto; then
- PKG_CHECK_MODULES(DGA, xf86dgaproto, [DGA=yes], [DGA=no])
- fi
- if test "x$DGA" = xyes; then
- XORG_MODULES="$XORG_MODULES xf86dgaproto"
- AC_DEFINE(DGA, 1, [Support DGA extension])
- AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
- fi
-
- if test "x$XF86MISC" = xauto; then
- PKG_CHECK_MODULES(XF86MISC, xf86miscproto, [XF86MISC=yes], [XF86MISC=no])
- fi
- if test "x$XF86MISC" = xyes; then
- XORG_MODULES="$XORG_MODULES xf86miscproto"
- AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
- fi
-
- if test "x$XF86VIDMODE" = xauto; then
- PKG_CHECK_MODULES(XF86VIDMODE, xf86vidmodeproto, [XF86VIDMODE=yes], [XF86VIDMODE=no])
- fi
- if test "x$XF86VIDMODE" = xyes; then
- XORG_MODULES="$XORG_MODULES xf86vidmodeproto"
- AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
- fi
-
- if test -n "$XORG_MODULES"; then
- PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
- XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
- XORG_LIBS="$XORG_LIBS $XORG_MODULES_LIBS"
- fi
-
dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [],
@@ -1273,6 +1263,64 @@ dnl has it in libc), or if libdl is needed to get it.
XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
case $host_os in
+ darwin*)
+ XORG_OS="Darwin"
+ build_darwin=yes
+ if test "X$XQUARTZ" = Xauto; then
+ AC_CACHE_CHECK([for Carbon framework],xorg_cv_Carbon_framework,[
+ save_LDFLAGS=$LDFLAGS
+ LDFLAGS="$LDFLAGS -framework Carbon"
+ AC_LINK_IFELSE([char FSFindFolder();
+int main() {
+FSFindFolder();
+return 0;}
+ ],[xorg_cv_Carbon_framework=yes],
+ [xorg_cv_Carbon_framework=no])
+ LDFLAGS=$save_LDFLAGS])
+ if test "X$xorg_cv_Carbon_framework" = Xyes; then
+ AC_DEFINE([DARWIN_WITH_QUARTZ],[1],
+ [Have Quartz])
+ XQUARTZ=yes
+ else
+ XQUARTZ=no
+ fi
+ fi
+# glxAGL / glxCGL don't work yet
+# AC_CACHE_CHECK([for AGL framework],xorg_cv_AGL_framework,[
+# save_LDFLAGS=$LDFLAGS
+# LDFLAGS="$LDFLAGS -framework AGL"
+# AC_LINK_IFELSE([char aglEnable();
+#int main() {
+#aglEnable();
+#return 0;}
+# ],[xorg_cv_AGL_framework=yes],
+# [xorg_cv_AGL_framework=no])
+# LDFLAGS=$save_LDFLAGS
+# ])
+ xorg_cv_AGL_framework=no
+ DARWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
+ AC_SUBST([DARWIN_LIBS])
+ AC_CHECK_LIB([Xplugin],[xp_init],[:])
+ AC_SUBST([APPLE_APPLICATIONS_DIR])
+ CFLAGS="${CFLAGS} -D__DARWIN__"
+ PLIST_VERSION_STRING=$VENDOR_VERSION_STRING
+ AC_SUBST([PLIST_VERSION_STRING])
+ PLIST_VENDOR_WEB=$VENDOR_WEB
+ AC_SUBST([PLIST_VENDOR_WEB])
+ # Not sure that we should be disabling all these...
+ if test "x$XF86MISC" = xyes || test "x$XF86MISC" = xauto; then
+ AC_MSG_NOTICE([Disabling XF86Misc extension])
+ XF86MISC=no
+ fi
+ if test "x$XF86VIDMODE" = xyes || test "x$XF86VIDMODE" = xauto; then
+ AC_MSG_NOTICE([Disabling XF86VidMode extension])
+ XF86VIDMODE=no
+ fi
+ if test "x$DGA" = xyes || test "x$DGA" = xauto; then
+ AC_MSG_NOTICE([Disabling DGA extension])
+ DGA=no
+ fi
+ ;;
linux*)
if test "x$LNXAPM" = xyes; then
XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
@@ -1365,6 +1413,8 @@ dnl has it in libc), or if libdl is needed to get it.
fi
if test "${OS_MINOR}" -lt 8 ; then
solaris_usl_console="yes"
+ else
+ XORG_CFLAGS="$XORG_CFLAGS -DXF86PM"
fi
;;
*)
@@ -1395,11 +1445,14 @@ dnl has it in libc), or if libdl is needed to get it.
case $host_cpu in
i*86)
- xorg_bus_ix86pci=yes
+ case $host_os in
+ darwin*) ;;
+ *) xorg_bus_ix86pci=yes ;;
+ esac
;;
powerpc*)
case $host_os in
- linux*|freebsd*|netbsd*|openbsd*|kfreebsd*-gnu)
+ darwin*|linux*|freebsd*|netbsd*|openbsd*|kfreebsd*-gnu)
;;
*)
xorg_bus_ppcpci="yes"
@@ -1412,7 +1465,7 @@ dnl has it in libc), or if libdl is needed to get it.
;;
x86_64*|amd64*)
case $host_os in
- freebsd*|kfreebsd*-gnu)
+ darwin*|freebsd*|kfreebsd*-gnu)
# FreeBSD uses the system pci interface
;;
*)
@@ -1425,6 +1478,37 @@ dnl has it in libc), or if libdl is needed to get it.
if test "x$XORG_OS_PCI" = x ; then
XORG_OS_PCI=$XORG_OS
fi
+ if test "x$DGA" = xauto; then
+ PKG_CHECK_MODULES(DGA, xf86dgaproto, [DGA=yes], [DGA=no])
+ fi
+ if test "x$DGA" = xyes; then
+ XORG_MODULES="$XORG_MODULES xf86dgaproto"
+ AC_DEFINE(DGA, 1, [Support DGA extension])
+ AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
+ fi
+
+ if test "x$XF86MISC" = xauto; then
+ PKG_CHECK_MODULES(XF86MISC, xf86miscproto, [XF86MISC=yes], [XF86MISC=no])
+ fi
+ if test "x$XF86MISC" = xyes; then
+ XORG_MODULES="$XORG_MODULES xf86miscproto"
+ AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
+ fi
+
+ if test "x$XF86VIDMODE" = xauto; then
+ PKG_CHECK_MODULES(XF86VIDMODE, xf86vidmodeproto, [XF86VIDMODE=yes], [XF86VIDMODE=no])
+ fi
+ if test "x$XF86VIDMODE" = xyes; then
+ XORG_MODULES="$XORG_MODULES xf86vidmodeproto"
+ AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
+ fi
+
+ if test -n "$XORG_MODULES"; then
+ PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
+ XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
+ XORG_LIBS="$XORG_LIBS $XORG_MODULES_LIBS"
+ fi
+
AC_SUBST([XORG_LIBS])
AC_SUBST([XORG_INCS])
AC_SUBST([XORG_OS])
@@ -1484,11 +1568,23 @@ AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])
AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
AM_CONDITIONAL([SOLARIS_USL_CONSOLE], [test "x$solaris_usl_console" = xyes])
AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
-AM_CONDITIONAL(MFB, [test "x$XORG" = xyes])
-AM_CONDITIONAL(CFB, [test "x$XORG" = xyes])
-AM_CONDITIONAL(AFB, [test "x$XORG" = xyes])
+AM_CONDITIONAL([BUILD_DARWIN],[test "X$build_darwin" = Xyes])
+AM_CONDITIONAL([XQUARTZ],[test "X$XQUARTZ" = Xyes])
AM_CONDITIONAL(DGA, [test "x$DGA" = xyes])
+dnl legacy fb support
+test "x$MFB" = xauto && MFB="$XORG"
+test "x$CFB" = xauto && CFB="$XORG"
+test "x$AFB" = xauto && AFB="$XORG"
+AM_CONDITIONAL(MFB, [test "x$MFB" = xyes])
+AM_CONDITIONAL(CFB, [test "x$CFB" = xyes])
+AM_CONDITIONAL(AFB, [test "x$AFB" = xyes])
+if test "x$MFB" = xyes -o "x$CFB" = xyes -o "x$AFB" = xyes; then
+ if test "x$XORG" != xyes; then
+ AC_MSG_ERROR([legacy fb support requires the Xorg server])
+ fi
+fi
+
dnl Xprint DDX
AC_MSG_CHECKING([whether to build Xprint DDX])
@@ -1497,7 +1593,7 @@ AC_MSG_RESULT([$XPRINT])
if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau])
XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
- XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS"
+ XPRINT_LIBS="$DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS $XPRINT_LIBS"
AC_SUBST([XPRINT_CFLAGS])
AC_SUBST([XPRINT_LIBS])
@@ -1611,6 +1707,21 @@ AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes && false])
AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes])
AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes])
+dnl Darwin / OS X DDX
+AM_CONDITIONAL(HAVE_X_PLUGIN, [test "x$ac_cv_lib_Xplugin_xp_init" = xyes])
+AM_CONDITIONAL(HAVE_AGL_FRAMEWORK, [test "x$xorg_cv_AGL_framework" = xyes])
+# Support for objc in autotools is minimal and not
+# documented.
+OBJC='$(CC)'
+OBJCLD='$(CCLD)'
+OBJCLINK='$(LINK)'
+OBJCFLAGS='$(CFLAGS)'
+AC_SUBST([OBJC])
+AC_SUBST([OBJCCLD])
+AC_SUBST([OBJCLINK])
+AC_SUBST([OBJCFLAGS])
+# internal, undocumented automake func follows :(
+_AM_DEPENDENCIES([OBJC])
dnl kdrive DDX
@@ -1844,6 +1955,7 @@ XORG_RELEASE_VERSION
AC_OUTPUT([
Makefile
GL/Makefile
+GL/apple/Makefile
GL/glx/Makefile
GL/mesa/Makefile
GL/mesa/glapi/Makefile
@@ -1877,6 +1989,8 @@ miext/damage/Makefile
miext/shadow/Makefile
miext/cw/Makefile
miext/rootless/Makefile
+miext/rootless/safeAlpha/Makefile
+miext/rootless/accel/Makefile
os/Makefile
randr/Makefile
render/Makefile
@@ -1903,6 +2017,7 @@ hw/xfree86/fbdevhw/Makefile
hw/xfree86/i2c/Makefile
hw/xfree86/int10/Makefile
hw/xfree86/loader/Makefile
+hw/xfree86/modes/Makefile
hw/xfree86/os-support/Makefile
hw/xfree86/os-support/bsd/Makefile
hw/xfree86/os-support/bus/Makefile
@@ -1950,6 +2065,19 @@ hw/xgl/glxext/module/Makefile
hw/xnest/Makefile
hw/xwin/Makefile
hw/darwin/Makefile
+hw/darwin/bundle/Makefile
+hw/darwin/bundle/Dutch.lproj/Makefile
+hw/darwin/bundle/English.lproj/Makefile
+hw/darwin/bundle/French.lproj/Makefile
+hw/darwin/bundle/German.lproj/Makefile
+hw/darwin/bundle/Japanese.lproj/Makefile
+hw/darwin/bundle/Portuguese.lproj/Makefile
+hw/darwin/bundle/Spanish.lproj/Makefile
+hw/darwin/bundle/Swedish.lproj/Makefile
+hw/darwin/bundle/ko.lproj/Makefile
+hw/darwin/iokit/Makefile
+hw/darwin/quartz/Makefile
+hw/darwin/utils/Makefile
hw/kdrive/Makefile
hw/kdrive/ati/Makefile
hw/kdrive/chips/Makefile
diff --git a/damageext/damageext.c b/damageext/damageext.c
index 739d20f09..57a7bce09 100755
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -28,12 +28,12 @@
#include "damageextint.h"
-unsigned char DamageReqCode;
-int DamageEventBase;
-int DamageErrorBase;
-int DamageClientPrivateIndex;
-RESTYPE DamageExtType;
-RESTYPE DamageExtWinType;
+static unsigned char DamageReqCode;
+static int DamageEventBase;
+static int DamageErrorBase;
+static int DamageClientPrivateIndex;
+static RESTYPE DamageExtType;
+static RESTYPE DamageExtWinType;
/* Version of the damage extension supported by the server, as opposed to the
* DAMAGE_* defines from damageproto for what version the proto header
@@ -319,7 +319,7 @@ static const int version_requests[] = {
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
-int (*ProcDamageVector[XDamageNumberRequests])(ClientPtr) = {
+static int (*ProcDamageVector[XDamageNumberRequests])(ClientPtr) = {
/*************** Version 1 ******************/
ProcDamageQueryVersion,
ProcDamageCreate,
@@ -408,7 +408,7 @@ SProcDamageAdd (ClientPtr client)
return (*ProcDamageVector[stuff->damageReqType]) (client);
}
-int (*SProcDamageVector[XDamageNumberRequests])(ClientPtr) = {
+static int (*SProcDamageVector[XDamageNumberRequests])(ClientPtr) = {
/*************** Version 1 ******************/
SProcDamageQueryVersion,
SProcDamageCreate,
@@ -478,7 +478,7 @@ FreeDamageExtWin (pointer value, XID wid)
return Success;
}
-void
+static void
SDamageNotifyEvent (xDamageNotifyEvent *from,
xDamageNotifyEvent *to)
{
diff --git a/damageext/damageextint.h b/damageext/damageextint.h
index 6f14e4e97..1ed07de83 100644
--- a/damageext/damageextint.h
+++ b/damageext/damageextint.h
@@ -44,13 +44,6 @@
#include "damage.h"
#include "xfixes.h"
-extern unsigned char DamageReqCode;
-extern int DamageEventBase;
-extern int DamageErrorBase;
-extern int DamageClientPrivateIndex;
-extern RESTYPE DamageExtType;
-extern RESTYPE DamageExtWinType;
-
typedef struct _DamageClient {
CARD32 major_version;
CARD32 minor_version;
@@ -67,9 +60,6 @@ typedef struct _DamageExt {
XID id;
} DamageExtRec, *DamageExtPtr;
-extern int (*ProcDamageVector[/*XDamageNumberRequests*/])(ClientPtr);
-extern int (*SProcDamageVector[/*XDamageNumberRequests*/])(ClientPtr);
-
#define VERIFY_DAMAGEEXT(pDamageExt, rid, client, mode) { \
pDamageExt = SecurityLookupIDByType (client, rid, DamageExtType, mode); \
if (!pDamageExt) { \
@@ -79,10 +69,6 @@ extern int (*SProcDamageVector[/*XDamageNumberRequests*/])(ClientPtr);
}
void
-SDamageNotifyEvent (xDamageNotifyEvent *from,
- xDamageNotifyEvent *to);
-
-void
DamageExtSetCritical (ClientPtr pClient, Bool critical);
#endif /* _DAMAGEEXTINT_H_ */
diff --git a/dbe/dbe.c b/dbe/dbe.c
index 862393b53..d63620d4f 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -82,36 +82,6 @@ static Bool firstRegistrationPass = TRUE;
/******************************************************************************
*
- * DBE DIX Procedure: DbeValidateBuffer
- *
- * Description:
- *
- * This function is called from VALIDATE_DRAWABLE_AND_GC and from
- * various places in dispatch.c if the server has been compiled with
- * the flags -DNEED_DBE_BUF_BITS and -DNEED_DBE_BUF_VALIDATE.
- * When pWin->dstBuffer changes, this function will be called with pWin
- * as the first argument, the drawable ID that was specified as the
- * second argument (could be a back buffer id), and True for the third
- * argument.
- * When pWin->srcBuffer changes, the third argument will be False, and
- * the first two arguments are as described for dstBuffer.
- *
- * This function should prepare the hardware to access the specified
- * buffer for reads (if dstbuf is False) or writes (if dstbuf is True).
- *
- *****************************************************************************/
-
-void
-DbeValidateBuffer(WindowPtr pWin, XID drawID, Bool dstbuf)
-{
- DbeScreenPrivPtr pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin);
- if (pDbeScreenPriv->ValidateBuffer)
- (*pDbeScreenPriv->ValidateBuffer)(pWin, drawID, dstbuf);
-}
-
-
-/******************************************************************************
- *
* DBE DIX Procedure: DbeRegisterFunction
*
* Description:
@@ -317,7 +287,6 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens)
pDbeScreenPriv->EndIdiom = NULL;
pDbeScreenPriv->WinPrivDelete = NULL;
pDbeScreenPriv->ResetProc = NULL;
- pDbeScreenPriv->ValidateBuffer = NULL;
(*nStubbedScreens)++;
diff --git a/dbe/dbestruct.h b/dbe/dbestruct.h
index 460cc7564..835074c75 100644
--- a/dbe/dbestruct.h
+++ b/dbe/dbestruct.h
@@ -221,11 +221,6 @@ typedef struct _DbeScreenPrivRec
void (*ResetProc)(
ScreenPtr /*pScreen*/
);
- void (*ValidateBuffer)(
- WindowPtr /*pWin*/,
- XID /*bufId*/,
- Bool /*dstbuffer*/
-);
/* Device-specific private information.
*/
diff --git a/dbe/midbe.c b/dbe/midbe.c
index e687b98b7..014e365ce 100644
--- a/dbe/midbe.c
+++ b/dbe/midbe.c
@@ -59,21 +59,12 @@
#include <stdio.h>
-/* DEFINES */
-
-
-/* TYPEDEFS */
-
-
-/* GLOBALS */
-
static int miDbePrivPrivGeneration = 0;
static int miDbeWindowPrivPrivIndex = -1;
-RESTYPE dbeDrawableResType;
-RESTYPE dbeWindowPrivResType;
-int dbeScreenPrivIndex = -1;
-int dbeWindowPrivIndex = -1;
-
+static RESTYPE dbeDrawableResType;
+static RESTYPE dbeWindowPrivResType;
+static int dbeScreenPrivIndex = -1;
+static int dbeWindowPrivIndex = -1;
/******************************************************************************
@@ -768,11 +759,6 @@ miDbeResetProc(ScreenPtr pScreen)
} /* miDbeResetProc() */
-static void
-miDbeNopValidateBuffer(WindowPtr pWin, XID bufId, Bool dstbuffer)
-{
-}
-
/******************************************************************************
*
@@ -830,9 +816,6 @@ miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv)
pDbeScreenPriv->ResetProc = miDbeResetProc;
pDbeScreenPriv->WinPrivDelete = miDbeWinPrivDelete;
- /* The mi implementation doesn't need buffer validation. */
- pDbeScreenPriv->ValidateBuffer = miDbeNopValidateBuffer;
-
return(TRUE);
} /* miDbeInit() */
diff --git a/dix/atom.c b/dix/atom.c
index d9d74f1da..bd3223caa 100644
--- a/dix/atom.c
+++ b/dix/atom.c
@@ -77,10 +77,10 @@ void FreeAtom(NodePtr patom);
_X_EXPORT Atom
MakeAtom(char *string, unsigned len, Bool makeit)
{
- register NodePtr * np;
+ NodePtr * np;
unsigned i;
- int comp;
- register unsigned int fp = 0;
+ int comp;
+ unsigned int fp = 0;
np = &atomRoot;
for (i = 0; i < (len+1)/2; i++)
@@ -107,7 +107,7 @@ MakeAtom(char *string, unsigned len, Bool makeit)
}
if (makeit)
{
- register NodePtr nd;
+ NodePtr nd;
nd = (NodePtr) xalloc(sizeof(NodeRec));
if (!nd)
diff --git a/dix/colormap.c b/dix/colormap.c
index a74cb390c..73b666971 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -95,8 +95,8 @@ static int BlueComp(
);
static void FreePixels(
- register ColormapPtr /*pmap*/,
- register int /*client*/
+ ColormapPtr /*pmap*/,
+ int /*client*/
);
static void CopyFree(
@@ -259,9 +259,9 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
int class, size;
unsigned long sizebytes;
ColormapPtr pmap;
- register EntryPtr pent;
+ EntryPtr pent;
int i;
- register Pixel *ppix, **pptr;
+ Pixel *ppix, **pptr;
class = pVisual->class;
if(!(class & DynamicClass) && (alloc != AllocNone) && (client != SERVER_ID))
@@ -428,8 +428,8 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
int
FreeColormap (pointer value, XID mid)
{
- int i;
- register EntryPtr pent;
+ int i;
+ EntryPtr pent;
ColormapPtr pmap = (ColormapPtr)value;
if(CLIENT_ID(mid) != SERVER_ID)
@@ -744,9 +744,9 @@ static void
UpdateColors (ColormapPtr pmap)
{
xColorItem *defs;
- register xColorItem *pdef;
- register EntryPtr pent;
- register VisualPtr pVisual;
+ xColorItem *pdef;
+ EntryPtr pent;
+ VisualPtr pVisual;
int i, n, size;
pVisual = pmap->pVisual;
@@ -993,14 +993,14 @@ AllocColor (ColormapPtr pmap,
*/
_X_EXPORT void
-FakeAllocColor (register ColormapPtr pmap, register xColorItem *item)
+FakeAllocColor (ColormapPtr pmap, xColorItem *item)
{
- Pixel pixR, pixG, pixB;
- Pixel temp;
- int entries;
- xrgb rgb;
- int class;
- register VisualPtr pVisual;
+ Pixel pixR, pixG, pixB;
+ Pixel temp;
+ int entries;
+ xrgb rgb;
+ int class;
+ VisualPtr pVisual;
pVisual = pmap->pVisual;
rgb.red = item->red;
@@ -1059,9 +1059,9 @@ FakeAllocColor (register ColormapPtr pmap, register xColorItem *item)
/* free a pixel value obtained from FakeAllocColor */
_X_EXPORT void
-FakeFreeColor(register ColormapPtr pmap, Pixel pixel)
+FakeFreeColor(ColormapPtr pmap, Pixel pixel)
{
- register VisualPtr pVisual;
+ VisualPtr pVisual;
Pixel pixR, pixG, pixB;
switch (pmap->class) {
@@ -1507,11 +1507,11 @@ QueryColors (ColormapPtr pmap, int count, Pixel *ppixIn, xrgb *prgbList)
}
static void
-FreePixels(register ColormapPtr pmap, register int client)
+FreePixels(ColormapPtr pmap, int client)
{
- register Pixel *ppix, *ppixStart;
- register int n;
- int class;
+ Pixel *ppix, *ppixStart;
+ int n;
+ int class;
class = pmap->class;
ppixStart = pmap->clientPixelsRed[client];
@@ -1646,8 +1646,8 @@ AllocColorPlanes (int client, ColormapPtr pmap, int colors,
{
int ok;
Pixel mask, *ppixFirst;
- register Pixel shift;
- register int i;
+ Pixel shift;
+ int i;
int class;
int oldcount;
colorResource *pcr = (colorResource *)NULL;
@@ -2409,10 +2409,10 @@ FreeCo (ColormapPtr pmap, int client, int color, int npixIn, Pixel *ppixIn, Pixe
_X_EXPORT int
StoreColors (ColormapPtr pmap, int count, xColorItem *defs)
{
- register Pixel pix;
- register xColorItem *pdef;
- register EntryPtr pent, pentT, pentLast;
- register VisualPtr pVisual;
+ Pixel pix;
+ xColorItem *pdef;
+ EntryPtr pent, pentT, pentLast;
+ VisualPtr pVisual;
SHAREDCOLOR *pred, *pgreen, *pblue;
int n, ChgRed, ChgGreen, ChgBlue, idef;
int class, errVal = Success;
diff --git a/dix/cursor.c b/dix/cursor.c
index 7071d8345..5ab562ead 100644
--- a/dix/cursor.c
+++ b/dix/cursor.c
@@ -86,7 +86,7 @@ FreeCursorBits(CursorBitsPtr bits)
#endif
if (bits->refcnt == 0)
{
- register GlyphSharePtr *prev, this;
+ GlyphSharePtr *prev, this;
for (prev = &sharedGlyphs;
(this = *prev) && (this->bits != bits);
@@ -135,7 +135,7 @@ FreeCursor(pointer value, XID cid)
static void
CheckForEmptyMask(CursorBitsPtr bits)
{
- register unsigned char *msk = bits->mask;
+ unsigned char *msk = bits->mask;
int n = BitmapBytePad(bits->width) * bits->height;
bits->emptyMask = FALSE;
@@ -305,8 +305,8 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
}
if (!maskfont)
{
- register long n;
- register unsigned char *mskptr;
+ long n;
+ unsigned char *mskptr;
n = BitmapBytePad(cm.width)*(long)cm.height;
mskptr = mskbits = (unsigned char *)xalloc(n);
diff --git a/dix/devices.c b/dix/devices.c
index 9f4218414..f622be756 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -67,7 +67,7 @@ SOFTWARE.
#define XKB_IN_SERVER
#endif
#ifdef XKB
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#endif
#include "xace.h"
@@ -79,12 +79,13 @@ SOFTWARE.
#include "exglobals.h"
#include "exevents.h"
-int CoreDevicePrivatesIndex = 0, CoreDevicePrivatesGeneration = -1;
+int CoreDevicePrivatesIndex = 0;
+static int CoreDevicePrivatesGeneration = -1;
DeviceIntPtr
AddInputDevice(DeviceProc deviceProc, Bool autoStart)
{
- register DeviceIntPtr dev, *prev; /* not a typo */
+ DeviceIntPtr dev, *prev; /* not a typo */
if (inputInfo.numDevices >= MAX_DEVICES)
return (DeviceIntPtr)NULL;
@@ -140,9 +141,9 @@ AddInputDevice(DeviceProc deviceProc, Bool autoStart)
}
Bool
-EnableDevice(register DeviceIntPtr dev)
+EnableDevice(DeviceIntPtr dev)
{
- register DeviceIntPtr *prev;
+ DeviceIntPtr *prev;
int ret;
for (prev = &inputInfo.off_devices;
@@ -166,9 +167,9 @@ EnableDevice(register DeviceIntPtr dev)
}
Bool
-DisableDevice(register DeviceIntPtr dev)
+DisableDevice(DeviceIntPtr dev)
{
- register DeviceIntPtr *prev;
+ DeviceIntPtr *prev;
for (prev = &inputInfo.devices;
*prev && (*prev != dev);
@@ -238,7 +239,7 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what)
keySyms.mapWidth = 4;
keySyms.map = (KeySym *)xcalloc(sizeof(KeySym),
(keySyms.maxKeyCode -
- keySyms.minKeyCode) *
+ keySyms.minKeyCode + 1) *
keySyms.mapWidth);
if (!keySyms.map) {
ErrorF("Couldn't allocate core keymap\n");
@@ -315,7 +316,7 @@ CorePointerProc(DeviceIntPtr pDev, int what)
void
InitCoreDevices()
{
- register DeviceIntPtr dev;
+ DeviceIntPtr dev;
if (CoreDevicePrivatesGeneration != serverGeneration) {
CoreDevicePrivatesIndex = AllocateDevicePrivateIndex();
@@ -374,7 +375,7 @@ InitCoreDevices()
int
InitAndStartDevices()
{
- register DeviceIntPtr dev, next;
+ DeviceIntPtr dev, next;
for (dev = inputInfo.off_devices; dev; dev = dev->next) {
DebugF("(dix) initialising device %d\n", dev->id);
@@ -406,7 +407,7 @@ InitAndStartDevices()
}
static void
-CloseDevice(register DeviceIntPtr dev)
+CloseDevice(DeviceIntPtr dev)
{
KbdFeedbackPtr k, knext;
PtrFeedbackPtr p, pnext;
@@ -494,6 +495,9 @@ CloseDevice(register DeviceIntPtr dev)
XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource);
#endif
+ if (dev->devPrivates)
+ xfree(dev->devPrivates);
+
xfree(dev->sync.event);
xfree(dev);
}
@@ -501,7 +505,7 @@ CloseDevice(register DeviceIntPtr dev)
void
CloseDownDevices()
{
- register DeviceIntPtr dev, next;
+ DeviceIntPtr dev, next;
for (dev = inputInfo.devices; dev; dev = next)
{
@@ -631,7 +635,7 @@ QueryMinMaxKeyCodes(KeyCode *minCode, KeyCode *maxCode)
}
Bool
-SetKeySymsMap(register KeySymsPtr dst, register KeySymsPtr src)
+SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src)
{
int i, j;
int rowDif = src->minKeyCode - dst->minKeyCode;
@@ -680,7 +684,7 @@ SetKeySymsMap(register KeySymsPtr dst, register KeySymsPtr src)
}
static Bool
-InitModMap(register KeyClassPtr keyc)
+InitModMap(KeyClassPtr keyc)
{
int i, j;
CARD8 keysPerModifier[8];
@@ -725,7 +729,7 @@ _X_EXPORT Bool
InitKeyClassDeviceStruct(DeviceIntPtr dev, KeySymsPtr pKeySyms, CARD8 pModifiers[])
{
int i;
- register KeyClassPtr keyc;
+ KeyClassPtr keyc;
keyc = (KeyClassPtr)xalloc(sizeof(KeyClassRec));
if (!keyc)
@@ -760,10 +764,10 @@ InitKeyClassDeviceStruct(DeviceIntPtr dev, KeySymsPtr pKeySyms, CARD8 pModifiers
}
_X_EXPORT Bool
-InitButtonClassDeviceStruct(register DeviceIntPtr dev, int numButtons,
+InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons,
CARD8 *map)
{
- register ButtonClassPtr butc;
+ ButtonClassPtr butc;
int i;
butc = (ButtonClassPtr)xalloc(sizeof(ButtonClassRec));
@@ -789,7 +793,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
int numMotionEvents, int mode)
{
int i;
- register ValuatorClassPtr valc;
+ ValuatorClassPtr valc;
if (!dev)
return FALSE;
@@ -831,7 +835,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
_X_EXPORT Bool
InitAbsoluteClassDeviceStruct(DeviceIntPtr dev)
{
- register AbsoluteClassPtr abs;
+ AbsoluteClassPtr abs;
abs = (AbsoluteClassPtr)xalloc(sizeof(AbsoluteClassRec));
if (!abs)
@@ -861,7 +865,7 @@ InitAbsoluteClassDeviceStruct(DeviceIntPtr dev)
_X_EXPORT Bool
InitFocusClassDeviceStruct(DeviceIntPtr dev)
{
- register FocusClassPtr focc;
+ FocusClassPtr focc;
focc = (FocusClassPtr)xalloc(sizeof(FocusClassRec));
if (!focc)
@@ -880,7 +884,7 @@ _X_EXPORT Bool
InitKbdFeedbackClassDeviceStruct(DeviceIntPtr dev, BellProcPtr bellProc,
KbdCtrlProcPtr controlProc)
{
- register KbdFeedbackPtr feedc;
+ KbdFeedbackPtr feedc;
feedc = (KbdFeedbackPtr)xalloc(sizeof(KbdFeedbackClassRec));
if (!feedc)
@@ -907,7 +911,7 @@ InitKbdFeedbackClassDeviceStruct(DeviceIntPtr dev, BellProcPtr bellProc,
_X_EXPORT Bool
InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc)
{
- register PtrFeedbackPtr feedc;
+ PtrFeedbackPtr feedc;
feedc = (PtrFeedbackPtr)xalloc(sizeof(PtrFeedbackClassRec));
if (!feedc)
@@ -923,16 +927,16 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc)
}
-LedCtrl defaultLedControl = {
+static LedCtrl defaultLedControl = {
DEFAULT_LEDS, DEFAULT_LEDS_MASK, 0};
-BellCtrl defaultBellControl = {
+static BellCtrl defaultBellControl = {
DEFAULT_BELL,
DEFAULT_BELL_PITCH,
DEFAULT_BELL_DURATION,
0};
-IntegerCtrl defaultIntegerControl = {
+static IntegerCtrl defaultIntegerControl = {
DEFAULT_INT_RESOLUTION,
DEFAULT_INT_MIN_VALUE,
DEFAULT_INT_MAX_VALUE,
@@ -945,7 +949,7 @@ InitStringFeedbackClassDeviceStruct (
int max_symbols, int num_symbols_supported, KeySym *symbols)
{
int i;
- register StringFeedbackPtr feedc;
+ StringFeedbackPtr feedc;
feedc = (StringFeedbackPtr)xalloc(sizeof(StringFeedbackClassRec));
if (!feedc)
@@ -983,7 +987,7 @@ _X_EXPORT Bool
InitBellFeedbackClassDeviceStruct (DeviceIntPtr dev, BellProcPtr bellProc,
BellCtrlProcPtr controlProc)
{
- register BellFeedbackPtr feedc;
+ BellFeedbackPtr feedc;
feedc = (BellFeedbackPtr)xalloc(sizeof(BellFeedbackClassRec));
if (!feedc)
@@ -1002,7 +1006,7 @@ InitBellFeedbackClassDeviceStruct (DeviceIntPtr dev, BellProcPtr bellProc,
_X_EXPORT Bool
InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc)
{
- register LedFeedbackPtr feedc;
+ LedFeedbackPtr feedc;
feedc = (LedFeedbackPtr)xalloc(sizeof(LedFeedbackClassRec));
if (!feedc)
@@ -1023,7 +1027,7 @@ InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc)
_X_EXPORT Bool
InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr controlProc)
{
- register IntegerFeedbackPtr feedc;
+ IntegerFeedbackPtr feedc;
feedc = (IntegerFeedbackPtr)xalloc(sizeof(IntegerFeedbackClassRec));
if (!feedc)
@@ -1109,9 +1113,9 @@ SendMappingNotify(unsigned request, unsigned firstKeyCode, unsigned count,
* sort it to do the checking. How often is it called? Just being lazy?
*/
Bool
-BadDeviceMap(register BYTE *buff, int length, unsigned low, unsigned high, XID *errval)
+BadDeviceMap(BYTE *buff, int length, unsigned low, unsigned high, XID *errval)
{
- register int i, j;
+ int i, j;
for (i = 0; i < length; i++)
if (buff[i]) /* only check non-zero elements */
@@ -1133,12 +1137,12 @@ BadDeviceMap(register BYTE *buff, int length, unsigned low, unsigned high, XID *
Bool
AllModifierKeysAreUp(dev, map1, per1, map2, per2)
- register DeviceIntPtr dev;
- register CARD8 *map1, *map2;
+ DeviceIntPtr dev;
+ CARD8 *map1, *map2;
int per1, per2;
{
- register int i, j, k;
- register CARD8 *down = dev->key->down;
+ int i, j, k;
+ CARD8 *down = dev->key->down;
for (i = 8; --i >= 0; map2 += per2)
{
@@ -1255,7 +1259,7 @@ int
ProcGetModifierMapping(ClientPtr client)
{
xGetModifierMappingReply rep;
- register KeyClassPtr keyc = inputInfo.keyboard->key;
+ KeyClassPtr keyc = inputInfo.keyboard->key;
REQUEST_SIZE_MATCH(xReq);
rep.type = X_Reply;
@@ -1456,7 +1460,7 @@ NoteLedState(DeviceIntPtr keybd, int led, Bool on)
_X_EXPORT int
Ones(unsigned long mask) /* HACKMEM 169 */
{
- register unsigned long y;
+ unsigned long y;
y = (mask >> 1) &033333333333;
y = mask - y - ((y >>1) & 033333333333);
@@ -1673,7 +1677,7 @@ int
ProcGetKeyboardControl (ClientPtr client)
{
int i;
- register KeybdCtrl *ctrl = &inputInfo.keyboard->kbdfeed->ctrl;
+ KeybdCtrl *ctrl = &inputInfo.keyboard->kbdfeed->ctrl;
xGetKeyboardControlReply rep;
REQUEST_SIZE_MATCH(xReq);
@@ -1695,7 +1699,7 @@ ProcGetKeyboardControl (ClientPtr client)
int
ProcBell(ClientPtr client)
{
- register DeviceIntPtr keybd = inputInfo.keyboard;
+ DeviceIntPtr keybd = inputInfo.keyboard;
int base = keybd->kbdfeed->ctrl.bell;
int newpercent;
REQUEST(xBellReq);
@@ -1804,7 +1808,7 @@ ProcChangePointerControl(ClientPtr client)
int
ProcGetPointerControl(ClientPtr client)
{
- register PtrCtrl *ctrl = &inputInfo.pointer->ptrfeed->ctrl;
+ PtrCtrl *ctrl = &inputInfo.pointer->ptrfeed->ctrl;
xGetPointerControlReply rep;
REQUEST_SIZE_MATCH(xReq);
@@ -1819,7 +1823,7 @@ ProcGetPointerControl(ClientPtr client)
}
void
-MaybeStopHint(register DeviceIntPtr dev, ClientPtr client)
+MaybeStopHint(DeviceIntPtr dev, ClientPtr client)
{
GrabPtr grab = dev->grab;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index d44687ec3..490b29c34 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -143,7 +143,7 @@ int ProcInitialConnection();
#define XKB_IN_SERVER
#endif
#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#endif
#ifdef XSERVER_DTRACE
@@ -262,7 +262,7 @@ void
FlushClientCaches(XID id)
{
int i;
- register ClientPtr client;
+ ClientPtr client;
client = clients[CLIENT_ID(id)];
if (client == NullClient)
@@ -297,9 +297,8 @@ long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;
long SmartScheduleTime;
-ClientPtr SmartLastClient;
-int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1];
-int SmartScheduleClient(int *clientReady, int nready);
+static ClientPtr SmartLastClient;
+static int SmartLastIndex[SMART_MAX_PRIORITY-SMART_MIN_PRIORITY+1];
#ifdef SMART_DEBUG
long SmartLastPrint;
@@ -308,7 +307,7 @@ long SmartLastPrint;
void Dispatch(void);
void InitProcVectors(void);
-int
+static int
SmartScheduleClient (int *clientReady, int nready)
{
ClientPtr pClient;
@@ -394,11 +393,11 @@ SmartScheduleClient (int *clientReady, int nready)
void
Dispatch(void)
{
- register int *clientReady; /* array of request ready clients */
- register int result;
- register ClientPtr client;
- register int nready;
- register HWEventQueuePtr* icheck = checkForInput;
+ int *clientReady; /* array of request ready clients */
+ int result;
+ ClientPtr client;
+ int nready;
+ HWEventQueuePtr* icheck = checkForInput;
#ifdef SMART_SCHEDULE
long start_tick;
#endif
@@ -594,11 +593,11 @@ ProcCreateWindow(ClientPtr client)
}
int
-ProcChangeWindowAttributes(register ClientPtr client)
+ProcChangeWindowAttributes(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xChangeWindowAttributesReq);
- register int result;
+ int result;
int len, rc;
REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
@@ -619,7 +618,7 @@ ProcChangeWindowAttributes(register ClientPtr client)
}
int
-ProcGetWindowAttributes(register ClientPtr client)
+ProcGetWindowAttributes(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xResourceReq);
@@ -636,7 +635,7 @@ ProcGetWindowAttributes(register ClientPtr client)
}
int
-ProcDestroyWindow(register ClientPtr client)
+ProcDestroyWindow(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xResourceReq);
@@ -652,7 +651,7 @@ ProcDestroyWindow(register ClientPtr client)
}
int
-ProcDestroySubwindows(register ClientPtr client)
+ProcDestroySubwindows(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xResourceReq);
@@ -667,11 +666,11 @@ ProcDestroySubwindows(register ClientPtr client)
}
int
-ProcChangeSaveSet(register ClientPtr client)
+ProcChangeSaveSet(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xChangeSaveSetReq);
- register int result, rc;
+ int result, rc;
REQUEST_SIZE_MATCH(xChangeSaveSetReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
@@ -695,11 +694,11 @@ ProcChangeSaveSet(register ClientPtr client)
}
int
-ProcReparentWindow(register ClientPtr client)
+ProcReparentWindow(ClientPtr client)
{
WindowPtr pWin, pParent;
REQUEST(xReparentWindowReq);
- register int result, rc;
+ int result, rc;
REQUEST_SIZE_MATCH(xReparentWindowReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
@@ -728,7 +727,7 @@ ProcReparentWindow(register ClientPtr client)
}
int
-ProcMapWindow(register ClientPtr client)
+ProcMapWindow(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xResourceReq);
@@ -744,7 +743,7 @@ ProcMapWindow(register ClientPtr client)
}
int
-ProcMapSubwindows(register ClientPtr client)
+ProcMapSubwindows(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xResourceReq);
@@ -760,7 +759,7 @@ ProcMapSubwindows(register ClientPtr client)
}
int
-ProcUnmapWindow(register ClientPtr client)
+ProcUnmapWindow(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xResourceReq);
@@ -776,7 +775,7 @@ ProcUnmapWindow(register ClientPtr client)
}
int
-ProcUnmapSubwindows(register ClientPtr client)
+ProcUnmapSubwindows(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xResourceReq);
@@ -791,11 +790,11 @@ ProcUnmapSubwindows(register ClientPtr client)
}
int
-ProcConfigureWindow(register ClientPtr client)
+ProcConfigureWindow(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xConfigureWindowReq);
- register int result;
+ int result;
int len, rc;
REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
@@ -814,7 +813,7 @@ ProcConfigureWindow(register ClientPtr client)
}
int
-ProcCirculateWindow(register ClientPtr client)
+ProcCirculateWindow(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xCirculateWindowReq);
@@ -834,8 +833,8 @@ ProcCirculateWindow(register ClientPtr client)
return(client->noClientException);
}
-int
-GetGeometry(register ClientPtr client, xGetGeometryReply *rep)
+static int
+GetGeometry(ClientPtr client, xGetGeometryReply *rep)
{
DrawablePtr pDraw;
int rc;
@@ -865,7 +864,7 @@ GetGeometry(register ClientPtr client, xGetGeometryReply *rep)
if ((pDraw->type == UNDRAWABLE_WINDOW) ||
((pDraw->type == DRAWABLE_WINDOW) && (stuff->id == pDraw->id)))
{
- register WindowPtr pWin = (WindowPtr)pDraw;
+ WindowPtr pWin = (WindowPtr)pDraw;
rep->x = pWin->origin.x - wBorderWidth (pWin);
rep->y = pWin->origin.y - wBorderWidth (pWin);
rep->borderWidth = pWin->borderWidth;
@@ -880,7 +879,7 @@ GetGeometry(register ClientPtr client, xGetGeometryReply *rep)
int
-ProcGetGeometry(register ClientPtr client)
+ProcGetGeometry(ClientPtr client)
{
xGetGeometryReply rep;
int status;
@@ -894,7 +893,7 @@ ProcGetGeometry(register ClientPtr client)
int
-ProcQueryTree(register ClientPtr client)
+ProcQueryTree(ClientPtr client)
{
xQueryTreeReply reply;
int rc, numChildren = 0;
@@ -942,7 +941,7 @@ ProcQueryTree(register ClientPtr client)
}
int
-ProcInternAtom(register ClientPtr client)
+ProcInternAtom(ClientPtr client)
{
Atom atom;
char *tchar;
@@ -971,7 +970,7 @@ ProcInternAtom(register ClientPtr client)
}
int
-ProcGetAtomName(register ClientPtr client)
+ProcGetAtomName(ClientPtr client)
{
char *str;
xGetAtomNameReply reply;
@@ -1002,7 +1001,7 @@ extern int k5_bad();
#endif
int
-ProcSetSelectionOwner(register ClientPtr client)
+ProcSetSelectionOwner(ClientPtr client)
{
WindowPtr pWin;
TimeStamp time;
@@ -1097,7 +1096,7 @@ ProcSetSelectionOwner(register ClientPtr client)
}
int
-ProcGetSelectionOwner(register ClientPtr client)
+ProcGetSelectionOwner(ClientPtr client)
{
REQUEST(xResourceReq);
@@ -1128,7 +1127,7 @@ ProcGetSelectionOwner(register ClientPtr client)
}
int
-ProcConvertSelection(register ClientPtr client)
+ProcConvertSelection(ClientPtr client)
{
Bool paramsOkay;
xEvent event;
@@ -1188,7 +1187,7 @@ ProcConvertSelection(register ClientPtr client)
}
int
-ProcGrabServer(register ClientPtr client)
+ProcGrabServer(ClientPtr client)
{
REQUEST_SIZE_MATCH(xReq);
if (grabState != GrabNone && client != grabClient)
@@ -1242,7 +1241,7 @@ UngrabServer(ClientPtr client)
}
int
-ProcUngrabServer(register ClientPtr client)
+ProcUngrabServer(ClientPtr client)
{
REQUEST_SIZE_MATCH(xReq);
UngrabServer(client);
@@ -1250,7 +1249,7 @@ ProcUngrabServer(register ClientPtr client)
}
int
-ProcTranslateCoords(register ClientPtr client)
+ProcTranslateCoords(ClientPtr client)
{
REQUEST(xTranslateCoordsReq);
@@ -1327,7 +1326,7 @@ ProcTranslateCoords(register ClientPtr client)
}
int
-ProcOpenFont(register ClientPtr client)
+ProcOpenFont(ClientPtr client)
{
int err;
REQUEST(xOpenFontReq);
@@ -1346,7 +1345,7 @@ ProcOpenFont(register ClientPtr client)
}
int
-ProcCloseFont(register ClientPtr client)
+ProcCloseFont(ClientPtr client)
{
FontPtr pFont;
REQUEST(xResourceReq);
@@ -1367,11 +1366,11 @@ ProcCloseFont(register ClientPtr client)
}
int
-ProcQueryFont(register ClientPtr client)
+ProcQueryFont(ClientPtr client)
{
xQueryFontReply *reply;
FontPtr pFont;
- register GC *pGC;
+ GC *pGC;
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
@@ -1425,7 +1424,7 @@ ProcQueryFont(register ClientPtr client)
}
int
-ProcQueryTextExtents(register ClientPtr client)
+ProcQueryTextExtents(ClientPtr client)
{
REQUEST(xQueryTextExtentsReq);
xQueryTextExtentsReply reply;
@@ -1475,7 +1474,7 @@ ProcQueryTextExtents(register ClientPtr client)
}
int
-ProcListFonts(register ClientPtr client)
+ProcListFonts(ClientPtr client)
{
REQUEST(xListFontsReq);
@@ -1486,7 +1485,7 @@ ProcListFonts(register ClientPtr client)
}
int
-ProcListFontsWithInfo(register ClientPtr client)
+ProcListFontsWithInfo(ClientPtr client)
{
REQUEST(xListFontsWithInfoReq);
@@ -1508,13 +1507,13 @@ dixDestroyPixmap(pointer value, XID pid)
}
int
-ProcCreatePixmap(register ClientPtr client)
+ProcCreatePixmap(ClientPtr client)
{
PixmapPtr pMap;
DrawablePtr pDraw;
REQUEST(xCreatePixmapReq);
DepthPtr pDepth;
- register int i, rc;
+ int i, rc;
REQUEST_SIZE_MATCH(xCreatePixmapReq);
client->errorValue = stuff->pid;
@@ -1571,7 +1570,7 @@ CreatePmap:
}
int
-ProcFreePixmap(register ClientPtr client)
+ProcFreePixmap(ClientPtr client)
{
PixmapPtr pMap;
@@ -1593,7 +1592,7 @@ ProcFreePixmap(register ClientPtr client)
}
int
-ProcCreateGC(register ClientPtr client)
+ProcCreateGC(ClientPtr client)
{
int error, rc;
GC *pGC;
@@ -1621,7 +1620,7 @@ ProcCreateGC(register ClientPtr client)
}
int
-ProcChangeGC(register ClientPtr client)
+ProcChangeGC(ClientPtr client)
{
GC *pGC;
int result;
@@ -1648,7 +1647,7 @@ ProcChangeGC(register ClientPtr client)
}
int
-ProcCopyGC(register ClientPtr client)
+ProcCopyGC(ClientPtr client)
{
GC *dstGC;
GC *pGC;
@@ -1675,7 +1674,7 @@ ProcCopyGC(register ClientPtr client)
}
int
-ProcSetDashes(register ClientPtr client)
+ProcSetDashes(ClientPtr client)
{
GC *pGC;
int result;
@@ -1704,7 +1703,7 @@ ProcSetDashes(register ClientPtr client)
}
int
-ProcSetClipRectangles(register ClientPtr client)
+ProcSetClipRectangles(ClientPtr client)
{
int nr, result;
GC *pGC;
@@ -1734,7 +1733,7 @@ ProcSetClipRectangles(register ClientPtr client)
}
int
-ProcFreeGC(register ClientPtr client)
+ProcFreeGC(ClientPtr client)
{
GC *pGC;
int rc;
@@ -1750,7 +1749,7 @@ ProcFreeGC(register ClientPtr client)
}
int
-ProcClearToBackground(register ClientPtr client)
+ProcClearToBackground(ClientPtr client)
{
REQUEST(xClearAreaReq);
WindowPtr pWin;
@@ -1777,7 +1776,7 @@ ProcClearToBackground(register ClientPtr client)
}
int
-ProcCopyArea(register ClientPtr client)
+ProcCopyArea(ClientPtr client)
{
DrawablePtr pDst;
DrawablePtr pSrc;
@@ -1804,8 +1803,6 @@ ProcCopyArea(register ClientPtr client)
else
pSrc = pDst;
- SET_DBE_SRCBUF(pSrc, stuff->srcDrawable);
-
pRgn = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, stuff->srcX, stuff->srcY,
stuff->width, stuff->height,
stuff->dstX, stuff->dstY);
@@ -1821,7 +1818,7 @@ ProcCopyArea(register ClientPtr client)
}
int
-ProcCopyPlane(register ClientPtr client)
+ProcCopyPlane(ClientPtr client)
{
DrawablePtr psrcDraw, pdstDraw;
GC *pGC;
@@ -1848,8 +1845,6 @@ ProcCopyPlane(register ClientPtr client)
else
psrcDraw = pdstDraw;
- SET_DBE_SRCBUF(psrcDraw, stuff->srcDrawable);
-
/* Check to see if stuff->bitPlane has exactly ONE good bit set */
if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
(stuff->bitPlane > (1L << (psrcDraw->depth - 1))))
@@ -1872,7 +1867,7 @@ ProcCopyPlane(register ClientPtr client)
}
int
-ProcPolyPoint(register ClientPtr client)
+ProcPolyPoint(ClientPtr client)
{
int npoint;
GC *pGC;
@@ -1895,7 +1890,7 @@ ProcPolyPoint(register ClientPtr client)
}
int
-ProcPolyLine(register ClientPtr client)
+ProcPolyLine(ClientPtr client)
{
int npoint;
GC *pGC;
@@ -1918,7 +1913,7 @@ ProcPolyLine(register ClientPtr client)
}
int
-ProcPolySegment(register ClientPtr client)
+ProcPolySegment(ClientPtr client)
{
int nsegs;
GC *pGC;
@@ -1937,7 +1932,7 @@ ProcPolySegment(register ClientPtr client)
}
int
-ProcPolyRectangle (register ClientPtr client)
+ProcPolyRectangle (ClientPtr client)
{
int nrects;
GC *pGC;
@@ -1957,7 +1952,7 @@ ProcPolyRectangle (register ClientPtr client)
}
int
-ProcPolyArc(register ClientPtr client)
+ProcPolyArc(ClientPtr client)
{
int narcs;
GC *pGC;
@@ -1976,7 +1971,7 @@ ProcPolyArc(register ClientPtr client)
}
int
-ProcFillPoly(register ClientPtr client)
+ProcFillPoly(ClientPtr client)
{
int things;
GC *pGC;
@@ -2007,7 +2002,7 @@ ProcFillPoly(register ClientPtr client)
}
int
-ProcPolyFillRectangle(register ClientPtr client)
+ProcPolyFillRectangle(ClientPtr client)
{
int things;
GC *pGC;
@@ -2028,7 +2023,7 @@ ProcPolyFillRectangle(register ClientPtr client)
}
int
-ProcPolyFillArc(register ClientPtr client)
+ProcPolyFillArc(ClientPtr client)
{
int narcs;
GC *pGC;
@@ -2101,7 +2096,7 @@ ReformatImage (char *base, int nbytes, int bpp, int order)
* boundary, even if the scanlines are padded to our satisfaction.
*/
int
-ProcPutImage(register ClientPtr client)
+ProcPutImage(ClientPtr client)
{
GC *pGC;
DrawablePtr pDraw;
@@ -2157,15 +2152,14 @@ ProcPutImage(register ClientPtr client)
return (client->noClientException);
}
-
-int
-DoGetImage(register ClientPtr client, int format, Drawable drawable,
+static int
+DoGetImage(ClientPtr client, int format, Drawable drawable,
int x, int y, int width, int height,
Mask planemask, xGetImageReply **im_return)
{
DrawablePtr pDraw;
int nlines, linesPerBuf, rc;
- register int linesDone;
+ int linesDone;
long widthBytesLine, length;
Mask plane = 0;
char *pBuf;
@@ -2210,8 +2204,6 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
xgi.visual = None;
}
- SET_DBE_SRCBUF(pDraw, drawable);
-
xgi.type = X_Reply;
xgi.sequenceNumber = client->sequence;
xgi.depth = pDraw->depth;
@@ -2379,7 +2371,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
}
int
-ProcGetImage(register ClientPtr client)
+ProcGetImage(ClientPtr client)
{
REQUEST(xGetImageReq);
@@ -2392,7 +2384,7 @@ ProcGetImage(register ClientPtr client)
}
int
-ProcPolyText(register ClientPtr client)
+ProcPolyText(ClientPtr client)
{
int err;
REQUEST(xPolyTextReq);
@@ -2421,7 +2413,7 @@ ProcPolyText(register ClientPtr client)
}
int
-ProcImageText8(register ClientPtr client)
+ProcImageText8(ClientPtr client)
{
int err;
DrawablePtr pDraw;
@@ -2451,7 +2443,7 @@ ProcImageText8(register ClientPtr client)
}
int
-ProcImageText16(register ClientPtr client)
+ProcImageText16(ClientPtr client)
{
int err;
DrawablePtr pDraw;
@@ -2482,7 +2474,7 @@ ProcImageText16(register ClientPtr client)
int
-ProcCreateColormap(register ClientPtr client)
+ProcCreateColormap(ClientPtr client)
{
VisualPtr pVisual;
ColormapPtr pmap;
@@ -2524,7 +2516,7 @@ ProcCreateColormap(register ClientPtr client)
}
int
-ProcFreeColormap(register ClientPtr client)
+ProcFreeColormap(ClientPtr client)
{
ColormapPtr pmap;
REQUEST(xResourceReq);
@@ -2548,7 +2540,7 @@ ProcFreeColormap(register ClientPtr client)
int
-ProcCopyColormapAndFree(register ClientPtr client)
+ProcCopyColormapAndFree(ClientPtr client)
{
Colormap mid;
ColormapPtr pSrcMap;
@@ -2575,7 +2567,7 @@ ProcCopyColormapAndFree(register ClientPtr client)
}
int
-ProcInstallColormap(register ClientPtr client)
+ProcInstallColormap(ClientPtr client)
{
ColormapPtr pcmp;
REQUEST(xResourceReq);
@@ -2596,7 +2588,7 @@ ProcInstallColormap(register ClientPtr client)
}
int
-ProcUninstallColormap(register ClientPtr client)
+ProcUninstallColormap(ClientPtr client)
{
ColormapPtr pcmp;
REQUEST(xResourceReq);
@@ -2618,7 +2610,7 @@ ProcUninstallColormap(register ClientPtr client)
}
int
-ProcListInstalledColormaps(register ClientPtr client)
+ProcListInstalledColormaps(ClientPtr client)
{
xListInstalledColormapsReply *preply;
int nummaps, rc;
@@ -2651,7 +2643,7 @@ ProcListInstalledColormaps(register ClientPtr client)
}
int
-ProcAllocColor (register ClientPtr client)
+ProcAllocColor (ClientPtr client)
{
ColormapPtr pmap;
int retval;
@@ -2693,7 +2685,7 @@ ProcAllocColor (register ClientPtr client)
}
int
-ProcAllocNamedColor (register ClientPtr client)
+ProcAllocNamedColor (ClientPtr client)
{
ColormapPtr pcmp;
REQUEST(xAllocNamedColorReq);
@@ -2745,7 +2737,7 @@ ProcAllocNamedColor (register ClientPtr client)
}
int
-ProcAllocColorCells (register ClientPtr client)
+ProcAllocColorCells (ClientPtr client)
{
ColormapPtr pcmp;
REQUEST(xAllocColorCellsReq);
@@ -2811,7 +2803,7 @@ ProcAllocColorCells (register ClientPtr client)
}
int
-ProcAllocColorPlanes(register ClientPtr client)
+ProcAllocColorPlanes(ClientPtr client)
{
ColormapPtr pcmp;
REQUEST(xAllocColorPlanesReq);
@@ -2875,7 +2867,7 @@ ProcAllocColorPlanes(register ClientPtr client)
}
int
-ProcFreeColors(register ClientPtr client)
+ProcFreeColors(ClientPtr client)
{
ColormapPtr pcmp;
REQUEST(xFreeColorsReq);
@@ -2944,7 +2936,7 @@ ProcStoreColors (ClientPtr client)
}
int
-ProcStoreNamedColor (register ClientPtr client)
+ProcStoreNamedColor (ClientPtr client)
{
ColormapPtr pcmp;
REQUEST(xStoreNamedColorReq);
@@ -2978,7 +2970,7 @@ ProcStoreNamedColor (register ClientPtr client)
}
int
-ProcQueryColors(register ClientPtr client)
+ProcQueryColors(ClientPtr client)
{
ColormapPtr pcmp;
REQUEST(xQueryColorsReq);
@@ -3029,7 +3021,7 @@ ProcQueryColors(register ClientPtr client)
}
int
-ProcLookupColor(register ClientPtr client)
+ProcLookupColor(ClientPtr client)
{
ColormapPtr pcmp;
REQUEST(xLookupColorReq);
@@ -3067,17 +3059,16 @@ ProcLookupColor(register ClientPtr client)
}
int
-ProcCreateCursor (register ClientPtr client)
+ProcCreateCursor (ClientPtr client)
{
- CursorPtr pCursor;
-
- register PixmapPtr src;
- register PixmapPtr msk;
+ CursorPtr pCursor;
+ PixmapPtr src;
+ PixmapPtr msk;
unsigned char * srcbits;
unsigned char * mskbits;
unsigned short width, height;
long n;
- CursorMetricRec cm;
+ CursorMetricRec cm;
REQUEST(xCreateCursorReq);
@@ -3132,7 +3123,7 @@ ProcCreateCursor (register ClientPtr client)
XYPixmap, 1, (pointer)srcbits);
if ( msk == (PixmapPtr)NULL)
{
- register unsigned char *bits = mskbits;
+ unsigned char *bits = mskbits;
while (--n >= 0)
*bits++ = ~0;
}
@@ -3157,7 +3148,7 @@ ProcCreateCursor (register ClientPtr client)
}
int
-ProcCreateGlyphCursor (register ClientPtr client)
+ProcCreateGlyphCursor (ClientPtr client)
{
CursorPtr pCursor;
int res;
@@ -3181,7 +3172,7 @@ ProcCreateGlyphCursor (register ClientPtr client)
int
-ProcFreeCursor (register ClientPtr client)
+ProcFreeCursor (ClientPtr client)
{
CursorPtr pCursor;
REQUEST(xResourceReq);
@@ -3202,7 +3193,7 @@ ProcFreeCursor (register ClientPtr client)
}
int
-ProcQueryBestSize (register ClientPtr client)
+ProcQueryBestSize (ClientPtr client)
{
xQueryBestSizeReply reply;
DrawablePtr pDraw;
@@ -3239,7 +3230,7 @@ ProcQueryBestSize (register ClientPtr client)
int
-ProcSetScreenSaver (register ClientPtr client)
+ProcSetScreenSaver (ClientPtr client)
{
int blankingOption, exposureOption;
REQUEST(xSetScreenSaverReq);
@@ -3295,7 +3286,7 @@ ProcSetScreenSaver (register ClientPtr client)
}
int
-ProcGetScreenSaver(register ClientPtr client)
+ProcGetScreenSaver(ClientPtr client)
{
xGetScreenSaverReply rep;
@@ -3312,7 +3303,7 @@ ProcGetScreenSaver(register ClientPtr client)
}
int
-ProcChangeHosts(register ClientPtr client)
+ProcChangeHosts(ClientPtr client)
{
REQUEST(xChangeHostsReq);
int result;
@@ -3336,7 +3327,7 @@ ProcChangeHosts(register ClientPtr client)
}
int
-ProcListHosts(register ClientPtr client)
+ProcListHosts(ClientPtr client)
{
xListHostsReply reply;
int len, nHosts, result;
@@ -3367,7 +3358,7 @@ ProcListHosts(register ClientPtr client)
}
int
-ProcChangeAccessControl(register ClientPtr client)
+ProcChangeAccessControl(ClientPtr client)
{
int result;
REQUEST(xSetAccessControlReq);
@@ -3384,8 +3375,30 @@ ProcChangeAccessControl(register ClientPtr client)
return (result);
}
+/*********************
+ * CloseDownRetainedResources
+ *
+ * Find all clients that are gone and have terminated in RetainTemporary
+ * and destroy their resources.
+ *********************/
+
+static void
+CloseDownRetainedResources(void)
+{
+ int i;
+ ClientPtr client;
+
+ for (i=1; i<currentMaxClients; i++)
+ {
+ client = clients[i];
+ if (client && (client->closeDownMode == RetainTemporary)
+ && (client->clientGone))
+ CloseDownClient(client);
+ }
+}
+
int
-ProcKillClient(register ClientPtr client)
+ProcKillClient(ClientPtr client)
{
REQUEST(xResourceReq);
ClientPtr killclient;
@@ -3417,7 +3430,7 @@ ProcKillClient(register ClientPtr client)
}
int
-ProcSetFontPath(register ClientPtr client)
+ProcSetFontPath(ClientPtr client)
{
unsigned char *ptr;
unsigned long nbytes, total;
@@ -3452,7 +3465,7 @@ ProcSetFontPath(register ClientPtr client)
}
int
-ProcGetFontPath(register ClientPtr client)
+ProcGetFontPath(ClientPtr client)
{
xGetFontPathReply reply;
int stringLens, numpaths;
@@ -3474,7 +3487,7 @@ ProcGetFontPath(register ClientPtr client)
}
int
-ProcChangeCloseDownMode(register ClientPtr client)
+ProcChangeCloseDownMode(ClientPtr client)
{
REQUEST(xSetCloseDownModeReq);
@@ -3493,7 +3506,7 @@ ProcChangeCloseDownMode(register ClientPtr client)
}
}
-int ProcForceScreenSaver(register ClientPtr client)
+int ProcForceScreenSaver(ClientPtr client)
{
REQUEST(xForceScreenSaverReq);
@@ -3509,7 +3522,7 @@ int ProcForceScreenSaver(register ClientPtr client)
return client->noClientException;
}
-int ProcNoOperation(register ClientPtr client)
+int ProcNoOperation(ClientPtr client)
{
REQUEST_AT_LEAST_SIZE(xReq);
@@ -3552,7 +3565,7 @@ InitProcVectors(void)
char dispatchExceptionAtReset = DE_RESET;
void
-CloseDownClient(register ClientPtr client)
+CloseDownClient(ClientPtr client)
{
Bool really_close_down = client->clientGone ||
client->closeDownMode == DestroyAll;
@@ -3652,28 +3665,6 @@ KillAllClients()
}
}
-/*********************
- * CloseDownRetainedResources
- *
- * Find all clients that are gone and have terminated in RetainTemporary
- * and destroy their resources.
- *********************/
-
-void
-CloseDownRetainedResources()
-{
- register int i;
- register ClientPtr client;
-
- for (i=1; i<currentMaxClients; i++)
- {
- client = clients[i];
- if (client && (client->closeDownMode == RetainTemporary)
- && (client->clientGone))
- CloseDownClient(client);
- }
-}
-
extern int clientPrivateLen;
extern unsigned *clientPrivateSizes;
extern unsigned totalClientSize;
@@ -3733,11 +3724,11 @@ void InitClient(ClientPtr client, int i, pointer ospriv)
int
InitClientPrivates(ClientPtr client)
{
- register char *ptr;
+ char *ptr;
DevUnion *ppriv;
- register unsigned *sizes;
- register unsigned size;
- register int i;
+ unsigned *sizes;
+ unsigned size;
+ int i;
if (totalClientSize == sizeof(ClientRec))
ppriv = (DevUnion *)NULL;
@@ -3787,8 +3778,8 @@ InitClientPrivates(ClientPtr client)
ClientPtr NextAvailableClient(pointer ospriv)
{
- register int i;
- register ClientPtr client;
+ int i;
+ ClientPtr client;
xReq data;
i = nextFreeClientID;
@@ -3829,10 +3820,10 @@ ClientPtr NextAvailableClient(pointer ospriv)
}
int
-ProcInitialConnection(register ClientPtr client)
+ProcInitialConnection(ClientPtr client)
{
REQUEST(xReq);
- register xConnClientPrefix *prefix;
+ xConnClientPrefix *prefix;
int whichbyte = 1;
prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq);
@@ -3856,10 +3847,10 @@ ProcInitialConnection(register ClientPtr client)
}
int
-SendConnSetup(register ClientPtr client, char *reason)
+SendConnSetup(ClientPtr client, char *reason)
{
- register xWindowRoot *root;
- register int i;
+ xWindowRoot *root;
+ int i;
int numScreens;
char* lConnectionInfo;
xConnSetupPrefix* lconnSetupPrefix;
@@ -3914,8 +3905,8 @@ SendConnSetup(register ClientPtr client, char *reason)
for (i=0; i<numScreens; i++)
{
- register unsigned int j;
- register xDepth *pDepth;
+ unsigned int j;
+ xDepth *pDepth;
root->currentInputMask = WindowTable[i]->eventMask |
wOtherEventMasks (WindowTable[i]);
@@ -3956,10 +3947,10 @@ SendConnSetup(register ClientPtr client, char *reason)
}
int
-ProcEstablishConnection(register ClientPtr client)
+ProcEstablishConnection(ClientPtr client)
{
char *reason, *auth_proto, *auth_string;
- register xConnClientPrefix *prefix;
+ xConnClientPrefix *prefix;
REQUEST(xReq);
prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq);
@@ -4008,7 +3999,7 @@ SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
void
DeleteWindowFromAnySelections(WindowPtr pWin)
{
- register int i;
+ int i;
for (i = 0; i< NumCurrentSelections; i++)
if (CurrentSelections[i].pWin == pWin)
@@ -4030,7 +4021,7 @@ DeleteWindowFromAnySelections(WindowPtr pWin)
static void
DeleteClientFromAnySelections(ClientPtr client)
{
- register int i;
+ int i;
for (i = 0; i< NumCurrentSelections; i++)
if (CurrentSelections[i].client == client)
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index d5b42dcf6..62ad575c9 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -64,6 +64,7 @@ Equipment Corporation.
#include "opaque.h"
#include "dixfontstr.h"
#include "closestr.h"
+#include "dixfont.h"
#ifdef DEBUG
#include <stdio.h>
@@ -1144,9 +1145,9 @@ static XID clearGC[] = { CT_NONE };
#define clearGCmask (GCClipMask)
int
-doPolyText(ClientPtr client, register PTclosurePtr c)
+doPolyText(ClientPtr client, PTclosurePtr c)
{
- register FontPtr pFont = c->pGC->font, oldpFont;
+ FontPtr pFont = c->pGC->font, oldpFont;
Font fid, oldfid;
int err = Success, lgerr; /* err is in X error, not font error, space */
enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state = NEVER_SLEPT;
@@ -1446,7 +1447,7 @@ PolyText(ClientPtr client, DrawablePtr pDraw, GC *pGC, unsigned char *pElt,
#undef FontShiftSize
int
-doImageText(ClientPtr client, register ITclosurePtr c)
+doImageText(ClientPtr client, ITclosurePtr c)
{
int err = Success, lgerr; /* err is in X error, not font error, space */
FontPathElementPtr fpe;
diff --git a/dix/dixutils.c b/dix/dixutils.c
index e530360fe..44d82c944 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -168,7 +168,7 @@ ISOLatin1ToLower (unsigned char source)
_X_EXPORT void
CopyISOLatin1Lowered(unsigned char *dest, unsigned char *source, int length)
{
- register int i;
+ int i;
for (i = 0; i < length; i++, source++, dest++)
*dest = ISOLatin1ToLower (*source);
@@ -392,8 +392,8 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode,
void
DeleteWindowFromAnySaveSet(WindowPtr pWin)
{
- register int i;
- register ClientPtr client;
+ int i;
+ ClientPtr client;
for (i = 0; i< currentMaxClients; i++)
{
@@ -434,7 +434,7 @@ static Bool handlerDeleted;
void
BlockHandler(pointer pTimeout, pointer pReadmask)
{
- register int i, j;
+ int i, j;
++inHandler;
for (i = 0; i < screenInfo.numScreens; i++)
@@ -468,7 +468,7 @@ BlockHandler(pointer pTimeout, pointer pReadmask)
void
WakeupHandler(int result, pointer pReadmask)
{
- register int i, j;
+ int i, j;
++inHandler;
for (i = numHandlers - 1; i >= 0; i--)
@@ -882,9 +882,7 @@ static CallbackFuncsRec default_cbfuncs =
_DeleteCallbackList
};
-/* ===== Public Procedures ===== */
-
-Bool
+static Bool
CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs)
{
CallbackListPtr cbl;
@@ -916,6 +914,8 @@ CreateCallbackList(CallbackListPtr *pcbl, CallbackFuncsPtr cbfuncs)
return TRUE;
}
+/* ===== Public Procedures ===== */
+
_X_EXPORT Bool
AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
{
diff --git a/dix/events.c b/dix/events.c
index 0053f42d4..e008e3613 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -133,7 +133,7 @@ of the copyright holder.
#ifdef XKB
#include <X11/extensions/XKBproto.h>
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
#endif
@@ -156,7 +156,7 @@ extern Mask xevieFilters[128];
extern int xevieEventSent;
extern int xevieKBEventSent;
int xeviegrabState = 0;
-xEvent *xeviexE;
+static xEvent *xeviexE;
#endif
#include <X11/extensions/XIproto.h>
@@ -761,8 +761,8 @@ CheckPhysLimits(
static void
CheckVirtualMotion(
- register QdEventPtr qe,
- register WindowPtr pWin)
+ QdEventPtr qe,
+ WindowPtr pWin)
{
#ifdef PANORAMIX
if(!noPanoramiXExtension) {
@@ -875,7 +875,7 @@ ChangeToCursor(CursorPtr cursor)
/* returns true if b is a descendent of a */
Bool
-IsParent(register WindowPtr a, register WindowPtr b)
+IsParent(WindowPtr a, WindowPtr b)
{
for (b = b->parent; b; b = b->parent)
if (b == a) return TRUE;
@@ -885,8 +885,8 @@ IsParent(register WindowPtr a, register WindowPtr b)
static void
PostNewCursor(void)
{
- register WindowPtr win;
- register GrabPtr grab = inputInfo.pointer->grab;
+ WindowPtr win;
+ GrabPtr grab = inputInfo.pointer->grab;
if (syncEvents.playingEvents)
return;
@@ -952,7 +952,7 @@ XineramaGetCursorScreen()
#define TIMESLOP (5 * 60 * 1000) /* 5 minutes */
static void
-MonthChangedOrBadTime(register xEvent *xE)
+MonthChangedOrBadTime(xEvent *xE)
{
/* If the ddx/OS is careless about not processing timestamped events from
* different sources in sorted order, then it's possible for time to go
@@ -971,7 +971,7 @@ MonthChangedOrBadTime(register xEvent *xE)
lastDeviceEventTime = currentTime; }
void
-NoticeEventTime(register xEvent *xE)
+NoticeEventTime(xEvent *xE)
{
if (!syncEvents.playingEvents)
NoticeTime(xE);
@@ -984,8 +984,8 @@ NoticeEventTime(register xEvent *xE)
void
EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
{
- register QdEventPtr tail = *syncEvents.pendtail;
- register QdEventPtr qe;
+ QdEventPtr tail = *syncEvents.pendtail;
+ QdEventPtr qe;
xEvent *qxE;
NoticeTime(xE);
@@ -1059,8 +1059,8 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
static void
PlayReleasedEvents(void)
{
- register QdEventPtr *prev, qe;
- register DeviceIntPtr dev;
+ QdEventPtr *prev, qe;
+ DeviceIntPtr dev;
prev = &syncEvents.pending;
while ( (qe = *prev) )
@@ -1104,7 +1104,7 @@ PlayReleasedEvents(void)
}
static void
-FreezeThaw(register DeviceIntPtr dev, Bool frozen)
+FreezeThaw(DeviceIntPtr dev, Bool frozen)
{
dev->sync.frozen = frozen;
if (frozen)
@@ -1116,13 +1116,13 @@ FreezeThaw(register DeviceIntPtr dev, Bool frozen)
void
ComputeFreezes()
{
- register DeviceIntPtr replayDev = syncEvents.replayDev;
- register int i;
+ DeviceIntPtr replayDev = syncEvents.replayDev;
+ int i;
WindowPtr w;
- register xEvent *xE;
+ xEvent *xE;
int count;
GrabPtr grab;
- register DeviceIntPtr dev;
+ DeviceIntPtr dev;
for (dev = inputInfo.devices; dev; dev = dev->next)
FreezeThaw(dev, dev->sync.other || (dev->sync.state >= FROZEN));
@@ -1198,10 +1198,10 @@ ScreenRestructured (ScreenPtr pScreen)
#endif
void
-CheckGrabForSyncs(register DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
+CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
{
- register GrabPtr grab = thisDev->grab;
- register DeviceIntPtr dev;
+ GrabPtr grab = thisDev->grab;
+ DeviceIntPtr dev;
if (thisMode == GrabModeSync)
thisDev->sync.state = FROZEN_NO_EVENT;
@@ -1232,7 +1232,7 @@ CheckGrabForSyncs(register DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
}
void
-ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab,
+ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
TimeStamp time, Bool autoGrab)
{
WindowPtr oldWin = (mouse->grab) ? mouse->grab->window
@@ -1260,10 +1260,10 @@ ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab,
}
void
-DeactivatePointerGrab(register DeviceIntPtr mouse)
+DeactivatePointerGrab(DeviceIntPtr mouse)
{
- register GrabPtr grab = mouse->grab;
- register DeviceIntPtr dev;
+ GrabPtr grab = mouse->grab;
+ DeviceIntPtr dev;
mouse->valuator->motionHintWindow = NullWindow;
mouse->grab = NullGrab;
@@ -1284,7 +1284,7 @@ DeactivatePointerGrab(register DeviceIntPtr mouse)
}
void
-ActivateKeyboardGrab(register DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive)
+ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive)
{
WindowPtr oldWin;
@@ -1310,11 +1310,11 @@ ActivateKeyboardGrab(register DeviceIntPtr keybd, GrabPtr grab, TimeStamp time,
}
void
-DeactivateKeyboardGrab(register DeviceIntPtr keybd)
+DeactivateKeyboardGrab(DeviceIntPtr keybd)
{
- register GrabPtr grab = keybd->grab;
- register DeviceIntPtr dev;
- register WindowPtr focusWin = keybd->focus ? keybd->focus->win
+ GrabPtr grab = keybd->grab;
+ DeviceIntPtr dev;
+ WindowPtr focusWin = keybd->focus ? keybd->focus->win
: sprite.win;
if (focusWin == FollowKeyboardWin)
@@ -1338,7 +1338,7 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
{
Bool thisGrabbed, otherGrabbed, othersFrozen, thisSynced;
TimeStamp grabTime;
- register DeviceIntPtr dev;
+ DeviceIntPtr dev;
thisGrabbed = thisDev->grab && SameClient(thisDev->grab, client);
thisSynced = FALSE;
@@ -1442,7 +1442,7 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
}
int
-ProcAllowEvents(register ClientPtr client)
+ProcAllowEvents(ClientPtr client)
{
TimeStamp time;
DeviceIntPtr mouse = inputInfo.pointer;
@@ -1487,7 +1487,7 @@ ProcAllowEvents(register ClientPtr client)
void
ReleaseActiveGrabs(ClientPtr client)
{
- register DeviceIntPtr dev;
+ DeviceIntPtr dev;
Bool done;
/* XXX CloseDownClient should remove passive grabs before
@@ -1589,12 +1589,12 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
}
int
-DeliverEventsToWindow(register WindowPtr pWin, xEvent *pEvents, int count,
+DeliverEventsToWindow(WindowPtr pWin, xEvent *pEvents, int count,
Mask filter, GrabPtr grab, int mskidx)
{
int deliveries = 0, nondeliveries = 0;
int attempt;
- register InputClients *other;
+ InputClients *other;
ClientPtr client = NullClient;
Mask deliveryMask = 0; /* If a grab occurs due to a button press, then
this mask is the mask of the grab. */
@@ -1708,10 +1708,10 @@ XineramaTryClientEventsResult(
#endif
int
-MaybeDeliverEventsToClient(register WindowPtr pWin, xEvent *pEvents,
+MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
int count, Mask filter, ClientPtr dontClient)
{
- register OtherClients *other;
+ OtherClients *other;
if (pWin->eventMask & filter)
@@ -1799,8 +1799,8 @@ FixUpEventFromWindow(
}
int
-DeliverDeviceEvents(register WindowPtr pWin, register xEvent *xE, GrabPtr grab,
- register WindowPtr stopAt, DeviceIntPtr dev, int count)
+DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab,
+ WindowPtr stopAt, DeviceIntPtr dev, int count)
{
Window child = None;
int type = xE->u.u.type;
@@ -1809,7 +1809,7 @@ DeliverDeviceEvents(register WindowPtr pWin, register xEvent *xE, GrabPtr grab,
if (type & EXTENSION_EVENT_BASE)
{
- register OtherInputMasks *inputMasks;
+ OtherInputMasks *inputMasks;
int mskidx = dev->id;
inputMasks = wOtherInputMasks(pWin);
@@ -1863,8 +1863,8 @@ DeliverDeviceEvents(register WindowPtr pWin, register xEvent *xE, GrabPtr grab,
/* not useful for events that propagate up the tree or extension events */
_X_EXPORT int
-DeliverEvents(register WindowPtr pWin, register xEvent *xE, int count,
- register WindowPtr otherParent)
+DeliverEvents(WindowPtr pWin, xEvent *xE, int count,
+ WindowPtr otherParent)
{
Mask filter;
int deliveries;
@@ -1929,7 +1929,7 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
static WindowPtr
XYToWindow(int x, int y)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
BoxRec box;
spriteTraceGood = 1; /* root window still there */
@@ -2092,9 +2092,9 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
#endif
void
-DefineInitialRootWindow(register WindowPtr win)
+DefineInitialRootWindow(WindowPtr win)
{
- register ScreenPtr pScreen = win->drawable.pScreen;
+ ScreenPtr pScreen = win->drawable.pScreen;
sprite.hotPhys.pScreen = pScreen;
sprite.hotPhys.x = pScreen->width / 2;
@@ -2411,13 +2411,13 @@ BorderSizeNotEmpty(WindowPtr pWin)
static Bool
CheckPassiveGrabsOnWindow(
WindowPtr pWin,
- register DeviceIntPtr device,
- register xEvent *xE,
+ DeviceIntPtr device,
+ xEvent *xE,
int count)
{
- register GrabPtr grab = wPassiveGrabs(pWin);
+ GrabPtr grab = wPassiveGrabs(pWin);
GrabRec tempGrab;
- register xEvent *dxE;
+ xEvent *dxE;
if (!grab)
return FALSE;
@@ -2513,12 +2513,12 @@ tried. PRH
*/
Bool
-CheckDeviceGrabs(register DeviceIntPtr device, register xEvent *xE,
+CheckDeviceGrabs(DeviceIntPtr device, xEvent *xE,
int checkFirst, int count)
{
- register int i;
- register WindowPtr pWin = NULL;
- register FocusClassPtr focus = device->focus;
+ int i;
+ WindowPtr pWin = NULL;
+ FocusClassPtr focus = device->focus;
if (((xE->u.u.type == ButtonPress)
#if defined(XINPUT) && defined(XKB)
@@ -2585,13 +2585,13 @@ DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count)
}
void
-DeliverGrabbedEvent(register xEvent *xE, register DeviceIntPtr thisDev,
+DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
Bool deactivateGrab, int count)
{
- register GrabPtr grab = thisDev->grab;
+ GrabPtr grab = thisDev->grab;
int deliveries = 0;
- register DeviceIntPtr dev;
- register xEvent *dxE;
+ DeviceIntPtr dev;
+ xEvent *dxE;
if (grab->ownerEvents)
{
@@ -2668,19 +2668,19 @@ DeliverGrabbedEvent(register xEvent *xE, register DeviceIntPtr thisDev,
void
#ifdef XKB
-CoreProcessKeyboardEvent (register xEvent *xE, register DeviceIntPtr keybd, int count)
+CoreProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count)
#else
-ProcessKeyboardEvent (register xEvent *xE, register DeviceIntPtr keybd, int count)
+ProcessKeyboardEvent (xEvent *xE, DeviceIntPtr keybd, int count)
#endif
{
int key, bit;
- register BYTE *kptr;
- register int i;
- register CARD8 modifiers;
- register CARD16 mask;
+ BYTE *kptr;
+ int i;
+ CARD8 modifiers;
+ CARD16 mask;
GrabPtr grab = keybd->grab;
Bool deactivateGrab = FALSE;
- register KeyClassPtr keyc = keybd->key;
+ KeyClassPtr keyc = keybd->key;
#ifdef XEVIE
static Window rootWin = 0;
@@ -2832,11 +2832,11 @@ drawable.id:0;
CoreProcessKeyEvent to be called, as in for example Mouse Keys.
*/
void
-FixKeyState (register xEvent *xE, register DeviceIntPtr keybd)
+FixKeyState (xEvent *xE, DeviceIntPtr keybd)
{
int key, bit;
- register BYTE *kptr;
- register KeyClassPtr keyc = keybd->key;
+ BYTE *kptr;
+ KeyClassPtr keyc = keybd->key;
key = xE->u.u.detail;
kptr = &keyc->down[key >> 3];
@@ -2863,14 +2863,14 @@ FixKeyState (register xEvent *xE, register DeviceIntPtr keybd)
void
#ifdef XKB
-CoreProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count)
+CoreProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
#else
-ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count)
+ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
#endif
{
- register GrabPtr grab = mouse->grab;
+ GrabPtr grab = mouse->grab;
Bool deactivateGrab = FALSE;
- register ButtonClassPtr butc = mouse->button;
+ ButtonClassPtr butc = mouse->button;
#ifdef XKB
XkbSrvInfoPtr xkbi= inputInfo.keyboard->key->xkbInfo;
#endif
@@ -2914,8 +2914,8 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
}
if (xE->u.u.type != MotionNotify)
{
- register int key;
- register BYTE *kptr;
+ int key;
+ BYTE *kptr;
int bit;
XE_KBPTR.rootX = sprite.hot.x;
@@ -2976,10 +2976,10 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
void
RecalculateDeliverableEvents(pWin)
- register WindowPtr pWin;
+ WindowPtr pWin;
{
- register OtherClients *others;
- register WindowPtr pChild;
+ OtherClients *others;
+ WindowPtr pChild;
pChild = pWin;
while (1)
@@ -3018,8 +3018,8 @@ RecalculateDeliverableEvents(pWin)
int
OtherClientGone(pointer value, XID id)
{
- register OtherClientsPtr other, prev;
- register WindowPtr pWin = (WindowPtr)value;
+ OtherClientsPtr other, prev;
+ WindowPtr pWin = (WindowPtr)value;
prev = 0;
for (other = wOtherClients(pWin); other; other = other->next)
@@ -3045,7 +3045,7 @@ OtherClientGone(pointer value, XID id)
}
int
-EventSelectForWindow(register WindowPtr pWin, register ClientPtr client, Mask mask)
+EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
{
Mask check;
OtherClients * others;
@@ -3117,10 +3117,10 @@ maskSet:
}
int
-EventSuppressForWindow(register WindowPtr pWin, register ClientPtr client,
+EventSuppressForWindow(WindowPtr pWin, ClientPtr client,
Mask mask, Bool *checkOptional)
{
- register int i, free;
+ int i, free;
if (mask & ~PropagateMask)
{
@@ -3174,8 +3174,8 @@ EventSuppressForWindow(register WindowPtr pWin, register ClientPtr client,
static WindowPtr
CommonAncestor(
- register WindowPtr a,
- register WindowPtr b)
+ WindowPtr a,
+ WindowPtr b)
{
for (b = b->parent; b; b = b->parent)
if (IsParent(b, a)) return b;
@@ -3187,14 +3187,14 @@ EnterLeaveEvent(
int type,
int mode,
int detail,
- register WindowPtr pWin,
+ WindowPtr pWin,
Window child)
{
xEvent event;
- register DeviceIntPtr keybd = inputInfo.keyboard;
+ DeviceIntPtr keybd = inputInfo.keyboard;
WindowPtr focus;
- register DeviceIntPtr mouse = inputInfo.pointer;
- register GrabPtr grab = mouse->grab;
+ DeviceIntPtr mouse = inputInfo.pointer;
+ GrabPtr grab = mouse->grab;
Mask mask;
if ((pWin == mouse->valuator->motionHintWindow) &&
@@ -3278,7 +3278,7 @@ EnterNotifies(WindowPtr ancestor, WindowPtr child, int mode, int detail)
static void
LeaveNotifies(WindowPtr child, WindowPtr ancestor, int mode, int detail)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
if (ancestor == child)
return;
@@ -3318,7 +3318,7 @@ DoEnterLeaveEvents(WindowPtr fromWin, WindowPtr toWin, int mode)
}
static void
-FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, register WindowPtr pWin)
+FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin)
{
xEvent event;
@@ -3388,7 +3388,7 @@ FocusOutEvents(
int mode, int detail,
Bool doAncestor)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
for (pWin = child; pWin != ancestor; pWin = pWin->parent)
FocusEvent(dev, FocusOut, mode, detail, pWin);
@@ -3531,7 +3531,7 @@ SetInputFocus(
Time ctime,
Bool followOK)
{
- register FocusClassPtr focus;
+ FocusClassPtr focus;
WindowPtr focusWin;
int mode, rc;
TimeStamp time;
@@ -3579,7 +3579,7 @@ SetInputFocus(
else
{
int depth = 0;
- register WindowPtr pWin;
+ WindowPtr pWin;
for (pWin = focusWin; pWin; pWin = pWin->parent) depth++;
if (depth > focus->traceSize)
@@ -3745,7 +3745,7 @@ int
ProcChangeActivePointerGrab(ClientPtr client)
{
DeviceIntPtr device = inputInfo.pointer;
- register GrabPtr grab = device->grab;
+ GrabPtr grab = device->grab;
CursorPtr newCursor, oldCursor;
REQUEST(xChangeActivePointerGrabReq);
TimeStamp time;
@@ -3807,12 +3807,12 @@ ProcUngrabPointer(ClientPtr client)
}
int
-GrabDevice(register ClientPtr client, register DeviceIntPtr dev,
+GrabDevice(ClientPtr client, DeviceIntPtr dev,
unsigned this_mode, unsigned other_mode, Window grabWindow,
unsigned ownerEvents, Time ctime, Mask mask, CARD8 *status)
{
WindowPtr pWin;
- register GrabPtr grab;
+ GrabPtr grab;
TimeStamp time;
int rc;
@@ -4433,7 +4433,7 @@ CheckCursorConfinement(WindowPtr pWin)
Mask
EventMaskForClient(WindowPtr pWin, ClientPtr client)
{
- register OtherClientsPtr other;
+ OtherClientsPtr other;
if (wClient (pWin) == client)
return pWin->eventMask;
diff --git a/dix/extension.c b/dix/extension.c
index 29cae8676..88dff15e2 100644
--- a/dix/extension.c
+++ b/dix/extension.c
@@ -66,8 +66,6 @@ SOFTWARE.
#define LAST_EVENT 128
#define LAST_ERROR 255
-ScreenProcEntry AuxillaryScreenProcs[MAXSCREENS];
-
static ExtensionEntry **extensions = (ExtensionEntry **)NULL;
int lastEvent = EXTENSION_EVENT_BASE;
@@ -81,11 +79,11 @@ extern unsigned totalExtensionSize;
static void
InitExtensionPrivates(ExtensionEntry *ext)
{
- register char *ptr;
+ char *ptr;
DevUnion *ppriv;
- register unsigned *sizes;
- register unsigned size;
- register int i;
+ unsigned *sizes;
+ unsigned size;
+ int i;
if (totalExtensionSize == sizeof(ExtensionEntry))
ppriv = (DevUnion *)NULL;
@@ -115,7 +113,7 @@ AddExtension(char *name, int NumEvents, int NumErrors,
unsigned short (*MinorOpcodeProc)(ClientPtr c3))
{
int i;
- register ExtensionEntry *ext, **newexts;
+ ExtensionEntry *ext, **newexts;
if (!MainProc || !SwappedMainProc || !CloseDownProc || !MinorOpcodeProc)
return((ExtensionEntry *) NULL);
@@ -282,7 +280,7 @@ MinorOpcodeOfRequest(ClientPtr client)
void
CloseDownExtensions()
{
- register int i,j;
+ int i,j;
for (i = NumExtensions - 1; i >= 0; i--)
{
@@ -298,21 +296,8 @@ CloseDownExtensions()
extensions = (ExtensionEntry **)NULL;
lastEvent = EXTENSION_EVENT_BASE;
lastError = FirstExtensionError;
- for (i=0; i<MAXSCREENS; i++)
- {
- register ScreenProcEntry *spentry = &AuxillaryScreenProcs[i];
-
- while (spentry->num)
- {
- spentry->num--;
- xfree(spentry->procList[spentry->num].name);
- }
- xfree(spentry->procList);
- spentry->procList = (ProcEntryPtr)NULL;
- }
}
-
int
ProcQueryExtension(ClientPtr client)
{
@@ -363,7 +348,7 @@ ProcListExtensions(ClientPtr client)
if ( NumExtensions )
{
- register int i, j;
+ int i, j;
for (i=0; i<NumExtensions; i++)
{
@@ -406,72 +391,6 @@ ProcListExtensions(ClientPtr client)
return(client->noClientException);
}
-
-ExtensionLookupProc
-LookupProc(char *name, GCPtr pGC)
-{
- register int i;
- register ScreenProcEntry *spentry;
- spentry = &AuxillaryScreenProcs[pGC->pScreen->myNum];
- if (spentry->num)
- {
- for (i = 0; i < spentry->num; i++)
- if (strcmp(name, spentry->procList[i].name) == 0)
- return(spentry->procList[i].proc);
- }
- return (ExtensionLookupProc)NULL;
-}
-
-Bool
-RegisterProc(char *name, GC *pGC, ExtensionLookupProc proc)
-{
- return RegisterScreenProc(name, pGC->pScreen, proc);
-}
-
-Bool
-RegisterScreenProc(char *name, ScreenPtr pScreen, ExtensionLookupProc proc)
-{
- register ScreenProcEntry *spentry;
- register ProcEntryPtr procEntry = (ProcEntryPtr)NULL;
- char *newname;
- int i;
-
- spentry = &AuxillaryScreenProcs[pScreen->myNum];
- /* first replace duplicates */
- if (spentry->num)
- {
- for (i = 0; i < spentry->num; i++)
- if (strcmp(name, spentry->procList[i].name) == 0)
- {
- procEntry = &spentry->procList[i];
- break;
- }
- }
- if (procEntry)
- procEntry->proc = proc;
- else
- {
- newname = (char *)xalloc(strlen(name)+1);
- if (!newname)
- return FALSE;
- procEntry = (ProcEntryPtr)
- xrealloc(spentry->procList,
- sizeof(ProcEntryRec) * (spentry->num+1));
- if (!procEntry)
- {
- xfree(newname);
- return FALSE;
- }
- spentry->procList = procEntry;
- procEntry += spentry->num;
- procEntry->name = newname;
- strcpy(newname, name);
- procEntry->proc = proc;
- spentry->num++;
- }
- return TRUE;
-}
-
#ifdef XSERVER_DTRACE
void LoadExtensionNames(char **RequestNames) {
int i;
diff --git a/dix/gc.c b/dix/gc.c
index 5106fcda2..7a76dd99d 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -69,7 +69,7 @@ extern FontPtr defaultFont;
static Bool CreateDefaultTile(GCPtr pGC);
-unsigned char DefaultDash[2] = {4, 4};
+static unsigned char DefaultDash[2] = {4, 4};
_X_EXPORT void
ValidateGC(DrawablePtr pDraw, GC *pGC)
@@ -144,12 +144,12 @@ ValidateGC(DrawablePtr pDraw, GC *pGC)
assert(pUnion); _var = (_type)pUnion->ptr; pUnion++; }
_X_EXPORT int
-dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC32, ChangeGCValPtr pUnion)
+dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr pUnion)
{
- register BITS32 index2;
- register int error = 0;
- PixmapPtr pPixmap;
- BITS32 maskQ;
+ BITS32 index2;
+ int error = 0;
+ PixmapPtr pPixmap;
+ BITS32 maskQ;
assert( (pC32 && !pUnion) || (!pC32 && pUnion) );
pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
@@ -522,7 +522,7 @@ dixChangeGC(ClientPtr client, register GC *pGC, register BITS32 mask, CARD32 *pC
/* Publically defined entry to ChangeGC. Just calls dixChangeGC and tells
* it that all of the entries are constants or IDs */
_X_EXPORT int
-ChangeGC(register GC *pGC, register BITS32 mask, XID *pval)
+ChangeGC(GC *pGC, BITS32 mask, XID *pval)
{
return (dixChangeGC(NullClient, pGC, mask, pval, NULL));
}
@@ -548,7 +548,7 @@ NOTE:
32 bits long
*/
_X_EXPORT int
-DoChangeGC(register GC *pGC, register BITS32 mask, XID *pval, int fPointer)
+DoChangeGC(GC *pGC, BITS32 mask, XID *pval, int fPointer)
{
if (fPointer)
/* XXX might be a problem on 64 bit big-endian servers */
@@ -572,11 +572,11 @@ static GCPtr
AllocateGC(ScreenPtr pScreen)
{
GCPtr pGC;
- register char *ptr;
- register DevUnion *ppriv;
- register unsigned *sizes;
- register unsigned size;
- register int i;
+ char *ptr;
+ DevUnion *ppriv;
+ unsigned *sizes;
+ unsigned size;
+ int i;
pGC = (GCPtr)xalloc(pScreen->totalGCSize);
if (pGC)
@@ -602,7 +602,7 @@ AllocateGC(ScreenPtr pScreen)
_X_EXPORT GCPtr
CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus)
{
- register GCPtr pGC;
+ GCPtr pGC;
pGC = AllocateGC(pDrawable->pScreen);
if (!pGC)
@@ -724,11 +724,11 @@ CreateDefaultTile (GCPtr pGC)
}
_X_EXPORT int
-CopyGC(register GC *pgcSrc, register GC *pgcDst, register BITS32 mask)
+CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask)
{
- register BITS32 index2;
- BITS32 maskQ;
- int error = 0;
+ BITS32 index2;
+ BITS32 maskQ;
+ int error = 0;
if (pgcSrc == pgcDst)
return Success;
@@ -907,17 +907,6 @@ FreeGC(pointer value, XID gid)
return(Success);
}
-void
-SetGCMask(GCPtr pGC, Mask selectMask, Mask newDataMask)
-{
- pGC->stateChanges = (~selectMask & pGC->stateChanges) |
- (selectMask & newDataMask);
- if (selectMask & newDataMask)
- pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
-}
-
-
-
/* CreateScratchGC(pScreen, depth)
like CreateGC, but doesn't do the default tile or stipple,
since we can't create them without already having a GC. any code
@@ -934,7 +923,7 @@ go with CreateGC() or ChangeGC().)
_X_EXPORT GCPtr
CreateScratchGC(ScreenPtr pScreen, unsigned depth)
{
- register GCPtr pGC;
+ GCPtr pGC;
pGC = AllocateGC(pScreen);
if (!pGC)
@@ -986,8 +975,8 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
void
FreeGCperDepth(int screenNum)
{
- register int i;
- register ScreenPtr pScreen;
+ int i;
+ ScreenPtr pScreen;
GCPtr *ppGC;
pScreen = screenInfo.screens[screenNum];
@@ -1002,8 +991,8 @@ FreeGCperDepth(int screenNum)
Bool
CreateGCperDepth(int screenNum)
{
- register int i;
- register ScreenPtr pScreen;
+ int i;
+ ScreenPtr pScreen;
DepthPtr pDepth;
GCPtr *ppGC;
@@ -1035,7 +1024,7 @@ CreateGCperDepth(int screenNum)
Bool
CreateDefaultStipple(int screenNum)
{
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
XID tmpval[3];
xRectangle rect;
CARD16 w, h;
@@ -1077,10 +1066,10 @@ FreeDefaultStipple(int screenNum)
}
_X_EXPORT int
-SetDashes(register GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash)
+SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash)
{
- register long i;
- register unsigned char *p, *indash;
+ long i;
+ unsigned char *p, *indash;
BITS32 maskQ = 0;
i = ndash;
@@ -1135,8 +1124,8 @@ SetDashes(register GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pd
_X_EXPORT int
VerifyRectOrder(int nrects, xRectangle *prects, int ordering)
{
- register xRectangle *prectP, *prectN;
- register int i;
+ xRectangle *prectP, *prectN;
+ int i;
switch(ordering)
{
@@ -1220,10 +1209,10 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects,
you use it often enough it will become real.)
*/
_X_EXPORT GCPtr
-GetScratchGC(register unsigned depth, register ScreenPtr pScreen)
+GetScratchGC(unsigned depth, ScreenPtr pScreen)
{
- register int i;
- register GCPtr pGC;
+ int i;
+ GCPtr pGC;
for (i=0; i<=pScreen->numDepths; i++)
if ( pScreen->GCperDepth[i]->depth == depth &&
@@ -1269,10 +1258,10 @@ mark it as available.
if not, free it for real
*/
_X_EXPORT void
-FreeScratchGC(register GCPtr pGC)
+FreeScratchGC(GCPtr pGC)
{
- register ScreenPtr pScreen = pGC->pScreen;
- register int i;
+ ScreenPtr pScreen = pGC->pScreen;
+ int i;
for (i=0; i<=pScreen->numDepths; i++)
{
diff --git a/dix/getevents.c b/dix/getevents.c
index 935112d85..3f636bc80 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -44,7 +44,7 @@
#ifdef XKB
#include <X11/extensions/XKBproto.h>
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
#endif
diff --git a/dix/glyphcurs.c b/dix/glyphcurs.c
index c1c545fa9..70b1ff8f7 100644
--- a/dix/glyphcurs.c
+++ b/dix/glyphcurs.c
@@ -74,10 +74,10 @@ cursor metrics.
*/
int
-ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, unsigned char **ppbits)
+ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, unsigned char **ppbits)
{
- register ScreenPtr pScreen;
- register GCPtr pGC;
+ ScreenPtr pScreen;
+ GCPtr pGC;
xRectangle rect;
PixmapPtr ppix;
long nby;
@@ -140,7 +140,7 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, uns
Bool
-CursorMetricsFromGlyph(register FontPtr pfont, unsigned ch, register CursorMetricPtr cm)
+CursorMetricsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm)
{
CharInfoPtr pci;
unsigned long nglyphs;
diff --git a/dix/grabs.c b/dix/grabs.c
index 0c2b05e89..714fea3e5 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -128,7 +128,7 @@ FreeGrab(GrabPtr pGrab)
int
DeletePassiveGrab(pointer value, XID id)
{
- register GrabPtr g, prev;
+ GrabPtr g, prev;
GrabPtr pGrab = (GrabPtr)value;
/* it is OK if the grab isn't found */
@@ -153,8 +153,8 @@ DeletePassiveGrab(pointer value, XID id)
static Mask *
DeleteDetailFromMask(Mask *pDetailMask, unsigned short detail)
{
- register Mask *mask;
- register int i;
+ Mask *mask;
+ int i;
mask = (Mask *)xalloc(sizeof(Mask) * MasksPerDetailMask);
if (mask)
@@ -305,7 +305,7 @@ AddPassiveGrabToList(GrabPtr pGrab)
Bool
DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
{
- register GrabPtr grab;
+ GrabPtr grab;
GrabPtr *deletes, *adds;
Mask ***updates, **details;
int i, ndels, nadds, nups;
diff --git a/dix/main.c b/dix/main.c
index 3a77533a5..92c30b639 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -361,9 +361,7 @@ main(int argc, char *argv[], char *envp[])
ResetScreenPrivates();
ResetWindowPrivates();
ResetGCPrivates();
-#ifdef PIXPRIV
ResetPixmapPrivates();
-#endif
ResetColormapPrivates();
ResetFontPrivateIndex();
ResetDevicePrivateIndex();
@@ -731,11 +729,9 @@ AddScreen(
pScreen->GCPrivateSizes = (unsigned *)NULL;
pScreen->totalGCSize =
((sizeof(GC) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
-#ifdef PIXPRIV
pScreen->PixmapPrivateLen = 0;
pScreen->PixmapPrivateSizes = (unsigned *)NULL;
pScreen->totalPixmapSize = BitmapBytePad(sizeof(PixmapRec)*8);
-#endif
pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
pScreen->CreateScreenResources = 0;
@@ -799,9 +795,7 @@ FreeScreen(ScreenPtr pScreen)
{
xfree(pScreen->WindowPrivateSizes);
xfree(pScreen->GCPrivateSizes);
-#ifdef PIXPRIV
xfree(pScreen->PixmapPrivateSizes);
-#endif
xfree(pScreen->devPrivates);
xfree(pScreen);
}
diff --git a/dix/pixmap.c b/dix/pixmap.c
index a5b7b064d..c280a3b94 100644
--- a/dix/pixmap.c
+++ b/dix/pixmap.c
@@ -109,7 +109,6 @@ _X_EXPORT PixmapPtr
AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
{
PixmapPtr pPixmap;
-#ifdef PIXPRIV
char *ptr;
DevUnion *ppriv;
unsigned *sizes;
@@ -136,9 +135,6 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
else
ppriv->ptr = (pointer)NULL;
}
-#else
- pPixmap = (PixmapPtr)xalloc(sizeof(PixmapRec) + pixDataSize);
-#endif
#ifdef _XSERVER64
if (pPixmap) {
diff --git a/dix/privates.c b/dix/privates.c
index b20a1dbf0..a66fc3df0 100644
--- a/dix/privates.c
+++ b/dix/privates.c
@@ -225,7 +225,7 @@ AllocateWindowPrivateIndex()
}
_X_EXPORT Bool
-AllocateWindowPrivate(register ScreenPtr pScreen, int index2, unsigned amount)
+AllocateWindowPrivate(ScreenPtr pScreen, int index2, unsigned amount)
{
unsigned oldamount;
@@ -275,7 +275,7 @@ AllocateGCPrivateIndex()
}
_X_EXPORT Bool
-AllocateGCPrivate(register ScreenPtr pScreen, int index2, unsigned amount)
+AllocateGCPrivate(ScreenPtr pScreen, int index2, unsigned amount)
{
unsigned oldamount;
@@ -309,7 +309,6 @@ AllocateGCPrivate(register ScreenPtr pScreen, int index2, unsigned amount)
/*
* pixmap private machinery
*/
-#ifdef PIXPRIV
static int pixmapPrivateCount;
void
@@ -325,7 +324,7 @@ AllocatePixmapPrivateIndex()
}
_X_EXPORT Bool
-AllocatePixmapPrivate(register ScreenPtr pScreen, int index2, unsigned amount)
+AllocatePixmapPrivate(ScreenPtr pScreen, int index2, unsigned amount)
{
unsigned oldamount;
@@ -355,7 +354,6 @@ AllocatePixmapPrivate(register ScreenPtr pScreen, int index2, unsigned amount)
pScreen->totalPixmapSize = BitmapBytePad(pScreen->totalPixmapSize * 8);
return TRUE;
}
-#endif
/*
diff --git a/dix/property.c b/dix/property.c
index d40284901..034d86f63 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -76,7 +76,7 @@ static void
PrintPropertys(WindowPtr pWin)
{
PropertyPtr pProp;
- register int j;
+ int j;
pProp = pWin->userProps;
while (pProp)
@@ -97,7 +97,7 @@ ProcRotateProperties(ClientPtr client)
int i, j, delta, rc;
REQUEST(xRotatePropertiesReq);
WindowPtr pWin;
- register Atom * atoms;
+ Atom * atoms;
PropertyPtr * props; /* array of pointer */
PropertyPtr pProp;
xEvent event;
@@ -622,7 +622,7 @@ ProcListProperties(ClientPtr client)
}
int
-ProcDeleteProperty(register ClientPtr client)
+ProcDeleteProperty(ClientPtr client)
{
WindowPtr pWin;
REQUEST(xDeletePropertyReq);
diff --git a/dix/resource.c b/dix/resource.c
index 4468f4575..a5a7eed80 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -246,7 +246,7 @@ CreateNewResourceClass()
return next;
}
-ClientResourceRec clientTable[MAXCLIENTS];
+static ClientResourceRec clientTable[MAXCLIENTS];
/*****************
* InitClientResources
@@ -257,7 +257,7 @@ ClientResourceRec clientTable[MAXCLIENTS];
Bool
InitClientResources(ClientPtr client)
{
- register int i, j;
+ int i, j;
if (client == serverClient)
{
@@ -314,7 +314,7 @@ InitClientResources(ClientPtr client)
static int
-Hash(int client, register XID id)
+Hash(int client, XID id)
{
id &= RESOURCE_ID_MASK;
switch (clientTable[client].hashsize)
@@ -337,12 +337,12 @@ Hash(int client, register XID id)
static XID
AvailableID(
- register int client,
- register XID id,
- register XID maxid,
- register XID goodid)
+ int client,
+ XID id,
+ XID maxid,
+ XID goodid)
{
- register ResourcePtr res;
+ ResourcePtr res;
if ((goodid >= id) && (goodid <= maxid))
return goodid;
@@ -360,10 +360,10 @@ AvailableID(
_X_EXPORT void
GetXIDRange(int client, Bool server, XID *minp, XID *maxp)
{
- register XID id, maxid;
- register ResourcePtr *resp;
- register ResourcePtr res;
- register int i;
+ XID id, maxid;
+ ResourcePtr *resp;
+ ResourcePtr res;
+ int i;
XID goodid;
id = (Mask)client << CLIENTOFFSET;
@@ -436,7 +436,7 @@ GetXIDList(ClientPtr pClient, unsigned count, XID *pids)
*/
_X_EXPORT XID
-FakeClientID(register int client)
+FakeClientID(int client)
{
XID id, maxid;
@@ -460,8 +460,8 @@ _X_EXPORT Bool
AddResource(XID id, RESTYPE type, pointer value)
{
int client;
- register ClientResourceRec *rrec;
- register ResourcePtr res, *head;
+ ClientResourceRec *rrec;
+ ResourcePtr res, *head;
#ifdef XSERVER_DTRACE
XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type));
@@ -498,10 +498,10 @@ AddResource(XID id, RESTYPE type, pointer value)
static void
RebuildTable(int client)
{
- register int j;
- register ResourcePtr res, next;
+ int j;
+ ResourcePtr res, next;
ResourcePtr **tails, *resources;
- register ResourcePtr **tptr, *rptr;
+ ResourcePtr **tptr, *rptr;
/*
* For now, preserve insertion order, since some ddx layers depend
@@ -548,9 +548,9 @@ _X_EXPORT void
FreeResource(XID id, RESTYPE skipDeleteFuncType)
{
int cid;
- register ResourcePtr res;
- register ResourcePtr *prev, *head;
- register int *eltptr;
+ ResourcePtr res;
+ ResourcePtr *prev, *head;
+ int *eltptr;
int elements;
Bool gotOne = FALSE;
@@ -600,8 +600,8 @@ _X_EXPORT void
FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
{
int cid;
- register ResourcePtr res;
- register ResourcePtr *prev, *head;
+ ResourcePtr res;
+ ResourcePtr *prev, *head;
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
{
head = &clientTable[cid].resources[Hash(cid, id)];
@@ -644,7 +644,7 @@ _X_EXPORT Bool
ChangeResourceValue (XID id, RESTYPE rtype, pointer value)
{
int cid;
- register ResourcePtr res;
+ ResourcePtr res;
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) && clientTable[cid].buckets)
{
@@ -675,10 +675,10 @@ FindClientResourcesByType(
FindResType func,
pointer cdata
){
- register ResourcePtr *resources;
- register ResourcePtr this, next;
+ ResourcePtr *resources;
+ ResourcePtr this, next;
int i, elements;
- register int *eltptr;
+ int *eltptr;
if (!client)
client = serverClient;
@@ -706,10 +706,10 @@ FindAllClientResources(
FindAllRes func,
pointer cdata
){
- register ResourcePtr *resources;
- register ResourcePtr this, next;
+ ResourcePtr *resources;
+ ResourcePtr this, next;
int i, elements;
- register int *eltptr;
+ int *eltptr;
if (!client)
client = serverClient;
@@ -796,8 +796,8 @@ FreeClientNeverRetainResources(ClientPtr client)
void
FreeClientResources(ClientPtr client)
{
- register ResourcePtr *resources;
- register ResourcePtr this;
+ ResourcePtr *resources;
+ ResourcePtr this;
int j;
/* This routine shouldn't be called with a null client, but just in
@@ -856,7 +856,7 @@ FreeAllResources()
}
_X_EXPORT Bool
-LegalNewID(XID id, register ClientPtr client)
+LegalNewID(XID id, ClientPtr client)
{
#ifdef PANORAMIX
@@ -887,7 +887,7 @@ _X_EXPORT pointer
SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype, Mask mode)
{
int cid;
- register ResourcePtr res;
+ ResourcePtr res;
pointer retval = NULL;
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
@@ -914,7 +914,7 @@ _X_EXPORT pointer
SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes, Mask mode)
{
int cid;
- register ResourcePtr res = NULL;
+ ResourcePtr res = NULL;
pointer retval = NULL;
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
diff --git a/dix/swaprep.c b/dix/swaprep.c
index 08ae6eb1a..7d3251ae3 100644
--- a/dix/swaprep.c
+++ b/dix/swaprep.c
@@ -73,10 +73,10 @@ static void SwapFont(xQueryFontReply *pr, Bool hasGlyphs);
* \param size size in bytes
*/
_X_EXPORT void
-Swap32Write(ClientPtr pClient, int size, register CARD32 *pbuf)
+Swap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
{
- register int i;
- register char n;
+ int i;
+ char n;
size >>= 2;
for(i = 0; i < size; i++)
@@ -97,7 +97,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
{
int bufsize = size;
CARD32 *pbufT;
- register CARD32 *from, *to, *fromLast, *toLast;
+ CARD32 *from, *to, *fromLast, *toLast;
CARD32 tmpbuf[1];
/* Allocate as big a buffer as we can... */
@@ -145,7 +145,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
{
int bufsize = size;
short *pbufT;
- register short *from, *to, *fromLast, *toLast;
+ short *from, *to, *fromLast, *toLast;
short tmpbuf[2];
/* Allocate as big a buffer as we can... */
@@ -189,7 +189,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
void
SGenericReply(ClientPtr pClient, int size, xGenericReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
(void)WriteToClient(pClient, size, (char *) pRep);
@@ -200,7 +200,7 @@ void
SGetWindowAttributesReply(ClientPtr pClient, int size,
xGetWindowAttributesReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -218,7 +218,7 @@ SGetWindowAttributesReply(ClientPtr pClient, int size,
void
SGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->root, n);
@@ -233,7 +233,7 @@ SGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply *pRep)
void
SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -246,7 +246,7 @@ SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply *pRep)
void
SInternAtomReply(ClientPtr pClient, int size, xInternAtomReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->atom, n);
@@ -256,7 +256,7 @@ SInternAtomReply(ClientPtr pClient, int size, xInternAtomReply *pRep)
void
SGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -268,7 +268,7 @@ SGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply *pRep)
void
SGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -281,7 +281,7 @@ SGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply *pRep)
void
SListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -293,7 +293,7 @@ void
SGetSelectionOwnerReply(ClientPtr pClient, int size,
xGetSelectionOwnerReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->owner, n);
@@ -304,7 +304,7 @@ SGetSelectionOwnerReply(ClientPtr pClient, int size,
void
SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->root, n);
@@ -317,10 +317,10 @@ SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply *pRep)
(void)WriteToClient(pClient, size, (char *) pRep);
}
-void
+static void
SwapTimecoord(xTimecoord* pCoord)
{
- register char n;
+ char n;
swapl(&pCoord->time, n);
swaps(&pCoord->x, n);
@@ -346,7 +346,7 @@ SwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord *pRep)
void
SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -357,7 +357,7 @@ SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply *pRep)
void
STranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->child, n);
@@ -369,7 +369,7 @@ STranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply *pRep)
void
SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->focus, n);
@@ -380,7 +380,7 @@ SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply *pRep)
void
SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -390,7 +390,7 @@ SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep)
static void
SwapCharInfo(xCharInfo *pInfo)
{
- register char n;
+ char n;
swaps(&pInfo->leftSideBearing, n);
swaps(&pInfo->rightSideBearing, n);
@@ -403,7 +403,7 @@ SwapCharInfo(xCharInfo *pInfo)
static void
SwapFontInfo(xQueryFontReply *pr)
{
- register char n;
+ char n;
swaps(&pr->minCharOrByte2, n);
swaps(&pr->maxCharOrByte2, n);
@@ -423,7 +423,7 @@ SwapFont(xQueryFontReply *pr, Bool hasGlyphs)
xCharInfo * pxci;
unsigned nchars, nprops;
char *pby;
- register char n;
+ char n;
swaps(&pr->sequenceNumber, n);
swapl(&pr->length, n);
@@ -458,7 +458,7 @@ SQueryFontReply(ClientPtr pClient, int size, xQueryFontReply *pRep)
void
SQueryTextExtentsReply(ClientPtr pClient, int size, xQueryTextExtentsReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swaps(&pRep->fontAscent, n);
@@ -474,7 +474,7 @@ SQueryTextExtentsReply(ClientPtr pClient, int size, xQueryTextExtentsReply *pRep
void
SListFontsReply(ClientPtr pClient, int size, xListFontsReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -493,7 +493,7 @@ SListFontsWithInfoReply(ClientPtr pClient, int size,
void
SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -504,7 +504,7 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply *pRep)
void
SGetImageReply(ClientPtr pClient, int size, xGetImageReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -517,7 +517,7 @@ void
SListInstalledColormapsReply(ClientPtr pClient, int size,
xListInstalledColormapsReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -531,7 +531,7 @@ SAllocColorReply(pClient, size, pRep)
int size;
xAllocColorReply *pRep;
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swaps(&pRep->red, n);
@@ -544,7 +544,7 @@ SAllocColorReply(pClient, size, pRep)
void
SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->pixel, n);
@@ -560,7 +560,7 @@ SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply *pRep)
void
SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -573,7 +573,7 @@ SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply *pRep)
void
SAllocColorPlanesReply(ClientPtr pClient, int size, xAllocColorPlanesReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -584,10 +584,10 @@ SAllocColorPlanesReply(ClientPtr pClient, int size, xAllocColorPlanesReply *pRep
(void)WriteToClient(pClient, size, (char *) pRep);
}
-void
+static void
SwapRGB(xrgb *prgb)
{
- register char n;
+ char n;
swaps(&prgb->red, n);
swaps(&prgb->green, n);
@@ -613,7 +613,7 @@ SQColorsExtend(ClientPtr pClient, int size, xrgb *prgb)
void
SQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply* pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -624,7 +624,7 @@ SQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply* pRep)
void
SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swaps(&pRep->exactRed, n);
@@ -639,7 +639,7 @@ SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply *pRep)
void
SQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swaps(&pRep->width, n);
@@ -650,7 +650,7 @@ SQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply *pRep)
void
SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -661,7 +661,7 @@ void
SGetKeyboardMappingReply(ClientPtr pClient, int size,
xGetKeyboardMappingReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -672,7 +672,7 @@ void
SGetPointerMappingReply(ClientPtr pClient, int size,
xGetPointerMappingReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -683,7 +683,7 @@ void
SGetModifierMappingReply(ClientPtr pClient, int size,
xGetModifierMappingReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -693,7 +693,7 @@ SGetModifierMappingReply(ClientPtr pClient, int size,
void
SGetKeyboardControlReply(ClientPtr pClient, int size, xGetKeyboardControlReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -706,7 +706,7 @@ SGetKeyboardControlReply(ClientPtr pClient, int size, xGetKeyboardControlReply *
void
SGetPointerControlReply(ClientPtr pClient, int size, xGetPointerControlReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swaps(&pRep->accelNumerator, n);
@@ -718,7 +718,7 @@ SGetPointerControlReply(ClientPtr pClient, int size, xGetPointerControlReply *pR
void
SGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swaps(&pRep->timeout, n);
@@ -734,7 +734,7 @@ SLHostsExtend(ClientPtr pClient, int size, char *buf)
while (bufT < endbuf) {
xHostEntry *host = (xHostEntry *) bufT;
int len = host->length;
- register char n;
+ char n;
swaps (&host->length, n);
bufT += sizeof (xHostEntry) + (((len + 3) >> 2) << 2);
}
@@ -744,7 +744,7 @@ SLHostsExtend(ClientPtr pClient, int size, char *buf)
void
SListHostsReply(ClientPtr pClient, int size, xListHostsReply *pRep)
{
- register char n;
+ char n;
swaps(&pRep->sequenceNumber, n);
swapl(&pRep->length, n);
@@ -1159,6 +1159,58 @@ SKeymapNotifyEvent(xEvent *from, xEvent *to)
*to = *from;
}
+static void
+SwapConnSetup(xConnSetup *pConnSetup, xConnSetup *pConnSetupT)
+{
+ cpswapl(pConnSetup->release, pConnSetupT->release);
+ cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase);
+ cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask);
+ cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize);
+ cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor);
+ cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize);
+ pConnSetupT->minKeyCode = pConnSetup->minKeyCode;
+ pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode;
+ pConnSetupT->numRoots = pConnSetup->numRoots;
+ pConnSetupT->numFormats = pConnSetup->numFormats;
+ pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder;
+ pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder;
+ pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit;
+ pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad;
+}
+
+static void
+SwapWinRoot(xWindowRoot *pRoot, xWindowRoot *pRootT)
+{
+ cpswapl(pRoot->windowId, pRootT->windowId);
+ cpswapl(pRoot->defaultColormap, pRootT->defaultColormap);
+ cpswapl(pRoot->whitePixel, pRootT->whitePixel);
+ cpswapl(pRoot->blackPixel, pRootT->blackPixel);
+ cpswapl(pRoot->currentInputMask, pRootT->currentInputMask);
+ cpswaps(pRoot->pixWidth, pRootT->pixWidth);
+ cpswaps(pRoot->pixHeight, pRootT->pixHeight);
+ cpswaps(pRoot->mmWidth, pRootT->mmWidth);
+ cpswaps(pRoot->mmHeight, pRootT->mmHeight);
+ cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps);
+ cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps);
+ cpswapl(pRoot->rootVisualID, pRootT->rootVisualID);
+ pRootT->backingStore = pRoot->backingStore;
+ pRootT->saveUnders = pRoot->saveUnders;
+ pRootT->rootDepth = pRoot->rootDepth;
+ pRootT->nDepths = pRoot->nDepths;
+}
+
+static void
+SwapVisual(xVisualType *pVis, xVisualType *pVisT)
+{
+ cpswapl(pVis->visualID, pVisT->visualID);
+ pVisT->class = pVis->class;
+ pVisT->bitsPerRGB = pVis->bitsPerRGB;
+ cpswaps(pVis->colormapEntries, pVisT->colormapEntries);
+ cpswapl(pVis->redMask, pVisT->redMask);
+ cpswapl(pVis->greenMask, pVisT->greenMask);
+ cpswapl(pVis->blueMask, pVisT->blueMask);
+}
+
_X_EXPORT void
SwapConnSetupInfo(
char *pInfo,
@@ -1210,7 +1262,6 @@ SwapConnSetupInfo(
}
}
-
void
WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
{
@@ -1227,58 +1278,6 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
DEALLOCATE_LOCAL(pInfoTBase);
}
-void
-SwapConnSetup(xConnSetup *pConnSetup, xConnSetup *pConnSetupT)
-{
- cpswapl(pConnSetup->release, pConnSetupT->release);
- cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase);
- cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask);
- cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize);
- cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor);
- cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize);
- pConnSetupT->minKeyCode = pConnSetup->minKeyCode;
- pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode;
- pConnSetupT->numRoots = pConnSetup->numRoots;
- pConnSetupT->numFormats = pConnSetup->numFormats;
- pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder;
- pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder;
- pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit;
- pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad;
-}
-
-void
-SwapWinRoot(xWindowRoot *pRoot, xWindowRoot *pRootT)
-{
- cpswapl(pRoot->windowId, pRootT->windowId);
- cpswapl(pRoot->defaultColormap, pRootT->defaultColormap);
- cpswapl(pRoot->whitePixel, pRootT->whitePixel);
- cpswapl(pRoot->blackPixel, pRootT->blackPixel);
- cpswapl(pRoot->currentInputMask, pRootT->currentInputMask);
- cpswaps(pRoot->pixWidth, pRootT->pixWidth);
- cpswaps(pRoot->pixHeight, pRootT->pixHeight);
- cpswaps(pRoot->mmWidth, pRootT->mmWidth);
- cpswaps(pRoot->mmHeight, pRootT->mmHeight);
- cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps);
- cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps);
- cpswapl(pRoot->rootVisualID, pRootT->rootVisualID);
- pRootT->backingStore = pRoot->backingStore;
- pRootT->saveUnders = pRoot->saveUnders;
- pRootT->rootDepth = pRoot->rootDepth;
- pRootT->nDepths = pRoot->nDepths;
-}
-
-void
-SwapVisual(xVisualType *pVis, xVisualType *pVisT)
-{
- cpswapl(pVis->visualID, pVisT->visualID);
- pVisT->class = pVis->class;
- pVisT->bitsPerRGB = pVis->bitsPerRGB;
- cpswaps(pVis->colormapEntries, pVisT->colormapEntries);
- cpswapl(pVis->redMask, pVisT->redMask);
- cpswapl(pVis->greenMask, pVisT->greenMask);
- cpswapl(pVis->blueMask, pVisT->blueMask);
-}
-
_X_EXPORT void
SwapConnSetupPrefix(xConnSetupPrefix *pcspFrom, xConnSetupPrefix *pcspTo)
{
diff --git a/dix/swapreq.c b/dix/swapreq.c
index a6a211515..ad60d17da 100644
--- a/dix/swapreq.c
+++ b/dix/swapreq.c
@@ -63,9 +63,9 @@ SOFTWARE.
/* Byte swap a list of longs */
_X_EXPORT void
-SwapLongs (register CARD32 *list, register unsigned long count)
+SwapLongs (CARD32 *list, unsigned long count)
{
- register char n;
+ char n;
while (count >= 8) {
swapl(list+0, n);
@@ -89,9 +89,9 @@ SwapLongs (register CARD32 *list, register unsigned long count)
/* Byte swap a list of shorts */
_X_EXPORT void
-SwapShorts (register short *list, register unsigned long count)
+SwapShorts (short *list, unsigned long count)
{
- register char n;
+ char n;
while (count >= 16) {
swaps(list+0, n);
@@ -124,9 +124,9 @@ SwapShorts (register short *list, register unsigned long count)
/* The following is used for all requests that have
no fields to be swapped (except "length") */
int
-SProcSimpleReq(register ClientPtr client)
+SProcSimpleReq(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xReq);
swaps(&stuff->length, n);
@@ -137,9 +137,9 @@ SProcSimpleReq(register ClientPtr client)
only a single 32-bit field to be swapped, coming
right after the "length" field */
int
-SProcResourceReq(register ClientPtr client)
+SProcResourceReq(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xResourceReq);
swaps(&stuff->length, n);
@@ -149,9 +149,9 @@ SProcResourceReq(register ClientPtr client)
}
int
-SProcCreateWindow(register ClientPtr client)
+SProcCreateWindow(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xCreateWindowReq);
swaps(&stuff->length, n);
@@ -171,9 +171,9 @@ SProcCreateWindow(register ClientPtr client)
}
int
-SProcChangeWindowAttributes(register ClientPtr client)
+SProcChangeWindowAttributes(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xChangeWindowAttributesReq);
swaps(&stuff->length, n);
@@ -185,9 +185,9 @@ SProcChangeWindowAttributes(register ClientPtr client)
}
int
-SProcReparentWindow(register ClientPtr client)
+SProcReparentWindow(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xReparentWindowReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xReparentWindowReq);
@@ -199,9 +199,9 @@ SProcReparentWindow(register ClientPtr client)
}
int
-SProcConfigureWindow(register ClientPtr client)
+SProcConfigureWindow(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xConfigureWindowReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
@@ -214,9 +214,9 @@ SProcConfigureWindow(register ClientPtr client)
int
-SProcInternAtom(register ClientPtr client)
+SProcInternAtom(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xInternAtomReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xInternAtomReq);
@@ -225,9 +225,9 @@ SProcInternAtom(register ClientPtr client)
}
int
-SProcChangeProperty(register ClientPtr client)
+SProcChangeProperty(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xChangePropertyReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
@@ -249,9 +249,9 @@ SProcChangeProperty(register ClientPtr client)
}
int
-SProcDeleteProperty(register ClientPtr client)
+SProcDeleteProperty(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xDeletePropertyReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xDeletePropertyReq);
@@ -262,9 +262,9 @@ SProcDeleteProperty(register ClientPtr client)
}
int
-SProcGetProperty(register ClientPtr client)
+SProcGetProperty(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xGetPropertyReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xGetPropertyReq);
@@ -277,9 +277,9 @@ SProcGetProperty(register ClientPtr client)
}
int
-SProcSetSelectionOwner(register ClientPtr client)
+SProcSetSelectionOwner(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xSetSelectionOwnerReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
@@ -290,9 +290,9 @@ SProcSetSelectionOwner(register ClientPtr client)
}
int
-SProcConvertSelection(register ClientPtr client)
+SProcConvertSelection(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xConvertSelectionReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xConvertSelectionReq);
@@ -305,9 +305,9 @@ SProcConvertSelection(register ClientPtr client)
}
int
-SProcSendEvent(register ClientPtr client)
+SProcSendEvent(ClientPtr client)
{
- register char n;
+ char n;
xEvent eventT;
EventSwapPtr proc;
REQUEST(xSendEventReq);
@@ -327,9 +327,9 @@ SProcSendEvent(register ClientPtr client)
}
int
-SProcGrabPointer(register ClientPtr client)
+SProcGrabPointer(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xGrabPointerReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xGrabPointerReq);
@@ -342,9 +342,9 @@ SProcGrabPointer(register ClientPtr client)
}
int
-SProcGrabButton(register ClientPtr client)
+SProcGrabButton(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xGrabButtonReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xGrabButtonReq);
@@ -357,9 +357,9 @@ SProcGrabButton(register ClientPtr client)
}
int
-SProcUngrabButton(register ClientPtr client)
+SProcUngrabButton(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xUngrabButtonReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xUngrabButtonReq);
@@ -369,9 +369,9 @@ SProcUngrabButton(register ClientPtr client)
}
int
-SProcChangeActivePointerGrab(register ClientPtr client)
+SProcChangeActivePointerGrab(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xChangeActivePointerGrabReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq);
@@ -382,9 +382,9 @@ SProcChangeActivePointerGrab(register ClientPtr client)
}
int
-SProcGrabKeyboard(register ClientPtr client)
+SProcGrabKeyboard(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xGrabKeyboardReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xGrabKeyboardReq);
@@ -394,9 +394,9 @@ SProcGrabKeyboard(register ClientPtr client)
}
int
-SProcGrabKey(register ClientPtr client)
+SProcGrabKey(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xGrabKeyReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xGrabKeyReq);
@@ -406,9 +406,9 @@ SProcGrabKey(register ClientPtr client)
}
int
-SProcUngrabKey(register ClientPtr client)
+SProcUngrabKey(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xUngrabKeyReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xUngrabKeyReq);
@@ -418,9 +418,9 @@ SProcUngrabKey(register ClientPtr client)
}
int
-SProcGetMotionEvents(register ClientPtr client)
+SProcGetMotionEvents(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xGetMotionEventsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xGetMotionEventsReq);
@@ -431,9 +431,9 @@ SProcGetMotionEvents(register ClientPtr client)
}
int
-SProcTranslateCoords(register ClientPtr client)
+SProcTranslateCoords(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xTranslateCoordsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xTranslateCoordsReq);
@@ -445,9 +445,9 @@ SProcTranslateCoords(register ClientPtr client)
}
int
-SProcWarpPointer(register ClientPtr client)
+SProcWarpPointer(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xWarpPointerReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xWarpPointerReq);
@@ -463,9 +463,9 @@ SProcWarpPointer(register ClientPtr client)
}
int
-SProcSetInputFocus(register ClientPtr client)
+SProcSetInputFocus(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xSetInputFocusReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xSetInputFocusReq);
@@ -475,9 +475,9 @@ SProcSetInputFocus(register ClientPtr client)
}
int
-SProcOpenFont(register ClientPtr client)
+SProcOpenFont(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xOpenFontReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xOpenFontReq);
@@ -487,9 +487,9 @@ SProcOpenFont(register ClientPtr client)
}
int
-SProcListFonts(register ClientPtr client)
+SProcListFonts(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xListFontsReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xListFontsReq);
@@ -499,9 +499,9 @@ SProcListFonts(register ClientPtr client)
}
int
-SProcListFontsWithInfo(register ClientPtr client)
+SProcListFontsWithInfo(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xListFontsWithInfoReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xListFontsWithInfoReq);
@@ -511,9 +511,9 @@ SProcListFontsWithInfo(register ClientPtr client)
}
int
-SProcSetFontPath(register ClientPtr client)
+SProcSetFontPath(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xSetFontPathReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
@@ -522,9 +522,9 @@ SProcSetFontPath(register ClientPtr client)
}
int
-SProcCreatePixmap(register ClientPtr client)
+SProcCreatePixmap(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xCreatePixmapReq);
swaps(&stuff->length, n);
@@ -537,9 +537,9 @@ SProcCreatePixmap(register ClientPtr client)
}
int
-SProcCreateGC(register ClientPtr client)
+SProcCreateGC(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xCreateGCReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xCreateGCReq);
@@ -551,9 +551,9 @@ SProcCreateGC(register ClientPtr client)
}
int
-SProcChangeGC(register ClientPtr client)
+SProcChangeGC(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xChangeGCReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xChangeGCReq);
@@ -564,9 +564,9 @@ SProcChangeGC(register ClientPtr client)
}
int
-SProcCopyGC(register ClientPtr client)
+SProcCopyGC(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xCopyGCReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xCopyGCReq);
@@ -577,9 +577,9 @@ SProcCopyGC(register ClientPtr client)
}
int
-SProcSetDashes(register ClientPtr client)
+SProcSetDashes(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xSetDashesReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xSetDashesReq);
@@ -591,9 +591,9 @@ SProcSetDashes(register ClientPtr client)
}
int
-SProcSetClipRectangles(register ClientPtr client)
+SProcSetClipRectangles(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xSetClipRectanglesReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
@@ -605,9 +605,9 @@ SProcSetClipRectangles(register ClientPtr client)
}
int
-SProcClearToBackground(register ClientPtr client)
+SProcClearToBackground(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xClearAreaReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xClearAreaReq);
@@ -620,9 +620,9 @@ SProcClearToBackground(register ClientPtr client)
}
int
-SProcCopyArea(register ClientPtr client)
+SProcCopyArea(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xCopyAreaReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xCopyAreaReq);
@@ -639,9 +639,9 @@ SProcCopyArea(register ClientPtr client)
}
int
-SProcCopyPlane(register ClientPtr client)
+SProcCopyPlane(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xCopyPlaneReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xCopyPlaneReq);
@@ -661,9 +661,9 @@ SProcCopyPlane(register ClientPtr client)
/* The following routine is used for all Poly drawing requests
(except FillPoly, which uses a different request format) */
int
-SProcPoly(register ClientPtr client)
+SProcPoly(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xPolyPointReq);
swaps(&stuff->length, n);
@@ -678,9 +678,9 @@ SProcPoly(register ClientPtr client)
is longer than xPolyPointReq, and we don't want to swap
the difference as shorts! */
int
-SProcFillPoly(register ClientPtr client)
+SProcFillPoly(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xFillPolyReq);
swaps(&stuff->length, n);
@@ -692,9 +692,9 @@ SProcFillPoly(register ClientPtr client)
}
int
-SProcPutImage(register ClientPtr client)
+SProcPutImage(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xPutImageReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xPutImageReq);
@@ -710,9 +710,9 @@ SProcPutImage(register ClientPtr client)
}
int
-SProcGetImage(register ClientPtr client)
+SProcGetImage(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xGetImageReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xGetImageReq);
@@ -728,9 +728,9 @@ SProcGetImage(register ClientPtr client)
/* ProcPolyText used for both PolyText8 and PolyText16 */
int
-SProcPolyText(register ClientPtr client)
+SProcPolyText(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xPolyTextReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xPolyTextReq);
@@ -744,9 +744,9 @@ SProcPolyText(register ClientPtr client)
/* ProcImageText used for both ImageText8 and ImageText16 */
int
-SProcImageText(register ClientPtr client)
+SProcImageText(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xImageTextReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xImageTextReq);
@@ -758,9 +758,9 @@ SProcImageText(register ClientPtr client)
}
int
-SProcCreateColormap(register ClientPtr client)
+SProcCreateColormap(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xCreateColormapReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xCreateColormapReq);
@@ -772,9 +772,9 @@ SProcCreateColormap(register ClientPtr client)
int
-SProcCopyColormapAndFree(register ClientPtr client)
+SProcCopyColormapAndFree(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xCopyColormapAndFreeReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
@@ -785,9 +785,9 @@ SProcCopyColormapAndFree(register ClientPtr client)
}
int
-SProcAllocColor(register ClientPtr client)
+SProcAllocColor(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xAllocColorReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xAllocColorReq);
@@ -799,9 +799,9 @@ SProcAllocColor(register ClientPtr client)
}
int
-SProcAllocNamedColor(register ClientPtr client)
+SProcAllocNamedColor(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xAllocNamedColorReq);
swaps(&stuff->length, n);
@@ -812,9 +812,9 @@ SProcAllocNamedColor(register ClientPtr client)
}
int
-SProcAllocColorCells(register ClientPtr client)
+SProcAllocColorCells(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xAllocColorCellsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xAllocColorCellsReq);
@@ -825,9 +825,9 @@ SProcAllocColorCells(register ClientPtr client)
}
int
-SProcAllocColorPlanes(register ClientPtr client)
+SProcAllocColorPlanes(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xAllocColorPlanesReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
@@ -840,9 +840,9 @@ SProcAllocColorPlanes(register ClientPtr client)
}
int
-SProcFreeColors(register ClientPtr client)
+SProcFreeColors(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xFreeColorsReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
@@ -856,7 +856,7 @@ SProcFreeColors(register ClientPtr client)
_X_EXPORT void
SwapColorItem(xColorItem *pItem)
{
- register char n;
+ char n;
swapl(&pItem->pixel, n);
swaps(&pItem->red, n);
@@ -865,9 +865,9 @@ SwapColorItem(xColorItem *pItem)
}
int
-SProcStoreColors(register ClientPtr client)
+SProcStoreColors(ClientPtr client)
{
- register char n;
+ char n;
long count;
xColorItem *pItem;
@@ -882,9 +882,9 @@ SProcStoreColors(register ClientPtr client)
}
int
-SProcStoreNamedColor (register ClientPtr client)
+SProcStoreNamedColor (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xStoreNamedColorReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xStoreNamedColorReq);
@@ -895,9 +895,9 @@ SProcStoreNamedColor (register ClientPtr client)
}
int
-SProcQueryColors (register ClientPtr client)
+SProcQueryColors (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xQueryColorsReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xQueryColorsReq);
@@ -907,9 +907,9 @@ SProcQueryColors (register ClientPtr client)
}
int
-SProcLookupColor (register ClientPtr client)
+SProcLookupColor (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xLookupColorReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xLookupColorReq);
@@ -919,9 +919,9 @@ SProcLookupColor (register ClientPtr client)
}
int
-SProcCreateCursor (register ClientPtr client)
+SProcCreateCursor (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xCreateCursorReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xCreateCursorReq);
@@ -940,9 +940,9 @@ SProcCreateCursor (register ClientPtr client)
}
int
-SProcCreateGlyphCursor (register ClientPtr client)
+SProcCreateGlyphCursor (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xCreateGlyphCursorReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xCreateGlyphCursorReq);
@@ -962,9 +962,9 @@ SProcCreateGlyphCursor (register ClientPtr client)
int
-SProcRecolorCursor (register ClientPtr client)
+SProcRecolorCursor (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xRecolorCursorReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xRecolorCursorReq);
@@ -979,9 +979,9 @@ SProcRecolorCursor (register ClientPtr client)
}
int
-SProcQueryBestSize (register ClientPtr client)
+SProcQueryBestSize (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xQueryBestSizeReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xQueryBestSizeReq);
@@ -993,9 +993,9 @@ SProcQueryBestSize (register ClientPtr client)
}
int
-SProcQueryExtension (register ClientPtr client)
+SProcQueryExtension (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xQueryExtensionReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xQueryExtensionReq);
@@ -1004,9 +1004,9 @@ SProcQueryExtension (register ClientPtr client)
}
int
-SProcChangeKeyboardMapping (register ClientPtr client)
+SProcChangeKeyboardMapping (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xChangeKeyboardMappingReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq);
@@ -1016,9 +1016,9 @@ SProcChangeKeyboardMapping (register ClientPtr client)
int
-SProcChangeKeyboardControl (register ClientPtr client)
+SProcChangeKeyboardControl (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xChangeKeyboardControlReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
@@ -1028,9 +1028,9 @@ SProcChangeKeyboardControl (register ClientPtr client)
}
int
-SProcChangePointerControl (register ClientPtr client)
+SProcChangePointerControl (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xChangePointerControlReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xChangePointerControlReq);
@@ -1042,9 +1042,9 @@ SProcChangePointerControl (register ClientPtr client)
int
-SProcSetScreenSaver (register ClientPtr client)
+SProcSetScreenSaver (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xSetScreenSaverReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xSetScreenSaverReq);
@@ -1054,9 +1054,9 @@ SProcSetScreenSaver (register ClientPtr client)
}
int
-SProcChangeHosts (register ClientPtr client)
+SProcChangeHosts (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xChangeHostsReq);
swaps(&stuff->length, n);
@@ -1066,9 +1066,9 @@ SProcChangeHosts (register ClientPtr client)
}
-int SProcRotateProperties (register ClientPtr client)
+int SProcRotateProperties (ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xRotatePropertiesReq);
swaps(&stuff->length, n);
REQUEST_AT_LEAST_SIZE(xRotatePropertiesReq);
@@ -1080,9 +1080,9 @@ int SProcRotateProperties (register ClientPtr client)
}
int
-SProcNoOperation(register ClientPtr client)
+SProcNoOperation(ClientPtr client)
{
- register char n;
+ char n;
REQUEST(xReq);
swaps(&stuff->length, n);
return ((* ProcVector[X_NoOperation])(client));
@@ -1091,7 +1091,7 @@ SProcNoOperation(register ClientPtr client)
void
SwapConnClientPrefix(xConnClientPrefix *pCCP)
{
- register char n;
+ char n;
swaps(&pCCP->majorVersion, n);
swaps(&pCCP->minorVersion, n);
diff --git a/dix/window.c b/dix/window.c
index e33140dd4..96002eb1f 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -220,10 +220,10 @@ PrintWindowTree(void)
#endif
_X_EXPORT int
-TraverseTree(register WindowPtr pWin, VisitWindowProcPtr func, pointer data)
+TraverseTree(WindowPtr pWin, VisitWindowProcPtr func, pointer data)
{
- register int result;
- register WindowPtr pChild;
+ int result;
+ WindowPtr pChild;
if (!(pChild = pWin))
return(WT_NOMATCH);
@@ -269,7 +269,7 @@ Bool enableBackingStore = FALSE;
Bool disableSaveUnders = FALSE;
static void
-SetWindowToDefaults(register WindowPtr pWin)
+SetWindowToDefaults(WindowPtr pWin)
{
pWin->prevSib = NullWindow;
pWin->firstChild = NullWindow;
@@ -297,10 +297,6 @@ SetWindowToDefaults(register WindowPtr pWin)
pWin->deliverableEvents = 0;
pWin->dontPropagate = 0;
pWin->forcedBS = FALSE;
-#ifdef NEED_DBE_BUF_BITS
- pWin->srcBuffer = DBE_FRONT_BUFFER;
- pWin->dstBuffer = DBE_FRONT_BUFFER;
-#endif
#ifdef COMPOSITE
pWin->redirectDraw = 0;
#endif
@@ -313,8 +309,8 @@ MakeRootTile(WindowPtr pWin)
GCPtr pGC;
unsigned char back[128];
int len = BitmapBytePad(sizeof(long));
- register unsigned char *from, *to;
- register int i, j;
+ unsigned char *from, *to;
+ int i, j;
pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4,
pScreen->rootDepth);
@@ -353,11 +349,11 @@ WindowPtr
AllocateWindow(ScreenPtr pScreen)
{
WindowPtr pWin;
- register char *ptr;
- register DevUnion *ppriv;
- register unsigned *sizes;
- register unsigned size;
- register int i;
+ char *ptr;
+ DevUnion *ppriv;
+ unsigned *sizes;
+ unsigned size;
+ int i;
pWin = (WindowPtr)xalloc(pScreen->totalWindowSize);
if (pWin)
@@ -539,10 +535,10 @@ InitRootWindow(WindowPtr pWin)
* window from which the region came.
*/
-void
-ClippedRegionFromBox(register WindowPtr pWin, RegionPtr Rgn,
- register int x, register int y,
- register int w, register int h)
+static void
+ClippedRegionFromBox(WindowPtr pWin, RegionPtr Rgn,
+ int x, int y,
+ int w, int h)
{
ScreenPtr pScreen;
BoxRec box;
@@ -579,7 +575,7 @@ RegisterRealChildHeadProc (RealChildHeadProc proc)
WindowPtr
-RealChildHead(register WindowPtr pWin)
+RealChildHead(WindowPtr pWin)
{
if (realChildHeadProc) {
return realChildHeadProc (pWin);
@@ -599,19 +595,19 @@ RealChildHead(register WindowPtr pWin)
*****/
_X_EXPORT WindowPtr
-CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w,
- unsigned h, unsigned bw, unsigned class, register Mask vmask, XID *vlist,
+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)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
WindowPtr pHead;
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
xEvent event;
int idepth, ivisual;
Bool fOK;
DepthPtr pDepth;
PixmapFormatRec *format;
- register WindowOptPtr ancwopt;
+ WindowOptPtr ancwopt;
if (class == CopyFromParent)
class = pParent->drawable.class;
@@ -836,9 +832,29 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w,
}
static void
-FreeWindowResources(register WindowPtr pWin)
+DisposeWindowOptional (WindowPtr pWin)
{
- register ScreenPtr pScreen = pWin->drawable.pScreen;
+ 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;
+ xfree (pWin->optional);
+ pWin->optional = NULL;
+}
+
+static void
+FreeWindowResources(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
DeleteWindowFromAnySaveSet(pWin);
DeleteWindowFromAnySelections(pWin);
@@ -869,7 +885,7 @@ FreeWindowResources(register WindowPtr pWin)
static void
CrushTree(WindowPtr pWin)
{
- register WindowPtr pChild, pSib, pParent;
+ WindowPtr pChild, pSib, pParent;
UnrealizeWindowProcPtr UnrealizeWindow;
xEvent event;
@@ -926,8 +942,8 @@ CrushTree(WindowPtr pWin)
int
DeleteWindow(pointer value, XID wid)
{
- register WindowPtr pParent;
- register WindowPtr pWin = (WindowPtr)value;
+ WindowPtr pParent;
+ WindowPtr pWin = (WindowPtr)value;
xEvent event;
UnmapWindow(pWin, FALSE);
@@ -959,7 +975,7 @@ DeleteWindow(pointer value, XID wid)
}
void
-DestroySubwindows(register WindowPtr pWin, ClientPtr client)
+DestroySubwindows(WindowPtr pWin, ClientPtr client)
{
/* XXX
* The protocol is quite clear that each window should be
@@ -986,10 +1002,10 @@ DestroySubwindows(register WindowPtr pWin, ClientPtr client)
*****/
_X_EXPORT int
-ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
+ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
{
- register Mask index2;
- register XID *pVlist;
+ Mask index2;
+ XID *pVlist;
PixmapPtr pPixmap;
Pixmap pixID;
CursorPtr pCursor, pOldCursor;
@@ -999,9 +1015,9 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
ColormapPtr pCmap;
xEvent xE;
int result;
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
Mask vmaskCopy = 0;
- register Mask tmask;
+ Mask tmask;
unsigned int val;
int error;
Bool checkOptional = FALSE;
@@ -1520,7 +1536,7 @@ PatchUp:
*****/
void
-GetWindowAttributes(register WindowPtr pWin, ClientPtr client, xGetWindowAttributesReply *wa)
+GetWindowAttributes(WindowPtr pWin, ClientPtr client, xGetWindowAttributesReply *wa)
{
wa->type = X_Reply;
wa->bitGravity = pWin->bitGravity;
@@ -1556,9 +1572,9 @@ GetWindowAttributes(register WindowPtr pWin, ClientPtr client, xGetWindowAttribu
_X_EXPORT WindowPtr
-MoveWindowInStack(register WindowPtr pWin, register WindowPtr pNextSib)
+MoveWindowInStack(WindowPtr pWin, WindowPtr pNextSib)
{
- register WindowPtr pParent = pWin->parent;
+ WindowPtr pParent = pWin->parent;
WindowPtr pFirstChange = pWin; /* highest window where list changes */
if (pWin->nextSib != pNextSib)
@@ -1640,7 +1656,7 @@ MoveWindowInStack(register WindowPtr pWin, register WindowPtr pNextSib)
}
_X_EXPORT RegionPtr
-CreateUnclippedWinSize (register WindowPtr pWin)
+CreateUnclippedWinSize (WindowPtr pWin)
{
RegionPtr pRgn;
BoxRec box;
@@ -1668,7 +1684,7 @@ CreateUnclippedWinSize (register WindowPtr pWin)
}
_X_EXPORT void
-SetWinSize (register WindowPtr pWin)
+SetWinSize (WindowPtr pWin)
{
#ifdef COMPOSITE
if (pWin->redirectDraw)
@@ -1707,7 +1723,7 @@ SetWinSize (register WindowPtr pWin)
}
_X_EXPORT void
-SetBorderSize (register WindowPtr pWin)
+SetBorderSize (WindowPtr pWin)
{
int bw;
@@ -1759,9 +1775,9 @@ SetBorderSize (register WindowPtr pWin)
*/
_X_EXPORT void
-GravityTranslate (register int x, register int y, int oldx, int oldy,
+GravityTranslate (int x, int y, int oldx, int oldy,
int dw, int dh, unsigned gravity,
- register int *destx, register int *desty)
+ int *destx, int *desty)
{
switch (gravity) {
case NorthGravity:
@@ -1809,10 +1825,10 @@ GravityTranslate (register int x, register int y, int oldx, int oldy,
/* XXX need to retile border on each window with ParentRelative origin */
_X_EXPORT void
-ResizeChildrenWinSize(register WindowPtr pWin, int dx, int dy, int dw, int dh)
+ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
{
- register ScreenPtr pScreen;
- register WindowPtr pSib, pChild;
+ ScreenPtr pScreen;
+ WindowPtr pSib, pChild;
Bool resized = (dw || dh);
pScreen = pWin->drawable.pScreen;
@@ -1904,10 +1920,10 @@ ResizeChildrenWinSize(register WindowPtr pWin, int dx, int dy, int dw, int dh)
static int
IsSiblingAboveMe(
- register WindowPtr pMe,
- register WindowPtr pSib)
+ WindowPtr pMe,
+ WindowPtr pSib)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
pWin = pMe->parent->firstChild;
while (pWin)
@@ -1923,8 +1939,8 @@ IsSiblingAboveMe(
static BoxPtr
WindowExtents(
- register WindowPtr pWin,
- register BoxPtr pBox)
+ WindowPtr pWin,
+ BoxPtr pBox)
{
pBox->x1 = pWin->drawable.x - wBorderWidth (pWin);
pBox->y1 = pWin->drawable.y - wBorderWidth (pWin);
@@ -1940,7 +1956,7 @@ WindowExtents(
static RegionPtr
MakeBoundingRegion (
- register WindowPtr pWin,
+ WindowPtr pWin,
BoxPtr pBox)
{
RegionPtr pRgn;
@@ -1966,7 +1982,7 @@ ShapeOverlap (
BoxPtr pSibBox)
{
RegionPtr pWinRgn, pSibRgn;
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
Bool ret;
if (!IS_SHAPED(pWin) && !IS_SHAPED(pSib))
@@ -1986,11 +2002,11 @@ static Bool
AnyWindowOverlapsMe(
WindowPtr pWin,
WindowPtr pHead,
- register BoxPtr box)
+ BoxPtr box)
{
- register WindowPtr pSib;
+ WindowPtr pSib;
BoxRec sboxrec;
- register BoxPtr sbox;
+ BoxPtr sbox;
for (pSib = pWin->prevSib; pSib != pHead; pSib = pSib->prevSib)
{
@@ -2011,11 +2027,11 @@ AnyWindowOverlapsMe(
static Bool
IOverlapAnyWindow(
WindowPtr pWin,
- register BoxPtr box)
+ BoxPtr box)
{
- register WindowPtr pSib;
+ WindowPtr pSib;
BoxRec sboxrec;
- register BoxPtr sbox;
+ BoxPtr sbox;
for (pSib = pWin->nextSib; pSib; pSib = pSib->nextSib)
{
@@ -2063,8 +2079,8 @@ IOverlapAnyWindow(
static WindowPtr
WhereDoIGoInTheStack(
- register WindowPtr pWin,
- register WindowPtr pSib,
+ WindowPtr pWin,
+ WindowPtr pSib,
short x,
short y,
unsigned short w,
@@ -2072,7 +2088,7 @@ WhereDoIGoInTheStack(
int smode)
{
BoxRec box;
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
WindowPtr pHead, pFirst;
if ((pWin == pWin->parent->firstChild) &&
@@ -2169,8 +2185,8 @@ WhereDoIGoInTheStack(
static void
ReflectStackChange(
- register WindowPtr pWin,
- register WindowPtr pSib,
+ WindowPtr pWin,
+ WindowPtr pSib,
VTKind kind)
{
/* Note that pSib might be NULL */
@@ -2222,17 +2238,17 @@ ReflectStackChange(
*****/
int
-ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientPtr client)
+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
- register WindowPtr pSib = NullWindow;
- register WindowPtr pParent = pWin->parent;
+ WindowPtr pSib = NullWindow;
+ WindowPtr pParent = pWin->parent;
Window sibwid = 0;
Mask index2, tmask;
- register XID *pVlist;
+ XID *pVlist;
short x, y, beforeX, beforeY;
unsigned short w = pWin->drawable.width,
h = pWin->drawable.height,
@@ -2509,7 +2525,7 @@ ActuallyDoSomething:
int
CirculateWindow(WindowPtr pParent, int direction, ClientPtr client)
{
- register WindowPtr pWin, pHead, pFirst;
+ WindowPtr pWin, pHead, pFirst;
xEvent event;
BoxRec box;
@@ -2579,14 +2595,14 @@ CompareWIDs(
*****/
int
-ReparentWindow(register WindowPtr pWin, register WindowPtr pParent,
+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);
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
pScreen = pWin->drawable.pScreen;
if (TraverseTree(pWin, CompareWIDs, (pointer)&pParent->drawable.id) == WT_STOPWALKING)
@@ -2673,7 +2689,7 @@ ReparentWindow(register WindowPtr pWin, register WindowPtr pParent,
static void
RealizeTree(WindowPtr pWin)
{
- register WindowPtr pChild;
+ WindowPtr pChild;
RealizeWindowProcPtr Realize;
Realize = pWin->drawable.pScreen->RealizeWindow;
@@ -2703,6 +2719,30 @@ RealizeTree(WindowPtr pWin)
}
}
+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
@@ -2712,11 +2752,11 @@ RealizeTree(WindowPtr pWin)
*****/
_X_EXPORT int
-MapWindow(register WindowPtr pWin, ClientPtr client)
+MapWindow(WindowPtr pWin, ClientPtr client)
{
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
- register WindowPtr pParent;
+ WindowPtr pParent;
#ifdef DO_SAVE_UNDERS
Bool dosave = FALSE;
#endif
@@ -2832,18 +2872,18 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
*****/
void
-MapSubwindows(register WindowPtr pParent, ClientPtr client)
+MapSubwindows(WindowPtr pParent, ClientPtr client)
{
- register WindowPtr pWin;
- WindowPtr pFirstMapped = NullWindow;
+ WindowPtr pWin;
+ WindowPtr pFirstMapped = NullWindow;
#ifdef DO_SAVE_UNDERS
- WindowPtr pFirstSaveUndered = NullWindow;
+ WindowPtr pFirstSaveUndered = NullWindow;
#endif
- register ScreenPtr pScreen;
- register Mask parentRedirect;
- register Mask parentNotify;
- xEvent event;
- Bool anyMarked;
+ ScreenPtr pScreen;
+ Mask parentRedirect;
+ Mask parentNotify;
+ xEvent event;
+ Bool anyMarked;
#ifdef DO_SAVE_UNDERS
Bool dosave = FALSE;
#endif
@@ -2952,7 +2992,7 @@ UnrealizeTree(
WindowPtr pWin,
Bool fromConfigure)
{
- register WindowPtr pChild;
+ WindowPtr pChild;
UnrealizeWindowProcPtr Unrealize;
MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
@@ -3011,9 +3051,9 @@ UnrealizeTree(
*****/
_X_EXPORT int
-UnmapWindow(register WindowPtr pWin, Bool fromConfigure)
+UnmapWindow(WindowPtr pWin, Bool fromConfigure)
{
- register WindowPtr pParent;
+ WindowPtr pParent;
xEvent event;
Bool wasRealized = (Bool)pWin->realized;
Bool wasViewable = (Bool)pWin->viewable;
@@ -3070,9 +3110,9 @@ UnmapWindow(register WindowPtr pWin, Bool fromConfigure)
*****/
void
-UnmapSubwindows(register WindowPtr pWin)
+UnmapSubwindows(WindowPtr pWin)
{
- register WindowPtr pChild, pHead;
+ WindowPtr pChild, pHead;
xEvent event;
Bool wasRealized = (Bool)pWin->realized;
Bool wasViewable = (Bool)pWin->viewable;
@@ -3161,10 +3201,10 @@ UnmapSubwindows(register WindowPtr pWin)
void
-HandleSaveSet(register ClientPtr client)
+HandleSaveSet(ClientPtr client)
{
- register WindowPtr pParent, pWin;
- register int j;
+ WindowPtr pParent, pWin;
+ int j;
for (j=0; j<client->numSaved; j++)
{
@@ -3203,25 +3243,10 @@ HandleSaveSet(register ClientPtr client)
/**
*
- * \param x,y in root
- * \param box "return" value
- */
-Bool
-VisibleBoundingBoxFromPoint(register WindowPtr pWin, int x, int y, BoxPtr box)
-{
- if (!pWin->realized)
- return (FALSE);
- if (POINT_IN_REGION(pWin->drawable.pScreen, &pWin->clipList, x, y, box))
- return(TRUE);
- return(FALSE);
-}
-
-/**
- *
* \param x,y in root
*/
Bool
-PointInWindowIsVisible(register WindowPtr pWin, int x, int y)
+PointInWindowIsVisible(WindowPtr pWin, int x, int y)
{
BoxRec box;
@@ -3240,9 +3265,9 @@ PointInWindowIsVisible(register WindowPtr pWin, int x, int y)
_X_EXPORT RegionPtr
-NotClippedByChildren(register WindowPtr pWin)
+NotClippedByChildren(WindowPtr pWin)
{
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
RegionPtr pReg;
pScreen = pWin->drawable.pScreen;
@@ -3324,30 +3349,6 @@ SendVisibilityNotify(WindowPtr pWin)
DeliverEvents(pWin, &event, 1, NullWindow);
}
-static WindowPtr windowDisableMapUnmapEvents;
-
-void
-DisableMapUnmapEvents(WindowPtr pWin)
-{
- assert (windowDisableMapUnmapEvents == NULL);
-
- windowDisableMapUnmapEvents = pWin;
-}
-
-void
-EnableMapUnmapEvents(WindowPtr pWin)
-{
- assert (windowDisableMapUnmapEvents != NULL);
-
- windowDisableMapUnmapEvents = NULL;
-}
-
-Bool
-MapUnmapEventsEnabled(WindowPtr pWin)
-{
- return pWin != windowDisableMapUnmapEvents;
-}
-
#define RANDOM_WIDTH 32
#ifndef NOLOGOHACK
@@ -3588,7 +3589,7 @@ TileScreenSaver(int i, int kind)
*/
_X_EXPORT WindowPtr
-FindWindowWithOptional (register WindowPtr w)
+FindWindowWithOptional (WindowPtr w)
{
do
w = w->parent;
@@ -3605,10 +3606,10 @@ FindWindowWithOptional (register WindowPtr w)
*/
_X_EXPORT void
-CheckWindowOptionalNeed (register WindowPtr w)
+CheckWindowOptionalNeed (WindowPtr w)
{
- register WindowOptPtr optional;
- register WindowOptPtr parentOptional;
+ WindowOptPtr optional;
+ WindowOptPtr parentOptional;
if (!w->parent)
return;
@@ -3659,10 +3660,10 @@ CheckWindowOptionalNeed (register WindowPtr w)
*/
_X_EXPORT Bool
-MakeWindowOptional (register WindowPtr pWin)
+MakeWindowOptional (WindowPtr pWin)
{
- register WindowOptPtr optional;
- register WindowOptPtr parentOptional;
+ WindowOptPtr optional;
+ WindowOptPtr parentOptional;
if (pWin->optional)
return TRUE;
@@ -3700,41 +3701,6 @@ MakeWindowOptional (register WindowPtr pWin)
return TRUE;
}
-void
-DisposeWindowOptional (register WindowPtr pWin)
-{
- if (!pWin->optional)
- return;
- /*
- * everything is peachy. Delete the optional record
- * and clean up
- */
- /*
- * TOG changed this code to:
- *
- * if (pWin->cursorIsNone == FALSE)
- * FreeCursor (pWin->optional->cursor, (Cursor)0);
- * pWin->cursorIsNone = TRUE;
- *
- * This is blatently wrong; windows without optionals can have
- * two different cursor values, either None or sharing their
- * parents cursor. This difference is controlled by the
- * cursorIsNone value; when TRUE, the window has no cursor,
- * when false, it shares its cursor with its parent; TOG
- * made it impossible for a window to have a cursor without
- * an optional record.
- */
- if (pWin->optional->cursor)
- {
- FreeCursor (pWin->optional->cursor, (Cursor)0);
- pWin->cursorIsNone = FALSE;
- }
- else
- pWin->cursorIsNone = TRUE;
- xfree (pWin->optional);
- pWin->optional = NULL;
-}
-
#ifndef NOLOGOHACK
static void
DrawLogo(WindowPtr pWin)
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 0ac533e18..ce1979d4f 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,25 +1,35 @@
appmandir = $(APP_MAN_DIR)
+filemandir = $(FILE_MAN_DIR)
# Xserver.man covers options generic to all X servers built in this tree
+# (i.e. those handled in the os/utils.c options processing instead of in
+# the DDX-level options processing)
appman_PRE = Xserver.man.pre
+fileman_PRE = SecurityPolicy.man.pre
appman_PROCESSED = $(appman_PRE:man.pre=man)
+fileman_PROCESSED = $(fileman_PRE:man.pre=man)
appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@)
+fileman_DATA = $(fileman_PRE:man.pre=@FILE_MAN_SUFFIX@)
-BUILT_SOURCES = $(appman_PROCESSED)
+BUILT_SOURCES = $(appman_PROCESSED) $(fileman_PROCESSED)
-CLEANFILES = $(appman_PROCESSED) $(appman_DATA)
+CLEANFILES = $(appman_PROCESSED) $(appman_DATA) \
+ $(fileman_PROCESSED) $(fileman_DATA)
include $(top_srcdir)/cpprules.in
.man.$(APP_MAN_SUFFIX):
cp $< $@
+.man.$(FILE_MAN_SUFFIX):
+ cp $< $@
+
EXTRAMANDEFS = -D__default_font_path__="`echo $(COMPILEDDEFAULTFONTPATH) | sed -e 's/,/, /g'`"
# Docs about X server internals that we ship with source but don't install
DEVEL_DOCS = smartsched
-EXTRA_DIST = $(DEVEL_DOCS) $(appman_PRE)
+EXTRA_DIST = $(DEVEL_DOCS) $(appman_PRE) $(fileman_PRE)
diff --git a/doc/SecurityPolicy.man.pre b/doc/SecurityPolicy.man.pre
new file mode 100644
index 000000000..f5aff0c6c
--- /dev/null
+++ b/doc/SecurityPolicy.man.pre
@@ -0,0 +1,258 @@
+.\" Split out of Xserver.man, which was covered by this notice:
+.\" Copyright 1984 - 1991, 1993, 1994, 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.
+.\" $XFree86: xc/programs/Xserver/Xserver.man,v 3.31 2004/01/10 22:27:46 dawes Exp $
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH SecurityPolicy __filemansuffix__ __xorgversion__
+.SH NAME
+SecurityPolicy \- X Window System SECURITY Extension Policy file format
+.SH DESCRIPTION
+The SECURITY extension to the X Window System uses a policy file to determine
+which operations should be allowed or denied. The default location for this
+file is
+.IR __projectroot__/lib/xserver/SecurityPolicy .
+.PP
+The syntax of the security policy file is as follows.
+Notation: "*" means zero or more occurrences of the preceding element,
+and "+" means one or more occurrences. To interpret <foo/bar>, ignore
+the text after the /; it is used to distinguish between instances of
+<foo> in the next section.
+.PP
+.nf
+<policy file> ::= <version line> <other line>*
+
+<version line> ::= <string/v> '\en'
+
+<other line > ::= <comment> | <access rule> | <site policy> | <blank line>
+
+<comment> ::= # <not newline>* '\en'
+
+<blank line> ::= <space> '\en'
+
+<site policy> ::= sitepolicy <string/sp> '\en'
+
+<access rule> ::= property <property/ar> <window> <perms> '\en'
+
+<property> ::= <string>
+
+<window> ::= any | root | <required property>
+
+<required property> ::= <property/rp> | <property with value>
+
+<property with value> ::= <property/rpv> = <string/rv>
+
+<perms> ::= [ <operation> | <action> | <space> ]*
+
+<operation> ::= r | w | d
+
+<action> ::= a | i | e
+
+<string> ::= <dbl quoted string> | <single quoted string> | <unquoted string>
+
+<dbl quoted string> ::= <space> " <not dquote>* " <space>
+
+<single quoted string> ::= <space> ' <not squote>* ' <space>
+
+<unquoted string> ::= <space> <not space>+ <space>
+
+<space> ::= [ ' ' | '\et' ]*
+
+Character sets:
+
+<not newline> ::= any character except '\en'
+<not dquote> ::= any character except "
+<not squote> ::= any character except '
+<not space> ::= any character except those in <space>
+.fi
+.PP
+The semantics associated with the above syntax are as follows.
+.PP
+<version line>, the first line in the file, specifies the file format
+version. If the server does not recognize the version <string/v>, it
+ignores the rest of the file. The version string for the file format
+described here is "version-1" .
+.PP
+Once past the <version line>, lines that do not match the above syntax
+are ignored.
+.PP
+<comment> lines are ignored.
+.PP
+<sitepolicy> lines are currently ignored. They are intended to
+specify the site policies used by the XC-QUERY-SECURITY-1
+authorization method.
+.PP
+<access rule> lines specify how the server should react to untrusted
+client requests that affect the X Window property named <property/ar>.
+The rest of this section describes the interpretation of an
+<access rule>.
+.PP
+For an <access rule> to apply to a given instance of <property/ar>,
+<property/ar> must be on a window that is in the set of windows
+specified by <window>. If <window> is any, the rule applies to
+<property/ar> on any window. If <window> is root, the rule applies to
+<property/ar> only on root windows.
+.PP
+If <window> is <required property>, the following apply. If <required
+property> is a <property/rp>, the rule applies when the window also
+has that <property/rp>, regardless of its value. If <required
+property> is a <property with value>, <property/rpv> must also have
+the value specified by <string/rv>. In this case, the property must
+have type STRING and format 8, and should contain one or more
+null-terminated strings. If any of the strings match <string/rv>, the
+rule applies.
+.PP
+The definition of string matching is simple case-sensitive string
+comparison with one elaboration: the occurrence of the character '*' in
+<string/rv> is a wildcard meaning "any string." A <string/rv> can
+contain multiple wildcards anywhere in the string. For example, "x*"
+matches strings that begin with x, "*x" matches strings that end with
+x, "*x*" matches strings containing x, and "x*y*" matches strings that
+start with x and subsequently contain y.
+.PP
+There may be multiple <access rule> lines for a given <property/ar>.
+The rules are tested in the order that they appear in the file. The
+first rule that applies is used.
+.PP
+<perms> specify operations that untrusted clients may attempt, and
+the actions that the server should take in response to those operations.
+.PP
+<operation> can be r (read), w (write), or d (delete). The following
+table shows how X Protocol property requests map to these operations
+in the X.Org server implementation.
+.PP
+.nf
+GetProperty r, or r and d if delete = True
+ChangeProperty w
+RotateProperties r and w
+DeleteProperty d
+ListProperties none, untrusted clients can always list all properties
+.fi
+.PP
+<action> can be a (allow), i (ignore), or e (error). Allow means
+execute the request as if it had been issued by a trusted client.
+Ignore means treat the request as a no-op. In the case of
+GetProperty, ignore means return an empty property value if the
+property exists, regardless of its actual value. Error means do not
+execute the request and return a BadAtom error with the atom set to
+the property name. Error is the default action for all properties,
+including those not listed in the security policy file.
+.PP
+An <action> applies to all <operation>s that follow it, until the next
+<action> is encountered. Thus, irwad means ignore read and write,
+allow delete.
+.PP
+GetProperty and RotateProperties may do multiple operations (r and d,
+or r and w). If different actions apply to the operations, the most
+severe action is applied to the whole request; there is no partial
+request execution. The severity ordering is: allow < ignore < error.
+Thus, if the <perms> for a property are ired (ignore read, error
+delete), and an untrusted client attempts GetProperty on that property
+with delete = True, an error is returned, but the property value is
+not. Similarly, if any of the properties in a RotateProperties do not
+allow both read and write, an error is returned without changing any
+property values.
+.PP
+Here is an example security policy file.
+.PP
+.ta 3i 4i
+.nf
+version-1
+
+XCOMM Allow reading of application resources, but not writing.
+property RESOURCE_MANAGER root ar iw
+property SCREEN_RESOURCES root ar iw
+
+XCOMM Ignore attempts to use cut buffers. Giving errors causes apps to crash,
+XCOMM and allowing access may give away too much information.
+property CUT_BUFFER0 root irw
+property CUT_BUFFER1 root irw
+property CUT_BUFFER2 root irw
+property CUT_BUFFER3 root irw
+property CUT_BUFFER4 root irw
+property CUT_BUFFER5 root irw
+property CUT_BUFFER6 root irw
+property CUT_BUFFER7 root irw
+
+XCOMM If you are using Motif, you probably want these.
+property _MOTIF_DEFAULT_BINDINGS root ar iw
+property _MOTIF_DRAG_WINDOW root ar iw
+property _MOTIF_DRAG_TARGETS any ar iw
+property _MOTIF_DRAG_ATOMS any ar iw
+property _MOTIF_DRAG_ATOM_PAIRS any ar iw
+
+XCOMM The next two rules let xwininfo -tree work when untrusted.
+property WM_NAME any ar
+
+XCOMM Allow read of WM_CLASS, but only for windows with WM_NAME.
+XCOMM This might be more restrictive than necessary, but demonstrates
+XCOMM the <required property> facility, and is also an attempt to
+XCOMM say "top level windows only."
+property WM_CLASS WM_NAME ar
+
+XCOMM These next three let xlsclients work untrusted. Think carefully
+XCOMM before including these; giving away the client machine name and command
+XCOMM may be exposing too much.
+property WM_STATE WM_NAME ar
+property WM_CLIENT_MACHINE WM_NAME ar
+property WM_COMMAND WM_NAME ar
+
+XCOMM To let untrusted clients use the standard colormaps created by
+XCOMM xstdcmap, include these lines.
+property RGB_DEFAULT_MAP root ar
+property RGB_BEST_MAP root ar
+property RGB_RED_MAP root ar
+property RGB_GREEN_MAP root ar
+property RGB_BLUE_MAP root ar
+property RGB_GRAY_MAP root ar
+
+XCOMM To let untrusted clients use the color management database created
+XCOMM by xcmsdb, include these lines.
+property XDCCC_LINEAR_RGB_CORRECTION root ar
+property XDCCC_LINEAR_RGB_MATRICES root ar
+property XDCCC_GRAY_SCREENWHITEPOINT root ar
+property XDCCC_GRAY_CORRECTION root ar
+
+XCOMM To let untrusted clients use the overlay visuals that many vendors
+XCOMM support, include this line.
+property SERVER_OVERLAY_VISUALS root ar
+
+XCOMM Dumb examples to show other capabilities.
+
+XCOMM oddball property names and explicit specification of error conditions
+property "property with spaces" 'property with "' aw er ed
+
+XCOMM Allow deletion of Woo-Hoo if window also has property OhBoy with value
+XCOMM ending in "son". Reads and writes will cause an error.
+property Woo-Hoo OhBoy = "*son" ad
+
+.fi
+.SH FILES
+.TP 30
+.I __projectroot__/lib/xserver/SecurityPolicy
+Default X server security policy
+.SH "SEE ALSO"
+.PP
+\fIXserver\fp(__appmansuffix__),
+.I "Security Extension Specification"
diff --git a/doc/Xserver.man.pre b/doc/Xserver.man.pre
index aa931a88a..aac3b51c3 100644
--- a/doc/Xserver.man.pre
+++ b/doc/Xserver.man.pre
@@ -414,221 +414,8 @@ X servers that support the SECURITY extension accept the following option:
causes the server to attempt to read and interpret filename as a security
policy file with the format described below. The file is read at server
startup and reread at each server reset.
-.PP
-The syntax of the security policy file is as follows.
-Notation: "*" means zero or more occurrences of the preceding element,
-and "+" means one or more occurrences. To interpret <foo/bar>, ignore
-the text after the /; it is used to distinguish between instances of
-<foo> in the next section.
-.PP
-.nf
-<policy file> ::= <version line> <other line>*
-
-<version line> ::= <string/v> '\en'
-
-<other line > ::= <comment> | <access rule> | <site policy> | <blank line>
-
-<comment> ::= # <not newline>* '\en'
-
-<blank line> ::= <space> '\en'
-
-<site policy> ::= sitepolicy <string/sp> '\en'
-
-<access rule> ::= property <property/ar> <window> <perms> '\en'
-
-<property> ::= <string>
-
-<window> ::= any | root | <required property>
-
-<required property> ::= <property/rp> | <property with value>
-
-<property with value> ::= <property/rpv> = <string/rv>
-
-<perms> ::= [ <operation> | <action> | <space> ]*
-
-<operation> ::= r | w | d
-
-<action> ::= a | i | e
-
-<string> ::= <dbl quoted string> | <single quoted string> | <unquoted string>
-
-<dbl quoted string> ::= <space> " <not dqoute>* " <space>
-
-<single quoted string> ::= <space> ' <not squote>* ' <space>
-
-<unquoted string> ::= <space> <not space>+ <space>
-
-<space> ::= [ ' ' | '\et' ]*
-
-Character sets:
-
-<not newline> ::= any character except '\en'
-<not dqoute> ::= any character except "
-<not squote> ::= any character except '
-<not space> ::= any character except those in <space>
-.fi
-.PP
-The semantics associated with the above syntax are as follows.
-.PP
-<version line>, the first line in the file, specifies the file format
-version. If the server does not recognize the version <string/v>, it
-ignores the rest of the file. The version string for the file format
-described here is "version-1" .
-.PP
-Once past the <version line>, lines that do not match the above syntax
-are ignored.
-.PP
-<comment> lines are ignored.
-.PP
-<sitepolicy> lines are currently ignored. They are intended to
-specify the site policies used by the XC-QUERY-SECURITY-1
-authorization method.
-.PP
-<access rule> lines specify how the server should react to untrusted
-client requests that affect the X Window property named <property/ar>.
-The rest of this section describes the interpretation of an
-<access rule>.
-.PP
-For an <access rule> to apply to a given instance of <property/ar>,
-<property/ar> must be on a window that is in the set of windows
-specified by <window>. If <window> is any, the rule applies to
-<property/ar> on any window. If <window> is root, the rule applies to
-<property/ar> only on root windows.
-.PP
-If <window> is <required property>, the following apply. If <required
-property> is a <property/rp>, the rule applies when the window also
-has that <property/rp>, regardless of its value. If <required
-property> is a <property with value>, <property/rpv> must also have
-the value specified by <string/rv>. In this case, the property must
-have type STRING and format 8, and should contain one or more
-null-terminated strings. If any of the strings match <string/rv>, the
-rule applies.
-.PP
-The definition of string matching is simple case-sensitive string
-comparison with one elaboration: the occurrence of the character '*' in
-<string/rv> is a wildcard meaning "any string." A <string/rv> can
-contain multiple wildcards anywhere in the string. For example, "x*"
-matches strings that begin with x, "*x" matches strings that end with
-x, "*x*" matches strings containing x, and "x*y*" matches strings that
-start with x and subsequently contain y.
-.PP
-There may be multiple <access rule> lines for a given <property/ar>.
-The rules are tested in the order that they appear in the file. The
-first rule that applies is used.
-.PP
-<perms> specify operations that untrusted clients may attempt, and
-the actions that the server should take in response to those operations.
-.PP
-<operation> can be r (read), w (write), or d (delete). The following
-table shows how X Protocol property requests map to these operations
-in The Open Group server implementation.
-.PP
-.nf
-GetProperty r, or r and d if delete = True
-ChangeProperty w
-RotateProperties r and w
-DeleteProperty d
-ListProperties none, untrusted clients can always list all properties
-.fi
-.PP
-<action> can be a (allow), i (ignore), or e (error). Allow means
-execute the request as if it had been issued by a trusted client.
-Ignore means treat the request as a no-op. In the case of
-GetProperty, ignore means return an empty property value if the
-property exists, regardless of its actual value. Error means do not
-execute the request and return a BadAtom error with the atom set to
-the property name. Error is the default action for all properties,
-including those not listed in the security policy file.
-.PP
-An <action> applies to all <operation>s that follow it, until the next
-<action> is encountered. Thus, irwad means ignore read and write,
-allow delete.
-.PP
-GetProperty and RotateProperties may do multiple operations (r and d,
-or r and w). If different actions apply to the operations, the most
-severe action is applied to the whole request; there is no partial
-request execution. The severity ordering is: allow < ignore < error.
-Thus, if the <perms> for a property are ired (ignore read, error
-delete), and an untrusted client attempts GetProperty on that property
-with delete = True, an error is returned, but the property value is
-not. Similarly, if any of the properties in a RotateProperties do not
-allow both read and write, an error is returned without changing any
-property values.
-.PP
-Here is an example security policy file.
-.PP
-.ta 3i 4i
-.nf
-version-1
-
-XCOMM Allow reading of application resources, but not writing.
-property RESOURCE_MANAGER root ar iw
-property SCREEN_RESOURCES root ar iw
-
-XCOMM Ignore attempts to use cut buffers. Giving errors causes apps to crash,
-XCOMM and allowing access may give away too much information.
-property CUT_BUFFER0 root irw
-property CUT_BUFFER1 root irw
-property CUT_BUFFER2 root irw
-property CUT_BUFFER3 root irw
-property CUT_BUFFER4 root irw
-property CUT_BUFFER5 root irw
-property CUT_BUFFER6 root irw
-property CUT_BUFFER7 root irw
-
-XCOMM If you are using Motif, you probably want these.
-property _MOTIF_DEFAULT_BINDINGS root ar iw
-property _MOTIF_DRAG_WINDOW root ar iw
-property _MOTIF_DRAG_TARGETS any ar iw
-property _MOTIF_DRAG_ATOMS any ar iw
-property _MOTIF_DRAG_ATOM_PAIRS any ar iw
-
-XCOMM The next two rules let xwininfo -tree work when untrusted.
-property WM_NAME any ar
-
-XCOMM Allow read of WM_CLASS, but only for windows with WM_NAME.
-XCOMM This might be more restrictive than necessary, but demonstrates
-XCOMM the <required property> facility, and is also an attempt to
-XCOMM say "top level windows only."
-property WM_CLASS WM_NAME ar
-
-XCOMM These next three let xlsclients work untrusted. Think carefully
-XCOMM before including these; giving away the client machine name and command
-XCOMM may be exposing too much.
-property WM_STATE WM_NAME ar
-property WM_CLIENT_MACHINE WM_NAME ar
-property WM_COMMAND WM_NAME ar
-
-XCOMM To let untrusted clients use the standard colormaps created by
-XCOMM xstdcmap, include these lines.
-property RGB_DEFAULT_MAP root ar
-property RGB_BEST_MAP root ar
-property RGB_RED_MAP root ar
-property RGB_GREEN_MAP root ar
-property RGB_BLUE_MAP root ar
-property RGB_GRAY_MAP root ar
-
-XCOMM To let untrusted clients use the color management database created
-XCOMM by xcmsdb, include these lines.
-property XDCCC_LINEAR_RGB_CORRECTION root ar
-property XDCCC_LINEAR_RGB_MATRICES root ar
-property XDCCC_GRAY_SCREENWHITEPOINT root ar
-property XDCCC_GRAY_CORRECTION root ar
-
-XCOMM To let untrusted clients use the overlay visuals that many vendors
-XCOMM support, include this line.
-property SERVER_OVERLAY_VISUALS root ar
-
-XCOMM Dumb examples to show other capabilities.
-
-XCOMM oddball property names and explicit specification of error conditions
-property "property with spaces" 'property with "' aw er ed
-
-XCOMM Allow deletion of Woo-Hoo if window also has property OhBoy with value
-XCOMM ending in "son". Reads and writes will cause an error.
-property Woo-Hoo OhBoy = "*son" ad
-
-.fi
+The syntax of the security policy file is described in
+\fISecurityPolicy\fP(__filemansuffix__).
.SH "NETWORK CONNECTIONS"
The X server supports client connections via a platform-dependent subset of
the following transport types: TCP\/IP, Unix Domain sockets, DECnet,
@@ -757,6 +544,9 @@ Error log file for display number \fBn\fP if run from \fIinit\fP(__adminmansuffi
.TP 30
.I __projectroot__/lib/X11/xdm/xdm-errors
Default error log file if the server is run from \fIxdm\fP(1)
+.TP 30
+.I __projectroot__/lib/xserver/SecurityPolicy
+Default X server security policy
.SH "SEE ALSO"
General information: \fIX\fP(__miscmansuffix__)
.PP
@@ -771,6 +561,7 @@ Fonts: \fIbdftopcf\fP(1), \fImkfontdir\fP(1), \fImkfontscale\fP(1),
.PP
Security: \fIXsecurity\fP(__miscmansuffix__), \fIxauth\fP(1), \fIXau\fP(1),
\fIxdm\fP(1), \fIxhost\fP(1), \fIxfwp\fP(1),
+\fISecurityPolicy\fP(__filemansuffix__),
.I "Security Extension Specification"
.PP
Starting the server: \fIxdm\fP(1), \fIxinit\fP(1)
diff --git a/exa/exa.c b/exa/exa.c
index e9f42df45..dd27d5e89 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -668,10 +668,6 @@ exaDriverInit (ScreenPtr pScreen,
}
#endif
-#ifdef COMPOSITE
- miDisableCompositeWrapper(pScreen);
-#endif
-
#ifdef MITSHM
/* Re-register with the MI funcs, which don't allow shared pixmaps.
* Shared pixmaps are almost always a performance loss for us, but this
diff --git a/fb/fbpixmap.c b/fb/fbpixmap.c
index c2ddcb0e9..18c120440 100644
--- a/fb/fbpixmap.c
+++ b/fb/fbpixmap.c
@@ -43,11 +43,7 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp)
if (paddedWidth / 4 > 32767 || height > 32767)
return NullPixmap;
datasize = height * paddedWidth;
-#ifdef PIXPRIV
base = pScreen->totalPixmapSize;
-#else
- base = sizeof (PixmapRec);
-#endif
adjust = 0;
if (base & 7)
adjust = 8 - (base & 7);
diff --git a/hw/Makefile.am b/hw/Makefile.am
index d00d6fb3f..99df8e230 100644
--- a/hw/Makefile.am
+++ b/hw/Makefile.am
@@ -1,10 +1,18 @@
if DMX
+if BUILD_DARWIN
+# Darwin does not need the dmx subdir
+else
DMX_SUBDIRS = dmx
endif
+endif
if XORG
+if BUILD_DARWIN
+# Darwin does not need the xfree86 subdir
+else
XORG_SUBDIRS = xfree86
endif
+endif
if XVFB
XVFB_SUBDIRS = vfb
@@ -30,12 +38,15 @@ if XPRINT
XPRINT_SUBDIRS = xprint
endif
-# need to add darwin support here
+if BUILD_DARWIN
+DARWIN_SUBDIRS = darwin
+endif
SUBDIRS = \
$(XORG_SUBDIRS) \
$(XGL_SUBDIRS) \
$(XWIN_SUBDIRS) \
+ $(DARWIN_SUBDIRS) \
$(XVFB_SUBDIRS) \
$(XNEST_SUBDIRS) \
$(DMX_SUBDIRS) \
diff --git a/hw/darwin/Makefile.am b/hw/darwin/Makefile.am
index 542bfdb24..3e28d3212 100644
--- a/hw/darwin/Makefile.am
+++ b/hw/darwin/Makefile.am
@@ -1,52 +1,283 @@
+noinst_LIBRARIES = libdarwinShared.a
+libdarwin_XINPUT_SRCS = darwinXinput.c
+
+AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
+AM_CPPFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
+INCLUDES = @XORG_INCS@ -I../../miext/rootless
+
+DEFS = @DEFS@ -DUSE_NEW_CLUT
+
+if XQUARTZ
+XQUARTZ_SUBDIRS = bundle quartz
+endif
+
+SUBDIRS = \
+ iokit \
+ $(XQUARTZ_SUBDIRS) \
+ utils \
+ .
+
+darwinappdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app
+
+libdarwinShared_a_SOURCES = darwin.c \
+ darwinEvents.c \
+ darwinKeyboard.c \
+ $(darwin_XINPUT_SRCS)
+
+bin_PROGRAMS = XDarwin Xquartz
+XDarwin_SOURCES = \
+ $(top_srcdir)/fb/fbcmap.c \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/Xi/stubs.c
+
+Xquartz_SOURCES = \
+ $(top_srcdir)/fb/fbcmap.c \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/Xi/stubs.c \
+ apple/X11Application.m \
+ apple/X11Controller.m \
+ quartz/Xserver.m \
+ quartz/Preferences.m \
+ quartz/applewm.c \
+ quartz/keysym2ucs.c \
+ quartz/pseudoramiX.c \
+ quartz/quartz.c \
+ quartz/quartzAudio.c \
+ quartz/quartzCocoa.m \
+ quartz/quartzKeyboard.c \
+ quartz/quartzPasteboard.c \
+ quartz/quartzStartup.c \
+ quartz/xpr/appledri.c \
+ quartz/xpr/dri.c \
+ quartz/xpr/xprAppleWM.c \
+ quartz/xpr/xprCursor.c \
+ quartz/xpr/xprFrame.c \
+ quartz/xpr/xprScreen.c \
+ quartz/xpr/x-hash.c \
+ quartz/xpr/x-hook.c \
+ quartz/xpr/x-list.c
+
+XDarwin_LDADD = \
+ $(top_builddir)/dix/dixfonts.lo \
+ $(top_builddir)/dix/libdix.la \
+ $(top_builddir)/config/libconfig.a \
+ ./libdarwinShared.a \
+ ./iokit/libiokit.a \
+ $(top_builddir)/miext/shadow/libshadow.la \
+ $(top_builddir)/miext/cw/libcw.la \
+ $(DARWIN_LIBS) \
+ $(top_builddir)/miext/rootless/librootless.la \
+ $(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
+ $(top_builddir)/miext/rootless/accel/librlAccel.la \
+ @XORG_LIBS@ \
+ $(XSERVER_LIBS)
+
+Xquartz_LDADD = \
+ $(top_builddir)/dix/dixfonts.lo \
+ $(top_builddir)/dix/libdix.la \
+ $(top_builddir)/config/libconfig.a \
+ ./libdarwinShared.a \
+ $(top_builddir)/miext/shadow/libshadow.la \
+ $(top_builddir)/miext/cw/libcw.la \
+ $(DARWIN_LIBS) \
+ $(top_builddir)/miext/rootless/librootless.la \
+ $(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
+ $(top_builddir)/miext/rootless/accel/librlAccel.la \
+ @XORG_LIBS@ \
+ $(XSERVER_LIBS) -lXplugin
+
+XDarwin_LDFLAGS = \
+ -XCClinker -Objc \
+ -Wl,-u,_miDCInitialize \
+ -Wl,-framework,IOKit
+
+Xquartz_LDFLAGS = \
+ -XCClinker -Objc \
+ -Wl,-u,_miDCInitialize \
+ -Wl,-framework,Carbon \
+ -Wl,-framework,OpenGL \
+ -Wl,-framework,Cocoa \
+ -Wl,-framework,CoreAudio \
+ -Wl,-framework,IOKit
+
+XDarwin_CFLAGS = -DINXDARWIN
+Xquartz_CFLAGS = -DINXQUARTZ -DHAS_CG_MACH_PORT -DHAS_KL_API -DHAVE_XORG_CONFIG_H
+
+if XQUARTZ
+macosdir = $(darwinappdir)/Contents/MacOS
+
+DEFS += -DDARWIN_WITH_QUARTZ -DXFree86Server
+
+macos_PROGRAMS = XDarwinApp
+macos_SCRIPTS = x11app
+
+x11app:
+ cd apple && xcodebuild CFLAGS="$(XSERVERCFLAGS_CFLAGS)" LDFLAGS="$(XSERVERCFLAGS_LIBS)"
+
+XDarwinApp_SOURCES = \
+ $(top_srcdir)/fb/fbcmap.c \
+ $(top_srcdir)/mi/miinitext.c \
+ $(top_srcdir)/Xi/stubs.c
+
+XDarwinApp_LDADD = \
+ $(top_builddir)/dix/dixfonts.lo \
+ $(top_builddir)/dix/libdix.la \
+ $(top_builddir)/config/libconfig.a \
+ $(top_builddir)/os/libos.la \
+ ./quartz/XApplication.o \
+ ./libdarwinShared.a \
+ ./quartz/libXQuartz.a \
+ $(top_builddir)/miext/shadow/libshadow.la \
+ $(top_builddir)/miext/cw/libcw.la \
+ $(DARWIN_LIBS) \
+ $(top_builddir)/miext/rootless/librootless.la \
+ $(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
+ $(top_builddir)/miext/rootless/accel/librlAccel.la \
+ @XORG_LIBS@ \
+ $(XSERVER_LIBS)
+
+XDarwinApp_LDFLAGS = \
+ -XCClinker -Objc \
+ -Wl,-u,_miDCInitialize \
+ -Wl,-framework,Carbon \
+ -Wl,-framework,ApplicationServices \
+ -Wl,-framework,Cocoa \
+ -Wl,-framework,CoreAudio \
+ -Wl,-framework,IOKit
+
+XDarwinApp_CFLAGS = -DINXDARWINAPP
+HOOK_TARGETS = xquartz-install-hook
+
+
+crplugindir = $(darwinappdir)/Contents/Resources/cr.bundle/Contents/MacOS
+crplugin_LTLIBRARIES = cr.la
+cr_la_SOURCES = \
+ quartz/cr/crAppleWM.m \
+ quartz/cr/crFrame.m \
+ quartz/cr/crScreen.m \
+ quartz/fullscreen/quartzCursor.c \
+ quartz/cr/XView.m
+
+cr_la_LIBADD = \
+ $(top_builddir)/miext/rootless/librootless.la \
+ $(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
+ $(top_builddir)/miext/rootless/accel/librlAccel.la
+
+cr_la_LDFLAGS = -shrext '' -Wl,-framework,ApplicationServices \
+ -Wl,-framework,Cocoa \
+ -Wl,-framework,Carbon \
+ -XCClinker -ObjC \
+ -XCClinker -bundle_loader -XCClinker XDarwinApp \
+ -module -avoid-version -no-undefined
+cr_la_DEPENDENCIES = XDarwinApp
+
+fullscreenplugindir = $(darwinappdir)/Contents/Resources/fullscreen.bundle/Contents/MacOS
+fullscreenplugin_LTLIBRARIES = fullscreen.la
+fullscreen_la_SOURCES = \
+ quartz/fullscreen/fullscreen.c \
+ quartz/fullscreen/quartzCursor.c
+
+fullscreen_la_LIBADD = \
+ $(top_builddir)/miext/shadow/libshadow.la
+
+fullscreen_la_LDFLAGS = -shrext '' -Wl,-framework,ApplicationServices \
+ -XCClinker -bundle_loader -XCClinker XDarwinApp \
+ -module -avoid-version -no-undefined
+fullscreen_la_DEPENDENCIES = XDarwinApp
+
+if GLX
+glxMesaplugindir = $(darwinappdir)/Contents/Resources/glxMesa.bundle/Contents/MacOS
+glxMesaplugin_LTLIBRARIES = glxMesa.la
+glxMesa_la_SOURCES =
+glxMesa_la_LIBADD = \
+ $(top_builddir)/GL/glx/libglx.la \
+ $(top_builddir)/GL/mesa/libGLcore.la
+glxMesa_la_LDFLAGS = -shrext '' \
+ -Wl,-framework,AGL \
+ -Wl,-framework,OpenGL \
+ -XCClinker -ObjC \
+ -XCClinker -bundle_loader -XCClinker XDarwinApp \
+ -module -avoid-version -no-undefined
+glxMesa_la_DEPENDENCIES = XDarwinApp
+endif
+
+endif
+if HAVE_X_PLUGIN
+
+xprplugindir = $(darwinappdir)/Contents/Resources/xpr.bundle/Contents/MacOS
+xprplugin_LTLIBRARIES = xpr.la
+xpr_la_SOURCES = \
+ quartz/xpr/appledri.c \
+ quartz/xpr/dri.c \
+ quartz/xpr/xprAppleWM.c \
+ quartz/xpr/xprCursor.c \
+ quartz/xpr/xprFrame.c \
+ quartz/xpr/xprScreen.c \
+ quartz/xpr/x-hash.c \
+ quartz/xpr/x-hook.c \
+ quartz/xpr/x-list.c
+
+xpr_la_LIBADD = \
+ $(top_builddir)/miext/rootless/librootless.la \
+ $(top_builddir)/miext/rootless/safeAlpha/libsafeAlpha.la \
+ $(top_builddir)/miext/rootless/accel/librlAccel.la
+
+xpr_la_LDFLAGS = -shrext '' -Wl,-framework,ApplicationServices \
+ -lXplugin \
+ -XCClinker -bundle_loader -XCClinker XDarwinApp \
+ -module -avoid-version -no-undefined
+xpr_la_DEPENDENCIES = XDarwinApp
+
+endif
+
+if HAVE_AGL_FRAMEWORK
+glxCGLplugindir = $(darwinappdir)/Contents/Resources/glxCGL.bundle/Contents/MacOS
+glxCGLplugin_LTLIBRARIES = glxCGL.la
+glxCGL_la_SOURCES =
+glxCGL_la_LIBADD = \
+ $(top_builddir)/GL/glx/glxext.o \
+ $(top_builddir)/GL/glx/libglx.a \
+ $(top_builddir)/GL/apple/libAGLcore.a
+glxCGL_la_LDFLAGS = -shrext '' -Wl,-framework,ApplicationServices \
+ -Wl,-framework,AGL \
+ -Wl,-framework,OpenGL \
+ -XCClinker -ObjC \
+ -XCClinker -bundle_loader -XCClinker XDarwinApp \
+ -module -avoid-version -no-undefined
+glxCGL_la_DEPENDENCIES = XDarwinApp
+
+
+glxAGLplugindir = $(darwinappdir)/Contents/Resources/glxAGL.bundle/Contents/MacOS
+glxAGLplugin_LTLIBRARIES = glxAGL.la
+glxAGL_la_SOURCES =
+glxAGL_la_LIBADD = \
+ $(top_builddir)/GL/glx/glxext.o \
+ $(top_builddir)/GL/glx/libglx.a \
+ $(top_builddir)/GL/apple/libAGLcore.a
+glxAGL_la_LDFLAGS = -shrext '' \
+ -Wl,-framework,AGL \
+ -Wl,-framework,OpenGL \
+ -XCClinker -ObjC \
+ -XCClinker -bundle_loader -XCClinker XDarwinApp \
+ -module -avoid-version -no-undefined
+glxAGL_la_DEPENDENCIES = XDarwinApp
+
+
+
+endif
+
+man1_MANS = XDarwin.man
+
+uninstall-hook:
+ rm -rf $(DESTDIR)$(macosdir)/XDarwin
+
+install-data-hook: $(HOOK_TARGETS)
+
+xquartz-install-hook:
+ mv $(DESTDIR)$(macosdir)/XDarwinApp $(DESTDIR)$(macosdir)/XDarwin
+ cd apple && xcodebuild install
+
EXTRA_DIST = \
- bundle/Dutch.lproj/Credits.rtf \
- bundle/Dutch.lproj/Localizable.strings \
- bundle/Dutch.lproj/MainMenu.nib/classes.nib \
- bundle/Dutch.lproj/MainMenu.nib/objects.nib \
- bundle/Dutch.lproj/XDarwinHelp.html.cpp \
- bundle/English.lproj/Credits.rtf \
- bundle/English.lproj/InfoPlist.strings.cpp \
- bundle/English.lproj/Localizable.strings \
- bundle/English.lproj/MainMenu.nib/classes.nib \
- bundle/English.lproj/MainMenu.nib/objects.nib \
- bundle/English.lproj/XDarwinHelp.html.cpp \
- bundle/French.lproj/Credits.rtf \
- bundle/French.lproj/Localizable.strings \
- bundle/French.lproj/MainMenu.nib/classes.nib \
- bundle/French.lproj/MainMenu.nib/objects.nib \
- bundle/French.lproj/XDarwinHelp.html.cpp \
- bundle/German.lproj/Credits.rtf \
- bundle/German.lproj/Localizable.strings \
- bundle/German.lproj/MainMenu.nib/classes.nib \
- bundle/German.lproj/MainMenu.nib/objects.nib \
- bundle/German.lproj/XDarwinHelp.html.cpp \
- bundle/Japanese.lproj/Credits.rtf \
- bundle/Japanese.lproj/Localizable.strings \
- bundle/Japanese.lproj/MainMenu.nib/classes.nib \
- bundle/Japanese.lproj/MainMenu.nib/objects.nib \
- bundle/Japanese.lproj/XDarwinHelp.html.cpp \
- bundle/ko.lproj/Credits.rtf \
- bundle/ko.lproj/Localizable.strings \
- bundle/ko.lproj/MainMenu.nib/classes.nib \
- bundle/ko.lproj/MainMenu.nib/objects.nib \
- bundle/ko.lproj/XDarwinHelp.html.cpp \
- bundle/Portuguese.lproj/Credits.rtf \
- bundle/Portuguese.lproj/Localizable.strings \
- bundle/Portuguese.lproj/MainMenu.nib/classes.nib \
- bundle/Portuguese.lproj/MainMenu.nib/objects.nib \
- bundle/Portuguese.lproj/XDarwinHelp.html.cpp \
- bundle/Spanish.lproj/Credits.rtf \
- bundle/Spanish.lproj/Localizable.strings \
- bundle/Spanish.lproj/MainMenu.nib/classes.nib \
- bundle/Spanish.lproj/MainMenu.nib/objects.nib \
- bundle/Spanish.lproj/XDarwinHelp.html.cpp \
- bundle/startXClients.cpp \
- bundle/Swedish.lproj/Credits.rtf \
- bundle/Swedish.lproj/Localizable.strings \
- bundle/Swedish.lproj/MainMenu.nib/classes.nib \
- bundle/Swedish.lproj/MainMenu.nib/objects.nib \
- bundle/Swedish.lproj/XDarwinHelp.html.cpp \
- bundle/XDarwin.icns \
darwin.c \
darwinClut8.h \
darwinEvents.c \
@@ -54,64 +285,4 @@ EXTRA_DIST = \
darwinKeyboard.c \
darwinKeyboard.h \
darwinXinput.c \
- iokit/xfIOKit.c \
- iokit/xfIOKitCursor.c \
- iokit/xfIOKit.h \
- iokit/xfIOKitStartup.c \
- Makefile.am \
- quartz/applewm.c \
- quartz/applewmExt.h \
- quartz/cr/crAppleWM.m \
- quartz/cr/crFrame.m \
- quartz/cr/cr.h \
- quartz/cr/crScreen.m \
- quartz/cr/XView.h \
- quartz/cr/XView.m \
- quartz/fullscreen/fullscreen.c \
- quartz/fullscreen/quartzCursor.c \
- quartz/fullscreen/quartzCursor.h \
- quartz/keysym2ucs.c \
- quartz/keysym2ucs.h \
- quartz/Preferences.h \
- quartz/Preferences.m \
- quartz/pseudoramiX.c \
- quartz/pseudoramiX.h \
- quartz/quartzAudio.c \
- quartz/quartzAudio.h \
- quartz/quartz.c \
- quartz/quartzCocoa.m \
- quartz/quartzCommon.h \
- quartz/quartzCursor.c \
- quartz/quartzCursor.h \
- quartz/quartz.h \
- quartz/quartzKeyboard.c \
- quartz/quartzPasteboard.c \
- quartz/quartzPasteboard.h \
- quartz/quartzStartup.c \
- quartz/XApplication.h \
- quartz/XApplication.m \
- quartz/XDarwin.pbproj/project.pbxproj \
- quartz/XDarwinStartup.c \
- quartz/XDarwinStartup.man \
- quartz/xpr/appledri.c \
- quartz/xpr/dri.c \
- quartz/xpr/dri.h \
- quartz/xpr/dristruct.h \
- quartz/xpr/x-hash.c \
- quartz/xpr/x-hash.h \
- quartz/xpr/x-hook.c \
- quartz/xpr/x-hook.h \
- quartz/xpr/x-list.c \
- quartz/xpr/x-list.h \
- quartz/xpr/Xplugin.h \
- quartz/xpr/xprAppleWM.c \
- quartz/xpr/xprCursor.c \
- quartz/xpr/xprFrame.c \
- quartz/xpr/xpr.h \
- quartz/xpr/xprScreen.c \
- quartz/XServer.h \
- quartz/XServer.m \
- utils/dumpkeymap.c \
- utils/dumpkeymap.man \
- utils/README.txt \
XDarwin.man
diff --git a/hw/darwin/README.apple b/hw/darwin/README.apple
new file mode 100644
index 000000000..229ab17ad
--- /dev/null
+++ b/hw/darwin/README.apple
@@ -0,0 +1,35 @@
+This directory contains a port of the XDarwin code to the modular X.org
+codebase to be compiled on Darwin/OS X; this would not have been possible
+without the help of Torrey Lyons and Peter O'Gorman, to whom I am
+grateful for their patches, time and moral support.
+
+The server builds 4 targets:
+
+* XDarwin: this server runs on Darwin systems without Quartz
+ (i.e. non-OS X); it has not been well-tested.
+
+* XDarwinApp: this builds XDarwin.app, which is a full X server using
+ Quartz. It has loadable module support for AGL and CGL, and well as
+ fullscreen and rootless support.
+
+* Xquartz: this server runs on Quartz-based systems, and is meant to
+ work with X11.app
+
+* x11app: this builds a version of Apple's X11.app using patches by
+ Torrey Lyons; most, but not all, functionality of Apple's original
+ X11.app is present in this release.
+
+Known issues:
+
+* AGL and CGL support for 3D indirect acceleration does not work;
+ indirect.c has been rewritten, but not yet integrated into this source tree.
+
+* Fullscreen mode does not work; I don't know why.
+
+* Some features in X11.app are not yet implemented; these are marked
+ with #ifdef DARWIN_DDX_MISSING in the code.
+
+* The build system code could probably be cleaned up slightly.
+
+Any patches or code contributions would be most welcome and may be
+sent to me at bbyer@apple.com.
diff --git a/hw/darwin/apple/English.lproj/InfoPlist.strings b/hw/darwin/apple/English.lproj/InfoPlist.strings
new file mode 100644
index 000000000..88e1f04ac
--- /dev/null
+++ b/hw/darwin/apple/English.lproj/InfoPlist.strings
Binary files differ
diff --git a/hw/darwin/apple/English.lproj/main.nib/.svn/entries b/hw/darwin/apple/English.lproj/main.nib/.svn/entries
new file mode 100644
index 000000000..95a15f220
--- /dev/null
+++ b/hw/darwin/apple/English.lproj/main.nib/.svn/entries
@@ -0,0 +1,65 @@
+8
+
+dir
+29110
+svn+ssh://src.apple.com/svn/BSD/X11server/trunk/darwin/apple/English.lproj/main.nib
+svn+ssh://src.apple.com/svn/BSD
+
+
+
+2007-02-03T03:06:20.842932Z
+28761
+bbyer
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+e92bca22-270c-0410-9cea-e3f1106b6a1c
+
+info.nib
+file
+
+
+
+
+2007-02-27T01:00:07.000000Z
+456347804c516786b1d1339ce2ef50a2
+2007-02-03T03:06:20.842932Z
+28761
+bbyer
+
+keyedobjects.nib
+file
+
+
+
+
+2007-02-27T01:00:07.000000Z
+eb3010372b09768c846df0d996cfdd8d
+2007-02-03T03:06:20.842932Z
+28761
+bbyer
+has-props
+
+classes.nib
+file
+
+
+
+
+2007-02-27T01:00:07.000000Z
+0ae2660c3afabbd5aa02fc34712c96e6
+2007-02-03T03:06:20.842932Z
+28761
+bbyer
+
diff --git a/hw/darwin/apple/English.lproj/main.nib/.svn/format b/hw/darwin/apple/English.lproj/main.nib/.svn/format
new file mode 100644
index 000000000..45a4fb75d
--- /dev/null
+++ b/hw/darwin/apple/English.lproj/main.nib/.svn/format
@@ -0,0 +1 @@
+8
diff --git a/hw/darwin/apple/English.lproj/main.nib/.svn/prop-base/keyedobjects.nib.svn-base b/hw/darwin/apple/English.lproj/main.nib/.svn/prop-base/keyedobjects.nib.svn-base
new file mode 100644
index 000000000..5e9587e65
--- /dev/null
+++ b/hw/darwin/apple/English.lproj/main.nib/.svn/prop-base/keyedobjects.nib.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:mime-type
+V 24
+application/octet-stream
+END
diff --git a/hw/darwin/apple/English.lproj/main.nib/.svn/text-base/classes.nib.svn-base b/hw/darwin/apple/English.lproj/main.nib/.svn/text-base/classes.nib.svn-base
new file mode 100644
index 000000000..a82159bd5
--- /dev/null
+++ b/hw/darwin/apple/English.lproj/main.nib/.svn/text-base/classes.nib.svn-base
@@ -0,0 +1,318 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBClasses</key>
+ <array>
+ <dict>
+ <key>CLASS</key>
+ <string>IBLibraryObjectTemplate</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>draggedView</key>
+ <string>NSView</string>
+ <key>representedObject</key>
+ <string>NSObject</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSView</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>IBInspector</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>inspectorView</key>
+ <string>NSView</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSDateFormatter</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSFormatter</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>apps_table_cancel</key>
+ <string>id</string>
+ <key>apps_table_delete</key>
+ <string>id</string>
+ <key>apps_table_done</key>
+ <string>id</string>
+ <key>apps_table_duplicate</key>
+ <string>id</string>
+ <key>apps_table_new</key>
+ <string>id</string>
+ <key>apps_table_show</key>
+ <string>id</string>
+ <key>bring_to_front</key>
+ <string>id</string>
+ <key>close_window</key>
+ <string>id</string>
+ <key>enable_fullscreen_changed</key>
+ <string>id</string>
+ <key>minimize_window</key>
+ <string>id</string>
+ <key>next_window</key>
+ <string>id</string>
+ <key>prefs_changed</key>
+ <string>id</string>
+ <key>prefs_show</key>
+ <string>id</string>
+ <key>previous_window</key>
+ <string>id</string>
+ <key>toggle_fullscreen</key>
+ <string>id</string>
+ <key>x11_help</key>
+ <string>id</string>
+ <key>zoom_window</key>
+ <string>id</string>
+ </dict>
+ <key>CLASS</key>
+ <string>X11Controller</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>apps_separator</key>
+ <string>id</string>
+ <key>apps_table</key>
+ <string>id</string>
+ <key>depth</key>
+ <string>id</string>
+ <key>dock_apps_menu</key>
+ <string>id</string>
+ <key>dock_menu</key>
+ <string>id</string>
+ <key>dock_window_separator</key>
+ <string>id</string>
+ <key>enable_auth</key>
+ <string>id</string>
+ <key>enable_fullscreen</key>
+ <string>id</string>
+ <key>enable_keyequivs</key>
+ <string>id</string>
+ <key>enable_tcp</key>
+ <string>id</string>
+ <key>fake_buttons</key>
+ <string>id</string>
+ <key>prefs_panel</key>
+ <string>id</string>
+ <key>sync_keymap</key>
+ <string>id</string>
+ <key>toggle_fullscreen_item</key>
+ <string>id</string>
+ <key>use_sysbeep</key>
+ <string>id</string>
+ <key>window_separator</key>
+ <string>id</string>
+ <key>x11_about_item</key>
+ <string>id</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSNumberFormatter</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSFormatter</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSFormatter</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>alignCenter:</key>
+ <string>id</string>
+ <key>alignJustified:</key>
+ <string>id</string>
+ <key>alignLeft:</key>
+ <string>id</string>
+ <key>alignRight:</key>
+ <string>id</string>
+ <key>arrangeInFront:</key>
+ <string>id</string>
+ <key>centerSelectionInVisibleArea:</key>
+ <string>id</string>
+ <key>changeFont:</key>
+ <string>id</string>
+ <key>checkSpelling:</key>
+ <string>id</string>
+ <key>clear:</key>
+ <string>id</string>
+ <key>clearRecentDocuments:</key>
+ <string>id</string>
+ <key>complete:</key>
+ <string>id</string>
+ <key>copy:</key>
+ <string>id</string>
+ <key>copyFont:</key>
+ <string>id</string>
+ <key>copyRuler:</key>
+ <string>id</string>
+ <key>cut:</key>
+ <string>id</string>
+ <key>delete:</key>
+ <string>id</string>
+ <key>deminiaturize:</key>
+ <string>id</string>
+ <key>fax:</key>
+ <string>id</string>
+ <key>hide:</key>
+ <string>id</string>
+ <key>hideOtherApplications:</key>
+ <string>id</string>
+ <key>loosenKerning:</key>
+ <string>id</string>
+ <key>lowerBaseline:</key>
+ <string>id</string>
+ <key>makeKeyAndOrderFront:</key>
+ <string>id</string>
+ <key>miniaturize:</key>
+ <string>id</string>
+ <key>newDocument:</key>
+ <string>id</string>
+ <key>openDocument:</key>
+ <string>id</string>
+ <key>orderBack:</key>
+ <string>id</string>
+ <key>orderFront:</key>
+ <string>id</string>
+ <key>orderFrontColorPanel:</key>
+ <string>id</string>
+ <key>orderFrontHelpPanel:</key>
+ <string>id</string>
+ <key>orderOut:</key>
+ <string>id</string>
+ <key>outline:</key>
+ <string>id</string>
+ <key>paste:</key>
+ <string>id</string>
+ <key>pasteAsPlainText:</key>
+ <string>id</string>
+ <key>pasteAsRichText:</key>
+ <string>id</string>
+ <key>pasteFont:</key>
+ <string>id</string>
+ <key>pasteRuler:</key>
+ <string>id</string>
+ <key>pause:</key>
+ <string>id</string>
+ <key>performClose:</key>
+ <string>id</string>
+ <key>performFindPanelAction:</key>
+ <string>id</string>
+ <key>performMiniaturize:</key>
+ <string>id</string>
+ <key>performZoom:</key>
+ <string>id</string>
+ <key>play:</key>
+ <string>id</string>
+ <key>print:</key>
+ <string>id</string>
+ <key>printDocument:</key>
+ <string>id</string>
+ <key>raiseBaseline:</key>
+ <string>id</string>
+ <key>record:</key>
+ <string>id</string>
+ <key>redo:</key>
+ <string>id</string>
+ <key>resume:</key>
+ <string>id</string>
+ <key>revertDocumentToSaved:</key>
+ <string>id</string>
+ <key>run:</key>
+ <string>id</string>
+ <key>runPageLayout:</key>
+ <string>id</string>
+ <key>runToolbarCustomizationPalette:</key>
+ <string>id</string>
+ <key>saveAllDocuments:</key>
+ <string>id</string>
+ <key>saveDocument:</key>
+ <string>id</string>
+ <key>saveDocumentAs:</key>
+ <string>id</string>
+ <key>saveDocumentTo:</key>
+ <string>id</string>
+ <key>selectAll:</key>
+ <string>id</string>
+ <key>selectText:</key>
+ <string>id</string>
+ <key>showGuessPanel:</key>
+ <string>id</string>
+ <key>showHelp:</key>
+ <string>id</string>
+ <key>start:</key>
+ <string>id</string>
+ <key>startSpeaking:</key>
+ <string>id</string>
+ <key>stop:</key>
+ <string>id</string>
+ <key>stopSpeaking:</key>
+ <string>id</string>
+ <key>subscript:</key>
+ <string>id</string>
+ <key>superscript:</key>
+ <string>id</string>
+ <key>terminate:</key>
+ <string>id</string>
+ <key>tightenKerning:</key>
+ <string>id</string>
+ <key>toggleContinuousSpellChecking:</key>
+ <string>id</string>
+ <key>toggleRuler:</key>
+ <string>id</string>
+ <key>toggleToolbarShown:</key>
+ <string>id</string>
+ <key>turnOffKerning:</key>
+ <string>id</string>
+ <key>turnOffLigatures:</key>
+ <string>id</string>
+ <key>underline:</key>
+ <string>id</string>
+ <key>undo:</key>
+ <string>id</string>
+ <key>unhideAllApplications:</key>
+ <string>id</string>
+ <key>unscript:</key>
+ <string>id</string>
+ <key>useAllLigatures:</key>
+ <string>id</string>
+ <key>useStandardKerning:</key>
+ <string>id</string>
+ <key>useStandardLigatures:</key>
+ <string>id</string>
+ </dict>
+ <key>CLASS</key>
+ <string>FirstResponder</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ </array>
+ <key>IBVersion</key>
+ <integer>1</integer>
+</dict>
+</plist>
diff --git a/hw/darwin/apple/English.lproj/main.nib/.svn/text-base/info.nib.svn-base b/hw/darwin/apple/English.lproj/main.nib/.svn/text-base/info.nib.svn-base
new file mode 100644
index 000000000..88bc6260d
--- /dev/null
+++ b/hw/darwin/apple/English.lproj/main.nib/.svn/text-base/info.nib.svn-base
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBFramework Version</key>
+ <string>588</string>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>244</integer>
+ <integer>29</integer>
+ <integer>423</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>9A356</string>
+ <key>targetFramework</key>
+ <string>IBCocoaFramework</string>
+</dict>
+</plist>
diff --git a/hw/darwin/apple/English.lproj/main.nib/.svn/text-base/keyedobjects.nib.svn-base b/hw/darwin/apple/English.lproj/main.nib/.svn/text-base/keyedobjects.nib.svn-base
new file mode 100644
index 000000000..8b31450ff
--- /dev/null
+++ b/hw/darwin/apple/English.lproj/main.nib/.svn/text-base/keyedobjects.nib.svn-base
Binary files differ
diff --git a/hw/darwin/apple/English.lproj/main.nib/classes.nib b/hw/darwin/apple/English.lproj/main.nib/classes.nib
new file mode 100644
index 000000000..a82159bd5
--- /dev/null
+++ b/hw/darwin/apple/English.lproj/main.nib/classes.nib
@@ -0,0 +1,318 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBClasses</key>
+ <array>
+ <dict>
+ <key>CLASS</key>
+ <string>IBLibraryObjectTemplate</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>draggedView</key>
+ <string>NSView</string>
+ <key>representedObject</key>
+ <string>NSObject</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSView</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>IBInspector</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>inspectorView</key>
+ <string>NSView</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSDateFormatter</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSFormatter</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>apps_table_cancel</key>
+ <string>id</string>
+ <key>apps_table_delete</key>
+ <string>id</string>
+ <key>apps_table_done</key>
+ <string>id</string>
+ <key>apps_table_duplicate</key>
+ <string>id</string>
+ <key>apps_table_new</key>
+ <string>id</string>
+ <key>apps_table_show</key>
+ <string>id</string>
+ <key>bring_to_front</key>
+ <string>id</string>
+ <key>close_window</key>
+ <string>id</string>
+ <key>enable_fullscreen_changed</key>
+ <string>id</string>
+ <key>minimize_window</key>
+ <string>id</string>
+ <key>next_window</key>
+ <string>id</string>
+ <key>prefs_changed</key>
+ <string>id</string>
+ <key>prefs_show</key>
+ <string>id</string>
+ <key>previous_window</key>
+ <string>id</string>
+ <key>toggle_fullscreen</key>
+ <string>id</string>
+ <key>x11_help</key>
+ <string>id</string>
+ <key>zoom_window</key>
+ <string>id</string>
+ </dict>
+ <key>CLASS</key>
+ <string>X11Controller</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>apps_separator</key>
+ <string>id</string>
+ <key>apps_table</key>
+ <string>id</string>
+ <key>depth</key>
+ <string>id</string>
+ <key>dock_apps_menu</key>
+ <string>id</string>
+ <key>dock_menu</key>
+ <string>id</string>
+ <key>dock_window_separator</key>
+ <string>id</string>
+ <key>enable_auth</key>
+ <string>id</string>
+ <key>enable_fullscreen</key>
+ <string>id</string>
+ <key>enable_keyequivs</key>
+ <string>id</string>
+ <key>enable_tcp</key>
+ <string>id</string>
+ <key>fake_buttons</key>
+ <string>id</string>
+ <key>prefs_panel</key>
+ <string>id</string>
+ <key>sync_keymap</key>
+ <string>id</string>
+ <key>toggle_fullscreen_item</key>
+ <string>id</string>
+ <key>use_sysbeep</key>
+ <string>id</string>
+ <key>window_separator</key>
+ <string>id</string>
+ <key>x11_about_item</key>
+ <string>id</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSNumberFormatter</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSFormatter</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
+ <string>NSFormatter</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>alignCenter:</key>
+ <string>id</string>
+ <key>alignJustified:</key>
+ <string>id</string>
+ <key>alignLeft:</key>
+ <string>id</string>
+ <key>alignRight:</key>
+ <string>id</string>
+ <key>arrangeInFront:</key>
+ <string>id</string>
+ <key>centerSelectionInVisibleArea:</key>
+ <string>id</string>
+ <key>changeFont:</key>
+ <string>id</string>
+ <key>checkSpelling:</key>
+ <string>id</string>
+ <key>clear:</key>
+ <string>id</string>
+ <key>clearRecentDocuments:</key>
+ <string>id</string>
+ <key>complete:</key>
+ <string>id</string>
+ <key>copy:</key>
+ <string>id</string>
+ <key>copyFont:</key>
+ <string>id</string>
+ <key>copyRuler:</key>
+ <string>id</string>
+ <key>cut:</key>
+ <string>id</string>
+ <key>delete:</key>
+ <string>id</string>
+ <key>deminiaturize:</key>
+ <string>id</string>
+ <key>fax:</key>
+ <string>id</string>
+ <key>hide:</key>
+ <string>id</string>
+ <key>hideOtherApplications:</key>
+ <string>id</string>
+ <key>loosenKerning:</key>
+ <string>id</string>
+ <key>lowerBaseline:</key>
+ <string>id</string>
+ <key>makeKeyAndOrderFront:</key>
+ <string>id</string>
+ <key>miniaturize:</key>
+ <string>id</string>
+ <key>newDocument:</key>
+ <string>id</string>
+ <key>openDocument:</key>
+ <string>id</string>
+ <key>orderBack:</key>
+ <string>id</string>
+ <key>orderFront:</key>
+ <string>id</string>
+ <key>orderFrontColorPanel:</key>
+ <string>id</string>
+ <key>orderFrontHelpPanel:</key>
+ <string>id</string>
+ <key>orderOut:</key>
+ <string>id</string>
+ <key>outline:</key>
+ <string>id</string>
+ <key>paste:</key>
+ <string>id</string>
+ <key>pasteAsPlainText:</key>
+ <string>id</string>
+ <key>pasteAsRichText:</key>
+ <string>id</string>
+ <key>pasteFont:</key>
+ <string>id</string>
+ <key>pasteRuler:</key>
+ <string>id</string>
+ <key>pause:</key>
+ <string>id</string>
+ <key>performClose:</key>
+ <string>id</string>
+ <key>performFindPanelAction:</key>
+ <string>id</string>
+ <key>performMiniaturize:</key>
+ <string>id</string>
+ <key>performZoom:</key>
+ <string>id</string>
+ <key>play:</key>
+ <string>id</string>
+ <key>print:</key>
+ <string>id</string>
+ <key>printDocument:</key>
+ <string>id</string>
+ <key>raiseBaseline:</key>
+ <string>id</string>
+ <key>record:</key>
+ <string>id</string>
+ <key>redo:</key>
+ <string>id</string>
+ <key>resume:</key>
+ <string>id</string>
+ <key>revertDocumentToSaved:</key>
+ <string>id</string>
+ <key>run:</key>
+ <string>id</string>
+ <key>runPageLayout:</key>
+ <string>id</string>
+ <key>runToolbarCustomizationPalette:</key>
+ <string>id</string>
+ <key>saveAllDocuments:</key>
+ <string>id</string>
+ <key>saveDocument:</key>
+ <string>id</string>
+ <key>saveDocumentAs:</key>
+ <string>id</string>
+ <key>saveDocumentTo:</key>
+ <string>id</string>
+ <key>selectAll:</key>
+ <string>id</string>
+ <key>selectText:</key>
+ <string>id</string>
+ <key>showGuessPanel:</key>
+ <string>id</string>
+ <key>showHelp:</key>
+ <string>id</string>
+ <key>start:</key>
+ <string>id</string>
+ <key>startSpeaking:</key>
+ <string>id</string>
+ <key>stop:</key>
+ <string>id</string>
+ <key>stopSpeaking:</key>
+ <string>id</string>
+ <key>subscript:</key>
+ <string>id</string>
+ <key>superscript:</key>
+ <string>id</string>
+ <key>terminate:</key>
+ <string>id</string>
+ <key>tightenKerning:</key>
+ <string>id</string>
+ <key>toggleContinuousSpellChecking:</key>
+ <string>id</string>
+ <key>toggleRuler:</key>
+ <string>id</string>
+ <key>toggleToolbarShown:</key>
+ <string>id</string>
+ <key>turnOffKerning:</key>
+ <string>id</string>
+ <key>turnOffLigatures:</key>
+ <string>id</string>
+ <key>underline:</key>
+ <string>id</string>
+ <key>undo:</key>
+ <string>id</string>
+ <key>unhideAllApplications:</key>
+ <string>id</string>
+ <key>unscript:</key>
+ <string>id</string>
+ <key>useAllLigatures:</key>
+ <string>id</string>
+ <key>useStandardKerning:</key>
+ <string>id</string>
+ <key>useStandardLigatures:</key>
+ <string>id</string>
+ </dict>
+ <key>CLASS</key>
+ <string>FirstResponder</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ </array>
+ <key>IBVersion</key>
+ <integer>1</integer>
+</dict>
+</plist>
diff --git a/hw/darwin/apple/English.lproj/main.nib/info.nib b/hw/darwin/apple/English.lproj/main.nib/info.nib
new file mode 100644
index 000000000..88bc6260d
--- /dev/null
+++ b/hw/darwin/apple/English.lproj/main.nib/info.nib
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IBFramework Version</key>
+ <string>588</string>
+ <key>IBOpenObjects</key>
+ <array>
+ <integer>244</integer>
+ <integer>29</integer>
+ <integer>423</integer>
+ </array>
+ <key>IBSystem Version</key>
+ <string>9A356</string>
+ <key>targetFramework</key>
+ <string>IBCocoaFramework</string>
+</dict>
+</plist>
diff --git a/hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib b/hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib
new file mode 100644
index 000000000..8b31450ff
--- /dev/null
+++ b/hw/darwin/apple/English.lproj/main.nib/keyedobjects.nib
Binary files differ
diff --git a/hw/darwin/apple/Info.plist b/hw/darwin/apple/Info.plist
new file mode 100644
index 000000000..ae47e9590
--- /dev/null
+++ b/hw/darwin/apple/Info.plist
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>x11app</string>
+ </array>
+ <key>CFBundleTypeIconFile</key>
+ <string>X11.icns</string>
+ <key>CFBundleTypeName</key>
+ <string>X11 Application</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>****</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>LSIsAppleDefaultForType</key>
+ <true/>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>tool</string>
+ <string>*</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>UNIX Application</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>****</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+ <string>X11</string>
+ <key>CFBundleGetInfoString</key>
+ <string>X11</string>
+ <key>CFBundleIconFile</key>
+ <string>X11.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.x.X11</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>X11</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>2.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2003-2007, Apple Inc.
+Copyright © 2003, XFree86 Project, Inc.</string>
+ <key>NSMainNibFile</key>
+ <string>main</string>
+ <key>NSPrincipalClass</key>
+ <string>X11Application</string>
+</dict>
+</plist>
diff --git a/hw/darwin/apple/X11.icns b/hw/darwin/apple/X11.icns
new file mode 100644
index 000000000..4c4717726
--- /dev/null
+++ b/hw/darwin/apple/X11.icns
Binary files differ
diff --git a/hw/darwin/apple/X11.xcodeproj/project.pbxproj b/hw/darwin/apple/X11.xcodeproj/project.pbxproj
new file mode 100644
index 000000000..2fef99ba0
--- /dev/null
+++ b/hw/darwin/apple/X11.xcodeproj/project.pbxproj
@@ -0,0 +1,320 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */; };
+ 527F241A0B5D938C007840A7 /* main.nib in Resources */ = {isa = PBXBuildFile; fileRef = 02345980000FD03B11CA0E72 /* main.nib */; };
+ 527F241B0B5D938C007840A7 /* X11.icns in Resources */ = {isa = PBXBuildFile; fileRef = 50459C5F038587C60ECA21EC /* X11.icns */; };
+ 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */ = {isa = PBXBuildFile; fileRef = 50EE2AB703849F0B0ECA21EC /* bundle-main.c */; };
+ 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */; };
+ 527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 570C5748047186C400ACF82F /* SystemConfiguration.framework */; };
+ 527F24370B5D9D89007840A7 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 527F24260B5D938C007840A7 /* Info.plist */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 0867D6ABFE840B52C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 1870340FFE93FCAF11CA0CD7 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/main.nib; sourceTree = "<group>"; };
+ 50459C5F038587C60ECA21EC /* X11.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = X11.icns; sourceTree = "<group>"; };
+ 50EE2AB703849F0B0ECA21EC /* bundle-main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = "bundle-main.c"; sourceTree = "<group>"; };
+ 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
+ 527F24260B5D938C007840A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+ 527F24270B5D938C007840A7 /* X11.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = X11.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 570C5748047186C400ACF82F /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = "<absolute>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 527F241E0B5D938C007840A7 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 527F241F0B5D938C007840A7 /* CoreFoundation.framework in Frameworks */,
+ 527F24200B5D938C007840A7 /* SystemConfiguration.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 195DF8CFFE9D517E11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 527F24270B5D938C007840A7 /* X11.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 20286C29FDCF999611CA2CEA /* X11 */ = {
+ isa = PBXGroup;
+ children = (
+ 20286C2AFDCF999611CA2CEA /* Sources */,
+ 20286C2CFDCF999611CA2CEA /* Resources */,
+ 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */,
+ 195DF8CFFE9D517E11CA2CBB /* Products */,
+ 527F24260B5D938C007840A7 /* Info.plist */,
+ );
+ name = X11;
+ sourceTree = "<group>";
+ };
+ 20286C2AFDCF999611CA2CEA /* Sources */ = {
+ isa = PBXGroup;
+ children = (
+ 50EE2AB703849F0B0ECA21EC /* bundle-main.c */,
+ );
+ name = Sources;
+ sourceTree = "<group>";
+ };
+ 20286C2CFDCF999611CA2CEA /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 50459C5F038587C60ECA21EC /* X11.icns */,
+ 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */,
+ 02345980000FD03B11CA0E72 /* main.nib */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */ = {
+ isa = PBXGroup;
+ children = (
+ 50F4F0A7039D6ACA0E82C0CB /* CoreFoundation.framework */,
+ 570C5748047186C400ACF82F /* SystemConfiguration.framework */,
+ );
+ name = "External Frameworks and Libraries";
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 527F24170B5D938C007840A7 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 527F24160B5D938C007840A7 /* X11 */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */;
+ buildPhases = (
+ 527F24170B5D938C007840A7 /* Headers */,
+ 527F24180B5D938C007840A7 /* Resources */,
+ 527F241C0B5D938C007840A7 /* Sources */,
+ 527F241E0B5D938C007840A7 /* Frameworks */,
+ 527F24210B5D938C007840A7 /* Rez */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = X11;
+ productName = X11;
+ productReference = 527F24270B5D938C007840A7 /* X11.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 20286C28FDCF999611CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */;
+ compatibilityVersion = "Xcode 2.4";
+ hasScannedForEncodings = 1;
+ mainGroup = 20286C29FDCF999611CA2CEA /* X11 */;
+ projectDirPath = "";
+ projectRoot = "";
+ shouldCheckCompatibility = 1;
+ targets = (
+ 527F24160B5D938C007840A7 /* X11 */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 527F24180B5D938C007840A7 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 527F24370B5D9D89007840A7 /* Info.plist in Resources */,
+ 527F24190B5D938C007840A7 /* InfoPlist.strings in Resources */,
+ 527F241A0B5D938C007840A7 /* main.nib in Resources */,
+ 527F241B0B5D938C007840A7 /* X11.icns in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXRezBuildPhase section */
+ 527F24210B5D938C007840A7 /* Rez */ = {
+ isa = PBXRezBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXRezBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 527F241C0B5D938C007840A7 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 527F241D0B5D938C007840A7 /* bundle-main.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 02345980000FD03B11CA0E72 /* main.nib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 1870340FFE93FCAF11CA0CD7 /* English */,
+ );
+ name = main.nib;
+ sourceTree = "<group>";
+ };
+ 0867D6AAFE840B52C02AAC07 /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 0867D6ABFE840B52C02AAC07 /* English */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 527F24090B5D8FFC007840A7 /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DSTROOT = "$(DSTROOT)";
+ SKIP_INSTALL = YES;
+ };
+ name = Development;
+ };
+ 527F240A0B5D8FFC007840A7 /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DSTROOT = "$(DSTROOT)";
+ SKIP_INSTALL = YES;
+ };
+ name = Deployment;
+ };
+ 527F240B0B5D8FFC007840A7 /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DSTROOT = "$(DSTROOT)";
+ SKIP_INSTALL = YES;
+ };
+ name = Default;
+ };
+ 527F24230B5D938C007840A7 /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(NATIVE_ARCH_32_BIT)";
+ COPY_PHASE_STRIP = NO;
+ DSTROOT = "$(DSTROOT)";
+ FRAMEWORK_SEARCH_PATHS = "";
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = "";
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = $DSTROOT/Applications/Utilties;
+ LIBRARY_SEARCH_PATHS = "";
+ OTHER_CFLAGS = "$(CFLAGS)";
+ OTHER_LDFLAGS = "$(LDFLAGS)";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = X11;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ WRAPPER_EXTENSION = app;
+ };
+ name = Development;
+ };
+ 527F24240B5D938C007840A7 /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ DSTROOT = "$(DSTROOT)";
+ FRAMEWORK_SEARCH_PATHS = "";
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = "";
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = $DSTROOT/Applications/Utilties;
+ LIBRARY_SEARCH_PATHS = "";
+ OTHER_CFLAGS = "$(CFLAGS)";
+ OTHER_LDFLAGS = "$(LDFLAGS)";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = X11;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ WRAPPER_EXTENSION = app;
+ };
+ name = Deployment;
+ };
+ 527F24250B5D938C007840A7 /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DSTROOT = "$(DSTROOT)";
+ FRAMEWORK_SEARCH_PATHS = "";
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ HEADER_SEARCH_PATHS = "";
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = $DSTROOT/Applications/Utilties;
+ LIBRARY_SEARCH_PATHS = "";
+ OTHER_CFLAGS = "$(CFLAGS)";
+ OTHER_LDFLAGS = "$(LDFLAGS)";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = X11;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ WRAPPER_EXTENSION = app;
+ };
+ name = Default;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 527F24080B5D8FFC007840A7 /* Build configuration list for PBXProject "X11" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 527F24090B5D8FFC007840A7 /* Development */,
+ 527F240A0B5D8FFC007840A7 /* Deployment */,
+ 527F240B0B5D8FFC007840A7 /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Default;
+ };
+ 527F24220B5D938C007840A7 /* Build configuration list for PBXNativeTarget "X11" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 527F24230B5D938C007840A7 /* Development */,
+ 527F24240B5D938C007840A7 /* Deployment */,
+ 527F24250B5D938C007840A7 /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Default;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 20286C28FDCF999611CA2CEA /* Project object */;
+}
diff --git a/hw/darwin/apple/X11Application.h b/hw/darwin/apple/X11Application.h
new file mode 100644
index 000000000..b9d2af8bf
--- /dev/null
+++ b/hw/darwin/apple/X11Application.h
@@ -0,0 +1,104 @@
+/* X11Application.h -- subclass of NSApplication to multiplex events
+ $Id: X11Application.h,v 1.26 2003/08/08 19:16:13 jharper Exp $
+
+ Copyright (c) 2002-2007 Apple Inc. 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. */
+
+#ifndef X11APPLICATION_H
+#define X11APPLICATION_H 1
+
+#if __OBJC__
+
+#import <Cocoa/Cocoa.h>
+#import "X11Controller.h"
+
+@interface X11Application : NSApplication {
+ X11Controller *_controller;
+
+ unsigned int _x_active :1;
+}
+
+- (void) set_controller:controller;
+- (void) set_window_menu:(NSArray *)list;
+
+- (int) prefs_get_integer:(NSString *)key default:(int)def;
+- (const char *) prefs_get_string:(NSString *)key default:(const char *)def;
+- (float) prefs_get_float:(NSString *)key default:(float)def;
+- (int) prefs_get_boolean:(NSString *)key default:(int)def;
+- (NSArray *) prefs_get_array:(NSString *)key;
+- (void) prefs_set_integer:(NSString *)key value:(int)value;
+- (void) prefs_set_float:(NSString *)key value:(float)value;
+- (void) prefs_set_boolean:(NSString *)key value:(int)value;
+- (void) prefs_set_array:(NSString *)key value:(NSArray *)value;
+- (void) prefs_set_string:(NSString *)key value:(NSString *)value;
+- (void) prefs_synchronize;
+
+- (BOOL) x_active;
+
+@end
+
+extern X11Application *X11App;
+
+#endif /* __OBJC__ */
+
+extern void X11ApplicationSetWindowMenu (int nitems, const char **items,
+ const char *shortcuts);
+extern void X11ApplicationSetWindowMenuCheck (int idx);
+extern void X11ApplicationSetFrontProcess (void);
+extern void X11ApplicationSetCanQuit (int state);
+extern void X11ApplicationServerReady (void);
+extern void X11ApplicationShowHideMenubar (int state);
+
+extern void X11ApplicationMain (int argc, const char *argv[],
+ void (*server_thread) (void *),
+ void *server_arg);
+
+extern int X11EnableKeyEquivalents;
+extern int quartzHasRoot, quartzEnableRootless;
+
+#define APP_PREFS "com.apple.x11"
+
+#define PREFS_APPSMENU "apps_menu"
+#define PREFS_FAKEBUTTONS "enable_fake_buttons"
+#define PREFS_SYSBEEP "enable_system_beep"
+#define PREFS_KEYEQUIVS "enable_key_equivalents"
+#define PREFS_KEYMAP_FILE "keymap_file"
+#define PREFS_SYNC_KEYMAP "sync_keymap"
+#define PREFS_DEPTH "depth"
+#define PREFS_NO_AUTH "no_auth"
+#define PREFS_NO_TCP "nolisten_tcp"
+#define PREFS_DONE_XINIT_CHECK "done_xinit_check"
+#define PREFS_NO_QUIT_ALERT "no_quit_alert"
+#define PREFS_FAKE_BUTTON2 "fake_button2"
+#define PREFS_FAKE_BUTTON3 "fake_button3"
+#define PREFS_ROOTLESS "rootless"
+#define PREFS_FULLSCREEN_HOTKEYS "fullscreen_hotkeys"
+#define PREFS_SWAP_ALT_META "swap_alt_meta"
+#define PREFS_XP_OPTIONS "xp_options"
+#define PREFS_ENABLE_STEREO "enable_stereo"
+
+#endif /* X11APPLICATION_H */
diff --git a/hw/darwin/apple/X11Application.m b/hw/darwin/apple/X11Application.m
new file mode 100644
index 000000000..57795f452
--- /dev/null
+++ b/hw/darwin/apple/X11Application.m
@@ -0,0 +1,926 @@
+/* X11Application.m -- subclass of NSApplication to multiplex events
+
+ Copyright (c) 2002-2007 Apple 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 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. */
+
+#include "../quartz/quartzCommon.h"
+
+#import "X11Application.h"
+#include <Carbon/Carbon.h>
+
+/* ouch! */
+#define BOOL X_BOOL
+# include "darwin.h"
+# include "../quartz/quartz.h"
+# define _APPLEWM_SERVER_
+# include "X11/extensions/applewm.h"
+# include "micmap.h"
+#undef BOOL
+
+#include "xf86Version.h"
+
+#include <mach/mach.h>
+#include <unistd.h>
+#include <pthread.h>
+
+#define DEFAULTS_FILE "/etc/X11/xserver/Xquartz.plist"
+
+int X11EnableKeyEquivalents = TRUE;
+int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
+
+extern int darwinFakeButtons, input_check_flag;
+// extern Bool enable_stereo;
+Bool enable_stereo; //<-- this needs to go back to being an extern once glxCGL is fixed
+
+extern xEvent *darwinEvents;
+
+X11Application *X11App;
+
+#define ALL_KEY_MASKS (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)
+
+@implementation X11Application
+
+typedef struct message_struct message;
+struct message_struct {
+ mach_msg_header_t hdr;
+ SEL selector;
+ NSObject *arg;
+};
+
+static mach_port_t _port;
+
+static void send_nsevent (NSEventType type, NSEvent *e);
+
+/* Quartz mode initialization routine. This is often dynamically loaded
+ but is statically linked into this X server. */
+extern Bool QuartzModeBundleInit(void);
+
+static void init_ports (void) {
+ kern_return_t r;
+ NSPort *p;
+
+ if (_port != MACH_PORT_NULL) return;
+
+ r = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &_port);
+ if (r != KERN_SUCCESS) return;
+
+ p = [NSMachPort portWithMachPort:_port];
+ [p setDelegate:NSApp];
+ [p scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+}
+
+static void message_kit_thread (SEL selector, NSObject *arg) {
+ message msg;
+ kern_return_t r;
+
+ msg.hdr.msgh_bits = MACH_MSGH_BITS (MACH_MSG_TYPE_MAKE_SEND, 0);
+ msg.hdr.msgh_size = sizeof (msg);
+ msg.hdr.msgh_remote_port = _port;
+ msg.hdr.msgh_local_port = MACH_PORT_NULL;
+ msg.hdr.msgh_reserved = 0;
+ msg.hdr.msgh_id = 0;
+
+ msg.selector = selector;
+ msg.arg = [arg retain];
+
+ r = mach_msg (&msg.hdr, MACH_SEND_MSG, msg.hdr.msgh_size,
+ 0, MACH_PORT_NULL, 0, MACH_PORT_NULL);
+ if (r != KERN_SUCCESS)
+ ErrorF("%s: mach_msg failed: %x\n", __FUNCTION__, r);
+}
+
+- (void) handleMachMessage:(void *)_msg {
+ message *msg = _msg;
+
+ [self performSelector:msg->selector withObject:msg->arg];
+ [msg->arg release];
+}
+
+- (void) set_controller:obj {
+ if (_controller == nil) _controller = [obj retain];
+}
+
+- (void) dealloc {
+ if (_controller != nil) [_controller release];
+
+ if (_port != MACH_PORT_NULL)
+ mach_port_deallocate (mach_task_self (), _port);
+
+ [super dealloc];
+}
+
+- (void) orderFrontStandardAboutPanel: (id) sender {
+ NSMutableDictionary *dict;
+ NSDictionary *infoDict;
+ NSString *tem;
+
+ dict = [NSMutableDictionary dictionaryWithCapacity:2];
+ infoDict = [[NSBundle mainBundle] infoDictionary];
+
+ [dict setObject: NSLocalizedString (@"The X Window System", @"About panel")
+ forKey:@"ApplicationName"];
+
+ tem = [infoDict objectForKey:@"CFBundleShortVersionString"];
+
+ [dict setObject:[NSString stringWithFormat:@"X11.app %@ - X.org X11R7.3", tem]
+ forKey:@"ApplicationVersion"];
+
+ [self orderFrontStandardAboutPanelWithOptions: dict];
+}
+
+- (void) activateX:(BOOL)state {
+ /* Create a TSM document that supports full Unicode input, and
+ have it activated while X is active (unless using the old
+ keymapping files) */
+ static TSMDocumentID x11_document;
+
+ if (state) {
+ QuartzMessageServerThread (kXDarwinActivate, 0);
+
+ if (!_x_active) {
+ if (x11_document == 0 && darwinKeymapFile == NULL) {
+ OSType types[1];
+ types[0] = kUnicodeDocument;
+ NewTSMDocument (1, types, &x11_document, 0);
+ }
+
+ if (x11_document != 0) ActivateTSMDocument (x11_document);
+ }
+ } else {
+ QuartzMessageServerThread (kXDarwinDeactivate, 0);
+
+ if (_x_active && x11_document != 0)
+ DeactivateTSMDocument (x11_document);
+ }
+
+ _x_active = state;
+}
+
+- (void) became_key:(NSWindow *)win {
+ [self activateX:NO];
+}
+
+- (void) sendEvent:(NSEvent *)e {
+ NSEventType type;
+ BOOL for_appkit, for_x;
+
+ type = [e type];
+
+ /* By default pass down the responder chain and to X. */
+ for_appkit = YES;
+ for_x = YES;
+
+ switch (type) {
+ case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
+ case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
+ if ([e window] != nil) {
+ /* Pointer event has a window. Probably something for the kit. */
+
+ for_x = NO;
+
+ if (_x_active) [self activateX:NO];
+ } else if ([self modalWindow] == nil) {
+ /* Must be an X window. Tell appkit it doesn't have focus. */
+
+ for_appkit = NO;
+
+ if ([self isActive]) {
+ [self deactivate];
+
+ if (!_x_active && quartzProcs->IsX11Window([e window], [e windowNumber]))
+ [self activateX:YES];
+ }
+ }
+ break;
+
+ case NSKeyDown: case NSKeyUp:
+ if (_x_active) {
+ static int swallow_up;
+
+ /* No kit window is focused, so send it to X. */
+
+ for_appkit = NO;
+
+ if (type == NSKeyDown) {
+ /* Before that though, see if there are any global
+ shortcuts bound to it. */
+
+ if (X11EnableKeyEquivalents
+ && [[self mainMenu] performKeyEquivalent:e]) {
+ swallow_up = [e keyCode];
+ for_x = NO;
+ } else if (!quartzEnableRootless
+ && ([e modifierFlags] & ALL_KEY_MASKS)
+ == (NSCommandKeyMask | NSAlternateKeyMask)
+ && ([e keyCode] == 0 /*a*/
+ || [e keyCode] == 53 /*Esc*/)) {
+ swallow_up = 0;
+ for_x = NO;
+#ifdef DARWIN_DDX_MISSING
+ QuartzMessageServerThread (kXDarwinToggleFullscreen, 0);
+#endif
+ }
+ } else {
+ /* If we saw a key equivalent on the down, don't pass
+ the up through to X. */
+
+ if (swallow_up != 0 && [e keyCode] == swallow_up) {
+ swallow_up = 0;
+ for_x = NO;
+ }
+ }
+ }
+ else for_x = NO;
+ break;
+
+ case NSFlagsChanged:
+ /* For the l33t X users who remap modifier keys to normal keysyms. */
+ if (!_x_active)
+ for_x = NO;
+ break;
+
+ case NSAppKitDefined:
+ switch ([e subtype]) {
+ case NSApplicationActivatedEventType:
+ for_x = NO;
+ if ([self modalWindow] == nil) {
+ for_appkit = NO;
+
+ /* FIXME: hack to avoid having to pass the event to appkit,
+ which would cause it to raise one of its windows. */
+ _appFlags._active = YES;
+
+ [self activateX:YES];
+#ifdef DARWIN_DDX_MISSING
+ if ([e data2] & 0x10) QuartzMessageServerThread (kXDarwinBringAllToFront, 0);
+#endif
+ }
+ break;
+
+ case 18: /* ApplicationDidReactivate */
+ if (quartzHasRoot) for_appkit = NO;
+ break;
+
+ case NSApplicationDeactivatedEventType:
+ for_x = NO;
+ [self activateX:NO];
+ break;
+ }
+ break;
+
+ default: break; /* for gcc */
+ }
+
+ if (for_appkit) [super sendEvent:e];
+ if (for_x) send_nsevent (type, e);
+}
+
+- (void) set_window_menu:(NSArray *)list {
+ [_controller set_window_menu:list];
+}
+
+- (void) set_window_menu_check:(NSNumber *)n {
+ [_controller set_window_menu_check:n];
+}
+
+- (void) set_apps_menu:(NSArray *)list {
+ [_controller set_apps_menu:list];
+}
+
+- (void) set_front_process:unused {
+ [NSApp activateIgnoringOtherApps:YES];
+
+ if ([self modalWindow] == nil) [self activateX:YES];
+}
+
+- (void) set_can_quit:(NSNumber *)state {
+ [_controller set_can_quit:[state boolValue]];
+}
+
+- (void) server_ready:unused {
+ [_controller server_ready];
+}
+
+- (void) show_hide_menubar:(NSNumber *)state {
+ if ([state boolValue]) ShowMenuBar ();
+ else HideMenuBar ();
+}
+
+
+/* user preferences */
+
+/* Note that these functions only work for arrays whose elements
+ can be toll-free-bridged between NS and CF worlds. */
+
+static const void *cfretain (CFAllocatorRef a, const void *b) {
+ return CFRetain (b);
+}
+
+static void cfrelease (CFAllocatorRef a, const void *b) {
+ CFRelease (b);
+}
+
+static CFMutableArrayRef nsarray_to_cfarray (NSArray *in) {
+ CFMutableArrayRef out;
+ CFArrayCallBacks cb;
+ NSObject *ns;
+ const CFTypeRef *cf;
+ int i, count;
+
+ memset (&cb, 0, sizeof (cb));
+ cb.version = 0;
+ cb.retain = cfretain;
+ cb.release = cfrelease;
+
+ count = [in count];
+ out = CFArrayCreateMutable (NULL, count, &cb);
+
+ for (i = 0; i < count; i++) {
+ ns = [in objectAtIndex:i];
+
+ if ([ns isKindOfClass:[NSArray class]])
+ cf = (CFTypeRef) nsarray_to_cfarray ((NSArray *) ns);
+ else
+ cf = CFRetain ((CFTypeRef) ns);
+
+ CFArrayAppendValue (out, cf);
+ CFRelease (cf);
+ }
+
+ return out;
+}
+
+static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
+ NSMutableArray *out;
+ const CFTypeRef *cf;
+ NSObject *ns;
+ int i, count;
+
+ count = CFArrayGetCount (in);
+ out = [[NSMutableArray alloc] initWithCapacity:count];
+
+ for (i = 0; i < count; i++) {
+ cf = CFArrayGetValueAtIndex (in, i);
+
+ if (CFGetTypeID (cf) == CFArrayGetTypeID ())
+ ns = cfarray_to_nsarray ((CFArrayRef) cf);
+ else
+ ns = [(id)cf retain];
+
+ [out addObject:ns];
+ [ns release];
+ }
+
+ return out;
+}
+
+- (CFPropertyListRef) prefs_get:(NSString *)key {
+ CFPropertyListRef value;
+
+ value = CFPreferencesCopyAppValue ((CFStringRef) key, CFSTR (APP_PREFS));
+
+ if (value == NULL) {
+ static CFDictionaryRef defaults;
+
+ if (defaults == NULL) {
+ CFStringRef error = NULL;
+ CFDataRef data;
+ CFURLRef url;
+ SInt32 error_code;
+
+ url = (CFURLCreateFromFileSystemRepresentation
+ (NULL, (unsigned char *)DEFAULTS_FILE, strlen (DEFAULTS_FILE), false));
+ if (CFURLCreateDataAndPropertiesFromResource (NULL, url, &data,
+ NULL, NULL, &error_code)) {
+ defaults = (CFPropertyListCreateFromXMLData
+ (NULL, data, kCFPropertyListMutableContainersAndLeaves, &error));
+ if (error != NULL) CFRelease (error);
+ CFRelease (data);
+ }
+ CFRelease (url);
+
+ if (defaults != NULL) {
+ NSMutableArray *apps, *elt;
+ int count, i;
+ NSString *name, *nname;
+
+ /* Localize the names in the default apps menu. */
+
+ apps = [(NSDictionary *)defaults objectForKey:@PREFS_APPSMENU];
+ if (apps != nil) {
+ count = [apps count];
+ for (i = 0; i < count; i++) {
+ elt = [apps objectAtIndex:i];
+ if (elt != nil && [elt isKindOfClass:[NSArray class]]) {
+ name = [elt objectAtIndex:0];
+ if (name != nil) {
+ nname = NSLocalizedString (name, nil);
+ if (nname != nil && nname != name)
+ [elt replaceObjectAtIndex:0 withObject:nname];
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (defaults != NULL) value = CFDictionaryGetValue (defaults, key);
+ if (value != NULL) CFRetain (value);
+ }
+
+ return value;
+}
+
+- (int) prefs_get_integer:(NSString *)key default:(int)def {
+ CFPropertyListRef value;
+ int ret;
+
+ value = [self prefs_get:key];
+
+ if (value != NULL && CFGetTypeID (value) == CFNumberGetTypeID ())
+ CFNumberGetValue (value, kCFNumberIntType, &ret);
+ else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ())
+ ret = CFStringGetIntValue (value);
+ else
+ ret = def;
+
+ if (value != NULL) CFRelease (value);
+
+ return ret;
+}
+
+- (const char *) prefs_get_string:(NSString *)key default:(const char *)def {
+ CFPropertyListRef value;
+ const char *ret = NULL;
+
+ value = [self prefs_get:key];
+
+ if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) {
+ NSString *s = (NSString *) value;
+
+ ret = [s UTF8String];
+ }
+
+ if (value != NULL) CFRelease (value);
+
+ return ret != NULL ? ret : def;
+}
+
+- (float) prefs_get_float:(NSString *)key default:(float)def {
+ CFPropertyListRef value;
+ float ret = def;
+
+ value = [self prefs_get:key];
+
+ if (value != NULL
+ && CFGetTypeID (value) == CFNumberGetTypeID ()
+ && CFNumberIsFloatType (value))
+ CFNumberGetValue (value, kCFNumberFloatType, &ret);
+ else if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ())
+ ret = CFStringGetDoubleValue (value);
+
+ if (value != NULL) CFRelease (value);
+
+ return ret;
+}
+
+- (int) prefs_get_boolean:(NSString *)key default:(int)def {
+ CFPropertyListRef value;
+ int ret = def;
+
+ value = [self prefs_get:key];
+
+ if (value != NULL) {
+ if (CFGetTypeID (value) == CFNumberGetTypeID ())
+ CFNumberGetValue (value, kCFNumberIntType, &ret);
+ else if (CFGetTypeID (value) == CFBooleanGetTypeID ())
+ ret = CFBooleanGetValue (value);
+ else if (CFGetTypeID (value) == CFStringGetTypeID ()) {
+ const char *tem = [(NSString *) value lossyCString];
+ if (strcasecmp (tem, "true") == 0 || strcasecmp (tem, "yes") == 0)
+ ret = YES;
+ else
+ ret = NO;
+ }
+
+ CFRelease (value);
+ }
+ return ret;
+}
+
+- (NSArray *) prefs_get_array:(NSString *)key {
+ NSArray *ret = nil;
+ CFPropertyListRef value;
+
+ value = [self prefs_get:key];
+
+ if (value != NULL) {
+ if (CFGetTypeID (value) == CFArrayGetTypeID ())
+ ret = [cfarray_to_nsarray (value) autorelease];
+
+ CFRelease (value);
+ }
+
+ return ret;
+}
+
+- (void) prefs_set_integer:(NSString *)key value:(int)value {
+ CFNumberRef x;
+
+ x = CFNumberCreate (NULL, kCFNumberIntType, &value);
+
+ CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS),
+ kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+
+ CFRelease (x);
+}
+
+- (void) prefs_set_float:(NSString *)key value:(float)value {
+ CFNumberRef x;
+
+ x = CFNumberCreate (NULL, kCFNumberFloatType, &value);
+
+ CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) x, CFSTR (APP_PREFS),
+ kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+
+ CFRelease (x);
+}
+
+- (void) prefs_set_boolean:(NSString *)key value:(int)value {
+ CFPreferencesSetValue ((CFStringRef) key,
+ (CFTypeRef) value ? kCFBooleanTrue
+ : kCFBooleanFalse, CFSTR (APP_PREFS),
+ kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+
+}
+
+- (void) prefs_set_array:(NSString *)key value:(NSArray *)value {
+ CFArrayRef cfarray;
+
+ cfarray = nsarray_to_cfarray (value);
+ CFPreferencesSetValue ((CFStringRef) key,
+ (CFTypeRef) cfarray,
+ CFSTR (APP_PREFS),
+ kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
+ CFRelease (cfarray);
+}
+
+- (void) prefs_set_string:(NSString *)key value:(NSString *)value {
+ CFPreferencesSetValue ((CFStringRef) key, (CFTypeRef) value,
+ CFSTR (APP_PREFS), kCFPreferencesCurrentUser,
+ kCFPreferencesAnyHost);
+}
+
+- (void) prefs_synchronize {
+ CFPreferencesAppSynchronize (kCFPreferencesCurrentApplication);
+}
+
+- (void) read_defaults {
+ const char *tem;
+
+ quartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP
+ default:quartzUseSysBeep];
+ quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS
+ default:quartzEnableRootless];
+#ifdef DARWIN_DDX_MISSING
+ quartzFullscreenDisableHotkeys = ![self prefs_get_boolean:
+ @PREFS_FULLSCREEN_HOTKEYS default:
+ !quartzFullscreenDisableHotkeys];
+ quartzXpluginOptions = [self prefs_get_integer:@PREFS_XP_OPTIONS
+ default:quartzXpluginOptions];
+#endif
+
+ darwinSwapAltMeta = [self prefs_get_boolean:@PREFS_SWAP_ALT_META
+ default:darwinSwapAltMeta];
+ darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS
+ default:darwinFakeButtons];
+ if (darwinFakeButtons) {
+ const char *fake2, *fake3;
+
+ fake2 = [self prefs_get_string:@PREFS_FAKE_BUTTON2 default:NULL];
+ fake3 = [self prefs_get_string:@PREFS_FAKE_BUTTON3 default:NULL];
+
+ if (fake2 != NULL) darwinFakeMouse2Mask = DarwinParseModifierList(fake2);
+ if (fake3 != NULL) darwinFakeMouse3Mask = DarwinParseModifierList(fake3);
+
+ }
+
+ X11EnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS
+ default:X11EnableKeyEquivalents];
+
+ darwinSyncKeymap = [self prefs_get_boolean:@PREFS_SYNC_KEYMAP
+ default:darwinSyncKeymap];
+
+ tem = [self prefs_get_string:@PREFS_KEYMAP_FILE default:NULL];
+
+ if (tem != NULL) darwinKeymapFile = strdup (tem);
+ else darwinKeymapFile = NULL;
+
+ darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH
+ default:darwinDesiredDepth];
+
+ enable_stereo = [self prefs_get_boolean:@PREFS_ENABLE_STEREO
+ default:false];
+}
+
+/* This will end up at the end of the responder chain. */
+- (void) copy:sender {
+ QuartzMessageServerThread (kXDarwinPasteboardNotify, 1,
+ AppleWMCopyToPasteboard);
+}
+
+- (BOOL) x_active {
+ return _x_active;
+}
+
+@end
+
+static NSArray *
+array_with_strings_and_numbers (int nitems, const char **items,
+ const char *numbers) {
+ NSMutableArray *array, *subarray;
+ NSString *string, *number;
+ int i;
+
+ /* (Can't autorelease on the X server thread) */
+
+ array = [[NSMutableArray alloc] initWithCapacity:nitems];
+
+ for (i = 0; i < nitems; i++) {
+ subarray = [[NSMutableArray alloc] initWithCapacity:2];
+
+ string = [[NSString alloc] initWithUTF8String:items[i]];
+ [subarray addObject:string];
+ [string release];
+
+ if (numbers[i] != 0) {
+ number = [[NSString alloc] initWithFormat:@"%d", numbers[i]];
+ [subarray addObject:number];
+ [number release];
+ } else
+ [subarray addObject:@""];
+
+ [array addObject:subarray];
+ [subarray release];
+ }
+
+ return array;
+}
+
+void X11ApplicationSetWindowMenu (int nitems, const char **items,
+ const char *shortcuts) {
+ NSArray *array;
+ array = array_with_strings_and_numbers (nitems, items, shortcuts);
+
+ /* Send the array of strings over to the appkit thread */
+
+ message_kit_thread (@selector (set_window_menu:), array);
+ [array release];
+}
+
+void X11ApplicationSetWindowMenuCheck (int idx) {
+ NSNumber *n;
+
+ n = [[NSNumber alloc] initWithInt:idx];
+
+ message_kit_thread (@selector (set_window_menu_check:), n);
+
+ [n release];
+}
+
+void X11ApplicationSetFrontProcess (void) {
+ message_kit_thread (@selector (set_front_process:), nil);
+}
+
+void X11ApplicationSetCanQuit (int state) {
+ NSNumber *n;
+
+ n = [[NSNumber alloc] initWithBool:state];
+
+ message_kit_thread (@selector (set_can_quit:), n);
+
+ [n release];
+}
+
+void X11ApplicationServerReady (void) {
+ message_kit_thread (@selector (server_ready:), nil);
+}
+
+void X11ApplicationShowHideMenubar (int state) {
+ NSNumber *n;
+
+ n = [[NSNumber alloc] initWithBool:state];
+
+ message_kit_thread (@selector (show_hide_menubar:), n);
+
+ [n release];
+}
+
+static void * create_thread (void *func, void *arg) {
+ pthread_attr_t attr;
+ pthread_t tid;
+
+ pthread_attr_init (&attr);
+ pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM);
+ pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
+ pthread_create (&tid, &attr, func, arg);
+ pthread_attr_destroy (&attr);
+
+ return (void *) tid;
+}
+
+static void check_xinitrc (void) {
+ char *tem, buf[1024];
+ NSString *msg;
+
+ if ([X11App prefs_get_boolean:@PREFS_DONE_XINIT_CHECK default:NO])
+ return;
+
+ tem = getenv ("HOME");
+ if (tem == NULL) goto done;
+
+ snprintf (buf, sizeof (buf), "%s/.xinitrc", tem);
+ if (access (buf, F_OK) != 0)
+ goto done;
+
+ /* FIXME: put localized strings into Resources/English.lproj */
+
+ msg = NSLocalizedString (@"You have an existing ~/.xinitrc file.\n\n\
+Windows displayed by X11 applications may not have titlebars, or may look \
+different to windows displayed by native applications.\n\n\
+Would you like to move aside the existing file and use the standard X11 \
+environment?", @"Startup xinitrc dialog");
+
+ if (NSRunAlertPanel (nil, msg, NSLocalizedString (@"Yes", @""),
+ NSLocalizedString (@"No", @""), nil)
+ == NSAlertDefaultReturn) {
+ char buf2[1024];
+ int i = -1;
+
+ snprintf (buf2, sizeof (buf2), "%s.old", buf);
+
+ for (i = 1; access (buf2, F_OK) == 0; i++)
+ snprintf (buf2, sizeof (buf2), "%s.old.%d", buf, i);
+
+ rename (buf, buf2);
+ }
+
+ done:
+ [X11App prefs_set_boolean:@PREFS_DONE_XINIT_CHECK value:YES];
+ [X11App prefs_synchronize];
+}
+
+void X11ApplicationMain (int argc, const char *argv[],
+ void (*server_thread) (void *), void *server_arg) {
+ NSAutoreleasePool *pool;
+
+#ifdef DEBUG
+ while (access ("/tmp/x11-block", F_OK) == 0) sleep (1);
+#endif
+
+ pool = [[NSAutoreleasePool alloc] init];
+
+ X11App = (X11Application *) [X11Application sharedApplication];
+
+ init_ports ();
+
+ [NSApp read_defaults];
+
+ [NSBundle loadNibNamed:@"main" owner:NSApp];
+
+ [[NSNotificationCenter defaultCenter] addObserver:NSApp
+ selector:@selector (became_key:)
+ name:NSWindowDidBecomeKeyNotification object:nil];
+
+ check_xinitrc ();
+
+ /*
+ * The xpr Quartz mode is statically linked into this server.
+ * Initialize all the Quartz functions.
+ */
+ QuartzModeBundleInit();
+
+ /* Calculate the height of the menubar so we can avoid it. */
+ aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) -
+ NSMaxY([[NSScreen mainScreen] visibleFrame]) - 1;
+
+ if (!create_thread (server_thread, server_arg)) {
+ ErrorF("can't create secondary thread\n");
+ exit(1);
+ }
+
+ [NSApp run];
+}
+
+
+/* event conversion */
+
+static inline unsigned short
+convert_flags (unsigned int nsflags) {
+ unsigned int xflags = 0;
+
+ if (nsflags == ~0) return 0xffff;
+
+ if (nsflags & NSAlphaShiftKeyMask) xflags |= LockMask;
+ if (nsflags & NSShiftKeyMask) xflags |= ShiftMask;
+ if (nsflags & NSControlKeyMask) xflags |= ControlMask;
+ if (nsflags & NSAlternateKeyMask) xflags |= Mod1Mask;
+ if (nsflags & NSCommandKeyMask) xflags |= Mod2Mask;
+ /* FIXME: secondaryfn? */
+
+ return xflags;
+}
+
+
+// This code should probably be merged with that in XDarwin's XServer.m - BB
+static void send_nsevent (NSEventType type, NSEvent *e) {
+ // static unsigned int button_state = 0;
+ NSRect screen;
+ NSPoint location;
+ NSWindow *window;
+ int pointer_x, pointer_y, ev_button, ev_type;
+ // int num_events=0, i=0, state;
+ xEvent xe;
+
+ /* convert location to global top-left coordinates */
+ location = [e locationInWindow];
+ window = [e window];
+ screen = [[[NSScreen screens] objectAtIndex:0] frame];
+
+ if (window != nil) {
+ NSRect frame = [window frame];
+ pointer_x = location.x + frame.origin.x;
+ pointer_y = (((screen.origin.y + screen.size.height)
+ - location.y) - frame.origin.y);
+ } else {
+ pointer_x = location.x;
+ pointer_y = (screen.origin.y + screen.size.height) - location.y;
+ }
+
+ pointer_y -= aquaMenuBarHeight;
+ // state = convert_flags ([e modifierFlags]);
+
+ switch (type) {
+ case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse;
+ case NSOtherMouseDown: ev_button=2; ev_type=ButtonPress; goto handle_mouse;
+ case NSRightMouseDown: ev_button=3; ev_type=ButtonPress; goto handle_mouse;
+ case NSLeftMouseUp: ev_button=1; ev_type=ButtonRelease; goto handle_mouse;
+ case NSOtherMouseUp: ev_button=2; ev_type=ButtonRelease; goto handle_mouse;
+ case NSRightMouseUp: ev_button=3; ev_type=ButtonRelease; goto handle_mouse;
+ case NSLeftMouseDragged: ev_button=1; ev_type=MotionNotify; goto handle_mouse;
+ case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify; goto handle_mouse;
+ case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify; goto handle_mouse;
+ case NSMouseMoved: ev_button=0; ev_type=MotionNotify; goto handle_mouse;
+ handle_mouse:
+
+ /* I'm not sure the below code is necessary or useful (-bb)
+ if(ev_type==ButtonPress) {
+ if (!quartzProcs->IsX11Window([e window], [e windowNumber])) {
+ fprintf(stderr, "Dropping event because it's not a window\n");
+ break;
+ }
+ button_state |= (1 << ev_button);
+ DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y);
+ } else if (ev_type==ButtonRelease && (button_state & (1 << ev_button)) == 0) break;
+ */
+ DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y);
+ break;
+ case NSScrollWheel:
+ DarwinSendScrollEvents([e deltaY], pointer_x, pointer_y);
+ break;
+
+ case NSKeyDown: // do we need to translate these keyCodes?
+ case NSKeyUp:
+ DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
+ break;
+
+ case NSFlagsChanged:
+ DarwinUpdateModKeys([e modifierFlags]);
+ break;
+ default: break; /* for gcc */
+ }
+}
diff --git a/hw/darwin/apple/X11Controller.h b/hw/darwin/apple/X11Controller.h
new file mode 100644
index 000000000..954d0abb9
--- /dev/null
+++ b/hw/darwin/apple/X11Controller.h
@@ -0,0 +1,86 @@
+/* X11Controller.h -- connect the IB ui
+ $Id: X11Controller.h,v 1.21 2003/07/24 17:52:29 jharper Exp $
+
+ Copyright (c) 2002 Apple Computer, Inc. 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. */
+
+#ifndef X11CONTROLLER_H
+#define X11CONTROLLER_H 1
+
+#if __OBJC__
+
+#import <Cocoa/Cocoa.h>
+#include "../quartz/xpr/x-list.h"
+
+@interface X11Controller : NSObject
+{
+ NSPanel *prefs_panel;
+
+ NSButton *fake_buttons;
+ NSButton *enable_fullscreen;
+ NSButton *use_sysbeep;
+ NSButton *enable_keyequivs;
+ NSButton *sync_keymap;
+ NSButton *enable_auth;
+ NSButton *enable_tcp;
+ NSPopUpButton *depth;
+
+ NSMenuItem *x11_about_item;
+ NSMenuItem *window_separator;
+ NSMenuItem *dock_window_separator;
+ NSMenuItem *apps_separator;
+ NSMenuItem *toggle_fullscreen_item;
+ NSMenu *dock_apps_menu;
+ NSTableView *apps_table;
+
+ NSArray *apps;
+ NSMutableArray *table_apps;
+
+ NSMenu *dock_menu;
+
+ int checked_window_item;
+ x_list *pending_apps;
+
+ BOOL finished_launching;
+ BOOL can_quit;
+}
+
+- (void) set_window_menu:(NSArray *)list;
+- (void) set_window_menu_check:(NSNumber *)n;
+- (void) set_apps_menu:(NSArray *)list;
+- (void) set_can_quit:(BOOL)state;
+- (void) server_ready;
+
+@end
+
+#endif /* __OBJC__ */
+
+extern void X11ControllerMain (int argc, const char *argv[],
+ void (*server_thread) (void *),
+ void *server_arg);
+
+#endif /* X11CONTROLLER_H */
diff --git a/hw/darwin/apple/X11Controller.m b/hw/darwin/apple/X11Controller.m
new file mode 100644
index 000000000..3dc965b69
--- /dev/null
+++ b/hw/darwin/apple/X11Controller.m
@@ -0,0 +1,752 @@
+/* X11Controller.m -- connect the IB ui, also the NSApp delegate
+ $Id: X11Controller.m,v 1.40 2006/09/06 21:19:32 jharper Exp $
+
+ Copyright (c) 2002-2007 Apple Inc. 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. */
+
+#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin"
+
+#include "../quartz/quartzCommon.h"
+
+#import "X11Controller.h"
+#import "X11Application.h"
+#import <Carbon/Carbon.h>
+
+/* ouch! */
+#define BOOL X_BOOL
+//# include "Xproto.h"
+#include "opaque.h"
+# include "darwin.h"
+# include "../quartz/quartz.h"
+# define _APPLEWM_SERVER_
+# include "X11/extensions/applewm.h"
+# include "../quartz/applewmExt.h"
+//# include "X.h"
+#undef BOOL
+
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#define TRACE() fprintf (stderr, "%s\n", __FUNCTION__)
+
+@implementation X11Controller
+
+- (void) awakeFromNib
+{
+ X11Application *xapp = NSApp;
+ NSArray *array;
+
+ /* Point X11Application at ourself. */
+ [xapp set_controller:self];
+
+ array = [xapp prefs_get_array:@PREFS_APPSMENU];
+ if (array != nil)
+ {
+ int count;
+
+ /* convert from [TITLE1 COMMAND1 TITLE2 COMMAND2 ...]
+ to [[TITLE1 COMMAND1] [TITLE2 COMMAND2] ...] format. */
+
+ count = [array count];
+ if (count > 0
+ && ![[array objectAtIndex:0] isKindOfClass:[NSArray class]])
+ {
+ int i;
+ NSMutableArray *copy, *sub;
+
+ copy = [NSMutableArray arrayWithCapacity:(count / 2)];
+
+ for (i = 0; i < count / 2; i++)
+ {
+ sub = [[NSMutableArray alloc] initWithCapacity:3];
+ [sub addObject:[array objectAtIndex:i*2]];
+ [sub addObject:[array objectAtIndex:i*2+1]];
+ [sub addObject:@""];
+ [copy addObject:sub];
+ [sub release];
+ }
+
+ array = copy;
+ }
+
+ [self set_apps_menu:array];
+ }
+}
+
+- (void) item_selected:sender
+{
+ [NSApp activateIgnoringOtherApps:YES];
+
+ QuartzMessageServerThread (kXDarwinControllerNotify, 2,
+ AppleWMWindowMenuItem, [sender tag]);
+}
+
+- (void) remove_window_menu
+{
+ NSMenu *menu;
+ int first, count, i;
+
+ /* Work backwards so we don't mess up the indices */
+ menu = [window_separator menu];
+ first = [menu indexOfItem:window_separator] + 1;
+ count = [menu numberOfItems];
+ for (i = count - 1; i >= first; i--)
+ [menu removeItemAtIndex:i];
+
+ menu = [dock_window_separator menu];
+ count = [menu indexOfItem:dock_window_separator];
+ for (i = 0; i < count; i++)
+ [dock_menu removeItemAtIndex:0];
+}
+
+- (void) install_window_menu:(NSArray *)list
+{
+ NSMenu *menu;
+ NSMenuItem *item;
+ int first, count, i;
+
+ menu = [window_separator menu];
+ first = [menu indexOfItem:window_separator] + 1;
+ count = [list count];
+ for (i = 0; i < count; i++)
+ {
+ NSString *name, *shortcut;
+
+ name = [[list objectAtIndex:i] objectAtIndex:0];
+ shortcut = [[list objectAtIndex:i] objectAtIndex:1];
+
+ item = (NSMenuItem *) [menu addItemWithTitle:name action:@selector
+ (item_selected:) keyEquivalent:shortcut];
+ [item setTarget:self];
+ [item setTag:i];
+ [item setEnabled:YES];
+
+ item = (NSMenuItem *) [dock_menu insertItemWithTitle:name
+ action:@selector
+ (item_selected:) keyEquivalent:shortcut
+ atIndex:i];
+ [item setTarget:self];
+ [item setTag:i];
+ [item setEnabled:YES];
+ }
+
+ if (checked_window_item >= 0 && checked_window_item < count)
+ {
+ item = (NSMenuItem *) [menu itemAtIndex:first + checked_window_item];
+ [item setState:NSOnState];
+ item = (NSMenuItem *) [dock_menu itemAtIndex:checked_window_item];
+ [item setState:NSOnState];
+ }
+}
+
+- (void) remove_apps_menu
+{
+ NSMenu *menu;
+ NSMenuItem *item;
+ int i;
+
+ if (apps == nil || apps_separator == nil) return;
+
+ menu = [apps_separator menu];
+
+ if (menu != nil)
+ {
+ for (i = [menu numberOfItems] - 1; i >= 0; i--)
+ {
+ item = (NSMenuItem *) [menu itemAtIndex:i];
+ if ([item tag] != 0)
+ [menu removeItemAtIndex:i];
+ }
+ }
+
+ if (dock_apps_menu != nil)
+ {
+ for (i = [dock_apps_menu numberOfItems] - 1; i >= 0; i--)
+ {
+ item = (NSMenuItem *) [dock_apps_menu itemAtIndex:i];
+ if ([item tag] != 0)
+ [dock_apps_menu removeItemAtIndex:i];
+ }
+ }
+
+ [apps release];
+ apps = nil;
+}
+
+- (void) prepend_apps_item:(NSArray *)list index:(int)i menu:(NSMenu *)menu
+{
+ NSString *title, *shortcut = @"";
+ NSArray *group;
+ NSMenuItem *item;
+
+ group = [list objectAtIndex:i];
+ title = [group objectAtIndex:0];
+ if ([group count] >= 3)
+ shortcut = [group objectAtIndex:2];
+
+ if ([title length] != 0)
+ {
+ item = (NSMenuItem *) [menu insertItemWithTitle:title
+ action:@selector (app_selected:)
+ keyEquivalent:shortcut atIndex:0];
+ [item setTarget:self];
+ [item setEnabled:YES];
+ }
+ else
+ {
+ item = (NSMenuItem *) [NSMenuItem separatorItem];
+ [menu insertItem:item atIndex:0];
+ }
+
+ [item setTag:i+1]; /* can't be zero, so add one */
+}
+
+- (void) install_apps_menu:(NSArray *)list
+{
+ NSMenu *menu;
+ int i, count;
+
+ count = [list count];
+
+ if (count == 0 || apps_separator == nil) return;
+
+ menu = [apps_separator menu];
+
+ for (i = count - 1; i >= 0; i--)
+ {
+ if (menu != nil)
+ [self prepend_apps_item:list index:i menu:menu];
+ if (dock_apps_menu != nil)
+ [self prepend_apps_item:list index:i menu:dock_apps_menu];
+ }
+
+ apps = [list retain];
+}
+
+- (void) set_window_menu:(NSArray *)list
+{
+ [self remove_window_menu];
+ [self install_window_menu:list];
+
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1,
+ AppleWMWindowMenuNotify);
+}
+
+- (void) set_window_menu_check:(NSNumber *)nn
+{
+ NSMenu *menu;
+ NSMenuItem *item;
+ int first, count;
+ int n = [nn intValue];
+
+ menu = [window_separator menu];
+ first = [menu indexOfItem:window_separator] + 1;
+ count = [menu numberOfItems] - first;
+
+ if (checked_window_item >= 0 && checked_window_item < count)
+ {
+ item = (NSMenuItem *) [menu itemAtIndex:first + checked_window_item];
+ [item setState:NSOffState];
+ item = (NSMenuItem *) [dock_menu itemAtIndex:checked_window_item];
+ [item setState:NSOffState];
+ }
+ if (n >= 0 && n < count)
+ {
+ item = (NSMenuItem *) [menu itemAtIndex:first + n];
+ [item setState:NSOnState];
+ item = (NSMenuItem *) [dock_menu itemAtIndex:n];
+ [item setState:NSOnState];
+ }
+ checked_window_item = n;
+}
+
+- (void) set_apps_menu:(NSArray *)list
+{
+ [self remove_apps_menu];
+ [self install_apps_menu:list];
+}
+
+- (void) launch_client:(NSString *)filename
+{
+ const char *command = [filename UTF8String];
+ const char *shell;
+ const char *argv[5];
+ int child1, child2 = 0;
+ int status;
+
+ shell = getenv("SHELL");
+ if (shell == NULL) shell = "/bin/bash";
+
+ argv[0] = shell;
+ argv[1] = "-l";
+ argv[2] = "-c";
+ argv[3] = command;
+ argv[4] = NULL;
+
+ /* Do the fork-twice trick to avoid having to reap zombies */
+
+ child1 = fork();
+
+ switch (child1) {
+ case -1: /* error */
+ break;
+
+ case 0: /* child1 */
+ child2 = fork();
+
+ switch (child2) {
+ int max_files, i;
+ char buf[1024], *temp;
+
+ case -1: /* error */
+ _exit(1);
+
+ case 0: /* child2 */
+ /* close all open files except for standard streams */
+ max_files = sysconf(_SC_OPEN_MAX);
+ for (i = 3; i < max_files; i++) close(i);
+
+ /* ensure stdin is on /dev/null */
+ close(0);
+ open("/dev/null", O_RDONLY);
+
+ /* Setup environment */
+ temp = getenv("DISPLAY");
+ if (temp == NULL || temp[0] == 0) {
+ snprintf(buf, sizeof(buf), ":%s", display);
+ setenv("DISPLAY", buf, TRUE);
+ }
+
+ temp = getenv("PATH");
+ if (temp == NULL || temp[0] == 0)
+ setenv ("PATH", DEFAULT_PATH, TRUE);
+ else if (strnstr(temp, "/usr/X11/bin", sizeof(temp)) == NULL) {
+ snprintf(buf, sizeof(buf), "%s:/usr/X11/bin", temp);
+ setenv("PATH", buf, TRUE);
+ }
+ /* cd $HOME */
+ temp = getenv("HOME");
+ if (temp != NULL && temp[0]!=0) chdir(temp);
+
+ execvp(argv[0], (char **const) argv);
+
+ _exit(2);
+
+ default: /* parent (child1) */
+ _exit(0);
+ }
+ break;
+
+ default: /* parent */
+ waitpid(child1, &status, 0);
+ }
+}
+
+- (void) app_selected:sender
+{
+ int tag;
+ NSString *item;
+
+ tag = [sender tag] - 1;
+ if (apps == nil || tag < 0 || tag >= [apps count])
+ return;
+
+ item = [[apps objectAtIndex:tag] objectAtIndex:1];
+
+ [self launch_client:item];
+}
+
+- (IBAction) apps_table_show:sender
+{
+ NSArray *columns;
+
+ if (table_apps == nil) {
+ table_apps = [[NSMutableArray alloc] initWithCapacity:1];
+
+ if (apps != nil)[table_apps addObjectsFromArray:apps];
+ }
+
+ columns = [apps_table tableColumns];
+ [[columns objectAtIndex:0] setIdentifier:@"0"];
+ [[columns objectAtIndex:1] setIdentifier:@"1"];
+ [[columns objectAtIndex:2] setIdentifier:@"2"];
+
+ [apps_table setDataSource:self];
+ [apps_table selectRow:0 byExtendingSelection:NO];
+
+ [[apps_table window] makeKeyAndOrderFront:sender];
+}
+
+- (IBAction) apps_table_cancel:sender
+{
+ [[apps_table window] orderOut:sender];
+ [apps_table reloadData];
+
+ [table_apps release];
+ table_apps = nil;
+}
+
+- (IBAction) apps_table_done:sender
+{
+ [apps_table deselectAll:sender]; /* flush edits? */
+
+ [self remove_apps_menu];
+ [self install_apps_menu:table_apps];
+
+ [NSApp prefs_set_array:@PREFS_APPSMENU value:table_apps];
+ [NSApp prefs_synchronize];
+
+ [[apps_table window] orderOut:sender];
+
+ [table_apps release];
+ table_apps = nil;
+}
+
+- (IBAction) apps_table_new:sender
+{
+ NSMutableArray *item;
+
+ int row = [apps_table selectedRow], i;
+
+ if (row < 0) row = 0;
+ else row = row + 1;
+
+ i = row;
+ if (i > [table_apps count])
+ return; /* avoid exceptions */
+
+ [apps_table deselectAll:sender];
+
+ item = [[NSMutableArray alloc] initWithCapacity:3];
+ [item addObject:@""];
+ [item addObject:@""];
+ [item addObject:@""];
+
+ [table_apps insertObject:item atIndex:i];
+ [item release];
+
+ [apps_table reloadData];
+ [apps_table selectRow:row byExtendingSelection:NO];
+}
+
+- (IBAction) apps_table_duplicate:sender
+{
+ int row = [apps_table selectedRow], i;
+ NSObject *item;
+
+ if (row < 0) {
+ [self apps_table_new:sender];
+ return;
+ }
+
+ i = row;
+ if (i > [table_apps count] - 1) return; /* avoid exceptions */
+
+ [apps_table deselectAll:sender];
+
+ item = [[table_apps objectAtIndex:i] mutableCopy];
+ [table_apps insertObject:item atIndex:i];
+ [item release];
+
+ [apps_table reloadData];
+ [apps_table selectRow:row+1 byExtendingSelection:NO];
+}
+
+- (IBAction) apps_table_delete:sender
+{
+ int row = [apps_table selectedRow];
+
+ if (row >= 0)
+ {
+ int i = row;
+
+ if (i > [table_apps count] - 1) return; /* avoid exceptions */
+
+ [apps_table deselectAll:sender];
+
+ [table_apps removeObjectAtIndex:i];
+ }
+
+ [apps_table reloadData];
+
+ row = MIN (row, [table_apps count] - 1);
+ if (row >= 0)
+ [apps_table selectRow:row byExtendingSelection:NO];
+}
+
+- (int) numberOfRowsInTableView:(NSTableView *)tableView
+{
+ if (table_apps == nil) return 0;
+
+ return [table_apps count];
+}
+
+- (id) tableView:(NSTableView *)tableView
+objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
+{
+ NSArray *item;
+ int col;
+
+ if (table_apps == nil) return nil;
+
+ col = [[tableColumn identifier] intValue];
+
+ item = [table_apps objectAtIndex:row];
+ if ([item count] > col)
+ return [item objectAtIndex:col];
+ else
+ return @"";
+}
+
+- (void) tableView:(NSTableView *)tableView setObjectValue:(id)object
+ forTableColumn:(NSTableColumn *)tableColumn row:(int)row
+{
+ NSMutableArray *item;
+ int col;
+
+ if (table_apps == nil) return;
+
+ col = [[tableColumn identifier] intValue];
+
+ item = [table_apps objectAtIndex:row];
+ [item replaceObjectAtIndex:col withObject:object];
+}
+
+- (void) hide_window:sender
+{
+ if ([X11App x_active])
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideWindow);
+ else
+ NSBeep (); /* FIXME: something here */
+}
+
+- (IBAction)bring_to_front:sender
+{
+ QuartzMessageServerThread(kXDarwinControllerNotify, 1, AppleWMBringAllToFront);
+}
+
+- (IBAction)close_window:sender
+{
+ if ([X11App x_active])
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMCloseWindow);
+ else
+ [[NSApp keyWindow] performClose:sender];
+}
+
+- (IBAction)minimize_window:sender
+{
+ if ([X11App x_active])
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMMinimizeWindow);
+ else
+ [[NSApp keyWindow] performMiniaturize:sender];
+}
+
+- (IBAction)zoom_window:sender
+{
+ if ([X11App x_active])
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMZoomWindow);
+ else
+ [[NSApp keyWindow] performZoom:sender];
+}
+
+- (IBAction) next_window:sender
+{
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMNextWindow);
+}
+
+- (IBAction) previous_window:sender
+{
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMPreviousWindow);
+}
+
+- (IBAction) enable_fullscreen_changed:sender
+{
+ int value = ![enable_fullscreen intValue];
+
+#ifdef DARWIN_DDX_MISSING
+ QuartzMessageServerThread (kXDarwinSetRootless, 1, value);
+#endif
+
+ [NSApp prefs_set_boolean:@PREFS_ROOTLESS value:value];
+ [NSApp prefs_synchronize];
+}
+
+- (IBAction) toggle_fullscreen:sender
+{
+#ifdef DARWIN_DDX_MISSING
+ QuartzMessageServerThread (kXDarwinToggleFullscreen, 0);
+#endif
+}
+
+- (void) set_can_quit:(BOOL)state
+{
+ can_quit = state;
+}
+
+- (IBAction)prefs_changed:sender
+{
+ darwinFakeButtons = [fake_buttons intValue];
+ quartzUseSysBeep = [use_sysbeep intValue];
+ X11EnableKeyEquivalents = [enable_keyequivs intValue];
+ darwinSyncKeymap = [sync_keymap intValue];
+
+ /* after adding prefs here, also add to [X11Application read_defaults]
+ and below */
+
+ [NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons];
+ [NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep];
+ [NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents];
+ [NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap];
+ [NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]];
+ [NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]];
+ [NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]];
+
+ [NSApp prefs_synchronize];
+}
+
+- (IBAction) prefs_show:sender
+{
+ [fake_buttons setIntValue:darwinFakeButtons];
+ [use_sysbeep setIntValue:quartzUseSysBeep];
+ [enable_keyequivs setIntValue:X11EnableKeyEquivalents];
+ [sync_keymap setIntValue:darwinSyncKeymap];
+ [sync_keymap setEnabled:darwinKeymapFile == NULL];
+
+ [enable_auth setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_AUTH default:NO]];
+ [enable_tcp setIntValue:![NSApp prefs_get_boolean:@PREFS_NO_TCP default:NO]];
+ [depth selectItemAtIndex:[depth indexOfItemWithTag:[NSApp prefs_get_integer:@PREFS_DEPTH default:-1]]];
+
+ [enable_fullscreen setIntValue:!quartzEnableRootless];
+
+ [prefs_panel makeKeyAndOrderFront:sender];
+}
+
+- (IBAction) quit:sender
+{
+ QuartzMessageServerThread (kXDarwinQuit, 0);
+}
+
+- (IBAction) x11_help:sender
+{
+ AHLookupAnchor (CFSTR ("Mac Help"), CFSTR ("mchlp2276"));
+}
+
+- (BOOL) validateMenuItem:(NSMenuItem *)item
+{
+ NSMenu *menu = [item menu];
+
+ if (item == toggle_fullscreen_item)
+ return !quartzEnableRootless;
+ else if (menu == [window_separator menu] || menu == dock_menu
+ || (menu == [x11_about_item menu] && [item tag] == 42))
+ return (AppleWMSelectedEvents () & AppleWMControllerNotifyMask) != 0;
+ else
+ return TRUE;
+}
+
+- (void) applicationDidHide:(NSNotification *)notify
+{
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMHideAll);
+}
+
+- (void) applicationDidUnhide:(NSNotification *)notify
+{
+ QuartzMessageServerThread (kXDarwinControllerNotify, 1, AppleWMShowAll);
+}
+
+- (NSApplicationTerminateReply) applicationShouldTerminate:sender
+{
+ NSString *msg;
+
+ if (can_quit || [X11App prefs_get_boolean:@PREFS_NO_QUIT_ALERT default:NO])
+ return NSTerminateNow;
+
+ /* Make sure we're frontmost. */
+ [NSApp activateIgnoringOtherApps:YES];
+
+ msg = NSLocalizedString (@"Are you sure you want to quit X11?\n\nIf you quit X11, any X11 applications you are running will stop immediately and you will lose any changes you have not saved.", @"Dialog when quitting");
+
+ /* FIXME: safe to run the alert in here? Or should we return Later
+ and then run the alert on a timer? It seems to work here, so.. */
+
+ return (NSRunAlertPanel (nil, msg, NSLocalizedString (@"Quit", @""),
+ NSLocalizedString (@"Cancel", @""), nil)
+ == NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel;
+}
+
+- (void) applicationWillTerminate:(NSNotification *)aNotification
+{
+ [X11App prefs_synchronize];
+
+ /* shutdown the X server, it will exit () for us. */
+ QuartzMessageServerThread (kXDarwinQuit, 0);
+
+ /* In case it doesn't, exit anyway after a while. */
+ while (sleep (10) != 0) ;
+ exit (1);
+}
+
+- (void) server_ready
+{
+ x_list *node;
+
+ finished_launching = YES;
+
+ for (node = pending_apps; node != NULL; node = node->next)
+ {
+ NSString *filename = node->data;
+ [self launch_client:filename];
+ [filename release];
+ }
+
+ x_list_free (pending_apps);
+ pending_apps = NULL;
+}
+
+- (BOOL) application:(NSApplication *)app openFile:(NSString *)filename
+{
+ const char *name = [filename UTF8String];
+
+ if (finished_launching)
+ [self launch_client:filename];
+ else if (name[0] != ':') /* ignore display names */
+ pending_apps = x_list_prepend (pending_apps, [filename retain]);
+
+ /* FIXME: report failures. */
+ return YES;
+}
+
+@end
+
+void X11ControllerMain (int argc, const char *argv[],
+ void (*server_thread) (void *), void *server_arg)
+{
+ X11ApplicationMain (argc, argv, server_thread, server_arg);
+}
diff --git a/hw/darwin/apple/Xquartz.man b/hw/darwin/apple/Xquartz.man
new file mode 100644
index 000000000..edac30ee9
--- /dev/null
+++ b/hw/darwin/apple/Xquartz.man
@@ -0,0 +1,158 @@
+.\" $XFree86: xc/programs/Xserver/hw/darwin/XDarwin.man,v 1.4 2002/01/09 18:01:58 torrey Exp $
+.\"
+.TH XQUARTZ 1 __vendorversion__
+.SH NAME
+Xquartz \- X window system server for Quartz operating system
+.SH SYNOPSIS
+.B Xquartz
+[ options ] ...
+.SH DESCRIPTION
+.I Xquartz
+is the X window server for Mac OS X provided by Apple.
+.I Xquartz
+runs in parallel with Aqua in rootless mode. In rootless mode, the X
+window system and Mac OS X share your display. The root window of the
+X11 display is the size of the screen and contains all the other
+windows. The X11 root window is not displayed in rootless mode as Mac
+OS X handles the desktop background.
+.SH OPTIONS
+.PP
+In addition to the normal server options described in the \fIXserver(1)\fP
+manual page, \fIXquartz\fP accepts the following command line switches:
+.TP 8
+.B \-fakebuttons
+Emulates a 3 button mouse using modifier keys. By default, the Command modifier
+is used to emulate button 2 and Option is used for button 3. Thus, clicking the
+first mouse button while holding down Command will act like clicking
+button 2. Holding down Option will simulate button 3.
+.TP 8
+.B \-nofakebuttons
+Do not emulate a 3 button mouse. This is the default.
+.TP 8
+.B "\-fakemouse2 \fImodifiers\fP"
+Change the modifier keys used to emulate the second mouse button. By default,
+Command is used to emulate the second button. Any combination of the following
+modifier names may be used: Shift, Option, Control, Command, Fn. For example,
+.B \-fakemouse2 """Option,Shift""
+will set holding Option, Shift and clicking on button one as equivalent to
+clicking the second mouse button.
+.TP 8
+.B "\-fakemouse3 \fImodifiers\fP"
+Change the modifier keys used to emulate the third mouse button. By default,
+Option is used to emulate the third button. Any combination of the following
+modifier names may be used: Shift, Option, Control, Command, Fn. For example,
+.B \-fakemouse3 """Control,Shift""
+will set holding Control, Shift and clicking on button one as equivalent to
+clicking the third mouse button.
+.TP 8
+.B "\-swapAltMeta"
+Swaps the meaning of the Alt and Meta modifier keys.
+.TP 8
+.B "\-keymap \fIfile\fP"
+On startup \fIXquartz\fP translates a Darwin keymapping into an X keymap.
+The default is to read this keymapping from USA.keymapping. With this option
+the keymapping will be read from \fIfile\fP instead. If the file's path is
+not specified, it will be searched for in Library/Keyboards/ underneath the
+following directories (in order): ~, /, /Network, /System.
+.TP 8
+.B \-nokeymap
+On startup \fIXquartz\fP translates a Darwin keymapping into an X keymap.
+With this option \fIXquartz\fP queries the kernel for the current keymapping
+instead of reading it from a file. This will often fail on newer kernels.
+.TP 8
+.B "\-depth \fIdepth\fP"
+Specifies the color bit depth to use. Currently only 15, and 24 color
+bits per pixel are supported. If not specified, defaults to the depth
+of the main display.
+.SH CUSTOMIZATION
+\fIXquartz\fP can also be customized using the defaults(1) command. The available options are:
+.TP 8
+.B defaults write com.apple.x11 enable_fake_buttons -boolean true
+Equivalent to the \fB-fakebuttons\fP command line option.
+.TP 8
+.B defaults write com.apple.x11 fake_button2 \fImodifiers\fP
+Equivalent to the \fB-fakemouse2\fP option.
+.TP 8
+.B defaults write com.apple.x11 fake_button3 \fImodifiers\fP
+Equivalent to the \fB-fakemouse3\fP option.
+.TP 8
+.B defaults write com.apple.x11 swap_alt_meta -boolean true
+Equivalent to the \fB-swapAltMeta\fP option.
+.TP 8
+.B defaults write com.apple.x11 keymap_file \fIfilename\fP
+Equivalent to the \fB-keymap\fP option.
+.TP 8
+.B defaults write com.apple.x11 no_quit_alert -boolean true
+Disables the alert dialog displayed when attempting to quit X11.
+.TP 8
+.B defaults write com.apple.x11 no_auth -boolean true
+Stops the X server requiring that clients authenticate themselves when
+connecting. See Xsecurity(__miscmansuffix__).
+.TP 8
+.B defaults write com.apple.x11 nolisten_tcp -boolean true
+Prevents the X server accepting remote connections.
+.TP 8
+.B defaults write com.apple.x11 xinit_kills_server -boolean false
+Stops the X server exiting when the xinitrc script terminates.
+.TP 8
+.B defaults write com.apple.x11 fullscreen_hotkeys -boolean false
+Allows system hotkeys to be handled while in X11 fullscreen mode.
+.TP 8
+.B defaults write com.apple.x11 enable_system_beep -boolean false
+Don't use the standard system beep effect for X11 alerts.
+.TP 8
+.B defaults write com.apple.x11 enable_key_equivalents -boolean false
+Disable menu keyboard equivalents while X11 windows are focused.
+.TP 8
+.B defaults write com.apple.x11 depth \fIdepth\fP
+Equivalent to the \fB-depth\fP option.
+.SH "SEE ALSO"
+.PP
+X(__miscmansuffix__), XFree86(1), Xserver(1), xdm(1), xinit(1)
+.PP
+.SH AUTHORS
+XFree86 was originally ported to Mac OS X Server by John Carmack. Dave
+Zarzycki used this as the basis of his port of XFree86 4.0 to Darwin 1.0.
+Torrey T. Lyons improved and integrated this code into the XFree86
+Project's mainline for the 4.0.2 release.
+.PP
+The following members of the XonX Team contributed to the following
+releases (in alphabetical order):
+.TP 4
+XFree86 4.1.0:
+.br
+Rob Braun - Darwin x86 support
+.br
+Torrey T. Lyons - Project Lead
+.br
+Andreas Monitzer - Cocoa version of XDarwin front end
+.br
+Gregory Robert Parker - Original Quartz implementation
+.br
+Christoph Pfisterer - Dynamic shared X libraries
+.br
+Toshimitsu Tanaka - Japanese localization
+.TP 4
+XFree86 4.2.0:
+.br
+Rob Braun - Darwin x86 support
+.br
+Pablo Di Noto - Spanish localization
+.br
+Paul Edens - Dutch localization
+.br
+Kyunghwan Kim - Korean localization
+.br
+Mario Klebsch - Non-US keyboard support
+.br
+Torrey T. Lyons - Project Lead
+.br
+Andreas Monitzer - German localization
+.br
+Patrik Montgomery - Swedish localization
+.br
+Greg Parker - Rootless support
+.br
+Toshimitsu Tanaka - Japanese localization
+.br
+Olivier Verdier - French localization
diff --git a/hw/darwin/apple/bundle-main.c b/hw/darwin/apple/bundle-main.c
new file mode 100644
index 000000000..a35e1e37f
--- /dev/null
+++ b/hw/darwin/apple/bundle-main.c
@@ -0,0 +1,912 @@
+/* bundle-main.c -- X server launcher
+ $Id: bundle-main.c,v 1.17 2003/09/11 00:17:10 jharper Exp $
+
+ Copyright (c) 2002-2007 Apple Inc. 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.
+
+ Parts of this file are derived from xdm, which has this copyright:
+
+ Copyright 1988, 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. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/socket.h>
+#include <sys/utsname.h>
+#include <ifaddrs.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <time.h>
+#include <sys/wait.h>
+#include <setjmp.h>
+#include <sys/ioctl.h>
+
+#include <X11/Xlib.h>
+#include <X11/Xauth.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+
+#define X_SERVER "/usr/X11/bin/Xquartz"
+#define XTERM_PATH "/usr/X11/bin/xterm"
+#define WM_PATH "/usr/X11/bin/quartz-wm"
+#define DEFAULT_XINITRC "/etc/X11/xinit/xinitrc"
+#define DEFAULT_PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11/bin"
+
+/* what xinit does */
+#ifndef SHELL
+# define SHELL "sh"
+#endif
+
+#undef FALSE
+#define FALSE 0
+#undef TRUE
+#define TRUE 1
+
+#define MAX_DISPLAYS 64
+
+static int server_pid = -1, client_pid = -1;
+static int xinit_kills_server = FALSE;
+static jmp_buf exit_continuation;
+static const char *server_name = NULL;
+static Display *server_dpy;
+
+static char *auth_file;
+
+typedef struct addr_list_struct addr_list;
+
+struct addr_list_struct {
+ addr_list *next;
+ Xauth auth;
+};
+
+static addr_list *addresses;
+
+
+/* Utility functions. */
+
+/* Return the current host name. Matches what Xlib does. */
+static char *
+host_name (void)
+{
+#ifdef NEED_UTSNAME
+ static struct utsname name;
+
+ uname(&name);
+
+ return name.nodename;
+#else
+ static char buf[100];
+
+ gethostname(buf, sizeof(buf));
+
+ return buf;
+#endif
+}
+
+static int
+read_boolean_pref (CFStringRef name, int default_)
+{
+ int value;
+ Boolean ok;
+
+ value = CFPreferencesGetAppBooleanValue (name,
+ CFSTR ("com.apple.x11"), &ok);
+ return ok ? value : default_;
+}
+
+static inline int
+binary_equal (const void *a, const void *b, int length)
+{
+ return memcmp (a, b, length) == 0;
+}
+
+static inline void *
+binary_dup (const void *a, int length)
+{
+ void *b = malloc (length);
+ if (b != NULL)
+ memcpy (b, a, length);
+ return b;
+}
+
+static inline void
+binary_free (void *data, int length)
+{
+ if (data != NULL)
+ free (data);
+}
+
+
+/* Functions for managing the authentication entries. */
+
+/* Returns true if something matching AUTH is in our list of auth items */
+static int
+check_auth_item (Xauth *auth)
+{
+ addr_list *a;
+
+ for (a = addresses; a != NULL; a = a->next)
+ {
+ if (a->auth.family == auth->family
+ && a->auth.address_length == auth->address_length
+ && binary_equal (a->auth.address, auth->address, auth->address_length)
+ && a->auth.number_length == auth->number_length
+ && binary_equal (a->auth.number, auth->number, auth->number_length)
+ && a->auth.name_length == auth->name_length
+ && binary_equal (a->auth.name, auth->name, auth->name_length))
+ {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+/* Add one item to our list of auth items. */
+static void
+add_auth_item (Xauth *auth)
+{
+ addr_list *a = malloc (sizeof (addr_list));
+
+ a->auth.family = auth->family;
+ a->auth.address_length = auth->address_length;
+ a->auth.address = binary_dup (auth->address, auth->address_length);
+ a->auth.number_length = auth->number_length;
+ a->auth.number = binary_dup (auth->number, auth->number_length);
+ a->auth.name_length = auth->name_length;
+ a->auth.name = binary_dup (auth->name, auth->name_length);
+ a->auth.data_length = auth->data_length;
+ a->auth.data = binary_dup (auth->data, auth->data_length);
+
+ a->next = addresses;
+ addresses = a;
+}
+
+/* Free all allocated auth items. */
+static void
+free_auth_items (void)
+{
+ addr_list *a;
+
+ while ((a = addresses) != NULL)
+ {
+ addresses = a->next;
+
+ binary_free (a->auth.address, a->auth.address_length);
+ binary_free (a->auth.number, a->auth.number_length);
+ binary_free (a->auth.name, a->auth.name_length);
+ binary_free (a->auth.data, a->auth.data_length);
+ free (a);
+ }
+}
+
+/* Add the unix domain auth item. */
+static void
+define_local (Xauth *auth)
+{
+ char *host = host_name ();
+
+#ifdef DEBUG
+ fprintf (stderr, "x11: hostname is %s\n", host);
+#endif
+
+ auth->family = FamilyLocal;
+ auth->address_length = strlen (host);
+ auth->address = host;
+
+ add_auth_item (auth);
+}
+
+/* Add the tcp auth item. */
+static void
+define_named (Xauth *auth, const char *name)
+{
+ struct ifaddrs *addrs, *ptr;
+
+ if (getifaddrs (&addrs) != 0)
+ return;
+
+ for (ptr = addrs; ptr != NULL; ptr = ptr->ifa_next)
+ {
+ if (ptr->ifa_addr->sa_family != AF_INET)
+ continue;
+
+ auth->family = FamilyInternet;
+ auth->address_length = sizeof (struct in_addr);
+ auth->address = (char *) &(((struct sockaddr_in *) ptr->ifa_addr)->sin_addr);
+
+#ifdef DEBUG
+ fprintf (stderr, "x11: ipaddr is %d.%d.%d.%d\n",
+ (unsigned char) auth->address[0],
+ (unsigned char) auth->address[1],
+ (unsigned char) auth->address[2],
+ (unsigned char) auth->address[3]);
+#endif
+
+ add_auth_item (auth);
+ }
+
+ freeifaddrs (addrs);
+}
+
+/* Parse the display number from NAME and add it to AUTH. */
+static void
+set_auth_number (Xauth *auth, const char *name)
+{
+ char *colon;
+ char *dot, *number;
+
+ colon = strrchr(name, ':');
+ if (colon != NULL)
+ {
+ colon++;
+ dot = strchr(colon, '.');
+
+ if (dot != NULL)
+ auth->number_length = dot - colon;
+ else
+ auth->number_length = strlen (colon);
+
+ number = malloc (auth->number_length + 1);
+ if (number != NULL)
+ {
+ strncpy (number, colon, auth->number_length);
+ number[auth->number_length] = '\0';
+ }
+ else
+ {
+ auth->number_length = 0;
+ }
+
+ auth->number = number;
+ }
+}
+
+/* Put 128 bits of random data into DATA. If possible, it will be "high
+ quality" */
+static int
+generate_mit_magic_cookie (char data[16])
+{
+ int fd, ret, i;
+ long *ldata = (long *) data;
+
+ fd = open ("/dev/random", O_RDONLY);
+ if (fd > 0) {
+ ret = read (fd, data, 16);
+ close (fd);
+ if (ret == 16) return TRUE;
+ }
+
+ /* fall back to the usual crappy rng */
+
+ srand48 (getpid () ^ time (NULL));
+
+ for (i = 0; i < 4; i++)
+ ldata[i] = lrand48 ();
+
+ return TRUE;
+}
+
+/* Create the keys we'll be using for the display named NAME. */
+static int
+make_auth_keys (const char *name)
+{
+ Xauth auth;
+ char key[16];
+
+ if (auth_file == NULL)
+ return FALSE;
+
+ auth.name = "MIT-MAGIC-COOKIE-1";
+ auth.name_length = strlen (auth.name);
+
+ if (!generate_mit_magic_cookie (key))
+ {
+ auth_file = NULL;
+ return FALSE;
+ }
+
+ auth.data = key;
+ auth.data_length = 16;
+
+ set_auth_number (&auth, name);
+
+ define_named (&auth, host_name ());
+ define_local (&auth);
+
+ free (auth.number);
+
+ return TRUE;
+}
+
+/* If ADD-ENTRIES is true, merge our auth entries into the existing
+ Xauthority file. If ADD-ENTRIES is false, remove our entries. */
+static int
+write_auth_file (int add_entries)
+{
+ char *home, newname[1024];
+ int fd, ret;
+ FILE *new_fh, *old_fh;
+ addr_list *addr;
+ Xauth *auth;
+
+ if (auth_file == NULL)
+ return FALSE;
+
+ home = getenv ("HOME");
+ if (home == NULL)
+ {
+ auth_file = NULL;
+ return FALSE;
+ }
+
+ snprintf (newname, sizeof (newname), "%s/.XauthorityXXXXXX", home);
+ mktemp (newname);
+
+ if (XauLockAuth (auth_file, 1, 2, 10) != LOCK_SUCCESS)
+ {
+ /* FIXME: do something here? */
+
+ auth_file = NULL;
+ return FALSE;
+ }
+
+ fd = open (newname, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+ if (fd >= 0)
+ {
+ new_fh = fdopen (fd, "w");
+ if (new_fh != NULL)
+ {
+ if (add_entries)
+ {
+ for (addr = addresses; addr != NULL; addr = addr->next)
+ {
+ XauWriteAuth (new_fh, &addr->auth);
+ }
+ }
+
+ old_fh = fopen (auth_file, "r");
+ if (old_fh != NULL)
+ {
+ while ((auth = XauReadAuth (old_fh)) != NULL)
+ {
+ if (!check_auth_item (auth))
+ XauWriteAuth (new_fh, auth);
+ XauDisposeAuth (auth);
+ }
+ fclose (old_fh);
+ }
+
+ fclose (new_fh);
+ unlink (auth_file);
+
+ ret = rename (newname, auth_file);
+
+ if (ret != 0)
+ auth_file = NULL;
+
+ XauUnlockAuth (auth_file);
+ return ret == 0;
+ }
+
+ close (fd);
+ }
+
+ XauUnlockAuth (auth_file);
+ auth_file = NULL;
+ return FALSE;
+}
+
+
+/* Subprocess management functions. */
+
+static int
+start_server (char **xargv)
+{
+ int child;
+
+ child = fork ();
+
+ switch (child)
+ {
+ case -1: /* error */
+ perror ("fork");
+ return FALSE;
+
+ case 0: /* child */
+ execv (X_SERVER, xargv);
+ perror ("Couldn't exec " X_SERVER);
+ _exit (1);
+
+ default: /* parent */
+ server_pid = child;
+ return TRUE;
+ }
+}
+
+static int
+wait_for_server (void)
+{
+ int count = 100;
+
+ while (count-- > 0)
+ {
+ int status;
+
+ server_dpy = XOpenDisplay (server_name);
+ if (server_dpy != NULL)
+ return TRUE;
+
+ if (waitpid (server_pid, &status, WNOHANG) == server_pid)
+ return FALSE;
+
+ sleep (1);
+ }
+
+ return FALSE;
+}
+
+static int
+start_client (void)
+{
+ int child;
+
+ child = fork();
+
+ switch (child) {
+ char *temp, buf[1024];
+
+ case -1: /* error */
+ perror("fork");
+ return FALSE;
+
+ case 0: /* child */
+ /* Setup environment */
+ temp = getenv("DISPLAY");
+ if (temp != NULL && temp[0] != 0)
+ setenv("DISPLAY", server_name, TRUE);
+
+ temp = getenv("PATH");
+ if (temp == NULL || temp[0] == 0)
+ setenv ("PATH", DEFAULT_PATH, TRUE);
+ else if (strnstr(temp, "/usr/X11/bin", sizeof(temp)) == NULL) {
+ snprintf(buf, sizeof(buf), "%s:/usr/X11/bin", temp);
+ setenv("PATH", buf, TRUE);
+ }
+
+ /* First try value of $XINITRC, if set. */
+ temp = getenv("XINITRC");
+ if (temp != NULL && temp[0] != 0 && access(temp, R_OK) == 0)
+ execlp (SHELL, SHELL, temp, NULL);
+
+ /* Then look for .xinitrc in user's home directory. */
+ temp = getenv("HOME");
+ if (temp != NULL && temp[0] != 0) {
+ chdir(temp);
+ snprintf (buf, sizeof (buf), "%s/.xinitrc", temp);
+ if (access(buf, R_OK) == 0)
+ execlp(SHELL, SHELL, buf, NULL);
+ }
+
+ /* Then try the default xinitrc in the lib directory. */
+
+ if (access(DEFAULT_XINITRC, R_OK) == 0)
+ execlp(SHELL, SHELL, DEFAULT_XINITRC, NULL);
+
+ /* Then fallback to hardcoding an xterm and the window manager. */
+
+ // system(XTERM_PATH " &");
+ execl(WM_PATH, WM_PATH, NULL);
+
+ perror("exec");
+ _exit(1);
+
+ default: /* parent */
+ client_pid = child;
+ return TRUE;
+ }
+}
+
+static void
+sigchld_handler (int sig)
+{
+ int pid, status;
+
+ again:
+ pid = waitpid (WAIT_ANY, &status, WNOHANG);
+
+ if (pid > 0)
+ {
+ if (pid == server_pid)
+ {
+ server_pid = -1;
+
+ if (client_pid >= 0)
+ kill (client_pid, SIGTERM);
+ }
+ else if (pid == client_pid)
+ {
+ client_pid = -1;
+
+ if (server_pid >= 0 && xinit_kills_server)
+ kill (server_pid, SIGTERM);
+ }
+ goto again;
+ }
+
+ if (server_pid == -1 && client_pid == -1)
+ longjmp (exit_continuation, 1);
+
+ signal (SIGCHLD, sigchld_handler);
+}
+
+
+/* Server utilities. */
+
+static Boolean
+display_exists_p (int number)
+{
+ char buf[64];
+ void *conn;
+ char *fullname = NULL;
+ int idisplay, iscreen;
+ char *conn_auth_name, *conn_auth_data;
+ int conn_auth_namelen, conn_auth_datalen;
+#ifdef USE_XTRANS_INTERNALS
+ extern void *_X11TransConnectDisplay ();
+ extern void _XDisconnectDisplay ();
+#endif
+ /* Since connecting to the display waits for a few seconds if the
+ display doesn't exist, check for trivial non-existence - if the
+ socket in /tmp exists or not.. (note: if the socket exists, the
+ server may still not, so we need to try to connect in that case..) */
+
+ sprintf (buf, "/tmp/.X11-unix/X%d", number);
+ if (access (buf, F_OK) != 0)
+ return FALSE;
+#ifdef USE_XTRANS_INTERNALS
+ /* This is a private function that we shouldn't really be calling,
+ but it's the best way to see if the server exists (without
+ needing to hold the necessary authentication to use it) */
+
+ sprintf (buf, ":%d", number);
+ conn = _X11TransConnectDisplay (buf, &fullname, &idisplay, &iscreen,
+ &conn_auth_name, &conn_auth_namelen,
+ &conn_auth_data, &conn_auth_datalen);
+ if (conn == NULL)
+ return FALSE;
+
+ _XDisconnectDisplay (conn);
+#endif
+ return TRUE;
+}
+
+
+/* Monitoring when the system's ip addresses change. */
+
+static Boolean pending_timer;
+
+static void
+timer_callback (CFRunLoopTimerRef timer, void *info)
+{
+ pending_timer = FALSE;
+
+ /* Update authentication names. Need to write .Xauthority file first
+ without the existing entries, then again with the new entries.. */
+
+ write_auth_file (FALSE);
+
+ free_auth_items ();
+ make_auth_keys (server_name);
+
+ write_auth_file (TRUE);
+}
+
+/* This function is called when the system's ip addresses may have changed. */
+static void
+ipaddr_callback (SCDynamicStoreRef store, CFArrayRef changed_keys, void *info)
+{
+#if DEBUG
+ if (changed_keys != NULL) {
+ fprintf (stderr, "x11: changed sc keys: ");
+ CFShow (changed_keys);
+ }
+#endif
+
+ if (auth_file != NULL && !pending_timer)
+ {
+ CFRunLoopTimerRef timer;
+
+ timer = CFRunLoopTimerCreate (NULL, CFAbsoluteTimeGetCurrent () + 1.0,
+ 0.0, 0, 0, timer_callback, NULL);
+ CFRunLoopAddTimer (CFRunLoopGetCurrent (), timer,
+ kCFRunLoopDefaultMode);
+ CFRelease (timer);
+
+ pending_timer = TRUE;
+ }
+}
+
+/* This code adapted from "Living in a Dynamic TCP/IP Environment" technote. */
+static Boolean
+install_ipaddr_source (void)
+{
+ CFRunLoopSourceRef source = NULL;
+
+ SCDynamicStoreContext context = {0};
+ SCDynamicStoreRef ref;
+
+ ref = SCDynamicStoreCreate (NULL,
+ CFSTR ("AddIPAddressListChangeCallbackSCF"),
+ ipaddr_callback, &context);
+
+ if (ref != NULL)
+ {
+ const void *keys[4], *patterns[2];
+ int i;
+
+ keys[0] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4);
+ keys[1] = SCDynamicStoreKeyCreateNetworkGlobalEntity (NULL, kSCDynamicStoreDomainState, kSCEntNetIPv6);
+ keys[2] = SCDynamicStoreKeyCreateComputerName (NULL);
+ keys[3] = SCDynamicStoreKeyCreateHostNames (NULL);
+
+ patterns[0] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4);
+ patterns[1] = SCDynamicStoreKeyCreateNetworkInterfaceEntity (NULL, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv6);
+
+ if (keys[0] != NULL && keys[1] != NULL && keys[2] != NULL
+ && keys[3] != NULL && patterns[0] != NULL && patterns[1] != NULL)
+ {
+ CFArrayRef key_array, pattern_array;
+
+ key_array = CFArrayCreate (NULL, keys, 4, &kCFTypeArrayCallBacks);
+ pattern_array = CFArrayCreate (NULL, patterns, 2, &kCFTypeArrayCallBacks);
+
+ if (key_array != NULL || pattern_array != NULL)
+ {
+ SCDynamicStoreSetNotificationKeys (ref, key_array, pattern_array);
+ source = SCDynamicStoreCreateRunLoopSource (NULL, ref, 0);
+ }
+
+ if (key_array != NULL)
+ CFRelease (key_array);
+ if (pattern_array != NULL)
+ CFRelease (pattern_array);
+ }
+
+
+ for (i = 0; i < 4; i++)
+ if (keys[i] != NULL)
+ CFRelease (keys[i]);
+ for (i = 0; i < 2; i++)
+ if (patterns[i] != NULL)
+ CFRelease (patterns[i]);
+
+ CFRelease (ref);
+ }
+
+ if (source != NULL)
+ {
+ CFRunLoopAddSource (CFRunLoopGetCurrent (),
+ source, kCFRunLoopDefaultMode);
+ CFRelease (source);
+ }
+
+ return source != NULL;
+}
+
+
+/* Entrypoint. */
+
+void
+termination_signal_handler (int unused_sig)
+{
+ signal (SIGTERM, SIG_DFL);
+ signal (SIGHUP, SIG_DFL);
+ signal (SIGINT, SIG_DFL);
+ signal (SIGQUIT, SIG_DFL);
+
+ longjmp (exit_continuation, 1);
+}
+
+int
+main (int argc, char **argv)
+{
+ char **xargv;
+ int i, j;
+ int fd;
+
+ xargv = alloca (sizeof (char *) * (argc + 32));
+
+ if (!read_boolean_pref (CFSTR ("no_auth"), FALSE))
+ auth_file = XauFileName ();
+
+ /* The standard X11 behaviour is for the server to quit when the first
+ client exits. But it can be useful for debugging (and to mimic our
+ behaviour in the beta releases) to not do that. */
+
+ xinit_kills_server = read_boolean_pref (CFSTR ("xinit_kills_server"), TRUE);
+
+ for (i = 1; i < argc; i++)
+ {
+ if (argv[i][0] == ':')
+ server_name = argv[i];
+ }
+
+ if (server_name == NULL)
+ {
+ static char name[8];
+
+ /* No display number specified, so search for the first unused.
+
+ There's a big old race condition here if two servers start at
+ the same time, but that's fairly unlikely. We could create
+ lockfiles or something, but that's seems more likely to cause
+ problems than the race condition itself.. */
+
+ for (i = 0; i < MAX_DISPLAYS; i++)
+ {
+ if (!display_exists_p (i))
+ break;
+ }
+
+ if (i == MAX_DISPLAYS)
+ {
+ fprintf (stderr, "%s: couldn't allocate a display number", argv[0]);
+ exit (1);
+ }
+
+ sprintf (name, ":%d", i);
+ server_name = name;
+ }
+
+ if (auth_file != NULL)
+ {
+ /* Create new Xauth keys and add them to the .Xauthority file */
+
+ make_auth_keys (server_name);
+ write_auth_file (TRUE);
+ }
+
+ /* Construct our new argv */
+
+ i = j = 0;
+
+ xargv[i++] = argv[j++];
+
+ if (auth_file != NULL)
+ {
+ xargv[i++] = "-auth";
+ xargv[i++] = auth_file;
+ }
+
+ /* By default, don't listen on tcp sockets if Xauth is disabled. */
+
+ if (read_boolean_pref (CFSTR ("nolisten_tcp"), auth_file == NULL))
+ {
+ xargv[i++] = "-nolisten";
+ xargv[i++] = "tcp";
+ }
+
+ while (j < argc)
+ {
+ if (argv[j++][0] != ':')
+ xargv[i++] = argv[j-1];
+ }
+
+ xargv[i++] = (char *) server_name;
+ xargv[i++] = NULL;
+
+ /* Detach from any controlling terminal and connect stdin to /dev/null */
+
+#ifdef TIOCNOTTY
+ fd = open ("/dev/tty", O_RDONLY);
+ if (fd != -1)
+ {
+ ioctl (fd, TIOCNOTTY, 0);
+ close (fd);
+ }
+#endif
+
+ fd = open ("/dev/null", O_RDWR, 0);
+ if (fd >= 0)
+ {
+ dup2 (fd, 0);
+ if (fd > 0)
+ close (fd);
+ }
+
+ if (!start_server (xargv))
+ return 1;
+
+ if (!wait_for_server ())
+ {
+ kill (server_pid, SIGTERM);
+ return 1;
+ }
+
+ if (!start_client ())
+ {
+ kill (server_pid, SIGTERM);
+ return 1;
+ }
+
+ signal (SIGCHLD, sigchld_handler);
+
+ signal (SIGTERM, termination_signal_handler);
+ signal (SIGHUP, termination_signal_handler);
+ signal (SIGINT, termination_signal_handler);
+ signal (SIGQUIT, termination_signal_handler);
+
+ if (setjmp (exit_continuation) == 0)
+ {
+ if (install_ipaddr_source ())
+ CFRunLoopRun ();
+ else
+ while (1) pause ();
+ }
+
+ signal (SIGCHLD, SIG_IGN);
+
+ if (client_pid >= 0) kill (client_pid, SIGTERM);
+ if (server_pid >= 0) kill (server_pid, SIGTERM);
+
+ if (auth_file != NULL)
+ {
+ /* Remove our Xauth keys */
+
+ write_auth_file (FALSE);
+ }
+
+ free_auth_items ();
+
+ return 0;
+}
diff --git a/hw/darwin/bundle/Dutch.lproj/Makefile.am b/hw/darwin/bundle/Dutch.lproj/Makefile.am
new file mode 100644
index 000000000..a480ceeb3
--- /dev/null
+++ b/hw/darwin/bundle/Dutch.lproj/Makefile.am
@@ -0,0 +1,35 @@
+BINDIR = ${bindir}
+include $(top_srcdir)/cpprules.in
+XINITDIR = $(libdir)/X11/xinit
+XDEFS = \
+ -DX_VERSION="$(PLIST_VERSION_STRING)" \
+ -DX_PRE_RELEASE="$(PRE)" \
+ -DX_REL_DATE="$(XORG_DATE)" \
+ -DX_VENDOR_NAME="$(VENDOR_STRING)" \
+ -DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
+
+resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
+
+Dutchlprojdir = $(resourcesdir)/Dutch.lproj
+
+Dutchlproj_DATA = \
+ XDarwinHelp.html \
+ InfoPlist.strings \
+ Credits.rtf Localizable.strings
+
+Dutchlprojnibdir = $(Dutchlprojdir)/MainMenu.nib
+Dutchlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
+
+InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
+
+XDarwinHelp.html: XDarwinHelp.html.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
+
+CLEANFILES = XDarwinHelp.html InfoPlist.strings
+
+EXTRA_DIST = \
+ Credits.rtf Localizable.strings \
+ MainMenu.nib/classes.nib \
+ MainMenu.nib/objects.nib \
+ XDarwinHelp.html.cpp
diff --git a/hw/darwin/bundle/English.lproj/Makefile.am b/hw/darwin/bundle/English.lproj/Makefile.am
new file mode 100644
index 000000000..45587086f
--- /dev/null
+++ b/hw/darwin/bundle/English.lproj/Makefile.am
@@ -0,0 +1,35 @@
+BINDIR = ${bindir}
+include $(top_srcdir)/cpprules.in
+XINITDIR = $(libdir)/X11/xinit
+XDEFS = \
+ -DX_VERSION="$(PLIST_VERSION_STRING)" \
+ -DX_PRE_RELEASE="$(PRE)" \
+ -DX_REL_DATE="$(XORG_DATE)" \
+ -DX_VENDOR_NAME="$(VENDOR_STRING)" \
+ -DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
+
+resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
+
+Englishlprojdir = $(resourcesdir)/English.lproj
+Englishlproj_DATA = \
+ XDarwinHelp.html \
+ InfoPlist.strings \
+ Credits.rtf Localizable.strings
+
+Englishlprojnibdir = $(Englishlprojdir)/MainMenu.nib
+Englishlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
+
+InfoPlist.strings: InfoPlist.strings.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
+
+XDarwinHelp.html: XDarwinHelp.html.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
+
+CLEANFILES = XDarwinHelp.html InfoPlist.strings
+
+EXTRA_DIST = \
+ Credits.rtf Localizable.strings \
+ MainMenu.nib/classes.nib \
+ MainMenu.nib/objects.nib \
+ XDarwinHelp.html.cpp \
+ InfoPlist.strings.cpp
diff --git a/hw/darwin/bundle/French.lproj/Makefile.am b/hw/darwin/bundle/French.lproj/Makefile.am
new file mode 100644
index 000000000..656ba5c0d
--- /dev/null
+++ b/hw/darwin/bundle/French.lproj/Makefile.am
@@ -0,0 +1,38 @@
+BINDIR = ${bindir}
+include $(top_srcdir)/cpprules.in
+XINITDIR = $(libdir)/X11/xinit
+
+XDEFS = \
+ -DX_VERSION="$(PLIST_VERSION_STRING)" \
+ -DX_PRE_RELEASE="$(PRE)" \
+ -DX_REL_DATE="$(XORG_DATE)" \
+ -DX_VENDOR_NAME="$(VENDOR_STRING)" \
+ -DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
+
+
+resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
+
+Frenchlprojdir = $(resourcesdir)/French.lproj
+
+Frenchlproj_DATA = \
+ XDarwinHelp.html \
+ InfoPlist.strings \
+ Credits.rtf Localizable.strings
+
+Frenchlprojnibdir = $(Frenchlprojdir)/MainMenu.nib
+Frenchlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
+
+InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
+
+XDarwinHelp.html: XDarwinHelp.html.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
+
+CLEANFILES = XDarwinHelp.html InfoPlist.strings
+
+EXTRA_DIST = \
+ Credits.rtf Localizable.strings \
+ Localizable.strings \
+ MainMenu.nib/classes.nib \
+ MainMenu.nib/objects.nib \
+ XDarwinHelp.html.cpp
diff --git a/hw/darwin/bundle/German.lproj/Makefile.am b/hw/darwin/bundle/German.lproj/Makefile.am
new file mode 100644
index 000000000..17af414ec
--- /dev/null
+++ b/hw/darwin/bundle/German.lproj/Makefile.am
@@ -0,0 +1,36 @@
+BINDIR = ${bindir}
+include $(top_srcdir)/cpprules.in
+XINITDIR = $(libdir)/X11/xinit
+XDEFS = \
+ -DX_VERSION="$(PLIST_VERSION_STRING)" \
+ -DX_PRE_RELEASE="$(PRE)" \
+ -DX_REL_DATE="$(XORG_DATE)" \
+ -DX_VENDOR_NAME="$(VENDOR_STRING)" \
+ -DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
+
+resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
+
+Germanlprojdir = $(resourcesdir)/German.lproj
+
+Germanlproj_DATA = \
+ XDarwinHelp.html \
+ InfoPlist.strings \
+ Credits.rtf Localizable.strings
+
+Germanlprojnibdir = $(Germanlprojdir)/MainMenu.nib
+Germanlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
+
+InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
+
+XDarwinHelp.html: XDarwinHelp.html.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
+
+CLEANFILES = XDarwinHelp.html InfoPlist.strings
+
+EXTRA_DIST = \
+ Credits.rtf Localizable.strings \
+ Localizable.strings \
+ MainMenu.nib/classes.nib \
+ MainMenu.nib/objects.nib \
+ XDarwinHelp.html.cpp
diff --git a/hw/darwin/bundle/Info.plist b/hw/darwin/bundle/Info.plist
new file mode 100644
index 000000000..bfef48d26
--- /dev/null
+++ b/hw/darwin/bundle/Info.plist
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>x11app</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>X11 Application</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>****</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ <dict>
+ <key>CFBundleTypeExtensions</key>
+ <array>
+ <string>tool</string>
+ <string>*</string>
+ </array>
+ <key>CFBundleTypeName</key>
+ <string>UNIX Application</string>
+ <key>CFBundleTypeOSTypes</key>
+ <array>
+ <string>****</string>
+ </array>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ </dict>
+ </array>
+ <key>CFBundleExecutable</key>
+ <string>XDarwin</string>
+ <key>CFBundleGetInfoString</key>
+ <string>XDarwin 1.4.0, X.Org Foundation</string>
+ <key>CFBundleIconFile</key>
+ <string>XDarwin.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.x.XDarwin</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>XDarwin</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>XDarwin 1.4.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string></string>
+ <key>NSHelpFile</key>
+ <string>XDarwinHelp.html</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>XApplication</string>
+</dict>
+</plist>
diff --git a/hw/darwin/bundle/Japanese.lproj/Makefile.am b/hw/darwin/bundle/Japanese.lproj/Makefile.am
new file mode 100644
index 000000000..2cc524858
--- /dev/null
+++ b/hw/darwin/bundle/Japanese.lproj/Makefile.am
@@ -0,0 +1,37 @@
+BINDIR = ${bindir}
+include $(top_srcdir)/cpprules.in
+XINITDIR = $(libdir)/X11/xinit
+XDEFS = \
+ -DX_VERSION="$(PLIST_VERSION_STRING)" \
+ -DX_PRE_RELEASE="$(PRE)" \
+ -DX_REL_DATE="$(XORG_DATE)" \
+ -DX_VENDOR_NAME="$(VENDOR_STRING)" \
+ -DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
+
+
+resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
+
+Japaneselprojdir = $(resourcesdir)/Japanese.lproj
+
+Japaneselproj_DATA = \
+ XDarwinHelp.html \
+ InfoPlist.strings \
+ Credits.rtf Localizable.strings
+
+Japaneselprojnibdir = $(Japaneselprojdir)/MainMenu.nib
+Japaneselprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
+
+InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
+
+XDarwinHelp.html: XDarwinHelp.html.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
+
+CLEANFILES = XDarwinHelp.html InfoPlist.strings
+
+EXTRA_DIST = \
+ Credits.rtf Localizable.strings \
+ Localizable.strings \
+ MainMenu.nib/classes.nib \
+ MainMenu.nib/objects.nib \
+ XDarwinHelp.html.cpp
diff --git a/hw/darwin/bundle/Makefile.am b/hw/darwin/bundle/Makefile.am
new file mode 100644
index 000000000..dee34fd83
--- /dev/null
+++ b/hw/darwin/bundle/Makefile.am
@@ -0,0 +1,38 @@
+BINDIR = ${bindir}
+include $(top_srcdir)/cpprules.in
+XINITDIR = $(libdir)/X11/xinit
+XDEFS = \
+ -DX_VERSION="$(PLIST_VERSION_STRING)" \
+ -DX_PRE_RELEASE="$(PRE)" \
+ -DX_REL_DATE="$(XORG_DATE)" \
+ -DX_VENDOR_NAME="$(VENDOR_STRING)" \
+ -DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
+
+SUBDIRS = English.lproj Dutch.lproj French.lproj German.lproj Japanese.lproj \
+ ko.lproj Portuguese.lproj Spanish.lproj Swedish.lproj
+
+bin_SCRIPTS = startXClients
+
+startXClients: $(srcdir)/startXClients.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) -DXINITDIR=$(XINITDIR) -DXBINDIR=$(BINDIR) $< | $(CPP_SED_MAGIC) > $@
+ -chmod 755 startXClients
+
+contentsdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents
+resourcesdir = $(contentsdir)/Resources
+
+contents_DATA = Info.plist
+resources_DATA = XDarwin.icns startXClients
+
+install-data-hook:
+ chmod 755 $(DESTDIR)$(resourcesdir)/startXClients
+ echo "APPL????" > $(DESTDIR)$(contentsdir)/PkgInfo
+ touch $(DESTDIR)@APPLE_APPLICATIONS_DIR@/XDarwin.app
+
+uninstall-hook:
+ rm -rf $(DESTDIR)$(contentsdir)/PkgInfo
+
+CLEANFILES = startXClients
+
+EXTRA_DIST = \
+ XDarwin.icns \
+ Info.plist
diff --git a/hw/darwin/bundle/Portuguese.lproj/Makefile.am b/hw/darwin/bundle/Portuguese.lproj/Makefile.am
new file mode 100644
index 000000000..81ba2be26
--- /dev/null
+++ b/hw/darwin/bundle/Portuguese.lproj/Makefile.am
@@ -0,0 +1,36 @@
+BINDIR = ${bindir}
+include $(top_srcdir)/cpprules.in
+XINITDIR = $(libdir)/X11/xinit
+XDEFS = \
+ -DX_VERSION="$(PLIST_VERSION_STRING)" \
+ -DX_PRE_RELEASE="$(PRE)" \
+ -DX_REL_DATE="$(XORG_DATE)" \
+ -DX_VENDOR_NAME="$(VENDOR_STRING)" \
+ -DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
+
+resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
+
+Portugueselprojdir = $(resourcesdir)/Portuguese.lproj
+
+Portugueselproj_DATA = \
+ XDarwinHelp.html \
+ InfoPlist.strings \
+ Credits.rtf Localizable.strings
+
+Portugueselprojnibdir = $(Portugueselprojdir)/MainMenu.nib
+Portugueselprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
+
+InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
+
+XDarwinHelp.html: XDarwinHelp.html.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
+
+CLEANFILES = XDarwinHelp.html InfoPlist.strings
+
+EXTRA_DIST = \
+ Credits.rtf Localizable.strings \
+ Localizable.strings \
+ MainMenu.nib/classes.nib \
+ MainMenu.nib/objects.nib \
+ XDarwinHelp.html.cpp
diff --git a/hw/darwin/bundle/Spanish.lproj/Makefile.am b/hw/darwin/bundle/Spanish.lproj/Makefile.am
new file mode 100644
index 000000000..438d0c2bd
--- /dev/null
+++ b/hw/darwin/bundle/Spanish.lproj/Makefile.am
@@ -0,0 +1,36 @@
+BINDIR = ${bindir}
+include $(top_srcdir)/cpprules.in
+XINITDIR = $(libdir)/X11/xinit
+XDEFS = \
+ -DX_VERSION="$(PLIST_VERSION_STRING)" \
+ -DX_PRE_RELEASE="$(PRE)" \
+ -DX_REL_DATE="$(XORG_DATE)" \
+ -DX_VENDOR_NAME="$(VENDOR_STRING)" \
+ -DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
+
+resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
+
+Spanishlprojdir = $(resourcesdir)/Spanish.lproj
+
+Spanishlproj_DATA = \
+ XDarwinHelp.html \
+ InfoPlist.strings \
+ Credits.rtf Localizable.strings
+
+Spanishlprojnibdir = $(Spanishlprojdir)/MainMenu.nib
+Spanishlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
+
+InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
+
+XDarwinHelp.html: XDarwinHelp.html.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
+
+CLEANFILES = XDarwinHelp.html InfoPlist.strings
+
+EXTRA_DIST = \
+ Credits.rtf Localizable.strings \
+ Localizable.strings \
+ MainMenu.nib/classes.nib \
+ MainMenu.nib/objects.nib \
+ XDarwinHelp.html.cpp
diff --git a/hw/darwin/bundle/Swedish.lproj/Makefile.am b/hw/darwin/bundle/Swedish.lproj/Makefile.am
new file mode 100644
index 000000000..19f35a690
--- /dev/null
+++ b/hw/darwin/bundle/Swedish.lproj/Makefile.am
@@ -0,0 +1,36 @@
+BINDIR = ${bindir}
+include $(top_srcdir)/cpprules.in
+XINITDIR = $(libdir)/X11/xinit
+XDEFS = \
+ -DX_VERSION="$(PLIST_VERSION_STRING)" \
+ -DX_PRE_RELEASE="$(PRE)" \
+ -DX_REL_DATE="$(XORG_DATE)" \
+ -DX_VENDOR_NAME="$(VENDOR_STRING)" \
+ -DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
+
+resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
+
+Swedishlprojdir = $(resourcesdir)/Swedish.lproj
+
+Swedishlproj_DATA = \
+ XDarwinHelp.html \
+ InfoPlist.strings \
+ Credits.rtf Localizable.strings
+
+Swedishlprojnibdir = $(Swedishlprojdir)/MainMenu.nib
+Swedishlprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
+
+InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
+
+XDarwinHelp.html: XDarwinHelp.html.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
+
+CLEANFILES = XDarwinHelp.html InfoPlist.strings
+
+EXTRA_DIST = \
+ Credits.rtf Localizable.strings \
+ Localizable.strings \
+ MainMenu.nib/classes.nib \
+ MainMenu.nib/objects.nib \
+ XDarwinHelp.html.cpp
diff --git a/hw/darwin/bundle/ko.lproj/Makefile.am b/hw/darwin/bundle/ko.lproj/Makefile.am
new file mode 100644
index 000000000..56dd6b310
--- /dev/null
+++ b/hw/darwin/bundle/ko.lproj/Makefile.am
@@ -0,0 +1,37 @@
+BINDIR = ${bindir}
+include $(top_srcdir)/cpprules.in
+XINITDIR = $(libdir)/X11/xinit
+XDEFS = \
+ -DX_VERSION="$(PLIST_VERSION_STRING)" \
+ -DX_PRE_RELEASE="$(PRE)" \
+ -DX_REL_DATE="$(XORG_DATE)" \
+ -DX_VENDOR_NAME="$(VENDOR_STRING)" \
+ -DX_VENDOR_LINK="$(PLIST_VENDOR_WEB)"
+
+
+resourcesdir = @APPLE_APPLICATIONS_DIR@/XDarwin.app/Contents/Resources
+
+kolprojdir = $(resourcesdir)/ko.lproj
+
+kolproj_DATA = \
+ XDarwinHelp.html \
+ InfoPlist.strings \
+ Credits.rtf Localizable.strings
+
+kolprojnibdir = $(kolprojdir)/MainMenu.nib
+kolprojnib_DATA = MainMenu.nib/classes.nib MainMenu.nib/objects.nib
+
+InfoPlist.strings: $(srcdir)/../English.lproj/InfoPlist.strings.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) | $(SED) -e's/__quote__/"/g' > $@
+
+XDarwinHelp.html: XDarwinHelp.html.cpp
+ $(RAWCPP) $(RAWCPPFLAGS) $(XDEFS) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@
+
+CLEANFILES = XDarwinHelp.html InfoPlist.strings
+
+EXTRA_DIST = \
+ Credits.rtf Localizable.strings \
+ Localizable.strings \
+ MainMenu.nib/classes.nib \
+ MainMenu.nib/objects.nib \
+ XDarwinHelp.html.cpp
diff --git a/hw/darwin/darwin.c b/hw/darwin/darwin.c
index bd9998976..7da8626ab 100644
--- a/hw/darwin/darwin.c
+++ b/hw/darwin/darwin.c
@@ -30,6 +30,10 @@
* use or other dealings in this Software without prior written authorization.
*/
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
#include <X11/X.h>
#include <X11/Xproto.h>
#include "os.h"
@@ -200,6 +204,12 @@ DarwinPrintBanner()
}
+void DDXRingBell(int volume, int pitch, int duration)
+{
+ // FIXME -- make some noise, yo
+}
+
+
/*
* DarwinSaveScreen
* X screensaver support. Not implemented.
@@ -409,9 +419,9 @@ static int DarwinMouseProc(
InitPointerDeviceStruct( (DevicePtr)pPointer,
map,
5, // numbuttons (4 & 5 are scroll wheel)
- miPointerGetMotionEvents,
+ GetMotionHistory,
DarwinChangePointerControl,
- 0 );
+ GetMotionHistorySize(), 2 );
#ifdef XINPUT
InitValuatorAxisStruct( pPointer,
0, // X axis
diff --git a/hw/darwin/darwin.h b/hw/darwin/darwin.h
index cd572258c..fc4a58a95 100644
--- a/hw/darwin/darwin.h
+++ b/hw/darwin/darwin.h
@@ -31,6 +31,7 @@
#include "inputstr.h"
#include "scrnintstr.h"
#include <X11/extensions/XKB.h>
+#include <assert.h>
typedef struct {
void *framebuffer;
@@ -57,6 +58,10 @@ Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr);
void DarwinEQEnqueue(const xEvent *e);
void DarwinEQPointerPost(xEvent *e);
void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
+void DarwinPokeEQ(void);
+void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y);
+void DarwinSendKeyboardEvents(int ev_type, int keycode);
+void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y);
// From darwinKeyboard.c
int DarwinModifierNXKeyToNXKeycode(int key, int side);
diff --git a/hw/darwin/darwinEvents.c b/hw/darwin/darwinEvents.c
index 6b902df05..3d7f268ca 100644
--- a/hw/darwin/darwinEvents.c
+++ b/hw/darwin/darwinEvents.c
@@ -1,9 +1,9 @@
/*
- * Darwin event queue and event handling
- */
-/*
-Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
+Darwin event queue and event handling
+
+Copyright 2007 Apple Inc.
Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved.
+Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved.
This file is based on mieq.c by Keith Packard,
which contains the following copyright:
@@ -61,6 +61,10 @@ typedef struct _Event {
ScreenPtr pScreen;
} EventRec, *EventPtr;
+int input_check_zero, input_check_flag;
+
+static int old_flags = 0; // last known modifier state
+
typedef struct _EventQueue {
HWEventQueueType head, tail; /* long for SetInputCheck */
CARD32 lastEventTime; /* to avoid time running backwards */
@@ -72,25 +76,22 @@ typedef struct _EventQueue {
} EventQueueRec, *EventQueuePtr;
static EventQueueRec darwinEventQueue;
-
+xEvent *darwinEvents;
/*
* DarwinPressModifierMask
* Press or release the given modifier key, specified by its mask.
*/
static void DarwinPressModifierMask(
- xEvent *xe, // must already have type, time and mouse location
+ int pressed,
int mask) // one of NX_*MASK constants
{
int key = DarwinModifierNXMaskToNXKey(mask);
if (key != -1) {
int keycode = DarwinModifierNXKeyToNXKeycode(key, 0);
- if (keycode != 0) {
- xe->u.u.detail = keycode + MIN_KEYCODE;
- (*darwinEventQueue.pKbd->processInputProc)(xe,
- (DeviceIntPtr)darwinEventQueue.pKbd, 1);
- }
+ if (keycode != 0)
+ DarwinSendKeyboardEvents(pressed, keycode);
}
}
@@ -123,28 +124,26 @@ static void DarwinPressModifierMask(
* Send events to update the modifier state.
*/
static void DarwinUpdateModifiers(
- xEvent *xe, // event template with time and mouse position set
int pressed, // KeyPress or KeyRelease
int flags ) // modifier flags that have changed
{
- xe->u.u.type = pressed;
if (flags & NX_ALPHASHIFTMASK) {
- DarwinPressModifierMask(xe, NX_ALPHASHIFTMASK);
+ DarwinPressModifierMask(pressed, NX_ALPHASHIFTMASK);
}
if (flags & NX_COMMANDMASK) {
- DarwinPressModifierMask(xe, COMMAND_MASK(flags));
+ DarwinPressModifierMask(pressed, COMMAND_MASK(flags));
}
if (flags & NX_CONTROLMASK) {
- DarwinPressModifierMask(xe, CONTROL_MASK(flags));
+ DarwinPressModifierMask(pressed, CONTROL_MASK(flags));
}
if (flags & NX_ALTERNATEMASK) {
- DarwinPressModifierMask(xe, ALTERNATE_MASK(flags));
+ DarwinPressModifierMask(pressed, ALTERNATE_MASK(flags));
}
if (flags & NX_SHIFTMASK) {
- DarwinPressModifierMask(xe, SHIFT_MASK(flags));
+ DarwinPressModifierMask(pressed, SHIFT_MASK(flags));
}
if (flags & NX_SECONDARYFNMASK) {
- DarwinPressModifierMask(xe, NX_SECONDARYFNMASK);
+ DarwinPressModifierMask(pressed, NX_SECONDARYFNMASK);
}
}
@@ -161,34 +160,33 @@ static void DarwinUpdateModifiers(
* simulate a button 2 press instead of Command-button 2.
*/
static void DarwinSimulateMouseClick(
- xEvent *xe, // event template with time and
- // mouse position filled in
+ int pointer_x,
+ int pointer_y,
int whichButton, // mouse button to be pressed
int modifierMask) // modifiers used for the fake click
{
// first fool X into forgetting about the keys
- DarwinUpdateModifiers(xe, KeyRelease, modifierMask);
+ DarwinUpdateModifiers(KeyRelease, modifierMask);
// push the mouse button
- xe->u.u.type = ButtonPress;
- xe->u.u.detail = whichButton;
- (*darwinEventQueue.pPtr->processInputProc)
- (xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
+ DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y);
+ DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y);
+
+ // restore old modifiers
+ DarwinUpdateModifiers(KeyPress, modifierMask);
}
-Bool
-DarwinEQInit(
- DevicePtr pKbd,
- DevicePtr pPtr)
-{
+Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr) {
+ darwinEvents = (xEvent *)malloc(sizeof(xEvent) * GetMaximumEventsNum());
+ mieqInit();
darwinEventQueue.head = darwinEventQueue.tail = 0;
darwinEventQueue.lastEventTime = GetTimeInMillis ();
darwinEventQueue.pKbd = pKbd;
darwinEventQueue.pPtr = pPtr;
darwinEventQueue.pEnqueueScreen = screenInfo.screens[0];
darwinEventQueue.pDequeueScreen = darwinEventQueue.pEnqueueScreen;
- SetInputCheck (&darwinEventQueue.head, &darwinEventQueue.tail);
+ SetInputCheck(&input_check_zero, &input_check_flag);
return TRUE;
}
@@ -199,11 +197,10 @@ DarwinEQInit(
* DarwinEQEnqueue - called from event gathering thread
* ProcessInputEvents - called from X server thread
* DarwinEQEnqueue should never be called from more than one thread.
+ *
+ * This should be deprecated in favor of miEQEnqueue -- BB
*/
-void
-DarwinEQEnqueue(
- const xEvent *e)
-{
+void DarwinEQEnqueue(const xEvent *e) {
HWEventQueueType oldtail, newtail;
char byte = 0;
@@ -213,13 +210,12 @@ DarwinEQEnqueue(
// This is difficult to do in a thread-safe way and rarely useful.
newtail = oldtail + 1;
- if (newtail == QUEUE_SIZE)
- newtail = 0;
+ if (newtail == QUEUE_SIZE) newtail = 0;
/* Toss events which come in late */
- if (newtail == darwinEventQueue.head)
- return;
+ if (newtail == darwinEventQueue.head) return;
darwinEventQueue.events[oldtail].event = *e;
+
/*
* Make sure that event times don't go backwards - this
* is "unnecessary", but very useful
@@ -236,7 +232,7 @@ DarwinEQEnqueue(
darwinEventQueue.tail = newtail;
// Signal there is an event ready to handle
- write(darwinEventWriteFD, &byte, 1);
+ DarwinPokeEQ();
}
@@ -244,20 +240,13 @@ DarwinEQEnqueue(
* DarwinEQPointerPost
* Post a pointer event. Used by the mipointer.c routines.
*/
-void
-DarwinEQPointerPost(
- xEvent *e)
-{
+void DarwinEQPointerPost(xEvent *e) {
(*darwinEventQueue.pPtr->processInputProc)
(e, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
}
-void
-DarwinEQSwitchScreen(
- ScreenPtr pScreen,
- Bool fromDIX)
-{
+void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX) {
darwinEventQueue.pEnqueueScreen = pScreen;
if (fromDIX)
darwinEventQueue.pDequeueScreen = pScreen;
@@ -268,21 +257,21 @@ DarwinEQSwitchScreen(
* ProcessInputEvents
* Read and process events from the event queue until it is empty.
*/
-void ProcessInputEvents(void)
-{
+void ProcessInputEvents(void) {
EventRec *e;
int x, y;
xEvent xe;
static int old_flags = 0; // last known modifier state
// button number and modifier mask of currently pressed fake button
- static int darwinFakeMouseButtonDown = 0;
- static int darwinFakeMouseButtonMask = 0;
+ input_check_flag=0;
+
+ // ErrorF("calling mieqProcessInputEvents\n");
+ mieqProcessInputEvents();
// Empty the signaling pipe
x = sizeof(xe);
- while (x == sizeof(xe)) {
+ while (x == sizeof(xe))
x = read(darwinEventReadFD, &xe, sizeof(xe));
- }
while (darwinEventQueue.head != darwinEventQueue.tail)
{
@@ -298,10 +287,16 @@ void ProcessInputEvents(void)
dixScreenOrigins[miPointerCurrentScreen()->myNum].x;
xe.u.keyButtonPointer.rootY -= darwinMainScreenY +
dixScreenOrigins[miPointerCurrentScreen()->myNum].y;
+
+ /* ErrorF("old rootX = (%d,%d) darwinMainScreen = (%d,%d) dixScreenOrigins[%d]=(%d,%d)\n",
+ xe.u.keyButtonPointer.rootX, xe.u.keyButtonPointer.rootY,
+ darwinMainScreenX, darwinMainScreenY,
+ miPointerCurrentScreen()->myNum,
+ dixScreenOrigins[miPointerCurrentScreen()->myNum].x,
+ dixScreenOrigins[miPointerCurrentScreen()->myNum].y); */
+
+ //Assumption - screen switching can only occur on motion events
- /*
- * Assumption - screen switching can only occur on motion events
- */
if (e->pScreen != darwinEventQueue.pDequeueScreen)
{
darwinEventQueue.pDequeueScreen = e->pScreen;
@@ -319,155 +314,35 @@ void ProcessInputEvents(void)
darwinEventQueue.head = 0;
else
++darwinEventQueue.head;
- switch (xe.u.u.type)
- {
+ switch (xe.u.u.type) {
case KeyPress:
- if (old_flags == 0
- && darwinSyncKeymap && darwinKeymapFile == NULL)
- {
- /* See if keymap has changed. */
-
- static unsigned int last_seed;
- unsigned int this_seed;
-
- this_seed = DarwinModeSystemKeymapSeed();
- if (this_seed != last_seed)
- {
- last_seed = this_seed;
- DarwinKeyboardReload(darwinKeyboard);
- }
- }
- /* fall through */
-
case KeyRelease:
- xe.u.u.detail += MIN_KEYCODE;
- (*darwinEventQueue.pKbd->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pKbd, 1);
- break;
+ ErrorF("Unexpected Keyboard event in DarwinProcessInputEvents\n");
+ break;
case ButtonPress:
- miPointerAbsoluteCursor(xe.u.keyButtonPointer.rootX,
- xe.u.keyButtonPointer.rootY,
- xe.u.keyButtonPointer.time);
- if (darwinFakeButtons && xe.u.u.detail == 1) {
- // Mimic multi-button mouse with modifier-clicks
- // If both sets of modifiers are pressed,
- // button 2 is clicked.
- if ((old_flags & darwinFakeMouse2Mask) ==
- darwinFakeMouse2Mask)
- {
- DarwinSimulateMouseClick(&xe, 2, darwinFakeMouse2Mask);
- darwinFakeMouseButtonDown = 2;
- darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
- break;
- }
- else if ((old_flags & darwinFakeMouse3Mask) ==
- darwinFakeMouse3Mask)
- {
- DarwinSimulateMouseClick(&xe, 3, darwinFakeMouse3Mask);
- darwinFakeMouseButtonDown = 3;
- darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
- break;
- }
- }
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
+ ErrorF("Unexpected ButtonPress event in DarwinProcessInputEvents\n");
break;
case ButtonRelease:
- miPointerAbsoluteCursor(xe.u.keyButtonPointer.rootX,
- xe.u.keyButtonPointer.rootY,
- xe.u.keyButtonPointer.time);
- if (darwinFakeButtons && xe.u.u.detail == 1 &&
- darwinFakeMouseButtonDown)
- {
- // If last mousedown was a fake click, don't check for
- // mouse modifiers here. The user may have released the
- // modifiers before the mouse button.
- xe.u.u.detail = darwinFakeMouseButtonDown;
- darwinFakeMouseButtonDown = 0;
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
-
- // Bring modifiers back up to date
- DarwinUpdateModifiers(&xe, KeyPress,
- darwinFakeMouseButtonMask & old_flags);
- darwinFakeMouseButtonMask = 0;
- } else {
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
- }
+ ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
break;
case MotionNotify:
- miPointerAbsoluteCursor(xe.u.keyButtonPointer.rootX,
- xe.u.keyButtonPointer.rootY,
- xe.u.keyButtonPointer.time);
+ ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
break;
case kXDarwinUpdateModifiers:
- {
- // Update modifier state.
- // Any amount of modifiers may have changed.
- int flags = xe.u.clientMessage.u.l.longs0;
- DarwinUpdateModifiers(&xe, KeyRelease,
- old_flags & ~flags);
- DarwinUpdateModifiers(&xe, KeyPress,
- ~old_flags & flags);
- old_flags = flags;
- break;
- }
+ ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
+ break;
case kXDarwinUpdateButtons:
- {
- long hwDelta = xe.u.clientMessage.u.l.longs0;
- long hwButtons = xe.u.clientMessage.u.l.longs1;
- int i;
-
- for (i = 1; i < 5; i++) {
- if (hwDelta & (1 << i)) {
- // IOKit and X have different numbering for the
- // middle and right mouse buttons.
- if (i == 1) {
- xe.u.u.detail = 3;
- } else if (i == 2) {
- xe.u.u.detail = 2;
- } else {
- xe.u.u.detail = i + 1;
- }
- if (hwButtons & (1 << i)) {
- xe.u.u.type = ButtonPress;
- } else {
- xe.u.u.type = ButtonRelease;
- }
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
- }
- }
- break;
- }
+ ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n");
+ break;
- case kXDarwinScrollWheel:
- {
- short count = xe.u.clientMessage.u.s.shorts0;
-
- if (count > 0) {
- xe.u.u.detail = SCROLLWHEELUPFAKE;
- } else {
- xe.u.u.detail = SCROLLWHEELDOWNFAKE;
- count = -count;
- }
-
- for (; count; --count) {
- xe.u.u.type = ButtonPress;
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
- xe.u.u.type = ButtonRelease;
- (*darwinEventQueue.pPtr->processInputProc)
- (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
- }
- break;
- }
+ case kXDarwinScrollWheel:
+ ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n");
+ break;
default:
// Check for mode specific event
@@ -476,5 +351,96 @@ void ProcessInputEvents(void)
}
}
- miPointerUpdate();
+ // miPointerUpdate();
+}
+
+/* Sends a null byte down darwinEventWriteFD, which will cause the
+ Dispatch() event loop to check out event queue */
+void DarwinPokeEQ(void) {
+ char nullbyte=0;
+ input_check_flag++;
+ // <daniels> bushing: oh, i ... er ... christ.
+ write(darwinEventWriteFD, &nullbyte, 1);
+}
+
+void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y) {
+ static int darwinFakeMouseButtonDown = 0;
+ static int darwinFakeMouseButtonMask = 0;
+ int i, num_events;
+ int valuators[2] = {pointer_x, pointer_y};
+ if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
+ // Mimic multi-button mouse with modifier-clicks
+ // If both sets of modifiers are pressed,
+ // button 2 is clicked.
+ if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) {
+ DarwinSimulateMouseClick(pointer_x, pointer_y, 2, darwinFakeMouse2Mask);
+ darwinFakeMouseButtonDown = 2;
+ darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
+ } else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
+ DarwinSimulateMouseClick(pointer_x, pointer_y, 3, darwinFakeMouse3Mask);
+ darwinFakeMouseButtonDown = 3;
+ darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
+ }
+ }
+ if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) {
+ // If last mousedown was a fake click, don't check for
+ // mouse modifiers here. The user may have released the
+ // modifiers before the mouse button.
+ ev_button = darwinFakeMouseButtonDown;
+ darwinFakeMouseButtonDown = 0;
+ // Bring modifiers back up to date
+ DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags);
+ darwinFakeMouseButtonMask = 0;
+ }
+
+ num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
+ POINTER_ABSOLUTE, 0, 2, valuators);
+
+ for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
+ DarwinPokeEQ();
+}
+
+void DarwinSendKeyboardEvents(int ev_type, int keycode) {
+ int i, num_events;
+ if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) {
+ /* See if keymap has changed. */
+
+ static unsigned int last_seed;
+ unsigned int this_seed;
+
+ this_seed = DarwinModeSystemKeymapSeed();
+ if (this_seed != last_seed) {
+ last_seed = this_seed;
+ DarwinKeyboardReload(darwinKeyboard);
+ }
+ }
+
+ num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
+ for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&darwinEvents[i]);
+ DarwinPokeEQ();
+}
+
+/* Send the appropriate number of button 4 / 5 clicks to emulate scroll wheel */
+void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y) {
+ int i;
+ int ev_button = count > 0.0f ? 4 : 5;
+ int valuators[2] = {pointer_x, pointer_y};
+
+ for (count = fabs(count); count > 0.0; count = count - 1.0f) {
+ int num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonPress, ev_button,
+ POINTER_ABSOLUTE, 0, 2, valuators);
+ for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
+ num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonRelease, ev_button,
+ POINTER_ABSOLUTE, 0, 2, valuators);
+ for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
+ }
+ DarwinPokeEQ();
+}
+
+/* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to
+ reflect changing modifier flags (alt, control, meta, etc) */
+void DarwinUpdateModKeys(int flags) {
+ DarwinUpdateModifiers(KeyRelease, old_flags & ~flags);
+ DarwinUpdateModifiers(KeyPress, ~old_flags & flags);
+ old_flags = flags;
}
diff --git a/hw/darwin/darwinKeyboard.c b/hw/darwin/darwinKeyboard.c
index 1cc49fe8e..4e7a136d6 100644
--- a/hw/darwin/darwinKeyboard.c
+++ b/hw/darwin/darwinKeyboard.c
@@ -72,7 +72,7 @@
#include <architecture/byte_order.h> // For the NXSwap*
#include "darwin.h"
#include "darwinKeyboard.h"
-
+#include <assert.h>
#define AltMask Mod1Mask
#define MetaMask Mod2Mask
#define FunctionMask Mod3Mask
diff --git a/hw/darwin/darwinKeyboard.h b/hw/darwin/darwinKeyboard.h
index f4a861186..368aee954 100644
--- a/hw/darwin/darwinKeyboard.h
+++ b/hw/darwin/darwinKeyboard.h
@@ -29,7 +29,7 @@
#define XK_TECHNICAL // needed to get XK_Escape
#define XK_PUBLISHING
-#include "keysym.h"
+#include "X11/keysym.h"
#include "inputstr.h"
// Each key can generate 4 glyphs. They are, in order:
diff --git a/hw/darwin/iokit/Makefile.am b/hw/darwin/iokit/Makefile.am
new file mode 100644
index 000000000..54464aec9
--- /dev/null
+++ b/hw/darwin/iokit/Makefile.am
@@ -0,0 +1,17 @@
+noinst_LIBRARIES = libiokit.a
+
+AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
+INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. @XORG_INCS@
+AM_DEFS =
+if XQUARTZ
+AM_DEFS += -DDARWIN_WITH_QUARTZ -DXFree86Server
+XQUARTZ_SUBDIRS = bundle quartz
+endif
+DEFS = @DEFS@ $(AM_DEFS)
+
+libiokit_a_SOURCES = xfIOKit.c \
+ xfIOKitCursor.c \
+ xfIOKitStartup.c
+
+EXTRA_DIST = \
+ xfIOKit.h
diff --git a/hw/darwin/iokit/xfIOKit.c b/hw/darwin/iokit/xfIOKit.c
index 95a7fb32c..c7ebd1c18 100644
--- a/hw/darwin/iokit/xfIOKit.c
+++ b/hw/darwin/iokit/xfIOKit.c
@@ -34,6 +34,10 @@
* use or other dealings in this Software without prior written authorization.
*/
+#if HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
#include <X11/X.h>
#include <X11/Xproto.h>
#include "os.h"
@@ -51,6 +55,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <pthread.h>
+#include <assert.h>
#include <mach/mach_interface.h>
diff --git a/hw/darwin/iokit/xfIOKitCursor.c b/hw/darwin/iokit/xfIOKitCursor.c
index ef3e254d7..8388513a3 100644
--- a/hw/darwin/iokit/xfIOKitCursor.c
+++ b/hw/darwin/iokit/xfIOKitCursor.c
@@ -58,6 +58,9 @@
* use or other dealings in this Software without prior written authorization.
*/
+#if HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "scrnintstr.h"
#include "cursorstr.h"
#include "mipointrst.h"
@@ -67,7 +70,7 @@
#include <IOKit/hidsystem/IOHIDLib.h>
#include "darwin.h"
#include "xfIOKit.h"
-
+#include <assert.h>
#define DUMP_DARWIN_CURSOR FALSE
#define CURSOR_PRIV(pScreen) \
diff --git a/hw/darwin/iokit/xfIOKitStartup.c b/hw/darwin/iokit/xfIOKitStartup.c
index 512793aa5..07e8c2181 100644
--- a/hw/darwin/iokit/xfIOKitStartup.c
+++ b/hw/darwin/iokit/xfIOKitStartup.c
@@ -29,6 +29,11 @@
* use or other dealings in this Software without prior written authorization.
*/
+
+#if HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
#include "darwin.h"
#include "darwinKeyboard.h"
#include "micmap.h"
@@ -57,7 +62,9 @@ void DarwinHandleGUI(
*/
void DarwinGlxExtensionInit(void)
{
- GlxExtensionInit();
+#ifdef GLXEXT
+ GlxExtensionInit();
+#endif
}
@@ -67,7 +74,9 @@ void DarwinGlxExtensionInit(void)
void DarwinGlxWrapInitVisuals(
miInitVisualsProcPtr *procPtr)
{
+#ifdef GLXEXT
GlxWrapInitVisuals(procPtr);
+#endif
}
diff --git a/hw/darwin/quartz/Makefile.am b/hw/darwin/quartz/Makefile.am
new file mode 100644
index 000000000..993cdb0ec
--- /dev/null
+++ b/hw/darwin/quartz/Makefile.am
@@ -0,0 +1,54 @@
+noinst_LIBRARIES = libXQuartz.a
+
+AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
+AM_OBJCFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
+
+INCLUDES = -I$(srcdir) -I$(srcdir)/.. @XORG_INCS@
+AM_DEFS = -DHAS_CG_MACH_PORT -DHAS_KL_API
+if HAVE_X_PLUGIN
+AM_DEFS += -DBUILD_XPR
+endif
+DEFS = @DEFS@ $(AM_DEFS) -DXBINDIR=\"${bindir}\"
+
+libXQuartz_a_SOURCES = \
+ Preferences.m \
+ XApplication.m \
+ XServer.m \
+ applewm.c \
+ keysym2ucs.c \
+ quartz.c \
+ quartzAudio.c \
+ quartzCocoa.m \
+ quartzPasteboard.c \
+ quartzKeyboard.c \
+ quartzStartup.c \
+ pseudoramiX.c
+
+bin_PROGRAMS = XDarwinStartup
+
+XDarwinStartup_SOURCES = XDarwinStartup.c
+XDarwinStartup_LDFLAGS = -Wl,-framework,CoreFoundation \
+ -Wl,-framework,ApplicationServices
+XDarwinStartupCFLAGS = -DXBINDIR="${bindir}"
+XDARWINROOT = @APPLE_APPLICATIONS_DIR@
+BINDIR = $(bindir)
+install-exec-local:
+ -(cd $(DESTDIR)$(BINDIR); rm X; $(LN_S) XDarwinStartup X)
+
+man1_MANS = XDarwinStartup.man
+
+EXTRA_DIST = \
+ applewmExt.h \
+ keysym2ucs.h \
+ Preferences.h \
+ pseudoramiX.h \
+ quartzAudio.h \
+ quartzCommon.h \
+ quartzCursor.c \
+ quartzCursor.h \
+ quartz.h \
+ quartzPasteboard.h \
+ XApplication.h \
+ XDarwin.pbproj/project.pbxproj \
+ XServer.h \
+ XDarwinStartup.man
diff --git a/hw/darwin/quartz/Preferences.m b/hw/darwin/quartz/Preferences.m
index 6c14f4982..eb78fd32a 100644
--- a/hw/darwin/quartz/Preferences.m
+++ b/hw/darwin/quartz/Preferences.m
@@ -31,7 +31,9 @@
* authorization.
*/
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/Preferences.m,v 1.5 2004/06/08 22:58:10 torrey Exp $ */
-
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#import "quartzCommon.h"
#define BOOL xBOOL
@@ -44,7 +46,7 @@
// Macros to build the path name
#ifndef XBINDIR
-#define XBINDIR /usr/X11R6/bin
+#define XBINDIR /usr/X11/bin
#endif
#define STR(s) #s
#define XSTRPATH(s) STR(s)
diff --git a/hw/darwin/quartz/XDarwin.pbproj/project.pbxproj b/hw/darwin/quartz/XDarwin.pbproj/project.pbxproj
index 90002db56..0ad831423 100644
--- a/hw/darwin/quartz/XDarwin.pbproj/project.pbxproj
+++ b/hw/darwin/quartz/XDarwin.pbproj/project.pbxproj
@@ -387,7 +387,7 @@
<key>CFBundleIconFile</key>
<string>XDarwin.icns</string>
<key>CFBundleIdentifier</key>
- <string>org.xfree86.XDarwin</string>
+ <string>org.x.x11</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
diff --git a/hw/darwin/quartz/XDarwinStartup.c b/hw/darwin/quartz/XDarwinStartup.c
index 8697776bf..8041e32d5 100644
--- a/hw/darwin/quartz/XDarwinStartup.c
+++ b/hw/darwin/quartz/XDarwinStartup.c
@@ -48,7 +48,7 @@
// Macros to build the path name
#ifndef XBINDIR
-#define XBINDIR /usr/X11R6/bin
+#define XBINDIR /usr/X11/bin
#endif
#define STR(s) #s
#define XSTRPATH(s) STR(s) "/"
@@ -124,7 +124,7 @@ int main(
// Otherwise query LaunchServices for the location of the XDarwin application
theStatus = LSFindApplicationForInfo(kLSUnknownCreator,
- CFSTR("org.xfree86.XDarwin"),
+ CFSTR("org.x.x11"),
NULL, NULL, &appURL);
if (theStatus) {
fprintf(stderr, "Could not find the XDarwin application. (Error = 0x%lx)\n", theStatus);
diff --git a/hw/darwin/quartz/XServer.m b/hw/darwin/quartz/XServer.m
index a5a1011e9..32bfbf58f 100644
--- a/hw/darwin/quartz/XServer.m
+++ b/hw/darwin/quartz/XServer.m
@@ -36,18 +36,20 @@
*/
/* $XdotOrg: xc/programs/Xserver/hw/darwin/quartz/XServer.m,v 1.3 2004/07/30 19:12:17 torrey Exp $ */
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/XServer.m,v 1.19 2003/11/24 05:39:01 torrey Exp $ */
-
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "quartzCommon.h"
#define BOOL xBOOL
-#include "X.h"
-#include "Xproto.h"
+#include "X11/X.h"
+#include "X11/Xproto.h"
#include "os.h"
#include "opaque.h"
#include "darwin.h"
#include "quartz.h"
#define _APPLEWM_SERVER_
-#include "applewm.h"
+#include "X11/extensions/applewm.h"
#include "applewmExt.h"
#undef BOOL
@@ -830,13 +832,13 @@ static io_connect_t root_port;
chdir(tem);
/* Setup environment */
- snprintf(buf, sizeof(buf), ":%s", display);
- setenv("DISPLAY", buf, TRUE);
+// snprintf(buf, sizeof(buf), ":%s", display);
+// setenv("DISPLAY", buf, TRUE);
tem = getenv("PATH");
if (tem != NULL && tem[0] != NULL)
- snprintf(buf, sizeof(buf), "%s:/usr/X11R6/bin", tem);
+ snprintf(buf, sizeof(buf), "%s:/usr/X11/bin", tem);
else
- snprintf(buf, sizeof(buf), "/bin:/usr/bin:/usr/X11R6/bin");
+ snprintf(buf, sizeof(buf), "/bin:/usr/bin:/usr/X11/bin");
setenv("PATH", buf, TRUE);
execvp(argv[0], (char **const) argv);
diff --git a/hw/darwin/quartz/applewm.c b/hw/darwin/quartz/applewm.c
index 224d6c5e0..cc11cfa4c 100644
--- a/hw/darwin/quartz/applewm.c
+++ b/hw/darwin/quartz/applewm.c
@@ -24,7 +24,9 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "quartzCommon.h"
#define NEED_REPLIES
@@ -43,7 +45,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <X11/Xatom.h>
#include "darwin.h"
#define _APPLEWM_SERVER_
-#include "applewmstr.h"
+#include "X11/extensions/applewmstr.h"
#include "applewmExt.h"
#define DEFINE_ATOM_HELPER(func,atom_name) \
@@ -444,7 +446,11 @@ ProcAppleWMSetWindowMenu(
}
}
+#ifdef INXQUARTZ
+ X11ApplicationSetWindowMenu (nitems, items, shortcuts);
+#else
QuartzSetWindowMenu (nitems, items, shortcuts);
+#endif
free(items);
free(shortcuts);
@@ -460,10 +466,12 @@ ProcAppleWMSetWindowMenuCheck(
REQUEST(xAppleWMSetWindowMenuCheckReq);
REQUEST_SIZE_MATCH(xAppleWMSetWindowMenuCheckReq);
-
+#ifdef INXQUARTZ
+ X11ApplicationSetWindowMenuCheck(stuff->index);
+#else
QuartzMessageMainThread(kQuartzSetWindowMenuCheck, &stuff->index,
sizeof(stuff->index));
-
+#endif
return (client->noClientException);
}
@@ -473,9 +481,11 @@ ProcAppleWMSetFrontProcess(
)
{
REQUEST_SIZE_MATCH(xAppleWMSetFrontProcessReq);
-
+#ifdef INXQUARTZ
+ X11ApplicationSetFrontProcess();
+#else
QuartzMessageMainThread(kQuartzSetFrontProcess, NULL, 0);
-
+#endif
return (client->noClientException);
}
@@ -514,9 +524,12 @@ ProcAppleWMSetCanQuit(
REQUEST(xAppleWMSetCanQuitReq);
REQUEST_SIZE_MATCH(xAppleWMSetCanQuitReq);
-
+#ifdef INXQUARTZ
+ X11ApplicationSetCanQuit(stuff->state);
+#else
QuartzMessageMainThread(kQuartzSetCanQuit, &stuff->state,
sizeof(stuff->state));
+#endif
return (client->noClientException);
}
diff --git a/hw/darwin/quartz/cr/XView.m b/hw/darwin/quartz/cr/XView.m
index 5feac6b42..8bcd1a76f 100644
--- a/hw/darwin/quartz/cr/XView.m
+++ b/hw/darwin/quartz/cr/XView.m
@@ -30,7 +30,9 @@
* use or other dealings in this Software without prior written authorization.
*/
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/XView.m,v 1.1 2003/06/07 05:49:07 torrey Exp $ */
-
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#import "XView.h"
diff --git a/hw/darwin/quartz/cr/crAppleWM.m b/hw/darwin/quartz/cr/crAppleWM.m
index a2e97ff81..0741d4e58 100644
--- a/hw/darwin/quartz/cr/crAppleWM.m
+++ b/hw/darwin/quartz/cr/crAppleWM.m
@@ -27,17 +27,19 @@
* use or other dealings in this Software without prior written authorization.
*/
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/xpr/xprFrame.c,v 1.2 2003/06/30 01:45:13 torrey Exp $ */
-
-#include "quartzCommon.h"
-#include "cr.h"
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+#include "quartz/quartzCommon.h"
+#include "quartz/cr/cr.h"
#undef BOOL
#define BOOL xBOOL
#include "rootless.h"
-#include "X.h"
+#include "X11/X.h"
#define _APPLEWM_SERVER_
-#include "applewm.h"
-#include "applewmExt.h"
+#include "X11/extensions/applewm.h"
+#include "quartz/applewmExt.h"
#undef BOOL
#define StdDocumentStyleMask (NSTitledWindowMask | \
diff --git a/hw/darwin/quartz/cr/crFrame.m b/hw/darwin/quartz/cr/crFrame.m
index 79d55a4d1..2b8e57d0a 100644
--- a/hw/darwin/quartz/cr/crFrame.m
+++ b/hw/darwin/quartz/cr/crFrame.m
@@ -29,14 +29,16 @@
*/
/* $XdotOrg: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m,v 1.2 2004/04/23 19:15:51 eich Exp $ */
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m,v 1.9 2004/03/19 02:05:29 torrey Exp $ */
-
-#include "quartzCommon.h"
-#include "cr.h"
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+#include "quartz/quartzCommon.h"
+#include "quartz/cr/cr.h"
#undef BOOL
#define BOOL xBOOL
#include "rootless.h"
-#include "applewmExt.h"
+#include "quartz/applewmExt.h"
#include "windowstr.h"
#undef BOOL
diff --git a/hw/darwin/quartz/cr/crScreen.m b/hw/darwin/quartz/cr/crScreen.m
index 21a79e006..9dd130e01 100644
--- a/hw/darwin/quartz/cr/crScreen.m
+++ b/hw/darwin/quartz/cr/crScreen.m
@@ -29,19 +29,21 @@
* use or other dealings in this Software without prior written authorization.
*/
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/crScreen.m,v 1.5 2003/11/12 20:21:52 torrey Exp $ */
-
-#include "quartzCommon.h"
-#include "cr.h"
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+#include "quartz/quartzCommon.h"
+#include "quartz/cr/cr.h"
#undef BOOL
#define BOOL xBOOL
#include "darwin.h"
-#include "quartz.h"
-#include "quartzCursor.h"
+#include "quartz/quartz.h"
+#include "quartz/quartzCursor.h"
#include "rootless.h"
-#include "safeAlpha.h"
-#include "pseudoramiX.h"
-#include "applewmExt.h"
+#include "safeAlpha/safeAlpha.h"
+#include "quartz/pseudoramiX.h"
+#include "quartz/applewmExt.h"
#include "regionstr.h"
#include "scrnintstr.h"
diff --git a/hw/darwin/quartz/fullscreen/fullscreen.c b/hw/darwin/quartz/fullscreen/fullscreen.c
index a4881f9d9..02f6e89a8 100644
--- a/hw/darwin/quartz/fullscreen/fullscreen.c
+++ b/hw/darwin/quartz/fullscreen/fullscreen.c
@@ -25,11 +25,13 @@
* holders shall not be used in advertising or otherwise to promote the sale,
* use or other dealings in this Software without prior written authorization.
*/
-
-#include "quartzCommon.h"
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+#include "quartz/quartzCommon.h"
#include "darwin.h"
-#include "quartz.h"
-#include "quartzCursor.h"
+#include "quartz/quartz.h"
+#include "quartz/quartzCursor.h"
#include "colormapst.h"
#include "scrnintstr.h"
#include "micmap.h"
diff --git a/hw/darwin/quartz/fullscreen/quartzCursor.c b/hw/darwin/quartz/fullscreen/quartzCursor.c
index e2333e2ea..77fa008f2 100644
--- a/hw/darwin/quartz/fullscreen/quartzCursor.c
+++ b/hw/darwin/quartz/fullscreen/quartzCursor.c
@@ -29,9 +29,11 @@
* holders shall not be used in advertising or otherwise to promote the sale,
* use or other dealings in this Software without prior written authorization.
*/
-
-#include "quartzCommon.h"
-#include "quartzCursor.h"
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+#include "quartz/quartzCommon.h"
+#include "quartz/quartzCursor.h"
#include "darwin.h"
#include <pthread.h>
diff --git a/hw/darwin/quartz/pseudoramiX.c b/hw/darwin/quartz/pseudoramiX.c
index a003daf43..7ba6d5a15 100644
--- a/hw/darwin/quartz/pseudoramiX.c
+++ b/hw/darwin/quartz/pseudoramiX.c
@@ -34,7 +34,9 @@ Equipment Corporation.
******************************************************************/
#include "pseudoramiX.h"
-
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "extnsionst.h"
#include "dixstruct.h"
#include "window.h"
diff --git a/hw/darwin/quartz/quartz.c b/hw/darwin/quartz/quartz.c
index 36a8bea08..038b21eff 100644
--- a/hw/darwin/quartz/quartz.c
+++ b/hw/darwin/quartz/quartz.c
@@ -29,14 +29,16 @@
* 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "quartzCommon.h"
#include "quartz.h"
#include "darwin.h"
#include "quartzAudio.h"
#include "pseudoramiX.h"
#define _APPLEWM_SERVER_
-#include "applewm.h"
+#include "X11/extensions/applewm.h"
#include "applewmExt.h"
// X headers
@@ -158,7 +160,11 @@ void DarwinModeInitInput(
int argc,
char **argv )
{
+#ifdef INXQUARTZ
+ X11ApplicationServerReady();
+#else
QuartzMessageMainThread(kQuartzServerStarted, NULL, 0);
+#endif
// Do final display mode specific initialization before handling events
if (quartzProcs->InitInput)
@@ -272,7 +278,9 @@ static void QuartzHide(void)
}
}
quartzServerVisible = FALSE;
+#ifndef INXQUARTZ
QuartzMessageMainThread(kQuartzServerHidden, NULL, 0);
+#endif
}
diff --git a/hw/darwin/quartz/quartzAudio.c b/hw/darwin/quartz/quartzAudio.c
index b477b037b..16b9c2ba8 100644
--- a/hw/darwin/quartz/quartzAudio.c
+++ b/hw/darwin/quartz/quartzAudio.c
@@ -35,7 +35,9 @@
* 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "quartzCommon.h"
#include "quartzAudio.h"
@@ -44,6 +46,7 @@
#include "inputstr.h"
#include <X11/extensions/XI.h>
+#include <assert.h>
void NSBeep();
diff --git a/hw/darwin/quartz/quartzCocoa.m b/hw/darwin/quartz/quartzCocoa.m
index 3cb191f22..c54c18acb 100644
--- a/hw/darwin/quartz/quartzCocoa.m
+++ b/hw/darwin/quartz/quartzCocoa.m
@@ -35,6 +35,9 @@
* use or other dealings in this Software without prior written authorization.
*/
/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/quartzCocoa.m,v 1.5 2004/06/08 22:58:10 torrey Exp $ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "quartzCommon.h"
diff --git a/hw/darwin/quartz/quartzCursor.c b/hw/darwin/quartz/quartzCursor.c
index e2333e2ea..6ed6a7677 100644
--- a/hw/darwin/quartz/quartzCursor.c
+++ b/hw/darwin/quartz/quartzCursor.c
@@ -30,6 +30,9 @@
* use or other dealings in this Software without prior written authorization.
*/
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "quartzCommon.h"
#include "quartzCursor.h"
#include "darwin.h"
@@ -90,7 +93,9 @@ static pthread_cond_t cursorCondition;
/* Acquire lock and tell the main thread to change cursor */ \
pthread_mutex_lock(&cursorMutex); \
currentCursor = (CCrsrHandle) (cursorH); \
+#ifndef INXQUARTZ
QuartzMessageMainThread(kQuartzCursorUpdate, NULL, 0); \
+#endif
\
/* Wait for the main thread to change the cursor */ \
pthread_cond_wait(&cursorCondition, &cursorMutex); \
diff --git a/hw/darwin/quartz/quartzCursor.h b/hw/darwin/quartz/quartzCursor.h
index 56cc94d49..57fac68a5 100644
--- a/hw/darwin/quartz/quartzCursor.h
+++ b/hw/darwin/quartz/quartzCursor.h
@@ -36,6 +36,7 @@
#include "screenint.h"
Bool QuartzInitCursor(ScreenPtr pScreen);
+void QuartzReallySetCursor(void);
void QuartzSuspendXCursor(ScreenPtr pScreen);
void QuartzResumeXCursor(ScreenPtr pScreen, int x, int y);
diff --git a/hw/darwin/quartz/quartzKeyboard.c b/hw/darwin/quartz/quartzKeyboard.c
index fc12522be..bd2cc25ea 100644
--- a/hw/darwin/quartz/quartzKeyboard.c
+++ b/hw/darwin/quartz/quartzKeyboard.c
@@ -33,13 +33,16 @@
prior written authorization.
*/
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "quartzCommon.h"
#include <CoreServices/CoreServices.h>
#include <Carbon/Carbon.h>
#include "darwinKeyboard.h"
-#include "keysym.h"
+#include "X11/keysym.h"
#include "keysym2ucs.h"
#ifdef HAS_KL_API
diff --git a/hw/darwin/quartz/quartzPasteboard.c b/hw/darwin/quartz/quartzPasteboard.c
index e92fe5c79..a3536fc56 100644
--- a/hw/darwin/quartz/quartzPasteboard.c
+++ b/hw/darwin/quartz/quartzPasteboard.c
@@ -30,6 +30,9 @@
* use or other dealings in this Software without prior written authorization.
*/
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "quartzPasteboard.h"
#include <X11/Xatom.h>
diff --git a/hw/darwin/quartz/quartzStartup.c b/hw/darwin/quartz/quartzStartup.c
index 277e5935f..76392e44c 100644
--- a/hw/darwin/quartz/quartzStartup.c
+++ b/hw/darwin/quartz/quartzStartup.c
@@ -37,21 +37,37 @@
#include "quartz.h"
#include "opaque.h"
#include "micmap.h"
-
-int NSApplicationMain(int argc, char *argv[]);
+#include <assert.h>
char **envpGlobal; // argcGlobal and argvGlobal
// are from dix/globals.c
+#ifdef INXQUARTZ
+void X11ControllerMain(int argc, char *argv[], void (*server_thread) (void *), void *server_arg);
+# ifdef GLXEXT
+void GlxExtensionInit(void);
+void GlxWrapInitVisuals(miInitVisualsProcPtr *);
+# endif
+
+static void server_thread (void *arg) {
+ extern int main (int argc, char **argv, char **envp);
+ exit (main (argcGlobal, argvGlobal, envpGlobal));
+}
+#else
+int NSApplicationMain(int argc, char *argv[]);
+typedef Bool (*QuartzModeBundleInitPtr)(void);
+
+# ifdef GLXEXT
// GLX bundle function pointers
typedef void (*GlxExtensionInitPtr)(void);
static GlxExtensionInitPtr GlxExtensionInit = NULL;
-
typedef void (*GlxWrapInitVisualsPtr)(miInitVisualsProcPtr *);
static GlxWrapInitVisualsPtr GlxWrapInitVisuals = NULL;
-
-typedef Bool (*QuartzModeBundleInitPtr)(void);
-
+void * __DarwinglXMesaProvider = NULL;
+typedef void (*GlxPushProviderPtr)(void *);
+GlxPushProviderPtr GlxPushProvider = NULL;
+# endif
+#endif
/*
* DarwinHandleGUI
@@ -71,7 +87,9 @@ void DarwinHandleGUI(
int fd[2];
if (been_here) {
+#ifdef INXDARWINAPP
QuartzReadPreferences();
+#endif
return;
}
been_here = TRUE;
@@ -106,11 +124,27 @@ void DarwinHandleGUI(
}
}
+#ifdef INXQUARTZ
+ /* Initially I ran the X server on the main thread, and received
+ events on the second thread. But now we may be using Carbon,
+ that needs to run on the main thread. (Otherwise, when it's
+ prebound, it will initialize itself on the wrong thread)
+
+ grr.. but doing that means that if the X thread gets scheduled
+ before the main thread when we're _not_ prebound, things fail,
+ so initialize by hand. */
+ extern void _InitHLTB(void);
+
+ _InitHLTB();
+
+ X11ControllerMain(argc, argv, server_thread, NULL);
+#else
main_exit = NSApplicationMain(argc, argv);
+#endif
exit(main_exit);
}
-
+#ifndef INXQUARTZ
/*
* QuartzLoadDisplayBundle
* Try to load the appropriate bundle containing the back end display code.
@@ -168,7 +202,7 @@ Bool QuartzLoadDisplayBundle(
return TRUE;
}
-
+#ifdef GLXEXT
/*
* LoadGlxBundle
* The Quartz mode X server needs to dynamically load the appropriate
@@ -186,7 +220,7 @@ static void LoadGlxBundle(void)
// Choose the bundle to load
ErrorF("Loading GLX bundle ");
- if (quartzUseAGL) {
+ if (/*quartzUseAGL*/0) {
bundleName = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault,
quartzOpenGLBundle,
kCFStringEncodingASCII,
@@ -213,6 +247,14 @@ static void LoadGlxBundle(void)
}
// Find the GLX init functions
+
+
+ __DarwinglXMesaProvider = (void *) CFBundleGetDataPointerForName(
+ glxBundle, CFSTR("__glXMesaProvider"));
+
+ GlxPushProvider = (void *) CFBundleGetFunctionPointerForName(
+ glxBundle, CFSTR("GlxPushProvider"));
+
GlxExtensionInit = (void *) CFBundleGetFunctionPointerForName(
glxBundle, CFSTR("GlxExtensionInit"));
@@ -227,7 +269,26 @@ static void LoadGlxBundle(void)
CFRelease(bundleName);
CFRelease(bundleURL);
}
+# endif
+#else
+Bool QuartzLoadDisplayBundle(const char *dpyBundleName)
+{
+ return TRUE;
+ }
+
+#endif
+
+#ifdef GLXEXT
+void DarwinGlxPushProvider(void *impl)
+{
+#ifndef INXQUARTZ
+ if (!GlxExtensionInit)
+ LoadGlxBundle();
+#endif
+
+ GlxPushProvider(impl);
+}
/*
* DarwinGlxExtensionInit
@@ -235,9 +296,10 @@ static void LoadGlxBundle(void)
*/
void DarwinGlxExtensionInit(void)
{
+#ifndef INXQUARTZ
if (!GlxExtensionInit)
LoadGlxBundle();
-
+#endif
GlxExtensionInit();
}
@@ -248,12 +310,13 @@ void DarwinGlxExtensionInit(void)
void DarwinGlxWrapInitVisuals(
miInitVisualsProcPtr *procPtr)
{
+#ifndef INXQUARTZ
if (!GlxWrapInitVisuals)
LoadGlxBundle();
-
+#endif
GlxWrapInitVisuals(procPtr);
}
-
+#endif
int DarwinModeProcessArgument( int argc, char *argv[], int i )
{
diff --git a/hw/darwin/quartz/xpr/appledri.c b/hw/darwin/quartz/xpr/appledri.c
index dd688cae3..ef68c867b 100644
--- a/hw/darwin/quartz/xpr/appledri.c
+++ b/hw/darwin/quartz/xpr/appledri.c
@@ -35,6 +35,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#define NEED_REPLIES
#define NEED_EVENTS
#include <X11/X.h>
diff --git a/hw/darwin/quartz/xpr/appledri.h b/hw/darwin/quartz/xpr/appledri.h
new file mode 100644
index 000000000..9c630373d
--- /dev/null
+++ b/hw/darwin/quartz/xpr/appledri.h
@@ -0,0 +1,107 @@
+/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+Copyright (c) 2002 Apple Computer, Inc.
+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, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Jens Owen <jens@valinux.com>
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ */
+
+#ifndef _APPLEDRI_H_
+#define _APPLEDRI_H_
+
+#include <X11/Xfuncproto.h>
+
+#define X_AppleDRIQueryVersion 0
+#define X_AppleDRIQueryDirectRenderingCapable 1
+#define X_AppleDRICreateSurface 2
+#define X_AppleDRIDestroySurface 3
+#define X_AppleDRIAuthConnection 4
+/* Requests up to and including 18 were used in a previous version */
+
+/* Events */
+#define AppleDRIObsoleteEvent1 0
+#define AppleDRIObsoleteEvent2 1
+#define AppleDRIObsoleteEvent3 2
+#define AppleDRISurfaceNotify 3
+#define AppleDRINumberEvents 4
+
+/* Errors */
+#define AppleDRIClientNotLocal 0
+#define AppleDRIOperationNotSupported 1
+#define AppleDRINumberErrors (AppleDRIOperationNotSupported + 1)
+
+/* Kinds of SurfaceNotify events: */
+#define AppleDRISurfaceNotifyChanged 0
+#define AppleDRISurfaceNotifyDestroyed 1
+
+#ifndef _APPLEDRI_SERVER_
+
+typedef struct {
+ int type; /* of event */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came frome a SendEvent request */
+ Display *display; /* Display the event was read from */
+ Window window; /* window of event */
+ Time time; /* server timestamp when event happened */
+ int kind; /* subtype of event */
+ int arg;
+} XAppleDRINotifyEvent;
+
+_XFUNCPROTOBEGIN
+
+Bool XAppleDRIQueryExtension (Display *dpy, int *event_base, int *error_base);
+
+Bool XAppleDRIQueryVersion (Display *dpy, int *majorVersion,
+ int *minorVersion, int *patchVersion);
+
+Bool XAppleDRIQueryDirectRenderingCapable (Display *dpy, int screen,
+ Bool *isCapable);
+
+void *XAppleDRISetSurfaceNotifyHandler (void (*fun) (Display *dpy,
+ unsigned uid, int kind));
+
+Bool XAppleDRIAuthConnection (Display *dpy, int screen, unsigned int magic);
+
+Bool XAppleDRICreateSurface (Display *dpy, int screen, Drawable drawable,
+ unsigned int client_id, unsigned int key[2],
+ unsigned int* uid);
+
+Bool XAppleDRIDestroySurface (Display *dpy, int screen, Drawable drawable);
+
+Bool XAppleDRISynchronizeSurfaces (Display *dpy);
+
+_XFUNCPROTOEND
+
+#endif /* _APPLEDRI_SERVER_ */
+#endif /* _APPLEDRI_H_ */
+
diff --git a/hw/darwin/quartz/xpr/appledristr.h b/hw/darwin/quartz/xpr/appledristr.h
new file mode 100644
index 000000000..36a2e891e
--- /dev/null
+++ b/hw/darwin/quartz/xpr/appledristr.h
@@ -0,0 +1,176 @@
+/* $XFree86: xc/lib/GL/dri/xf86dristr.h,v 1.9 2001/03/21 16:01:08 dawes Exp $ */
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+Copyright (c) 2002 Apple Computer, Inc.
+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, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Jens Owen <jens@valinux.com>
+ * Rickard E. (Rik) Fiath <faith@valinux.com>
+ *
+ */
+
+#ifndef _APPLEDRISTR_H_
+#define _APPLEDRISTR_H_
+
+#include "appledri.h"
+
+#define APPLEDRINAME "Apple-DRI"
+
+#define APPLE_DRI_MAJOR_VERSION 1 /* current version numbers */
+#define APPLE_DRI_MINOR_VERSION 0
+#define APPLE_DRI_PATCH_VERSION 0
+
+typedef struct _AppleDRIQueryVersion {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIQueryVersion */
+ CARD16 length B16;
+} xAppleDRIQueryVersionReq;
+#define sz_xAppleDRIQueryVersionReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 majorVersion B16; /* major version of DRI protocol */
+ CARD16 minorVersion B16; /* minor version of DRI protocol */
+ CARD32 patchVersion B32; /* patch version of DRI protocol */
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xAppleDRIQueryVersionReply;
+#define sz_xAppleDRIQueryVersionReply 32
+
+typedef struct _AppleDRIQueryDirectRenderingCapable {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
+ CARD16 length B16;
+ CARD32 screen B32;
+} xAppleDRIQueryDirectRenderingCapableReq;
+#define sz_xAppleDRIQueryDirectRenderingCapableReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ BOOL isCapable;
+ BOOL pad2;
+ BOOL pad3;
+ BOOL pad4;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+ CARD32 pad7 B32;
+ CARD32 pad8 B32;
+ CARD32 pad9 B32;
+} xAppleDRIQueryDirectRenderingCapableReply;
+#define sz_xAppleDRIQueryDirectRenderingCapableReply 32
+
+typedef struct _AppleDRIAuthConnection {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRICloseConnection */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 magic B32;
+} xAppleDRIAuthConnectionReq;
+#define sz_xAppleDRIAuthConnectionReq 12
+
+typedef struct {
+ BYTE type;
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 authenticated B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xAppleDRIAuthConnectionReply;
+#define zx_xAppleDRIAuthConnectionReply 32
+
+typedef struct _AppleDRICreateSurface {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRICreateSurface */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
+ CARD32 client_id B32;
+} xAppleDRICreateSurfaceReq;
+#define sz_xAppleDRICreateSurfaceReq 16
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 key_0 B32;
+ CARD32 key_1 B32;
+ CARD32 uid B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xAppleDRICreateSurfaceReply;
+#define sz_xAppleDRICreateSurfaceReply 32
+
+typedef struct _AppleDRIDestroySurface {
+ CARD8 reqType; /* always DRIReqCode */
+ CARD8 driReqType; /* always X_DRIDestroySurface */
+ CARD16 length B16;
+ CARD32 screen B32;
+ CARD32 drawable B32;
+} xAppleDRIDestroySurfaceReq;
+#define sz_xAppleDRIDestroySurfaceReq 12
+
+typedef struct _AppleDRINotify {
+ BYTE type; /* always eventBase + event type */
+ BYTE kind;
+ CARD16 sequenceNumber B16;
+ Time time B32; /* time of change */
+ CARD16 pad1 B16;
+ CARD32 arg B32;
+ CARD32 pad3 B32;
+} xAppleDRINotifyEvent;
+#define sz_xAppleDRINotifyEvent 20
+
+#ifdef _APPLEDRI_SERVER_
+
+void AppleDRISendEvent (
+#if NeedFunctionPrototypes
+ int /* type */,
+ unsigned int /* mask */,
+ int /* which */,
+ int /* arg */
+#endif
+);
+
+#endif /* _APPLEDRI_SERVER_ */
+#endif /* _APPLEDRISTR_H_ */
diff --git a/hw/darwin/quartz/xpr/dri.c b/hw/darwin/quartz/xpr/dri.c
index 9aeaaa588..08ee38221 100644
--- a/hw/darwin/quartz/xpr/dri.c
+++ b/hw/darwin/quartz/xpr/dri.c
@@ -33,6 +33,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include <sys/time.h>
#include <unistd.h>
diff --git a/hw/darwin/quartz/xpr/x-hash.c b/hw/darwin/quartz/xpr/x-hash.c
index a7024b2da..40e530fe0 100644
--- a/hw/darwin/quartz/xpr/x-hash.c
+++ b/hw/darwin/quartz/xpr/x-hash.c
@@ -27,7 +27,9 @@
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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "x-hash.h"
#include "x-list.h"
#include <stdlib.h>
diff --git a/hw/darwin/quartz/xpr/x-hook.c b/hw/darwin/quartz/xpr/x-hook.c
index dcd34fdc5..7a0496763 100644
--- a/hw/darwin/quartz/xpr/x-hook.c
+++ b/hw/darwin/quartz/xpr/x-hook.c
@@ -28,7 +28,9 @@
promote the sale, use or other dealings in this Software without
prior written authorization. */
/* $XFree86: $ */
-
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "x-hook.h"
#include <stdlib.h>
#include <assert.h>
diff --git a/hw/darwin/quartz/xpr/x-list.c b/hw/darwin/quartz/xpr/x-list.c
index b9f23928b..a973e03f3 100644
--- a/hw/darwin/quartz/xpr/x-list.c
+++ b/hw/darwin/quartz/xpr/x-list.c
@@ -27,7 +27,9 @@
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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "x-list.h"
#include <stdlib.h>
#include <assert.h>
diff --git a/hw/darwin/quartz/xpr/xprAppleWM.c b/hw/darwin/quartz/xpr/xprAppleWM.c
index 21746f6e9..fdf404c2d 100644
--- a/hw/darwin/quartz/xpr/xprAppleWM.c
+++ b/hw/darwin/quartz/xpr/xprAppleWM.c
@@ -27,14 +27,15 @@
* 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "xpr.h"
-#include "applewmExt.h"
+#include "quartz/applewmExt.h"
#include "rootless.h"
#include "Xplugin.h"
#include <X11/X.h>
-
static int xprSetWindowLevel(
WindowPtr pWin,
int level)
diff --git a/hw/darwin/quartz/xpr/xprCursor.c b/hw/darwin/quartz/xpr/xprCursor.c
index cb949dadc..e7f23b78b 100644
--- a/hw/darwin/quartz/xpr/xprCursor.c
+++ b/hw/darwin/quartz/xpr/xprCursor.c
@@ -30,8 +30,10 @@
* holders shall not be used in advertising or otherwise to promote the sale,
* use or other dealings in this Software without prior written authorization.
*/
-
-#include "quartzCommon.h"
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+#include "quartz/quartzCommon.h"
#include "xpr.h"
#include "darwin.h"
#include "Xplugin.h"
diff --git a/hw/darwin/quartz/xpr/xprFrame.c b/hw/darwin/quartz/xpr/xprFrame.c
index ed02d4b62..b71b2a606 100644
--- a/hw/darwin/quartz/xpr/xprFrame.c
+++ b/hw/darwin/quartz/xpr/xprFrame.c
@@ -27,13 +27,15 @@
* 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_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
#include "xpr.h"
#include "rootlessCommon.h"
#include "Xplugin.h"
#include "x-hash.h"
#include "x-list.h"
-#include "applewmExt.h"
+#include "quartz/applewmExt.h"
#include "propertyst.h"
#include "dix.h"
diff --git a/hw/darwin/quartz/xpr/xprScreen.c b/hw/darwin/quartz/xpr/xprScreen.c
index 1755ca6f7..67a0737ef 100644
--- a/hw/darwin/quartz/xpr/xprScreen.c
+++ b/hw/darwin/quartz/xpr/xprScreen.c
@@ -27,18 +27,20 @@
* holders shall not be used in advertising or otherwise to promote the sale,
* use or other dealings in this Software without prior written authorization.
*/
-
-#include "quartzCommon.h"
-#include "quartz.h"
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+#include "quartz/quartzCommon.h"
+#include "quartz/quartz.h"
#include "xpr.h"
-#include "pseudoramiX.h"
+#include "quartz/pseudoramiX.h"
#include "darwin.h"
#include "rootless.h"
-#include "safeAlpha.h"
+#include "safeAlpha/safeAlpha.h"
#include "dri.h"
#include "globals.h"
#include "Xplugin.h"
-#include "applewmExt.h"
+#include "quartz/applewmExt.h"
#ifdef DAMAGE
# include "damage.h"
@@ -47,7 +49,6 @@
// Name of GLX bundle for native OpenGL
static const char *xprOpenGLBundle = "glxCGL.bundle";
-
/*
* eventHandler
* Callback handler for Xplugin events.
@@ -98,7 +99,6 @@ eventHandler(unsigned int type, const void *arg,
}
}
-
/*
* displayScreenBounds
* Return the display ID for a particular display index.
@@ -117,7 +117,6 @@ displayAtIndex(int index)
return kCGNullDirectDisplay;
}
-
/*
* displayScreenBounds
* Return the bounds of a particular display.
@@ -140,7 +139,6 @@ displayScreenBounds(CGDirectDisplayID id)
return frame;
}
-
/*
* xprAddPseudoramiXScreens
* Add a single virtual screen encompassing all the physical screens
@@ -196,7 +194,6 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height)
xfree(displayList);
}
-
/*
* xprDisplayInit
* Find number of CoreGraphics displays and initialize Xplugin.
@@ -219,9 +216,7 @@ xprDisplayInit(void)
darwinScreensFound = 1;
if (xp_init(XP_IN_BACKGROUND) != Success)
- {
FatalError("Could not initialize the Xplugin library.");
- }
xp_select_events(XP_EVENT_DISPLAY_CHANGED
| XP_EVENT_WINDOW_STATE_CHANGED
@@ -234,7 +229,6 @@ xprDisplayInit(void)
xprAppleWMInit();
}
-
/*
* xprAddScreen
* Init the framebuffer and record pixmap parameters for the screen.
@@ -304,7 +298,6 @@ xprAddScreen(int index, ScreenPtr pScreen)
return TRUE;
}
-
/*
* xprSetupScreen
* Setup the screen for rootless access.
@@ -341,7 +334,6 @@ xprSetupScreen(int index, ScreenPtr pScreen)
return DRIFinishScreenInit(pScreen);
}
-
/*
* xprUpdateScreen
* Update screen after configuation change.
@@ -358,7 +350,6 @@ xprUpdateScreen(ScreenPtr pScreen)
RootlessUpdateScreenPixmap(pScreen);
}
-
/*
* xprInitInput
* Finalize xpr specific setup.
@@ -375,7 +366,6 @@ xprInitInput(int argc, char **argv)
AppleWMSetScreenOrigin(WindowTable[i]);
}
-
/*
* Quartz display mode function list.
*/
@@ -401,7 +391,6 @@ static QuartzModeProcsRec xprModeProcs = {
DRIDestroySurface
};
-
/*
* QuartzModeBundleInit
* Initialize the display mode bundle after loading.
diff --git a/hw/darwin/utils/Makefile.am b/hw/darwin/utils/Makefile.am
new file mode 100644
index 000000000..11a26111e
--- /dev/null
+++ b/hw/darwin/utils/Makefile.am
@@ -0,0 +1,11 @@
+bin_PROGRAMS = dumpkeymap
+
+dumpkeymap_SOURCES = dumpkeymap.c
+
+dumpkeymap_LDFLAGS = -Wl,-framework,IOKit
+
+man1_MANS = dumpkeymap.man
+
+EXTRA_DIST = \
+ README.txt \
+ dumpkeymap.man
diff --git a/hw/dmx/dmxclient.h b/hw/dmx/dmxclient.h
index 586b82990..657a1275f 100644
--- a/hw/dmx/dmxclient.h
+++ b/hw/dmx/dmxclient.h
@@ -126,7 +126,7 @@ typedef XID KeySym64;
#undef KeySym
#endif
-/* These are in exglobals.h, but that conflicts with X11/extensions/XKBsrv.h */
+/* These are in exglobals.h, but that conflicts with xkbsrv.h */
extern int ProximityIn;
extern int ProximityOut;
extern int DeviceValuator;
@@ -144,7 +144,7 @@ extern int ChangeDeviceNotify;
#ifndef XKB_IN_SERVER
#define XKB_IN_SERVER
#endif
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#undef XPointer
#endif
#include <X11/extensions/XIproto.h>
diff --git a/hw/dmx/dmxpixmap.c b/hw/dmx/dmxpixmap.c
index 4a669fdd9..934060675 100644
--- a/hw/dmx/dmxpixmap.c
+++ b/hw/dmx/dmxpixmap.c
@@ -49,15 +49,11 @@
/** Initialize a private area in \a pScreen for pixmap information. */
Bool dmxInitPixmap(ScreenPtr pScreen)
{
-#ifdef PIXPRIV
if (!AllocatePixmapPrivate(pScreen, dmxPixPrivateIndex,
sizeof(dmxPixPrivRec)))
return FALSE;
return TRUE;
-#else
-#error Must define PIXPRIV to compile DMX X server
-#endif
}
/** Create a pixmap on the back-end server. */
diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c
index 5bfb4df0a..7c315d89f 100644
--- a/hw/dmx/dmxscrinit.c
+++ b/hw/dmx/dmxscrinit.c
@@ -70,9 +70,7 @@ static unsigned long *dmxCursorGeneration;
int dmxGCPrivateIndex; /**< Private index for GCs */
int dmxWinPrivateIndex; /**< Private index for Windows */
-#ifdef PIXPRIV
int dmxPixPrivateIndex; /**< Private index for Pixmaps */
-#endif
int dmxFontPrivateIndex; /**< Private index for Fonts */
int dmxScreenPrivateIndex; /**< Private index for Screens */
int dmxColormapPrivateIndex; /**< Private index for Colormaps */
@@ -233,14 +231,10 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
if (dmxWinPrivateIndex == -1)
return FALSE;
-#ifdef PIXPRIV
/* Allocate pixmap private index */
dmxPixPrivateIndex = AllocatePixmapPrivateIndex();
if (dmxPixPrivateIndex == -1)
return FALSE;
-#else
-#error Must define PIXPRIV to compile DMX X server
-#endif
/* Allocate font private index */
dmxFontPrivateIndex = AllocateFontPrivateIndex();
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 2ca51c30b..e8001df73 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -675,6 +675,8 @@ ephyrRestore (KdCardInfo *card)
void
ephyrScreenFini (KdScreenInfo *screen)
{
+ xfree(screen->driver);
+ screen->driver = NULL;
}
/*
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index a77b87e5e..45e2d3067 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -81,7 +81,7 @@ ddxUseMsg (void)
ErrorF("-host-cursor Re-use exisiting X host server cursor\n");
ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n");
ErrorF("-grayscale Simulate 8bit grayscale\n");
- ErrorF("-fakexa Simulate acceleration using software rendering\n");
+ ErrorF("-fakexa Simulate acceleration using software rendering\n");
ErrorF("\n");
exit(1);
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 573f77489..36d3cbd46 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -656,7 +656,7 @@ hostx_paint_debug_rect(int x, int y,
void
hostx_load_keymap(void)
{
- KeySym *keymap;
+ XID *keymap;
int host_width, min_keycode, max_keycode, width;
int i,j;
@@ -677,7 +677,7 @@ hostx_load_keymap(void)
*/
width = (host_width > 4) ? 4 : host_width;
- ephyrKeySyms.map = (KeySym *)calloc(sizeof(KeySym),
+ ephyrKeySyms.map = (CARD32 *)calloc(sizeof(CARD32),
(max_keycode - min_keycode + 1) *
width);
if (!ephyrKeySyms.map)
@@ -685,7 +685,7 @@ hostx_load_keymap(void)
for (i=0; i<(max_keycode - min_keycode+1); i++)
for (j=0; j<width; j++)
- ephyrKeySyms.map[(i*width)+j] = keymap[(i*host_width) + j];
+ ephyrKeySyms.map[(i*width)+j] = (CARD32) keymap[(i*host_width) + j];
EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width);
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
index 4e3c6af33..4d5f37f0a 100644
--- a/hw/kdrive/ephyr/hostx.h
+++ b/hw/kdrive/ephyr/hostx.h
@@ -56,7 +56,7 @@ typedef struct {
int minKeyCode;
int maxKeyCode;
int mapWidth;
- KeySym *map;
+ CARD32 *map;
} EphyrKeySyms;
struct EphyrHostXEvent
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 83da67f6c..857f04f6d 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -42,7 +42,7 @@
#endif
#ifdef XKB
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#endif
#include <X11/extensions/XI.h>
@@ -1915,11 +1915,6 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki,
KeybdCtrl *ctrl = NULL;
int type, nEvents, i;
-#ifdef DEBUG
- ErrorF("enqueuing kb event (scancode %d, %s)\n", scan_code, is_up ? "up" : "down");
- ErrorF("event is from %s\n", ki->name);
-#endif
-
if (!ki || !ki->dixdev || !ki->dixdev->kbdfeed || !ki->dixdev->key)
return;
@@ -1947,9 +1942,6 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki,
}
nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, type, key_code);
-#ifdef DEBUG
- ErrorF("KdEnqueueKeyboardEvent: got %d events from GKE\n", nEvents);
-#endif
for (i = 0; i < nEvents; i++)
KdQueueEvent(ki->dixdev, kdEvents + i);
}
@@ -2009,12 +2001,6 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
}
z = rz;
-#ifdef DEBUG
- ErrorF("sending motion notification for (%d, %d, %d)\n", x, y, z);
- ErrorF(" comes from (%d, %d, %d)\n", rx, ry, rz);
- ErrorF(" is %s\n", (flags & KD_MOUSE_DELTA) ? "relative" : "absolute");
-#endif
-
if (flags & KD_MOUSE_DELTA)
dixflags = POINTER_RELATIVE & POINTER_ACCELERATE;
else
@@ -2028,9 +2014,6 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
button <<= 1, n++) {
if (((pi->buttonState & button) ^ (buttons & button)) &&
!(buttons & button)) {
-#ifdef DEBUG
- ErrorF(" posting button release %d\n", n);
-#endif
_KdEnqueuePointerEvent(pi, ButtonRelease, x, y, z, n,
dixflags, FALSE);
}
@@ -2039,9 +2022,6 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
button <<= 1, n++) {
if (((pi->buttonState & button) ^ (buttons & button)) &&
(buttons & button)) {
-#ifdef DEBUG
- ErrorF(" posting button press %d\n", n);
-#endif
_KdEnqueuePointerEvent(pi, ButtonPress, x, y, z, n,
dixflags, FALSE);
}
@@ -2057,11 +2037,6 @@ _KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z,
int nEvents = 0, i = 0;
int valuators[3] = { x, y, z };
-#ifdef DEBUG
- ErrorF("mouse enqueuing event from device %s (%d, %d, %d; %d)\n",
- pi->name, x, y, z, b);
-#endif
-
/* TRUE from KdHandlePointerEvent, means 'we swallowed the event'. */
if (!force && KdHandlePointerEvent(pi, type, x, y, z, b, absrel))
return;
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index f0c9e56f3..ec6a7acb5 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -8,16 +8,24 @@ if XF86UTILS
XF86UTILS_SUBDIR = utils
endif
+if MFB
+MFB_SUBDIR = xf1bpp xf4bpp
+endif
+
+if CFB
+CFB_SUBDIR = xf8_16bpp xf8_32bpp
+endif
+
DOC_SUBDIR = doc
SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
- ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp xf8_16bpp \
- xf8_32bpp loader dixmods exa \
+ ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) $(CFB_SUBDIR) \
+ loader dixmods exa modes \
$(DRI_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR)
DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \
- xf8_16bpp xf8_32bpp loader dixmods dri exa \
+ xf8_16bpp xf8_32bpp loader dixmods dri exa modes \
utils doc
bin_PROGRAMS = Xorg
@@ -47,6 +55,10 @@ XORG_LIBS = \
rac/librac.a \
parser/libxf86config.a \
dixmods/libdixmods.la \
+ modes/libxf86modes.a \
+ ramdac/libramdac.a \
+ ddc/libddc.a \
+ i2c/libi2c.a \
@XORG_LIBS@
Xorg_DEPENDENCIES = \
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 86ad0182d..686e1eeac 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -1796,6 +1796,15 @@ convertRange2Host(int entityIndex, resRange *pRange)
}
}
+static void
+xf86ConvertListToHost(int entityIndex, resPtr list)
+{
+ while (list) {
+ convertRange2Host(entityIndex, &list->val);
+ list = list->next;
+ }
+}
+
/*
* xf86RegisterResources() -- attempts to register listed resources.
* If list is NULL it tries to obtain resources implicitly. Function
@@ -2835,18 +2844,7 @@ xf86IsSubsetOf(resRange range, resPtr list)
return ret;
}
-Bool
-xf86IsListSubsetOf(resPtr list, resPtr BaseList)
-{
- while (list) {
- if (! xf86IsSubsetOf(list->val,BaseList))
- return FALSE;
- list = list->next;
- }
- return TRUE;
-}
-
-resPtr
+static resPtr
findIntersect(resRange Range, resPtr list)
{
resRange range;
@@ -3070,15 +3068,6 @@ xf86NoSharedResources(int screenIndex,resType res)
return TRUE;
}
-void
-xf86ConvertListToHost(int entityIndex, resPtr list)
-{
- while (list) {
- convertRange2Host(entityIndex, &list->val);
- list = list->next;
- }
-}
-
_X_EXPORT void
xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg)
{
diff --git a/hw/xfree86/common/xf86Bus.h b/hw/xfree86/common/xf86Bus.h
index f1fc627b9..5ea5cc8e1 100644
--- a/hw/xfree86/common/xf86Bus.h
+++ b/hw/xfree86/common/xf86Bus.h
@@ -140,12 +140,9 @@ int xf86AllocateEntity(void);
BusType StringToBusType(const char* busID, const char **retID);
memType ChkConflict(resRange *rgp, resPtr res, xf86State state);
Bool xf86IsSubsetOf(resRange range, resPtr list);
-Bool xf86IsListSubsetOf(resPtr list, resPtr BaseList);
resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type);
-resPtr findIntersect(resRange Range, resPtr list);
resPtr xf86FindIntersect(resRange Range, resPtr list);
void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment,
Bool useEstimated);
-void xf86ConvertListToHost(int entityIndex, resPtr list);
#endif /* _XF86_BUS_H */
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 676392c04..986244557 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -76,7 +76,7 @@ extern DeviceAssocRec mouse_assoc;
#ifdef XKB
#undef XKB_IN_SERVER
#define XKB_IN_SERVER
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#endif
#ifdef RENDER
@@ -539,25 +539,6 @@ xf86DriverlistFromCompile(void)
return driverlist;
}
-
-char **
-xf86InputDriverlistFromCompile(void)
-{
- static char **driverlist = NULL;
- static Bool generated = FALSE;
-
- /* This string is modified in-place */
- static char drivernames[] = IDRIVERS;
-
- if (!generated) {
- generated = TRUE;
- driverlist = GenerateDriverlist("input", drivernames);
- }
-
- return driverlist;
-}
-
-
/*
* xf86ConfigError --
* Print a READABLE ErrorMessage!!! All information that is
@@ -2506,17 +2487,8 @@ xf86HandleConfigFile(Bool autoconfig)
return CONFIG_OK;
}
-
-/* These make the equivalent parser functions visible to the common layer. */
-Bool
-xf86PathIsAbsolute(const char *path)
-{
- return (xf86pathIsAbsolute(path) != 0);
-}
-
Bool
xf86PathIsSafe(const char *path)
{
return (xf86pathIsSafe(path) != 0);
}
-
diff --git a/hw/xfree86/common/xf86Config.h b/hw/xfree86/common/xf86Config.h
index 0786ec6fe..3787ba21e 100644
--- a/hw/xfree86/common/xf86Config.h
+++ b/hw/xfree86/common/xf86Config.h
@@ -53,7 +53,6 @@ char ** xf86ModulelistFromConfig(pointer **);
char ** xf86DriverlistFromConfig(void);
char ** xf86DriverlistFromCompile(void);
char ** xf86InputDriverlistFromConfig(void);
-char ** xf86InputDriverlistFromCompile(void);
Bool xf86BuiltinInputDriver(const char *);
ConfigStatus xf86HandleConfigFile(Bool);
diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 741e46b5b..0b7297511 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -69,7 +69,7 @@ static int nDevToConfig = 0, CurrentDriver;
_X_EXPORT xf86MonPtr ConfiguredMonitor;
Bool xf86DoConfigurePass1 = TRUE;
-Bool foundMouse = FALSE;
+static Bool foundMouse = FALSE;
#if defined(__UNIXOS2__)
#define DFLT_MOUSE_DEV "mouse$"
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 204457fb1..43db1ee1a 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -43,7 +43,7 @@
#include "servermd.h"
#include "micmap.h"
#ifdef XKB
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#endif
#include "xf86Xinput.h"
@@ -51,11 +51,14 @@
static unsigned long DGAGeneration = 0;
static int DGAScreenIndex = -1;
+static int mieq_installed = 0;
static Bool DGACloseScreen(int i, ScreenPtr pScreen);
static void DGADestroyColormap(ColormapPtr pmap);
static void DGAInstallColormap(ColormapPtr pmap);
static void DGAUninstallColormap(ColormapPtr pmap);
+static void DGAHandleEvent(int screen_num, xEvent *event,
+ DeviceIntPtr device, int nevents);
static void
DGACopyModeInfo(
@@ -96,7 +99,6 @@ typedef struct {
Bool grabKeyboard;
} DGAScreenRec, *DGAScreenPtr;
-
_X_EXPORT Bool
DGAInit(
ScreenPtr pScreen,
@@ -146,7 +148,6 @@ DGAInit(
modes[i].flags &= ~DGA_PIXMAP_AVAILABLE;
#endif
-
pScreen->devPrivates[DGAScreenIndex].ptr = (pointer)pScreenPriv;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = DGACloseScreen;
@@ -157,11 +158,6 @@ DGAInit(
pScreenPriv->UninstallColormap = pScreen->UninstallColormap;
pScreen->UninstallColormap = DGAUninstallColormap;
- /*
- * This is now set in InitOutput().
- *
- pScrn->SetDGAMode = xf86SetDGAMode;
- */
return TRUE;
}
@@ -247,12 +243,22 @@ FreeMarkedVisuals(ScreenPtr pScreen)
}
}
-
static Bool
DGACloseScreen(int i, ScreenPtr pScreen)
{
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+ if (XDGAEventBase) {
+ OsBlockSignals();
+ ProcessInputEvents();
+ mieqSetHandler(*XDGAEventBase + MotionNotify, NULL);
+ mieqSetHandler(*XDGAEventBase + ButtonPress, NULL);
+ mieqSetHandler(*XDGAEventBase + ButtonRelease, NULL);
+ mieqSetHandler(*XDGAEventBase + KeyPress, NULL);
+ mieqSetHandler(*XDGAEventBase + KeyRelease, NULL);
+ OsReleaseSignals();
+ }
+
FreeMarkedVisuals(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
@@ -462,6 +468,15 @@ DGASetInputMode(int index, Bool keyboard, Bool mouse)
{
pScreenPriv->grabMouse = mouse;
pScreenPriv->grabKeyboard = keyboard;
+
+ if (!mieq_installed) {
+ mieqSetHandler(*XDGAEventBase + MotionNotify, DGAHandleEvent);
+ mieqSetHandler(*XDGAEventBase + ButtonPress, DGAHandleEvent);
+ mieqSetHandler(*XDGAEventBase + ButtonRelease, DGAHandleEvent);
+ mieqSetHandler(*XDGAEventBase + KeyPress, DGAHandleEvent);
+ mieqSetHandler(*XDGAEventBase + KeyRelease, DGAHandleEvent);
+ mieq_installed = 1;
+ }
}
}
@@ -903,21 +918,93 @@ DGAVTSwitch(void)
return TRUE;
}
+Bool
+DGAStealKeyEvent(int index, int key_code, int is_down)
+{
+ DGAScreenPtr pScreenPriv;
+ dgaEvent de;
+
+ if(DGAScreenIndex < 0) /* no DGA */
+ return FALSE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
-/* We have the power to steal or modify events that are about to get queued */
+ if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */
+ return FALSE;
+
+ de.u.u.type = *XDGAEventBase + (is_down ? KeyPress : KeyRelease);
+ de.u.u.detail = key_code;
+ de.u.event.time = GetTimeInMillis();
+ mieqEnqueue (inputInfo.keyboard, (xEvent *) &de);
+
+ return TRUE;
+}
+
+static int DGAMouseX, DGAMouseY;
Bool
-DGAStealKeyEvent(int index, xEvent *e)
+DGAStealMotionEvent(int index, int dx, int dy)
{
-}
+ DGAScreenPtr pScreenPriv;
+ dgaEvent de;
-static int DGAMouseX, DGAMouseY;
+ if(DGAScreenIndex < 0) /* no DGA */
+ return FALSE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */
+ return FALSE;
+
+ DGAMouseX += dx;
+ if (DGAMouseX < 0)
+ DGAMouseX = 0;
+ else if (DGAMouseX > screenInfo.screens[index]->width)
+ DGAMouseX = screenInfo.screens[index]->width;
+ DGAMouseY += dy;
+ if (DGAMouseY < 0)
+ DGAMouseY = 0;
+ else if (DGAMouseY > screenInfo.screens[index]->height)
+ DGAMouseY = screenInfo.screens[index]->height;
+ de.u.u.type = *XDGAEventBase + MotionNotify;
+ de.u.u.detail = 0;
+ de.u.event.time = GetTimeInMillis();
+ de.u.event.dx = dx;
+ de.u.event.dy = dy;
+ de.u.event.pad1 = DGAMouseX;
+ de.u.event.pad2 = DGAMouseY;
+ mieqEnqueue (inputInfo.pointer, (xEvent *) &de);
+ return TRUE;
+}
Bool
-DGAStealMouseEvent(int index, xEvent *e, int dx, int dy)
+DGAStealButtonEvent(int index, int button, int is_down)
{
+ DGAScreenPtr pScreenPriv;
+ dgaEvent de;
+
+ if (DGAScreenIndex < 0)
+ return FALSE;
+
+ pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
+
+ if (!pScreenPriv || !pScreenPriv->grabMouse)
+ return FALSE;
+
+ de.u.u.type = *XDGAEventBase + (is_down ? ButtonPress : ButtonRelease);
+ de.u.u.detail = button;
+ de.u.event.time = GetTimeInMillis();
+ de.u.event.dx = 0;
+ de.u.event.dy = 0;
+ de.u.event.pad1 = DGAMouseX;
+ de.u.event.pad2 = DGAMouseY;
+ mieqEnqueue (inputInfo.pointer, (xEvent *) &de);
+
+ return TRUE;
}
+/* We have the power to steal or modify events that are about to get queued */
+
Bool
DGAIsDgaEvent (xEvent *e)
{
@@ -1124,39 +1211,6 @@ DGAProcessPointerEvent (ScreenPtr pScreen, dgaEvent *de, DeviceIntPtr mouse)
}
}
-Bool
-DGADeliverEvent (ScreenPtr pScreen, xEvent *e)
-{
- dgaEvent *de = (dgaEvent *) e;
- DGAScreenPtr pScreenPriv;
- int coreEquiv;
-
- /* no DGA */
- if (DGAScreenIndex < 0 || XDGAEventBase == 0)
- return FALSE;
- pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
-
- /* DGA not initialized on this screen */
- if (!pScreenPriv)
- return FALSE;
-
- coreEquiv = de->u.u.type - *XDGAEventBase;
- /* Not a DGA event */
- if (coreEquiv < KeyPress || coreEquiv > MotionNotify)
- return FALSE;
-
- switch (coreEquiv) {
- case KeyPress:
- case KeyRelease:
- DGAProcessKeyboardEvent (pScreen, de, inputInfo.keyboard);
- break;
- default:
- DGAProcessPointerEvent (pScreen, de, inputInfo.pointer);
- break;
- }
- return TRUE;
-}
-
_X_EXPORT Bool
DGAOpenFramebuffer(
int index,
@@ -1215,3 +1269,35 @@ DGAGetOldDGAMode(int index)
return 0;
}
+static void
+DGAHandleEvent(int screen_num, xEvent *event, DeviceIntPtr device, int nevents)
+{
+ dgaEvent *de = (dgaEvent *) event;
+ ScreenPtr pScreen = screenInfo.screens[screen_num];
+ DGAScreenPtr pScreenPriv;
+ int coreEquiv;
+
+ /* no DGA */
+ if (DGAScreenIndex < 0 || XDGAEventBase == 0)
+ return;
+ pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
+
+ /* DGA not initialized on this screen */
+ if (!pScreenPriv)
+ return;
+
+ coreEquiv = de->u.u.type - *XDGAEventBase;
+ /* Not a DGA event; shouldn't happen, but you never know. */
+ if (coreEquiv < KeyPress || coreEquiv > MotionNotify)
+ return;
+
+ switch (coreEquiv) {
+ case KeyPress:
+ case KeyRelease:
+ DGAProcessKeyboardEvent (pScreen, de, inputInfo.keyboard);
+ break;
+ default:
+ DGAProcessPointerEvent (pScreen, de, inputInfo.pointer);
+ break;
+ }
+}
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 05e62f184..3610c17c0 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -126,9 +126,9 @@ extern Bool noXkbExtension;
*/
#ifdef USE_VT_SYSREQ
-Bool VTSysreqToggle = FALSE;
+static Bool VTSysreqToggle = FALSE;
#endif /* !USE_VT_SYSREQ */
-Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
+_X_EXPORT Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
*BSD and for avoiding VT
switches when using the DRI
automatic full screen mode.*/
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index d81b5cc91..7dc45b75d 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -146,7 +146,6 @@ _X_EXPORT confDRIRec xf86ConfigDRI = {0, };
XF86ConfigPtr xf86configptr = NULL;
Bool xf86Resetting = FALSE;
Bool xf86Initialising = FALSE;
-Bool xf86ProbeFailed = FALSE;
Bool xf86DoProbe = FALSE;
Bool xf86DoConfigure = FALSE;
DriverPtr *xf86DriverList = NULL;
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 27a90c9a7..5353a5758 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -2986,3 +2986,16 @@ xf86IsUnblank(int mode)
return TRUE;
}
}
+
+_X_EXPORT void
+xf86MotionHistoryAllocate(LocalDevicePtr local)
+{
+ AllocateMotionHistory(local->dev);
+}
+
+_X_EXPORT int
+xf86GetMotionEvents(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
+ unsigned long stop, ScreenPtr pScreen)
+{
+ return GetMotionHistory(pDev, buff, start, stop, pScreen);
+}
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index f824f6867..17cc06bb4 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -36,6 +36,7 @@
#endif
#include <stdlib.h>
+#include <errno.h>
#undef HAS_UTSNAME
#if !defined(WIN32) && !defined(__UNIXOS2__)
diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index d5085b542..fc905dfac 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -368,6 +368,7 @@ xf86HandleBuiltinMode(ScrnInfoPtr scrp,
return MODE_OK;
}
+#if 0
/** Calculates the horizontal sync rate of a mode */
_X_EXPORT double
xf86ModeHSync(DisplayModePtr mode)
@@ -411,6 +412,7 @@ xf86SetModeDefaultName(DisplayModePtr mode)
mode->name = XNFprintf("%dx%d", mode->HDisplay, mode->VDisplay);
}
+#endif
/*
* xf86LookupMode
@@ -680,6 +682,7 @@ xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
}
+#if 0
/*
* xf86SetModeCrtc
*
@@ -733,7 +736,9 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
p->CrtcHAdjusted = FALSE;
p->CrtcVAdjusted = FALSE;
}
+#endif
+#if 0
/**
* Allocates and returns a copy of pMode, including pointers within pMode.
*/
@@ -814,6 +819,7 @@ xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
return FALSE;
}
}
+#endif
/*
* xf86CheckModeForMonitor
@@ -2040,6 +2046,7 @@ add(char **p, char *new)
strcat(*p, new);
}
+#if 0
_X_EXPORT void
xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
{
@@ -2075,6 +2082,7 @@ xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
mode->VTotal, flags);
xfree(flags);
}
+#endif
_X_EXPORT void
xf86PrintModes(ScrnInfoPtr scrp)
@@ -2145,6 +2153,7 @@ xf86PrintModes(ScrnInfoPtr scrp)
} while (p != NULL && p != scrp->modes);
}
+#if 0
/**
* Adds the new mode into the mode list, and returns the new list
*
@@ -2168,3 +2177,4 @@ xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
return modes;
}
+#endif
diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h
index 60fd31ab8..274f7e754 100644
--- a/hw/xfree86/common/xf86Priv.h
+++ b/hw/xfree86/common/xf86Priv.h
@@ -102,7 +102,6 @@ extern int xf86NumModuleInfos;
extern int xf86NumDrivers;
extern Bool xf86Resetting;
extern Bool xf86Initialising;
-extern Bool xf86ProbeFailed;
extern int xf86NumScreens;
extern xf86CurrentAccessRec xf86CurrentAccess;
extern const char *xf86VisualNames[];
@@ -153,7 +152,6 @@ extern void xf86PostScreenInit(void);
/* xf86Config.c */
-Bool xf86PathIsAbsolute(const char *path);
Bool xf86PathIsSafe(const char *path);
/* xf86DefaultModes */
diff --git a/hw/xfree86/common/xf86XKB.c b/hw/xfree86/common/xf86XKB.c
index 399eb02d9..b805885bd 100644
--- a/hw/xfree86/common/xf86XKB.c
+++ b/hw/xfree86/common/xf86XKB.c
@@ -73,7 +73,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define XF86_OS_PRIVS
#include "xf86_OSlib.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
void
xf86InitXkb(void)
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 16e330d43..17ffed899 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -90,6 +90,10 @@
#include "mi.h"
+#ifdef XFreeXDGA
+#include "dgaproc.h"
+#endif
+
xEvent *xf86Events = NULL;
static Bool
@@ -128,6 +132,9 @@ xf86ProcessCommonOptions(LocalDevicePtr local,
} else {
xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
}
+
+ /* Backwards compatibility. */
+ local->history_size = GetMotionHistorySize();
}
/***********************************************************************
@@ -395,10 +402,12 @@ xf86PostMotionEvent(DeviceIntPtr device,
{
va_list var;
int i = 0, nevents = 0;
+ int dx, dy;
Bool drag = xf86SendDragEvents(device);
int *valuators = NULL;
int flags = 0;
xEvent *xE = NULL;
+ int index;
if (is_absolute)
flags = POINTER_ABSOLUTE;
@@ -412,6 +421,24 @@ xf86PostMotionEvent(DeviceIntPtr device,
valuators[i] = va_arg(var, int);
va_end(var);
+#if XFreeXDGA
+ if (first_valuator == 0 && num_valuators >= 2) {
+ if (miPointerGetScreen(inputInfo.pointer)) {
+ index = miPointerGetScreen(inputInfo.pointer)->myNum;
+ if (is_absolute) {
+ dx = valuators[0] - device->valuator->lastx;
+ dy = valuators[1] - device->valuator->lasty;
+ }
+ else {
+ dx = valuators[0];
+ dy = valuators[1];
+ }
+ if (DGAStealMotionEvent(index, dx, dy))
+ goto out;
+ }
+ }
+#endif
+
if (!xf86Events)
xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
if (!xf86Events)
@@ -430,6 +457,7 @@ xf86PostMotionEvent(DeviceIntPtr device,
}
}
+out:
xfree(valuators);
}
@@ -476,6 +504,15 @@ xf86PostButtonEvent(DeviceIntPtr device,
va_list var;
int *valuators = NULL;
int i = 0, nevents = 0;
+ int index;
+
+#if XFreeXDGA
+ if (miPointerGetScreen(inputInfo.pointer)) {
+ index = miPointerGetScreen(inputInfo.pointer)->myNum;
+ if (DGAStealButtonEvent(index, button, is_down))
+ return;
+ }
+#endif
valuators = xcalloc(sizeof(int), num_valuators);
@@ -552,6 +589,15 @@ xf86PostKeyboardEvent(DeviceIntPtr device,
int is_down)
{
int nevents = 0, i = 0;
+ int index;
+
+#if XFreeXDGA
+ if (miPointerGetScreen(inputInfo.pointer)) {
+ index = miPointerGetScreen(inputInfo.pointer)->myNum;
+ if (DGAStealKeyEvent(index, key_code, is_down))
+ return;
+ }
+#endif
if (!xf86Events)
xf86Events = (xEvent *)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
index fe65643ce..b2bc8dec1 100644
--- a/hw/xfree86/common/xf86Xinput.h
+++ b/hw/xfree86/common/xf86Xinput.h
@@ -86,6 +86,9 @@
#define XI_PRIVATE(dev) \
(((LocalDevicePtr)((dev)->public.devicePrivate))->private)
+/* Stupid API backwards-compatibility. */
+#define TS_Raw 60
+#define TS_Scaled 61
#ifdef XINPUT
/* This holds the input driver entry and module information. */
@@ -144,6 +147,7 @@ typedef struct _LocalDeviceRec {
InputDriverPtr drv;
pointer module;
pointer options;
+ unsigned int history_size;
} LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
typedef struct _DeviceAssocRec
@@ -191,6 +195,10 @@ InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
InputDriverPtr xf86LookupInputDriver(const char *name);
InputInfoPtr xf86LookupInput(const char *name);
void xf86DeleteInput(InputInfoPtr pInp, int flags);
+void xf86MotionHistoryAllocate(LocalDevicePtr local);
+int xf86GetMotionEvents(DeviceIntPtr dev, xTimecoord *buff,
+ unsigned long start, unsigned long stop,
+ ScreenPtr pScreen);
/* xf86Option.c */
void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
diff --git a/hw/xfree86/common/xf86fbman.c b/hw/xfree86/common/xf86fbman.c
index d64cfaee4..537d53d7d 100644
--- a/hw/xfree86/common/xf86fbman.c
+++ b/hw/xfree86/common/xf86fbman.c
@@ -968,7 +968,7 @@ localAllocateOffscreenLinear(
linear->size = h * w;
linear->offset = (pitch * area->box.y1) + area->box.x1;
if (gran > 1)
- linear->offset += ((linear->offset + gran - 1) / gran) * gran;
+ linear->offset = ((linear->offset + gran - 1) / gran) * gran;
linear->granularity = gran;
linear->MoveLinearCallback = moveCB;
linear->RemoveLinearCallback = removeCB;
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 3e908b86a..2b097d2db 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -110,7 +110,7 @@ static void xf86XVAdjustFrame(int index, int x, int y, int flags);
static Bool xf86XVInitAdaptors(ScreenPtr, XF86VideoAdaptorPtr*, int);
-int XF86XVWindowIndex = -1;
+static int XF86XVWindowIndex = -1;
int XF86XvScreenIndex = -1;
static unsigned long XF86XVGeneration = 0;
static unsigned long PortResource = 0;
diff --git a/hw/xfree86/ddc/Makefile.am b/hw/xfree86/ddc/Makefile.am
index a04b5e8fe..04d3e445c 100644
--- a/hw/xfree86/ddc/Makefile.am
+++ b/hw/xfree86/ddc/Makefile.am
@@ -1,11 +1,9 @@
sdk_HEADERS = edid.h vdif.h xf86DDC.h
-module_LTLIBRARIES = libddc.la
+noinst_LIBRARIES = libddc.a
-libddc_la_LDFLAGS = -avoid-version
-libddc_la_SOURCES = xf86DDC.c edid.c interpret_edid.c print_edid.c \
- interpret_vdif.c print_vdif.c ddcProperty.c \
- edid_modes.c
+libddc_a_SOURCES = xf86DDC.c edid.c interpret_edid.c print_edid.c \
+ interpret_vdif.c print_vdif.c ddcProperty.c
INCLUDES = $(XORG_INCS) -I$(srcdir)/../i2c
diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index 13083dd50..37efb5bd9 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -31,6 +31,7 @@
#include "property.h"
#include "propertyst.h"
#include "xf86DDC.h"
+#include "xf86_ansic.h"
#define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA"
#define EDID2_ATOM_NAME "XFree86_DDC_EDID2_RAWDATA"
diff --git a/hw/xfree86/ddc/xf86DDC.c b/hw/xfree86/ddc/xf86DDC.c
index dd64bd56f..21984bc04 100644
--- a/hw/xfree86/ddc/xf86DDC.c
+++ b/hw/xfree86/ddc/xf86DDC.c
@@ -15,48 +15,6 @@
static const OptionInfoRec *DDCAvailableOptions(void *unused);
-static MODULESETUPPROTO(ddcSetup);
-
-static XF86ModuleVersionInfo ddcVersRec =
-{
- "ddc",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 0, 0,
- ABI_CLASS_VIDEODRV, /* needs the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData ddcModuleData = { &ddcVersRec, ddcSetup, NULL };
-
-ModuleInfoRec DDC = {
- 1,
- "DDC",
- NULL,
- 0,
- DDCAvailableOptions,
-};
-
-static pointer
-ddcSetup(pointer module, pointer opts, int *errmaj, int *errmin)
-{
- static Bool setupDone = FALSE;
-
- if (!setupDone) {
- setupDone = TRUE;
- xf86AddModuleInfo(&DDC, module);
- }
- /*
- * The return value must be non-NULL on success even though there
- * is no TearDownProc.
- */
- return (pointer)1;
-}
-
#define RETRIES 4
static unsigned char *EDIDRead_DDC1(
@@ -333,6 +291,12 @@ DDCRead_DDC2(int scrnIndex, I2CBusPtr pBus, int start, int len)
unsigned char *R_Buffer;
int i;
+ /*
+ * Slow down the bus so that older monitors don't
+ * miss things.
+ */
+ pBus->RiseFallTime = 20;
+
if (!(dev = xf86I2CFindDev(pBus, 0x00A0))) {
dev = xf86CreateI2CDevRec();
dev->DevName = "ddc2";
@@ -340,7 +304,6 @@ DDCRead_DDC2(int scrnIndex, I2CBusPtr pBus, int start, int len)
dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
dev->StartTimeout = 550;
dev->BitTimeout = 40;
- dev->ByteTimeout = 40;
dev->AcknTimeout = 40;
dev->pI2CBus = pBus;
diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am
index c34ddd6e3..58099bce9 100644
--- a/hw/xfree86/dixmods/Makefile.am
+++ b/hw/xfree86/dixmods/Makefile.am
@@ -14,12 +14,23 @@ if DBE
DBEMOD = libdbe.la
endif
-module_LTLIBRARIES = libafb.la \
- libcfb.la \
- libcfb32.la \
+if AFB
+AFBMOD = libafb.la
+endif
+
+if CFB
+CFBMOD = libcfb.la libcfb32.la
+endif
+
+if MFB
+MFBMOD = libmfb.la
+endif
+
+module_LTLIBRARIES = $(AFBMOD) \
+ $(CFBMOD) \
libfb.la \
libwfb.la \
- libmfb.la \
+ $(MFBMOD) \
libshadow.la
extsmoduledir = $(moduledir)/extensions
diff --git a/hw/xfree86/dixmods/extmod/dgaproc.h b/hw/xfree86/dixmods/extmod/dgaproc.h
index 5e424afb2..aaea4e20c 100644
--- a/hw/xfree86/dixmods/extmod/dgaproc.h
+++ b/hw/xfree86/dixmods/extmod/dgaproc.h
@@ -120,8 +120,9 @@ int DGAGetOldDGAMode(int Index);
int DGAGetModeInfo(int Index, XDGAModePtr mode, int num);
Bool DGAVTSwitch(void);
-Bool DGAStealMouseEvent(int Index, xEvent *e, int dx, int dy);
-Bool DGAStealKeyEvent(int Index, xEvent *e);
+Bool DGAStealButtonEvent(int Index, int button, int is_down);
+Bool DGAStealMotionEvent(int Index, int dx, int dy);
+Bool DGAStealKeyEvent(int Index, int key_code, int is_down);
Bool DGAIsDgaEvent (xEvent *e);
Bool DGADeliverEvent (ScreenPtr pScreen, xEvent *e);
diff --git a/hw/xfree86/dixmods/glxmodule.c b/hw/xfree86/dixmods/glxmodule.c
index 401707abc..5384f434b 100644
--- a/hw/xfree86/dixmods/glxmodule.c
+++ b/hw/xfree86/dixmods/glxmodule.c
@@ -95,8 +95,8 @@ __glXMesaProxyScreenProbe(ScreenPtr pScreen)
static __GLXprovider *provider;
if (provider == NULL) {
- GLcore = LoadSubModuleLocal(glxModule, "GLcore", NULL, NULL, NULL, NULL,
- NULL, NULL);
+ GLcore = LoadSubModule(glxModule, "GLcore", NULL, NULL, NULL, NULL,
+ NULL, NULL);
if (GLcore == NULL)
return NULL;
diff --git a/hw/xfree86/dixmods/xkbKillSrv.c b/hw/xfree86/dixmods/xkbKillSrv.c
index 415873ad0..b3399db4a 100644
--- a/hw/xfree86/dixmods/xkbKillSrv.c
+++ b/hw/xfree86/dixmods/xkbKillSrv.c
@@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
#include "xf86.h"
diff --git a/hw/xfree86/dixmods/xkbPrivate.c b/hw/xfree86/dixmods/xkbPrivate.c
index e6d4f0fc0..e0cd21739 100644
--- a/hw/xfree86/dixmods/xkbPrivate.c
+++ b/hw/xfree86/dixmods/xkbPrivate.c
@@ -12,7 +12,7 @@
#include <X11/X.h>
#include "windowstr.h"
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include "xf86.h"
diff --git a/hw/xfree86/dixmods/xkbVT.c b/hw/xfree86/dixmods/xkbVT.c
index a1cdc7016..e6d69e2eb 100644
--- a/hw/xfree86/dixmods/xkbVT.c
+++ b/hw/xfree86/dixmods/xkbVT.c
@@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
#include "xf86.h"
diff --git a/hw/xfree86/doc/README.modes b/hw/xfree86/doc/README.modes
new file mode 100644
index 000000000..894e21313
--- /dev/null
+++ b/hw/xfree86/doc/README.modes
@@ -0,0 +1,474 @@
+ Multi-monitor Mode Setting APIs
+ Keith Packard, <keithp@keithp.com
+ 6 March 2007
+
+1. Introduction
+
+This document describes a set of mode setting APIs added in X server version
+1.3 that support multiple monitors per card. These interfaces expose the
+underlying hardware CRTC and output concepts to the xf86 DDX layer so that
+the implementation of initial server setup and mode changes through
+extensions can be shared across drivers. In addition, these new interfaces
+support a new configuration mechanism as well which allows each monitor to
+be customized separately providing a consistent cross-driver configuration
+mechanism that supports the full range of output features.
+
+All of the code implementing this interface can be found in hw/xfree86/modes
+in the X server sources.
+
+2. Overview
+
+This document describes both the driver API and the configuration data
+placed in xorg.conf; these are entirely separate as the driver has no
+interaction with the configuration information at all. Much of the structure
+here is cloned from the RandR extension version 1.2 additions which deal
+with the same kinds of information.
+
+2.1 API overview
+
+The mode setting API is expressed through two new driver-visible objects,
+the 'CRTC' (xf86CrtcRec) and the 'Output' (xf86OutputRec). A CRTC refers to
+hardware within the video system that can scan a subset of the framebuffer
+and generate a video signal. An Output receives that signal and transmits it
+to a monitor, projector or other device.
+
+The xf86CrtcRec and xf86OutputRec contain a small amount of state data
+related to the object along with a pointer to a set of functions provided by
+the driver that manipulate the object in fairly simple ways.
+
+To emulate older behaviour, one of the outputs is picked as the 'compat'
+output; this output changes over time as outputs are detected and used, the
+goal is to always have one 'special' output which is used for operations
+which need a single defined monitor (like XFree86-VidModeExtension mode
+setting, RandR 1.1 mode setting, DDC property setting, etc.).
+
+2.1.1 Output overview
+
+As outputs are connected to monitors, they hold a list of modes supported by
+the monitor. If the monitor and output support DDC, then the list of modes
+generally comes from the EDID data in the monitor. Otherwise, the server
+uses the standard VESA modes, pruned by monitor timing. If the configuration
+file doesn't contain monitor timing data, the server uses default timing
+information which supports 640x480, 800x600 and 1024x768 all with a 60Hz
+refresh rate.
+
+As hardware often limits possible configuration combinations, each output
+knows the set of CRTCs that it can be connected to as well as the set of
+other outputs which can be simutaneously connected to a CRTC.
+
+2.1.2 CRTC overview
+
+CRTCs serve only to stream frame buffer data to outputs using a mode line.
+Ideally, they would not be presented to the user at all, and in fact the
+configuration file doesn't expose them. The RandR 1.2 protocol does, but the
+hope there is that client-side applications will hide them carefully away.
+
+Each crtc has an associated cursor, along with the current configuration.
+All of the data needed to determine valid configurations is contained within
+the Outputs.
+
+2.2 Configuration overview
+
+As outputs drive monitors, the "Monitor" section has been repurposed to
+define their configuration. This provides for a bit more syntax than
+the large list of driver-specific options that were used in the past for
+similar configuration.
+
+However, the existing "Monitor" section referenced by the active "Screen"
+section no longer has any use at all; some sensible meaning for this
+parameter is needed now that a Screen can have multiple Monitors.
+
+3. Public Functions
+
+3.1 PreInit functions
+
+These functions should be used during the driver PreInit phase, they are
+arranged in the order they should be invoked.
+
+ void
+ xf86CrtcConfigInit (ScrnInfoPtr scrn
+ const xf86CrtcConfigFuncsRec *funcs)
+
+This function allocates and initializes structures needed to track CRTC and
+Output state.
+
+ void
+ xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
+ int minWidth, int minHeight,
+ int maxWidth, int maxHeight)
+
+This sets the range of screen sizes supported by the driver.
+
+ xf86CrtcPtr
+ xf86CrtcCreate (ScrnInfoPtr scrn,
+ const xf86CrtcFuncsRec *funcs)
+
+Create one CRTC object. See the discussion below for a description of the
+contents of the xf86CrtcFuncsRec. Note that this is done in PreInit, so it
+should not be re-invoked at each server generation. Create one of these for
+each CRTC present in the hardware.
+
+ xf86OutputPtr
+ xf86OutputCreate (ScrnInfoPtr scrn,
+ const xf86OutputFuncsRec *funcs,
+ const char *name)
+
+Create one Output object. See the discussion below for a description of the
+contents of the xf86OutputFuncsRec. This is also called from PreInit and
+need not be re-invoked at each ScreenInit time. An Output should be created
+for every Output present in the hardware, not just for outputs which have
+detected monitors.
+
+ Bool
+ xf86OutputRename (xf86OutputPtr output, const char *name)
+
+If necessary, the name of an output can be changed after it is created using
+this function.
+
+ Bool
+ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
+
+Using the resources provided, and the configuration specified by the user,
+this function computes an initial configuration for the server. It tries to
+enable as much hardware as possible using some fairly simple heuristics.
+
+The 'canGrow' parameter indicates that the frame buffer does not have a fixed
+size (fixed size frame buffers are required by XAA). When the frame buffer
+has a fixed size, the configuration selects a 'reasonablely large' frame
+buffer so that common reconfiguration options are possible. For resizable
+frame buffers, the frame buffer is set to the smallest size that encloses
+the desired configuration.
+
+3.2 ScreenInit functions
+
+These functions should be used during the driver ScreenInit phase.
+
+ Bool
+ xf86DiDGAInit (ScreenPtr screen, unsigned long dga_address)
+
+This function provides driver-independent accelerated DGA support for some
+of the DGA operations; using this, the driver can avoid needing to implement
+any of the rest of DGA.
+
+ Bool
+ xf86SaveScreen(ScreenPtr pScreen, int mode)
+
+Stick this in pScreen->SaveScreen and the core X screen saver will be
+implemented by disabling outputs and crtcs using their dpms functions.
+
+ void
+ xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
+
+Pass this function to xf86DPMSInit and all DPMS mode switching will be
+managed by using the dpms functions provided by the Outputs and CRTCs.
+
+ Bool
+ xf86CrtcScreenInit (ScreenPtr screen)
+
+This function completes the screen initialization process for the crtc and
+output objects. Call it near the end of the ScreenInit function, after the
+frame buffer and acceleration layers have been added.
+
+3.3 EnterVT functions
+
+Functions used during EnterVT, or whenever the current configuration needs
+to be applied to the hardware.
+
+ Bool
+ xf86SetDesiredModes (ScrnInfoPtr scrn)
+
+xf86InitialConfiguration selects the desired configuration at PreInit time;
+when the server finally hits ScreenInit, xf86SetDesiredModes is used by the
+driver to take that configuration and apply it to the hardware. In addition,
+successful mode selection at other times updates the configuration that will
+be used by this function, so LeaveVT/EnterVT pairs can simply invoke this
+and return to the previous configuration.
+
+3.4 SwitchMode functions
+
+Functions called from the pScrn->SwitchMode hook, which is used by the
+XFree86-VidModeExtension and the keypad mode switch commands.
+
+ Bool
+ xf86SetSingleMode (ScrnInfoPtr scrn,
+ DisplayModePtr desired,
+ Rotation rotation)
+
+This function applies the specified mode to all active outputs. Which is to
+say, it picks reasonable modes for all active outputs, attempting to get the
+screen to the specified size while not breaking anything that is currently
+working.
+
+3.7 get_modes functions
+
+Functions called during output->get_modes to help build lists of modes
+
+ xf86MonPtr
+ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
+
+This returns the EDID data structure for the 'output' using the I2C bus
+'pDDCBus'. This has no effect on 'output' itself.
+
+ void
+ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
+
+Once the EDID data has been fetched, this call applies the EDID data to the
+output object, setting the physical size and also various properties, like
+the DDC root window property (when output is the 'compat' output), and the
+RandR 1.2 EDID output properties.
+
+ DisplayModePtr
+ xf86OutputGetEDIDModes (xf86OutputPtr output)
+
+Given an EDID data structure, this function computes a list of suitable
+modes. This function also applies a sequence of 'quirks' during this process
+so that the returned modes may not actually match the mode data present in
+the EDID data.
+
+3.6 Other functions
+
+These remaining functions in the API can be used by the driver as needed.
+
+ Bool
+ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
+ int x, int y)
+
+Applies a mode to a CRTC. All of the outputs which are currently using the
+specified CRTC are included in the mode setting process. 'x' and 'y' are the
+offset within the frame buffer that the crtc is placed at. No checking is
+done in this function to ensure that the mode is usable by the active
+outputs.
+
+ void
+ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
+
+This discards the mode lists for all outputs, re-detects monitor presence
+and then acquires new mode lists for all monitors which are not disconnected.
+Monitor configuration data is used to modify the mode lists returned by the
+outputs. 'maxX' and 'maxY' limit the maximum size modes that will be
+returned.
+
+ void
+ xf86SetScrnInfoModes (ScrnInfoPtr pScrn)
+
+This copies the 'compat' output mode list into the pScrn modes list which is
+used by the XFree86-VidModeExtension and the keypad mode switching
+operations. The current 'desired' mode for the CRTC associated with the
+'compat' output is placed first in this list to indicate the current mode.
+Usually, the driver won't need to call this function as
+xf86InitialConfiguration will do so automatically, as well as any RandR
+functions which reprobe for modes. However, if the driver reprobes for modes
+at other times using xf86ProbeOutputModes, this function needs to be called.
+
+ Bool
+ xf86DiDGAReInit (ScreenPtr pScreen)
+
+This is similar to xf86SetScrnInfoModes, but it applies the 'compat' output
+mode list to the set of modes advertised by the DGA extension; it needs to
+be called whenever xf86ProbeOutputModes is invoked.
+
+ void
+ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
+
+After any sequence of calls using xf86CrtcSetMode, this function cleans up
+any leftover Output and CRTC objects by disabling them, saving power. It is
+safe to call this whenever the server is running as it only disables objects
+which are not currently in use.
+
+4. CRTC operations
+
+4.1 CRTC functions
+
+These functions provide an abstract interface for the CRTC object; most
+manipulation of the CRTC object is done through these functions.
+
+ void
+ crtc->funcs->dpms (xf86CrtcPtr crtc, int mode)
+
+Where 'mode' is one of DPMSModeOff, DPMSModeSuspend, DPMSModeStandby or
+DPMSModeOn. This requests that the crtc go to the specified power state.
+When changing power states, the output dpms functions are invoked before the
+crtc dpms functions.
+
+ void
+ crtc->funcs->save (xf86CrtcPtr crtc)
+
+ void
+ crtc->funcs->restore (xf86CrtcPtr crtc)
+
+Preserve/restore any register contents related to the CRTC. These are
+strictly a convenience for the driver writer; if the existing driver has
+fully operation save/restore functions, you need not place any additional
+code here. In particular, the server itself never uses this function.
+
+ Bool
+ crtc->funcs->lock (xf86CrtcPtr crtc)
+
+ void
+ crtc->funcs->unlock (xf86CrtcPtr crtc)
+
+These functions are invoked around mode setting operations; the intent is
+that DRI locking be done here to prevent DRI applications from manipulating
+the hardware while the server is busy changing the output configuration. If
+the lock function returns FALSE, the unlock function will not be invoked.
+
+ Bool
+ crtc->funcs->mode_fixup (xf86CrtcPtr crtc,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode)
+
+This call gives the CRTC a chance to see what mode will be set and to
+comment on the mode by changing 'adjusted_mode' as needed. This function
+shall not modify the state of the crtc hardware at all. If the CRTC cannot
+accept this mode, this function may return FALSE.
+
+ void
+ crtc->funcs->prepare (xf86CrtcPtr crtc)
+
+This call is made just before the mode is set to make the hardware ready for
+the operation. A usual function to perform here is to disable the crtc so
+that mode setting can occur with clocks turned off and outputs deactivated.
+
+ void
+ crtc->funcs->mode_set (xf86CrtcPtr crtc,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode)
+
+This function applies the specified mode (possibly adjusted by the CRTC
+and/or Outputs).
+
+ void
+ crtc->funcs->commit (xf86CrtcPtr crtc)
+
+Once the mode has been applied to the CRTC and Outputs, this function is
+invoked to let the hardware turn things back on.
+
+ void
+ crtc->funcs->gamma_set (xf86CrtcPtr crtc, CARD16 *red,
+ CARD16 *green, CARD16 *blue, int size)
+
+This function adjusts the gamma ramps for the specified crtc.
+
+ void *
+ crtc->funcs->shadow_allocate (xf86CrtcPtr crtc, int width, int height)
+
+This function allocates frame buffer space for a shadow frame buffer. When
+allocated, the crtc must scan from the shadow instead of the main frame
+buffer. This is used for rotation. The address returned is passed to the
+shadow_create function. This function should return NULL on failure.
+
+ PixmapPtr
+ crtc->funcs->shadow_create (xf86CrtcPtr crtc, void *data,
+ int width, int height)
+
+This function creates a pixmap object that will be used as a shadow of the
+main frame buffer for CRTCs which are rotated or reflected. 'data' is the
+value returned by shadow_allocate.
+
+ void
+ crtc->funcs->shadow_destroy (xf86CrtcPtr crtc, PixmapPtr pPixmap,
+ void *data)
+
+Destroys any associated shadow objects. If pPixmap is NULL, then a pixmap
+was not created, but 'data' may still be non-NULL indicating that the shadow
+had been allocated.
+
+ void
+ crtc->funcs->destroy (xf86CrtcPtr crtc)
+
+When a CRTC is destroyed (which only happens in error cases), this function
+can clean up any driver-specific data.
+
+4.2 CRTC fields
+
+The CRTC object is not opaque; there are several fields of interest to the
+driver writer.
+
+ struct _xf86Crtc {
+ /**
+ * Associated ScrnInfo
+ */
+ ScrnInfoPtr scrn;
+
+ /**
+ * Active state of this CRTC
+ *
+ * Set when this CRTC is driving one or more outputs
+ */
+ Bool enabled;
+
+ /** Track whether cursor is within CRTC range */
+ Bool cursorInRange;
+
+ /** Track state of cursor associated with this CRTC */
+ Bool cursorShown;
+
+ /**
+ * Active mode
+ *
+ * This reflects the mode as set in the CRTC currently
+ * It will be cleared when the VT is not active or
+ * during server startup
+ */
+ DisplayModeRec mode;
+ Rotation rotation;
+ PixmapPtr rotatedPixmap;
+ void *rotatedData;
+
+ /**
+ * Position on screen
+ *
+ * Locates this CRTC within the frame buffer
+ */
+ int x, y;
+
+ /**
+ * Desired mode
+ *
+ * This is set to the requested mode, independent of
+ * whether the VT is active. In particular, it receives
+ * the startup configured mode and saves the active mode
+ * on VT switch.
+ */
+ DisplayModeRec desiredMode;
+ Rotation desiredRotation;
+ int desiredX, desiredY;
+
+ /** crtc-specific functions */
+ const xf86CrtcFuncsRec *funcs;
+
+ /**
+ * Driver private
+ *
+ * Holds driver-private information
+ */
+ void *driver_private;
+ #ifdef RANDR_12_INTERFACE
+ /**
+ * RandR crtc
+ *
+ * When RandR 1.2 is available, this
+ * points at the associated crtc object
+ */
+ RRCrtcPtr randr_crtc;
+ #else
+ void *randr_crtc;
+ #endif
+ };
+
+
+5. Output functions.
+
+6. Configuration
+
+Because the configuration file syntax is fixed,
+this was done by creating new "Driver" section options that hook specific
+outputs to specific "Monitor" sections in the file. The option:
+section of the form:
+
+ Option "monitor-VGA" "My VGA Monitor"
+
+connects the VGA output of this driver to the "Monitor" section with
+Identifier "My VGA Monitor". All of the usual monitor options can now be
+placed in that "Monitor" section and will be applied to the VGA output
+configuration.
diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index bbba21112..cc60d0754 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -1004,12 +1004,22 @@ The
.B Identifier
entry specifies the unique name for this monitor. The
.B Monitor
-section provides information about the specifications of the monitor,
-monitor-specific
+section may be used to provide information about the specifications of the
+monitor, monitor-specific
.BR Options ,
-and information about the video modes to use with the monitor. Specifying
-video modes is optional because the server now has a built-in list of
-VESA standard modes. When modes are specified explicitly in the
+and information about the video modes to use with the monitor.
+.PP
+With RandR 1.2-enabled drivers, monitor sections are tied to specific outputs
+of the video card. Each output has a name, and the server will look for a
+Monitor named
+.B \*qMonitor-outputname\*q
+for configuration of that output (for example,
+.B \*qMonitor-VGA\*q
+for a VGA output)
+.PP
+Specifying video modes is optional because the server will use the DDC or other
+information provided by the monitor to automatically configure the list of
+modes available. When modes are specified explicitly in the
.B Monitor
section (with the
.BR Modes ,
@@ -1017,7 +1027,8 @@ section (with the
or
.B UseModes
keywords), built-in modes with the same names are not included. Built-in
-modes with different names are, however, still implicitly included.
+modes with different names are, however, still implicitly included, when they
+meet the requirements of the monitor.
.PP
The entries that may be used in
.B Monitor
@@ -1214,6 +1225,62 @@ monitors do not require it. The default is off.
This optional entry specifies the vertical refresh rate that the server
should aim for when selecting video modes. Without this option, the
default is to prefer modes with higher refresh rates.
+.TP 7
+.BI "Option " "\*qPreferredMode\*q " \*qstring\*q
+This optional entry specifies a mode to be marked as the preferred initial mode
+of the monitor.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qPosition\*q " "\*qx y\*q"
+This optional entry specifies the position of the monitor within the X
+screen.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qLeftOf\*q " \*qmonitor\*q
+This optional entry specifies that the monitor should be positioned to the
+left of the monitor of the given name.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qRightOf\*q " \*qmonitor\*q
+This optional entry specifies that the monitor should be positioned to the
+right of the monitor of the given name.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qAbove\*q " \*qmonitor\*q
+This optional entry specifies that the monitor should be positioned above the
+monitor of the given name.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qBelow\*q " \*qmonitor\*q
+This optional entry specifies that the monitor should be positioned below the
+monitor of the given name.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qEnable\*q " \*qbool\*q
+This optional entry specifies whether the monitor should be turned on
+at startup. By default, the server will attempt to enable all connected
+monitors.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qMinClock\*q " \*qfrequency\*q
+This optional entry specifies the minimum dot clock, in kHz, that is supported
+by the monitor.
+.TP 7
+.BI "Option " "\*qMaxClock\*q " \*qfrequency\*q
+This optional entry specifies the maximum dot clock, in kHz, that is supported
+by the monitor.
+.TP 7
+.BI "Option " "\*qIgnore\*q " \*qbool\*q
+This optional entry specifies that the monitor should be ignored entirely,
+and not reported through RandR. This is useful if the hardware reports the
+presence of outputs that don't exist.
+(RandR 1.2-supporting drivers only)
+.TP 7
+.BI "Option " "\*qRotate\*q " \*qrotation\*q
+This optional entry specifies the initial rotation of the given monitor.
+Valid values for rotation are \*qnormal\*q, \*qleft\*q, \*qright\*q, and
+\*qinverted\*q.
+(RandR 1.2-supporting drivers only)
.SH MODES SECTION
The config file may have multiple
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index e9cf27c96..a9ca4cc80 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -71,6 +71,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "mipointer.h"
#include "xf86_OSproc.h"
+#define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
+
#if !defined(PANORAMIX)
extern Bool noPanoramiXExtension;
#endif
@@ -204,6 +206,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
pDRIPriv->directRenderingSupport = TRUE;
pDRIPriv->pDriverInfo = pDRIInfo;
pDRIPriv->nrWindows = 0;
+ pDRIPriv->nrWindowsVisible = 0;
pDRIPriv->fullscreen = NULL;
pDRIPriv->createDummyCtx = pDRIInfo->createDummyCtx;
@@ -1006,6 +1009,93 @@ DRITransitionTo2d(ScreenPtr pScreen)
}
+static int
+DRIDCNTreeTraversal(WindowPtr pWin, pointer data)
+{
+ DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+
+ if (pDRIDrawablePriv) {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (REGION_NUM_RECTS(&pWin->clipList) > 0) {
+ WindowPtr *pDRIWindows = (WindowPtr*)data;
+ int i = 0;
+
+ while (pDRIWindows[i])
+ i++;
+
+ pDRIWindows[i] = pWin;
+
+ pDRIPriv->nrWalked++;
+ }
+
+ if (pDRIPriv->nrWindows == pDRIPriv->nrWalked)
+ return WT_STOPWALKING;
+ }
+
+ return WT_WALKCHILDREN;
+}
+
+static void
+DRIDriverClipNotify(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (pDRIPriv->pDriverInfo->ClipNotify) {
+ WindowPtr *pDRIWindows = xcalloc(sizeof(WindowPtr), pDRIPriv->nrWindows);
+ DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
+
+ if (pDRIPriv->nrWindows > 0) {
+ pDRIPriv->nrWalked = 0;
+ TraverseTree(WindowTable[pScreen->myNum], DRIDCNTreeTraversal,
+ (pointer)pDRIWindows);
+ }
+
+ pDRIInfo->ClipNotify(pScreen, pDRIWindows, pDRIPriv->nrWindows);
+
+ xfree(pDRIWindows);
+ }
+}
+
+static void
+DRIIncreaseNumberVisible(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ switch (++pDRIPriv->nrWindowsVisible) {
+ case 1:
+ DRITransitionTo3d( pScreen );
+ break;
+ case 2:
+ DRITransitionToSharedBuffers( pScreen );
+ break;
+ default:
+ break;
+ }
+
+ DRIDriverClipNotify(pScreen);
+}
+
+static void
+DRIDecreaseNumberVisible(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ switch (--pDRIPriv->nrWindowsVisible) {
+ case 0:
+ DRITransitionTo2d( pScreen );
+ break;
+ case 1:
+ DRITransitionToPrivateBuffers( pScreen );
+ break;
+ default:
+ break;
+ }
+
+ DRIDriverClipNotify(pScreen);
+}
+
Bool
DRICreateDrawable(ScreenPtr pScreen, Drawable id,
DrawablePtr pDrawable, drm_drawable_t * hHWDrawable)
@@ -1040,21 +1130,16 @@ DRICreateDrawable(ScreenPtr pScreen, Drawable id,
pDRIDrawablePriv->pScreen = pScreen;
pDRIDrawablePriv->refCount = 1;
pDRIDrawablePriv->drawableIndex = -1;
+ pDRIDrawablePriv->nrects = REGION_NUM_RECTS(&pWin->clipList);
/* save private off of preallocated index */
pWin->devPrivates[DRIWindowPrivIndex].ptr =
(pointer)pDRIDrawablePriv;
- switch (++pDRIPriv->nrWindows) {
- case 1:
- DRITransitionTo3d( pScreen );
- break;
- case 2:
- DRITransitionToSharedBuffers( pScreen );
- break;
- default:
- break;
- }
+ pDRIPriv->nrWindows++;
+
+ if (pDRIDrawablePriv->nrects)
+ DRIIncreaseNumberVisible(pScreen);
/* track this in case this window is destroyed */
AddResource(id, DRIDrawablePrivResType, (pointer)pWin);
@@ -1126,19 +1211,14 @@ DRIDrawablePrivDelete(pointer pResource, XID id)
pDRIDrawablePriv->hwDrawable)) {
return FALSE;
}
+
xfree(pDRIDrawablePriv);
pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL;
- switch (--pDRIPriv->nrWindows) {
- case 0:
- DRITransitionTo2d( pDrawable->pScreen );
- break;
- case 1:
- DRITransitionToPrivateBuffers( pDrawable->pScreen );
- break;
- default:
- break;
- }
+ pDRIPriv->nrWindows--;
+
+ if (REGION_NUM_RECTS(&pWin->clipList))
+ DRIDecreaseNumberVisible(pDrawable->pScreen);
}
else { /* pixmap (or for GLX 1.3, a PBuffer) */
/* NOT_DONE */
@@ -1276,7 +1356,7 @@ DRIGetDrawableInfo(ScreenPtr pScreen,
*backX = *X;
*backY = *Y;
- if (pDRIPriv->nrWindows == 1 && *numClipRects) {
+ if (pDRIPriv->nrWindowsVisible == 1 && *numClipRects) {
/* Use a single cliprect. */
int x0 = *X;
@@ -1652,7 +1732,7 @@ DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
if(!pDRIPriv) return;
- if(pDRIPriv->nrWindows > 0) {
+ if(pDRIPriv->nrWindowsVisible > 0) {
RegionRec reg;
REGION_NULL(pScreen, &reg);
@@ -1844,19 +1924,28 @@ DRIClipNotify(WindowPtr pWin, int dx, int dy)
if(!pDRIPriv) return;
if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
+ int nrects = REGION_NUM_RECTS(&pWin->clipList);
if(!pDRIPriv->windowsTouched) {
DRILockTree(pScreen);
pDRIPriv->windowsTouched = TRUE;
}
+ if (nrects && !pDRIDrawablePriv->nrects)
+ DRIIncreaseNumberVisible(pScreen);
+ else if (!nrects && pDRIDrawablePriv->nrects)
+ DRIDecreaseNumberVisible(pScreen);
+ else
+ DRIDriverClipNotify(pScreen);
+
+ pDRIDrawablePriv->nrects = nrects;
+
pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp
= DRIDrawableValidationStamp++;
drmUpdateDrawableInfo(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable,
DRM_DRAWABLE_CLIPRECTS,
- REGION_NUM_RECTS(&pWin->clipList),
- REGION_RECTS(&pWin->clipList));
+ nrects, REGION_RECTS(&pWin->clipList));
}
/* call lower wrapped functions */
diff --git a/hw/xfree86/dri/dri.h b/hw/xfree86/dri/dri.h
index 0d695344b..395b4f1b3 100644
--- a/hw/xfree86/dri/dri.h
+++ b/hw/xfree86/dri/dri.h
@@ -109,7 +109,7 @@ typedef struct {
*/
#define DRIINFO_MAJOR_VERSION 5
-#define DRIINFO_MINOR_VERSION 0
+#define DRIINFO_MINOR_VERSION 1
#define DRIINFO_PATCH_VERSION 0
typedef struct {
@@ -175,6 +175,9 @@ typedef struct {
/* New with DRI version 4.1.0 */
void (*TransitionSingleToMulti3D)(ScreenPtr pScreen);
void (*TransitionMultiToSingle3D)(ScreenPtr pScreen);
+
+ /* New with DRI version 5.1.0 */
+ void (*ClipNotify)(ScreenPtr pScreen, WindowPtr *ppWin, int num);
} DRIInfoRec, *DRIInfoPtr;
diff --git a/hw/xfree86/dri/dristruct.h b/hw/xfree86/dri/dristruct.h
index 340c59a2e..9c42ff9cc 100644
--- a/hw/xfree86/dri/dristruct.h
+++ b/hw/xfree86/dri/dristruct.h
@@ -53,6 +53,7 @@ typedef struct _DRIDrawablePrivRec
int drawableIndex;
ScreenPtr pScreen;
int refCount;
+ int nrects;
} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
struct _DRIContextPrivRec
@@ -87,6 +88,8 @@ typedef struct _DRIScreenPrivRec
void** partial3DContextStore; /* parital 3D context */
DRIInfoPtr pDriverInfo;
int nrWindows;
+ int nrWindowsVisible;
+ int nrWalked;
drm_clip_rect_t private_buffer_rect; /* management of private buffers */
DrawablePtr fullscreen; /* pointer to fullscreen drawable */
drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */
diff --git a/hw/xfree86/i2c/Makefile.am b/hw/xfree86/i2c/Makefile.am
index e73fcaeb8..a16d88071 100644
--- a/hw/xfree86/i2c/Makefile.am
+++ b/hw/xfree86/i2c/Makefile.am
@@ -1,4 +1,4 @@
-module_LTLIBRARIES = libi2c.la
+noinst_LIBRARIES = libi2c.a
multimediadir = $(moduledir)/multimedia
multimedia_LTLIBRARIES = \
@@ -10,8 +10,7 @@ multimedia_LTLIBRARIES = \
tda9885_drv.la \
uda1380_drv.la
-libi2c_la_LDFLAGS = -avoid-version
-libi2c_la_SOURCES = xf86i2c.c xf86i2cmodule.c
+libi2c_a_SOURCES = xf86i2c.c
INCLUDES = $(XORG_INCS)
diff --git a/hw/xfree86/i2c/uda1380_module.c b/hw/xfree86/i2c/uda1380_module.c
index 384458326..895f8c6f2 100644
--- a/hw/xfree86/i2c/uda1380_module.c
+++ b/hw/xfree86/i2c/uda1380_module.c
@@ -12,7 +12,7 @@ static XF86ModuleVersionInfo uda1380VersRec =
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
- XF86_VERSION_CURRENT,
+ XORG_VERSION_CURRENT,
1, 0, 0,
ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
ABI_VIDEODRV_VERSION,
diff --git a/hw/xfree86/i2c/xf86i2cmodule.c b/hw/xfree86/i2c/xf86i2cmodule.c
deleted file mode 100644
index 3c6d313c7..000000000
--- a/hw/xfree86/i2c/xf86i2cmodule.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* (c) Itai Nahshon
- *
- * This code is derived from and inspired by the I2C driver
- * from the Linux kernel.
- * (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de>
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static MODULESETUPPROTO(i2cSetup);
-
-static XF86ModuleVersionInfo i2cVersRec =
-{
- "i2c",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 1, 2, 0,
- ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData i2cModuleData = { &i2cVersRec, i2cSetup, NULL };
-
-static pointer
-i2cSetup(pointer module, pointer opts, int *errmaj, int *errmin) {
-/* ErrorF("i2cSetup\n"); */
- return (pointer)1;
-}
diff --git a/hw/xfree86/loader/Makefile.am b/hw/xfree86/loader/Makefile.am
index 206600214..ef9ab9ab3 100644
--- a/hw/xfree86/loader/Makefile.am
+++ b/hw/xfree86/loader/Makefile.am
@@ -2,7 +2,8 @@ noinst_LIBRARIES = libloader.a
INCLUDES = $(XORG_INCS) -I$(srcdir)/../parser -I$(srcdir)/../dixmods/extmod \
-I$(srcdir)/../vbe -I$(top_srcdir)/miext/cw -I$(srcdir)/../int10 \
- -I$(srcdir)/../ddc -I$(srcdir)/../i2c
+ -I$(srcdir)/../ddc -I$(srcdir)/../i2c -I$(srcdir)/../modes \
+ -I$(srcdir)/../ramdac
#AM_LDFLAGS = -r
AM_CFLAGS = -DIN_LOADER $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index 32e0e4f68..5d06b05c7 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -86,7 +86,7 @@
#endif
#include "selection.h"
#ifdef XKB
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
extern int XkbDfltRepeatDelay, XkbDfltRepeatInterval;
#endif
@@ -271,10 +271,8 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(AllocateColormapPrivateIndex)
SYMFUNC(AllocateDevicePrivateIndex)
SYMFUNC(AllocateDevicePrivate)
-#ifdef PIXPRIV
SYMFUNC(AllocatePixmapPrivateIndex)
SYMFUNC(AllocatePixmapPrivate)
-#endif
/* resource.c */
SYMFUNC(AddResource)
SYMFUNC(ChangeResourceValue)
diff --git a/hw/xfree86/loader/loader.c b/hw/xfree86/loader/loader.c
index ddd624c2a..774a4c4a0 100644
--- a/hw/xfree86/loader/loader.c
+++ b/hw/xfree86/loader/loader.c
@@ -189,101 +189,6 @@ _LoaderListPop(int handle)
return 0;
}
-/*
- * _LoaderHandleToName() will return the name of the first module with a
- * given handle. This requires getting the last module on the LIFO with
- * the given handle.
- */
-char *
-_LoaderHandleToName(int handle)
-{
- loaderPtr item = listHead;
- loaderPtr aritem = NULL;
- loaderPtr lastitem = NULL;
-
- if (handle < 0) {
- return "(built-in)";
- }
- while (item) {
- if (item->handle == handle) {
- if (strchr(item->name, ':') == NULL)
- aritem = item;
- else
- lastitem = item;
- }
- item = item->next;
- }
-
- if (aritem)
- return aritem->name;
-
- if (lastitem)
- return lastitem->name;
-
- return 0;
-}
-
-/*
- * _LoaderHandleToCanonicalName() will return the cname of the first module
- * with a given handle. This requires getting the last module on the LIFO with
- * the given handle.
- */
-char *
-_LoaderHandleToCanonicalName(int handle)
-{
- loaderPtr item = listHead;
- loaderPtr lastitem = NULL;
-
- if (handle < 0) {
- return "(built-in)";
- }
- while (item) {
- if (item->handle == handle) {
- lastitem = item;
- }
- item = item->next;
- }
-
- if (lastitem)
- return lastitem->cname;
-
- return NULL;
-}
-
-/*
- * _LoaderModuleToName() will return the name of the first module with a
- * given handle. This requires getting the last module on the LIFO with
- * the given handle.
- */
-char *
-_LoaderModuleToName(int module)
-{
- loaderPtr item = listHead;
- loaderPtr aritem = NULL;
- loaderPtr lastitem = NULL;
-
- if (module < 0) {
- return "(built-in)";
- }
- while (item) {
- if (item->module == module) {
- if (strchr(item->name, ':') == NULL)
- aritem = item;
- else
- lastitem = item;
- }
- item = item->next;
- }
-
- if (aritem)
- return aritem->name;
-
- if (lastitem)
- return lastitem->name;
-
- return 0;
-}
-
/* These four are just ABI stubs */
_X_EXPORT void
LoaderRefSymbols(const char *sym0, ...)
@@ -450,35 +355,14 @@ LoaderUnload(int handle)
return 0;
}
-void
-LoaderDuplicateSymbol(const char *symbol, const int handle)
-{
- ErrorF("Duplicate symbol %s in %s\n", symbol,
- listHead ? listHead->name : "(built-in)");
- ErrorF("Also defined in %s\n", _LoaderHandleToName(handle));
- FatalError("Module load failure\n");
-}
-
unsigned long LoaderOptions = 0;
void
-LoaderResetOptions(void)
-{
- LoaderOptions = 0;
-}
-
-void
LoaderSetOptions(unsigned long opts)
{
LoaderOptions |= opts;
}
-void
-LoaderClearOptions(unsigned long opts)
-{
- LoaderOptions &= ~opts;
-}
-
_X_EXPORT int
LoaderGetABIVersion(const char *abiclass)
{
diff --git a/hw/xfree86/loader/loaderProcs.h b/hw/xfree86/loader/loaderProcs.h
index ecbd6762d..b71ad4590 100644
--- a/hw/xfree86/loader/loaderProcs.h
+++ b/hw/xfree86/loader/loaderProcs.h
@@ -97,9 +97,6 @@ void LoadFont(FontModule *);
void UnloadModule(ModuleDescPtr);
void UnloadSubModule(ModuleDescPtr);
void UnloadDriver(ModuleDescPtr);
-void FreeModuleDesc(ModuleDescPtr mod);
-ModuleDescPtr NewModuleDesc(const char *);
-ModuleDescPtr AddSibling(ModuleDescPtr head, ModuleDescPtr new);
void LoaderSetPath(const char *path);
void LoaderSortExtensions(void);
@@ -108,7 +105,6 @@ unsigned long LoaderGetModuleVersion(ModuleDescPtr mod);
void LoaderResetOptions(void);
void LoaderSetOptions(unsigned long);
-void LoaderClearOptions(unsigned long);
/* Options for LoaderSetOptions */
#define LDR_OPT_ABI_MISMATCH_NONFATAL 0x0001
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index ec0f181db..db12da466 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -745,6 +745,13 @@ CheckVersion(const char *module, XF86ModuleVersionInfo * data,
return TRUE;
}
+static ModuleDescPtr
+AddSibling(ModuleDescPtr head, ModuleDescPtr new)
+{
+ new->sib = head;
+ return (new);
+}
+
_X_EXPORT ModuleDescPtr
LoadSubModule(ModuleDescPtr parent, const char *module,
const char **subdirlist, const char **patternlist,
@@ -768,42 +775,35 @@ LoadSubModule(ModuleDescPtr parent, const char *module,
submod = doLoadModule(module, NULL, subdirlist, patternlist, options,
modreq, errmaj, errmin, LD_FLAG_GLOBAL);
- if (submod) {
+ if (submod && submod != (ModuleDescPtr) 1) {
parent->child = AddSibling(parent->child, submod);
submod->parent = parent;
}
return submod;
}
-ModuleDescPtr
-LoadSubModuleLocal(ModuleDescPtr parent, const char *module,
- const char **subdirlist, const char **patternlist,
- pointer options, const XF86ModReqInfo * modreq,
- int *errmaj, int *errmin)
+static ModuleDescPtr
+NewModuleDesc(const char *name)
{
- ModuleDescPtr submod;
-
- xf86MsgVerb(X_INFO, 3, "Loading local sub module \"%s\"\n", module);
+ ModuleDescPtr mdp = xalloc(sizeof(ModuleDesc));
- if (PathIsAbsolute(module))
- {
- xf86Msg(X_ERROR,
- "LoadSubModule: Absolute module path not permitted: \"%s\"\n",
- module);
- if (errmaj)
- *errmaj = LDR_BADUSAGE;
- if (errmin)
- *errmin = 0;
- return NULL;
+ if (mdp) {
+ mdp->child = NULL;
+ mdp->sib = NULL;
+ mdp->parent = NULL;
+ mdp->demand_next = NULL;
+ mdp->name = xstrdup(name);
+ mdp->filename = NULL;
+ mdp->identifier = NULL;
+ mdp->client_id = 0;
+ mdp->in_use = 0;
+ mdp->handle = -1;
+ mdp->SetupProc = NULL;
+ mdp->TearDownProc = NULL;
+ mdp->TearDownData = NULL;
}
- submod = doLoadModule(module, NULL, subdirlist, patternlist, options,
- modreq, errmaj, errmin, 0);
- if (submod) {
- parent->child = AddSibling(parent->child, submod);
- submod->parent = parent;
- }
- return submod;
+ return (mdp);
}
_X_EXPORT ModuleDescPtr
@@ -838,6 +838,12 @@ DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent)
return ret;
}
+static const char *compiled_in_modules[] = {
+ "ddc",
+ "i2c",
+ "ramdac",
+ NULL
+};
static ModuleDescPtr
doLoadModule(const char *module, const char *path, const char **subdirlist,
@@ -856,9 +862,17 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
PatternPtr patterns = NULL;
int noncanonical = 0;
char *m = NULL;
+ const char **cim;
xf86MsgVerb(X_INFO, 3, "LoadModule: \"%s\"", module);
+ for (cim = compiled_in_modules; *cim; cim++)
+ if (!strcmp (module, *cim))
+ {
+ xf86MsgVerb(X_INFO, 3, "Module already built-in\n");
+ return (ModuleDescPtr) 1;
+ }
+
patterns = InitPatterns(patternlist);
name = LoaderGetCanonicalName(module, patterns);
noncanonical = (name && strcmp(module, name) != 0);
@@ -1085,29 +1099,18 @@ LoadModule(const char *module, const char *path, const char **subdirlist,
modreq, errmaj, errmin, LD_FLAG_GLOBAL);
}
-ModuleDescPtr
-LoadDriver(const char *module, const char *path, int handle, pointer options,
- int *errmaj, int *errmin)
-{
- return LoadModule(module, path, NULL, NULL, options, NULL, errmaj,
- errmin);
-}
-
void
UnloadModule(ModuleDescPtr mod)
{
UnloadModuleOrDriver(mod);
}
-void
-UnloadDriver(ModuleDescPtr mod)
-{
- UnloadModuleOrDriver(mod);
-}
-
static void
UnloadModuleOrDriver(ModuleDescPtr mod)
{
+ if (mod == (ModuleDescPtr) 1)
+ return;
+
if (mod == NULL || mod->name == NULL)
return;
@@ -1151,14 +1154,16 @@ UnloadSubModule(ModuleDescPtr mod)
xfree(mod);
}
-void
+static void
FreeModuleDesc(ModuleDescPtr head)
{
ModuleDescPtr sibs, prev;
+ if (head == (ModuleDescPtr) 1)
+ return;
/*
* only free it if it's not marked as in use. In use means that it may
- * be unloaded someday, and UnloadModule or UnloadDriver will free it
+ * be unloaded someday, and UnloadModule will free it
*/
if (head->in_use)
return;
@@ -1173,38 +1178,6 @@ FreeModuleDesc(ModuleDescPtr head)
}
}
-ModuleDescPtr
-NewModuleDesc(const char *name)
-{
- ModuleDescPtr mdp = xalloc(sizeof(ModuleDesc));
-
- if (mdp) {
- mdp->child = NULL;
- mdp->sib = NULL;
- mdp->parent = NULL;
- mdp->demand_next = NULL;
- mdp->name = xstrdup(name);
- mdp->filename = NULL;
- mdp->identifier = NULL;
- mdp->client_id = 0;
- mdp->in_use = 0;
- mdp->handle = -1;
- mdp->SetupProc = NULL;
- mdp->TearDownProc = NULL;
- mdp->TearDownData = NULL;
- }
-
- return (mdp);
-}
-
-ModuleDescPtr
-AddSibling(ModuleDescPtr head, ModuleDescPtr new)
-{
- new->sib = head;
- return (new);
-
-}
-
static void
RemoveChild(ModuleDescPtr child)
{
@@ -1338,7 +1311,7 @@ LoaderGetCanonicalName(const char *modname, PatternPtr patterns)
unsigned long
LoaderGetModuleVersion(ModuleDescPtr mod)
{
- if (!mod || !mod->VersionInfo)
+ if (!mod || mod == (ModuleDescPtr) 1 || !mod->VersionInfo)
return 0;
return MODULE_VERSION_NUMERIC(mod->VersionInfo->majorversion,
diff --git a/hw/xfree86/loader/misym.c b/hw/xfree86/loader/misym.c
index 46d6a024d..78ae10e02 100644
--- a/hw/xfree86/loader/misym.c
+++ b/hw/xfree86/loader/misym.c
@@ -208,9 +208,6 @@ _X_HIDDEN void *miLookupTab[] = {
#ifdef RENDER
SYMFUNC(miGlyphExtents)
#endif
-#ifdef COMPOSITE
- SYMFUNC(miDisableCompositeWrapper)
-#endif
#ifdef DAMAGE
SYMFUNC(DamageDamageRegion)
#endif
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 952e7fe15..1900e00af 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -87,6 +87,13 @@
#include "xf86sbusBus.h"
#endif
#include "compiler.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#ifdef RANDR
+#include "xf86RandR12.h"
+#endif
+#include "xf86DDC.h"
+#include "edid.h"
#ifndef HAS_GLIBC_SIGSETJMP
#if defined(setjmp) && defined(__GNU_LIBRARY__) && \
@@ -1132,4 +1139,91 @@ _X_HIDDEN void *xfree86LookupTab[] = {
/* Pci.c */
SYMVAR(pciNumBuses)
+
+ /* modes */
+ SYMVAR(xf86CrtcConfigPrivateIndex)
+ SYMFUNC(xf86CrtcConfigInit)
+ SYMFUNC(xf86CrtcConfigPrivateIndex)
+ SYMFUNC(xf86CrtcCreate)
+ SYMFUNC(xf86CrtcDestroy)
+ SYMFUNC(xf86CrtcInUse)
+ SYMFUNC(xf86CrtcRotate)
+ SYMFUNC(xf86CrtcSetMode)
+ SYMFUNC(xf86CrtcSetSizeRange)
+ SYMFUNC(xf86CVTMode)
+ SYMFUNC(xf86DisableUnusedFunctions)
+ SYMFUNC(xf86DPMSSet)
+ SYMFUNC(xf86DuplicateMode)
+ SYMFUNC(xf86DuplicateModes)
+ SYMFUNC(xf86GetDefaultModes)
+ SYMFUNC(xf86GetMonitorModes)
+ SYMFUNC(xf86InitialConfiguration)
+ SYMFUNC(xf86ModeHSync)
+ SYMFUNC(xf86ModesAdd)
+ SYMFUNC(xf86ModesEqual)
+ SYMFUNC(xf86ModeVRefresh)
+ SYMFUNC(xf86OutputCreate)
+ SYMFUNC(xf86OutputDestroy)
+ SYMFUNC(xf86OutputGetEDID)
+ SYMFUNC(xf86OutputGetEDIDModes)
+ SYMFUNC(xf86OutputRename)
+ SYMFUNC(xf86OutputSetEDID)
+ SYMFUNC(xf86PrintModeline)
+ SYMFUNC(xf86ProbeOutputModes)
+ SYMFUNC(xf86PruneInvalidModes)
+ SYMFUNC(xf86SetModeCrtc)
+ SYMFUNC(xf86SetModeDefaultName)
+ SYMFUNC(xf86SetScrnInfoModes)
+ SYMFUNC(xf86ValidateModesClocks)
+ SYMFUNC(xf86ValidateModesFlags)
+ SYMFUNC(xf86ValidateModesSize)
+ SYMFUNC(xf86ValidateModesSync)
+ SYMFUNC(xf86ValidateModesUserConfig)
+ SYMFUNC(xf86DiDGAInit)
+ SYMFUNC(xf86DiDGAReInit)
+ SYMFUNC(xf86DDCGetModes)
+ SYMFUNC(xf86SaveScreen)
+#ifdef RANDR
+ SYMFUNC(xf86RandR12CreateScreenResources)
+ SYMFUNC(xf86RandR12GetOriginalVirtualSize)
+ SYMFUNC(xf86RandR12GetRotation)
+ SYMFUNC(xf86RandR12Init)
+ SYMFUNC(xf86RandR12PreInit)
+ SYMFUNC(xf86RandR12SetConfig)
+ SYMFUNC(xf86RandR12SetRotations)
+#endif
+ SYMFUNC(xf86_cursors_init)
+ SYMFUNC(xf86_reload_cursors)
+ SYMFUNC(xf86_show_cursors)
+ SYMFUNC(xf86_hide_cursors)
+ SYMFUNC(xf86_cursors_fini)
+
+ SYMFUNC(xf86DoEDID_DDC1)
+ SYMFUNC(xf86DoEDID_DDC2)
+ SYMFUNC(xf86InterpretEDID)
+ SYMFUNC(xf86PrintEDID)
+ SYMFUNC(xf86InterpretVdif)
+ SYMFUNC(xf86print_vdif)
+ SYMFUNC(xf86DDCMonitorSet)
+ SYMFUNC(xf86SetDDCproperties)
+
+ SYMFUNC(xf86CreateI2CBusRec)
+ SYMFUNC(xf86CreateI2CDevRec)
+ SYMFUNC(xf86DestroyI2CBusRec)
+ SYMFUNC(xf86DestroyI2CDevRec)
+ SYMFUNC(xf86I2CBusInit)
+ SYMFUNC(xf86I2CDevInit)
+ SYMFUNC(xf86I2CFindBus)
+ SYMFUNC(xf86I2CFindDev)
+ SYMFUNC(xf86I2CGetScreenBuses)
+ SYMFUNC(xf86I2CProbeAddress)
+ SYMFUNC(xf86I2CReadByte)
+ SYMFUNC(xf86I2CReadBytes)
+ SYMFUNC(xf86I2CReadStatus)
+ SYMFUNC(xf86I2CReadWord)
+ SYMFUNC(xf86I2CWriteByte)
+ SYMFUNC(xf86I2CWriteBytes)
+ SYMFUNC(xf86I2CWriteRead)
+ SYMFUNC(xf86I2CWriteVec)
+ SYMFUNC(xf86I2CWriteWord)
};
diff --git a/hw/xfree86/modes/Makefile.am b/hw/xfree86/modes/Makefile.am
new file mode 100644
index 000000000..1f82068b3
--- /dev/null
+++ b/hw/xfree86/modes/Makefile.am
@@ -0,0 +1,29 @@
+noinst_LIBRARIES = libxf86modes.a
+
+libxf86modes_a_SOURCES = \
+ xf86Crtc.c \
+ xf86Crtc.h \
+ xf86Cursors.c \
+ xf86cvt.c \
+ xf86DiDGA.c \
+ xf86EdidModes.c \
+ xf86Modes.c \
+ xf86Modes.h \
+ xf86RandR12.c \
+ xf86RandR12.h \
+ xf86Rename.h \
+ xf86Rotate.c
+
+INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
+ -I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
+ -I$(srcdir)/../scanpci -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
+ -I$(srcdir)/../vgahw -I$(srcdir)/../ramdac \
+ -I$(srcdir)/../dixmods/extmod
+
+sdk_HEADERS = \
+ xf86Crtc.h \
+ xf86Modes.h \
+ xf86RandR12.h \
+ xf86Rename.h
+
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
new file mode 100644
index 000000000..7d86b6606
--- /dev/null
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -0,0 +1,2040 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * 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, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#include "xf86RandR12.h"
+#include "X11/extensions/render.h"
+#define DPMS_SERVER
+#include "X11/extensions/dpms.h"
+#include "X11/Xatom.h"
+#ifdef RENDER
+#include "picturestr.h"
+#endif
+
+/*
+ * Initialize xf86CrtcConfig structure
+ */
+
+int xf86CrtcConfigPrivateIndex = -1;
+
+void
+xf86CrtcConfigInit (ScrnInfoPtr scrn,
+ const xf86CrtcConfigFuncsRec *funcs)
+{
+ xf86CrtcConfigPtr config;
+
+ if (xf86CrtcConfigPrivateIndex == -1)
+ xf86CrtcConfigPrivateIndex = xf86AllocateScrnInfoPrivateIndex();
+ config = xnfcalloc (1, sizeof (xf86CrtcConfigRec));
+
+ config->funcs = funcs;
+
+ scrn->privates[xf86CrtcConfigPrivateIndex].ptr = config;
+}
+
+void
+xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
+ int minWidth, int minHeight,
+ int maxWidth, int maxHeight)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ config->minWidth = minWidth;
+ config->minHeight = minHeight;
+ config->maxWidth = maxWidth;
+ config->maxHeight = maxHeight;
+}
+
+/*
+ * Crtc functions
+ */
+xf86CrtcPtr
+xf86CrtcCreate (ScrnInfoPtr scrn,
+ const xf86CrtcFuncsRec *funcs)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CrtcPtr crtc, *crtcs;
+
+ crtc = xcalloc (sizeof (xf86CrtcRec), 1);
+ if (!crtc)
+ return NULL;
+ crtc->scrn = scrn;
+ crtc->funcs = funcs;
+#ifdef RANDR_12_INTERFACE
+ crtc->randr_crtc = NULL;
+#endif
+ crtc->rotation = RR_Rotate_0;
+ crtc->desiredRotation = RR_Rotate_0;
+ if (xf86_config->crtc)
+ crtcs = xrealloc (xf86_config->crtc,
+ (xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
+ else
+ crtcs = xalloc ((xf86_config->num_crtc + 1) * sizeof (xf86CrtcPtr));
+ if (!crtcs)
+ {
+ xfree (crtc);
+ return NULL;
+ }
+ xf86_config->crtc = crtcs;
+ xf86_config->crtc[xf86_config->num_crtc++] = crtc;
+ return crtc;
+}
+
+void
+xf86CrtcDestroy (xf86CrtcPtr crtc)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+ int c;
+
+ (*crtc->funcs->destroy) (crtc);
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ if (xf86_config->crtc[c] == crtc)
+ {
+ memmove (&xf86_config->crtc[c],
+ &xf86_config->crtc[c+1],
+ xf86_config->num_crtc - (c + 1));
+ xf86_config->num_crtc--;
+ break;
+ }
+ xfree (crtc);
+}
+
+
+/**
+ * Return whether any outputs are connected to the specified pipe
+ */
+
+Bool
+xf86CrtcInUse (xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int o;
+
+ for (o = 0; o < xf86_config->num_output; o++)
+ if (xf86_config->output[o]->crtc == crtc)
+ return TRUE;
+ return FALSE;
+}
+
+void
+xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen)
+{
+#ifdef RENDER
+ int subpixel_order = SubPixelUnknown;
+ Bool has_none = FALSE;
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c, o;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ for (o = 0; o < xf86_config->num_output; o++)
+ {
+ xf86OutputPtr output = xf86_config->output[o];
+
+ if (output->crtc == crtc)
+ {
+ switch (output->subpixel_order) {
+ case SubPixelNone:
+ has_none = TRUE;
+ break;
+ case SubPixelUnknown:
+ break;
+ default:
+ subpixel_order = output->subpixel_order;
+ break;
+ }
+ }
+ if (subpixel_order != SubPixelUnknown)
+ break;
+ }
+ if (subpixel_order != SubPixelUnknown)
+ {
+ static const int circle[4] = {
+ SubPixelHorizontalRGB,
+ SubPixelVerticalRGB,
+ SubPixelHorizontalBGR,
+ SubPixelVerticalBGR,
+ };
+ int rotate;
+ int c;
+ for (rotate = 0; rotate < 4; rotate++)
+ if (crtc->rotation & (1 << rotate))
+ break;
+ for (c = 0; c < 4; c++)
+ if (circle[c] == subpixel_order)
+ break;
+ c = (c + rotate) & 0x3;
+ if ((crtc->rotation & RR_Reflect_X) && !(c & 1))
+ c ^= 2;
+ if ((crtc->rotation & RR_Reflect_Y) && (c & 1))
+ c ^= 2;
+ subpixel_order = circle[c];
+ break;
+ }
+ }
+ if (subpixel_order == SubPixelUnknown && has_none)
+ subpixel_order = SubPixelNone;
+ PictureSetSubpixelOrder (pScreen, subpixel_order);
+#endif
+}
+
+/**
+ * Sets the given video mode on the given crtc
+ */
+Bool
+xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
+ int x, int y)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
+ Bool ret = FALSE;
+ Bool didLock = FALSE;
+ DisplayModePtr adjusted_mode;
+ DisplayModeRec saved_mode;
+ int saved_x, saved_y;
+ Rotation saved_rotation;
+
+ adjusted_mode = xf86DuplicateMode(mode);
+
+ crtc->enabled = xf86CrtcInUse (crtc);
+
+ if (!crtc->enabled)
+ {
+ /* XXX disable crtc? */
+ return TRUE;
+ }
+
+ didLock = crtc->funcs->lock (crtc);
+
+ saved_mode = crtc->mode;
+ saved_x = crtc->x;
+ saved_y = crtc->y;
+ saved_rotation = crtc->rotation;
+ /* Update crtc values up front so the driver can rely on them for mode
+ * setting.
+ */
+ crtc->mode = *mode;
+ crtc->x = x;
+ crtc->y = y;
+ crtc->rotation = rotation;
+
+ /* XXX short-circuit changes to base location only */
+
+ /* Pass our mode to the outputs and the CRTC to give them a chance to
+ * adjust it according to limitations or output properties, and also
+ * a chance to reject the mode entirely.
+ */
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+
+ if (output->crtc != crtc)
+ continue;
+
+ if (!output->funcs->mode_fixup(output, mode, adjusted_mode)) {
+ goto done;
+ }
+ }
+
+ if (!crtc->funcs->mode_fixup(crtc, mode, adjusted_mode)) {
+ goto done;
+ }
+
+ if (!xf86CrtcRotate (crtc, mode, rotation)) {
+ goto done;
+ }
+
+ /* Prepare the outputs and CRTCs before setting the mode. */
+ for (i = 0; i < xf86_config->num_output; i++) {
+ xf86OutputPtr output = xf86_config->output[i];
+
+ if (output->crtc != crtc)
+ continue;
+
+ /* Disable the output as the first thing we do. */
+ output->funcs->prepare(output);
+ }
+
+ crtc->funcs->prepare(crtc);
+
+ /* Set up the DPLL and any output state that needs to adjust or depend
+ * on the DPLL.
+ */
+ crtc->funcs->mode_set(crtc, mode, adjusted_mode, x, y);
+ for (i = 0; i < xf86_config->num_output; i++)
+ {
+ xf86OutputPtr output = xf86_config->output[i];
+ if (output->crtc == crtc)
+ output->funcs->mode_set(output, mode, adjusted_mode);
+ }
+
+ /* Now, enable the clocks, plane, pipe, and outputs that we set up. */
+ crtc->funcs->commit(crtc);
+ for (i = 0; i < xf86_config->num_output; i++)
+ {
+ xf86OutputPtr output = xf86_config->output[i];
+ if (output->crtc == crtc)
+ {
+ output->funcs->commit(output);
+#ifdef RANDR_12_INTERFACE
+ if (output->randr_output)
+ RRPostPendingProperties (output->randr_output);
+#endif
+ }
+ }
+
+ /* XXX free adjustedmode */
+ ret = TRUE;
+ if (scrn->pScreen)
+ xf86CrtcSetScreenSubpixelOrder (scrn->pScreen);
+
+done:
+ if (!ret) {
+ crtc->x = saved_x;
+ crtc->y = saved_y;
+ crtc->rotation = saved_rotation;
+ crtc->mode = saved_mode;
+ }
+
+ if (didLock)
+ crtc->funcs->unlock (crtc);
+
+ return ret;
+}
+
+/*
+ * Output functions
+ */
+
+extern XF86ConfigPtr xf86configptr;
+
+typedef enum {
+ OPTION_PREFERRED_MODE,
+ OPTION_POSITION,
+ OPTION_BELOW,
+ OPTION_RIGHT_OF,
+ OPTION_ABOVE,
+ OPTION_LEFT_OF,
+ OPTION_ENABLE,
+ OPTION_DISABLE,
+ OPTION_MIN_CLOCK,
+ OPTION_MAX_CLOCK,
+ OPTION_IGNORE,
+ OPTION_ROTATE,
+} OutputOpts;
+
+static OptionInfoRec xf86OutputOptions[] = {
+ {OPTION_PREFERRED_MODE, "PreferredMode", OPTV_STRING, {0}, FALSE },
+ {OPTION_POSITION, "Position", OPTV_STRING, {0}, FALSE },
+ {OPTION_BELOW, "Below", OPTV_STRING, {0}, FALSE },
+ {OPTION_RIGHT_OF, "RightOf", OPTV_STRING, {0}, FALSE },
+ {OPTION_ABOVE, "Above", OPTV_STRING, {0}, FALSE },
+ {OPTION_LEFT_OF, "LeftOf", OPTV_STRING, {0}, FALSE },
+ {OPTION_ENABLE, "Enable", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_DISABLE, "Disable", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_MIN_CLOCK, "MinClock", OPTV_FREQ, {0}, FALSE },
+ {OPTION_MAX_CLOCK, "MaxClock", OPTV_FREQ, {0}, FALSE },
+ {OPTION_IGNORE, "Ignore", OPTV_BOOLEAN, {0}, FALSE },
+ {OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE },
+ {-1, NULL, OPTV_NONE, {0}, FALSE },
+};
+
+static void
+xf86OutputSetMonitor (xf86OutputPtr output)
+{
+ char *option_name;
+ static const char monitor_prefix[] = "monitor-";
+ char *monitor;
+
+ if (!output->name)
+ return;
+
+ if (output->options)
+ xfree (output->options);
+
+ output->options = xnfalloc (sizeof (xf86OutputOptions));
+ memcpy (output->options, xf86OutputOptions, sizeof (xf86OutputOptions));
+
+ option_name = xnfalloc (strlen (monitor_prefix) +
+ strlen (output->name) + 1);
+ strcpy (option_name, monitor_prefix);
+ strcat (option_name, output->name);
+ monitor = xf86findOptionValue (output->scrn->options, option_name);
+ if (!monitor)
+ monitor = output->name;
+ else
+ xf86MarkOptionUsedByName (output->scrn->options, option_name);
+ xfree (option_name);
+ output->conf_monitor = xf86findMonitor (monitor,
+ xf86configptr->conf_monitor_lst);
+ if (output->conf_monitor)
+ xf86ProcessOptions (output->scrn->scrnIndex,
+ output->conf_monitor->mon_option_lst,
+ output->options);
+}
+
+static Bool
+xf86OutputEnabled (xf86OutputPtr output)
+{
+ /* Check to see if this output was disabled in the config file */
+ if (xf86ReturnOptValBool (output->options, OPTION_ENABLE, TRUE) == FALSE ||
+ xf86ReturnOptValBool (output->options, OPTION_DISABLE, FALSE) == TRUE)
+ {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static Bool
+xf86OutputIgnored (xf86OutputPtr output)
+{
+ return xf86ReturnOptValBool (output->options, OPTION_IGNORE, FALSE);
+}
+
+static char *direction[4] = {
+ "normal",
+ "left",
+ "inverted",
+ "right"
+};
+
+static Rotation
+xf86OutputInitialRotation (xf86OutputPtr output)
+{
+ char *rotate_name = xf86GetOptValString (output->options,
+ OPTION_ROTATE);
+ int i;
+
+ if (!rotate_name)
+ return RR_Rotate_0;
+
+ for (i = 0; i < 4; i++)
+ if (xf86nameCompare (direction[i], rotate_name) == 0)
+ return (1 << i);
+ return RR_Rotate_0;
+}
+
+xf86OutputPtr
+xf86OutputCreate (ScrnInfoPtr scrn,
+ const xf86OutputFuncsRec *funcs,
+ const char *name)
+{
+ xf86OutputPtr output, *outputs;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int len;
+
+ if (name)
+ len = strlen (name) + 1;
+ else
+ len = 0;
+
+ output = xcalloc (sizeof (xf86OutputRec) + len, 1);
+ if (!output)
+ return NULL;
+ output->scrn = scrn;
+ output->funcs = funcs;
+ if (name)
+ {
+ output->name = (char *) (output + 1);
+ strcpy (output->name, name);
+ }
+ output->subpixel_order = SubPixelUnknown;
+#ifdef RANDR_12_INTERFACE
+ output->randr_output = NULL;
+#endif
+ if (name)
+ {
+ xf86OutputSetMonitor (output);
+ if (xf86OutputIgnored (output))
+ {
+ xfree (output);
+ return FALSE;
+ }
+ }
+
+
+ if (xf86_config->output)
+ outputs = xrealloc (xf86_config->output,
+ (xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
+ else
+ outputs = xalloc ((xf86_config->num_output + 1) * sizeof (xf86OutputPtr));
+ if (!outputs)
+ {
+ xfree (output);
+ return NULL;
+ }
+
+ xf86_config->output = outputs;
+ xf86_config->output[xf86_config->num_output++] = output;
+
+ return output;
+}
+
+Bool
+xf86OutputRename (xf86OutputPtr output, const char *name)
+{
+ int len = strlen(name) + 1;
+ char *newname = xalloc (len);
+
+ if (!newname)
+ return FALSE; /* so sorry... */
+
+ strcpy (newname, name);
+ if (output->name && output->name != (char *) (output + 1))
+ xfree (output->name);
+ output->name = newname;
+ xf86OutputSetMonitor (output);
+ if (xf86OutputIgnored (output))
+ return FALSE;
+ return TRUE;
+}
+
+void
+xf86OutputDestroy (xf86OutputPtr output)
+{
+ ScrnInfoPtr scrn = output->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+
+ (*output->funcs->destroy) (output);
+ while (output->probed_modes)
+ xf86DeleteMode (&output->probed_modes, output->probed_modes);
+ for (o = 0; o < xf86_config->num_output; o++)
+ if (xf86_config->output[o] == output)
+ {
+ memmove (&xf86_config->output[o],
+ &xf86_config->output[o+1],
+ xf86_config->num_output - (o + 1));
+ xf86_config->num_output--;
+ break;
+ }
+ if (output->name && output->name != (char *) (output + 1))
+ xfree (output->name);
+ xfree (output);
+}
+
+/*
+ * Called during CreateScreenResources to hook up RandR
+ */
+static Bool
+xf86CrtcCreateScreenResources (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ screen->CreateScreenResources = config->CreateScreenResources;
+
+ if (!(*screen->CreateScreenResources)(screen))
+ return FALSE;
+
+ if (!xf86RandR12CreateScreenResources (screen))
+ return FALSE;
+
+ return TRUE;
+}
+
+/*
+ * Clean up config on server reset
+ */
+static Bool
+xf86CrtcCloseScreen (int index, ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o, c;
+
+ screen->CloseScreen = config->CloseScreen;
+
+ xf86RotateCloseScreen (screen);
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ output->crtc = NULL;
+ output->randr_output = NULL;
+ }
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ crtc->randr_crtc = NULL;
+ }
+ return screen->CloseScreen (index, screen);
+}
+
+/*
+ * Called at ScreenInit time to set up
+ */
+Bool
+xf86CrtcScreenInit (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ /* Rotation */
+ xf86DrvMsg(scrn->scrnIndex, X_INFO, "RandR 1.2 enabled, ignore the following RandR disabled message.\n");
+ xf86DisableRandR(); /* Disable old RandR extension support */
+ xf86RandR12Init (screen);
+
+ /* support all rotations if every crtc has the shadow alloc funcs */
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+ if (!crtc->funcs->shadow_allocate || !crtc->funcs->shadow_create)
+ break;
+ }
+ if (c == config->num_crtc)
+ xf86RandR12SetRotations (screen, RR_Rotate_0 | RR_Rotate_90 |
+ RR_Rotate_180 | RR_Rotate_270);
+ else
+ xf86RandR12SetRotations (screen, RR_Rotate_0);
+
+ /* Wrap CreateScreenResources so we can initialize the RandR code */
+ config->CreateScreenResources = screen->CreateScreenResources;
+ screen->CreateScreenResources = xf86CrtcCreateScreenResources;
+
+ config->CloseScreen = screen->CloseScreen;
+ screen->CloseScreen = xf86CrtcCloseScreen;
+
+ return TRUE;
+}
+
+static DisplayModePtr
+xf86DefaultMode (xf86OutputPtr output, int width, int height)
+{
+ DisplayModePtr target_mode = NULL;
+ DisplayModePtr mode;
+ int target_diff = 0;
+ int target_preferred = 0;
+ int mm_height;
+
+ mm_height = output->mm_height;
+ if (!mm_height)
+ mm_height = 203; /* 768 pixels at 96dpi */
+ /*
+ * Pick a mode closest to 96dpi
+ */
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ int dpi;
+ int preferred = (mode->type & M_T_PREFERRED) != 0;
+ int diff;
+
+ if (xf86ModeWidth (mode, output->initial_rotation) > width ||
+ xf86ModeHeight (mode, output->initial_rotation) > height)
+ continue;
+
+ /* yes, use VDisplay here, not xf86ModeHeight */
+ dpi = (mode->VDisplay * 254) / (mm_height * 10);
+ diff = dpi - 96;
+ diff = diff < 0 ? -diff : diff;
+ if (target_mode == NULL || (preferred > target_preferred) ||
+ (preferred == target_preferred && diff < target_diff))
+ {
+ target_mode = mode;
+ target_diff = diff;
+ target_preferred = preferred;
+ }
+ }
+ return target_mode;
+}
+
+static DisplayModePtr
+xf86ClosestMode (xf86OutputPtr output,
+ DisplayModePtr match, Rotation match_rotation,
+ int width, int height)
+{
+ DisplayModePtr target_mode = NULL;
+ DisplayModePtr mode;
+ int target_diff = 0;
+
+ /*
+ * Pick a mode closest to the specified mode
+ */
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ int dx, dy;
+ int diff;
+
+ if (xf86ModeWidth (mode, output->initial_rotation) > width ||
+ xf86ModeHeight (mode, output->initial_rotation) > height)
+ continue;
+
+ /* exact matches are preferred */
+ if (output->initial_rotation == match_rotation &&
+ xf86ModesEqual (mode, match))
+ return mode;
+
+ dx = xf86ModeWidth (match, match_rotation) - xf86ModeWidth (mode, output->initial_rotation);
+ dy = xf86ModeHeight (match, match_rotation) - xf86ModeHeight (mode, output->initial_rotation);
+ diff = dx * dx + dy * dy;
+ if (target_mode == NULL || diff < target_diff)
+ {
+ target_mode = mode;
+ target_diff = diff;
+ }
+ }
+ return target_mode;
+}
+
+static Bool
+xf86OutputHasPreferredMode (xf86OutputPtr output, int width, int height)
+{
+ DisplayModePtr mode;
+
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ if (xf86ModeWidth (mode, output->initial_rotation) > width ||
+ xf86ModeHeight (mode, output->initial_rotation) > height)
+ continue;
+
+ if (mode->type & M_T_PREFERRED)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static int
+xf86PickCrtcs (ScrnInfoPtr scrn,
+ xf86CrtcPtr *best_crtcs,
+ DisplayModePtr *modes,
+ int n,
+ int width,
+ int height)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c, o;
+ xf86OutputPtr output;
+ xf86CrtcPtr crtc;
+ xf86CrtcPtr *crtcs;
+ xf86CrtcPtr best_crtc;
+ int best_score;
+ int score;
+ int my_score;
+
+ if (n == config->num_output)
+ return 0;
+ output = config->output[n];
+
+ /*
+ * Compute score with this output disabled
+ */
+ best_crtcs[n] = NULL;
+ best_crtc = NULL;
+ best_score = xf86PickCrtcs (scrn, best_crtcs, modes, n+1, width, height);
+ if (modes[n] == NULL)
+ return best_score;
+
+ crtcs = xalloc (config->num_output * sizeof (xf86CrtcPtr));
+ if (!crtcs)
+ return best_score;
+
+ my_score = 1;
+ /* Score outputs that are known to be connected higher */
+ if (output->status == XF86OutputStatusConnected)
+ my_score++;
+ /* Score outputs with preferred modes higher */
+ if (xf86OutputHasPreferredMode (output, width, height))
+ my_score++;
+ /*
+ * Select a crtc for this output and
+ * then attempt to configure the remaining
+ * outputs
+ */
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ if ((output->possible_crtcs & (1 << c)) == 0)
+ continue;
+
+ crtc = config->crtc[c];
+ /*
+ * Check to see if some other output is
+ * using this crtc
+ */
+ for (o = 0; o < n; o++)
+ if (best_crtcs[o] == crtc)
+ break;
+ if (o < n)
+ {
+ /*
+ * If the two outputs desire the same mode,
+ * see if they can be cloned
+ */
+ if (xf86ModesEqual (modes[o], modes[n]) &&
+ config->output[0]->initial_rotation == config->output[n]->initial_rotation &&
+ config->output[o]->initial_x == config->output[n]->initial_x &&
+ config->output[o]->initial_y == config->output[n]->initial_y)
+ {
+ if ((output->possible_clones & (1 << o)) == 0)
+ continue; /* nope, try next CRTC */
+ }
+ else
+ continue; /* different modes, can't clone */
+ }
+ crtcs[n] = crtc;
+ memcpy (crtcs, best_crtcs, n * sizeof (xf86CrtcPtr));
+ score = my_score + xf86PickCrtcs (scrn, crtcs, modes, n+1, width, height);
+ if (score > best_score)
+ {
+ best_crtc = crtc;
+ best_score = score;
+ memcpy (best_crtcs, crtcs, config->num_output * sizeof (xf86CrtcPtr));
+ }
+ }
+ xfree (crtcs);
+ return best_score;
+}
+
+
+/*
+ * Compute the virtual size necessary to place all of the available
+ * crtcs in the specified configuration.
+ *
+ * canGrow indicates that the driver can make the screen larger than its initial
+ * configuration. If FALSE, this function will enlarge the screen to include
+ * the largest available mode.
+ */
+
+static void
+xf86DefaultScreenLimits (ScrnInfoPtr scrn, int *widthp, int *heightp,
+ Bool canGrow)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int width = 0, height = 0;
+ int o;
+ int c;
+ int s;
+
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ int crtc_width = 0, crtc_height = 0;
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ if (crtc->enabled)
+ {
+ crtc_width = crtc->x + xf86ModeWidth (&crtc->desiredMode, crtc->desiredRotation);
+ crtc_height = crtc->y + xf86ModeHeight (&crtc->desiredMode, crtc->desiredRotation);
+ }
+ if (!canGrow) {
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ for (s = 0; s < config->num_crtc; s++)
+ if (output->possible_crtcs & (1 << s))
+ {
+ DisplayModePtr mode;
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ if (mode->HDisplay > crtc_width)
+ crtc_width = mode->HDisplay;
+ if (mode->VDisplay > crtc_width)
+ crtc_width = mode->VDisplay;
+ if (mode->VDisplay > crtc_height)
+ crtc_height = mode->VDisplay;
+ if (mode->HDisplay > crtc_height)
+ crtc_height = mode->HDisplay;
+ }
+ }
+ }
+ }
+ if (crtc_width > width)
+ width = crtc_width;
+ if (crtc_height > height)
+ height = crtc_height;
+ }
+ if (config->maxWidth && width > config->maxWidth) width = config->maxWidth;
+ if (config->maxHeight && height > config->maxHeight) height = config->maxHeight;
+ if (config->minWidth && width < config->minWidth) width = config->minWidth;
+ if (config->minHeight && height < config->minHeight) height = config->minHeight;
+ *widthp = width;
+ *heightp = height;
+}
+
+#define POSITION_UNSET -100000
+
+static Bool
+xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+ int min_x, min_y;
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ output->initial_x = output->initial_y = POSITION_UNSET;
+ }
+
+ /*
+ * Loop until all outputs are set
+ */
+ for (;;)
+ {
+ Bool any_set = FALSE;
+ Bool keep_going = FALSE;
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ static const OutputOpts relations[] = {
+ OPTION_BELOW, OPTION_RIGHT_OF, OPTION_ABOVE, OPTION_LEFT_OF
+ };
+ xf86OutputPtr output = config->output[o];
+ xf86OutputPtr relative;
+ char *relative_name;
+ char *position;
+ OutputOpts relation;
+ int r;
+
+ if (output->initial_x != POSITION_UNSET)
+ continue;
+ position = xf86GetOptValString (output->options,
+ OPTION_POSITION);
+ /*
+ * Absolute position wins
+ */
+ if (position)
+ {
+ int x, y;
+ if (sscanf (position, "%d %d", &x, &y) == 2)
+ {
+ output->initial_x = x;
+ output->initial_y = y;
+ }
+ else
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Output %s position not of form \"x y\"\n",
+ output->name);
+ output->initial_x = output->initial_y = 0;
+ }
+ any_set = TRUE;
+ continue;
+ }
+ /*
+ * Next comes relative positions
+ */
+ relation = 0;
+ relative_name = NULL;
+ for (r = 0; r < 4; r++)
+ {
+ relation = relations[r];
+ relative_name = xf86GetOptValString (output->options,
+ relation);
+ if (relative_name)
+ break;
+ }
+ if (relative_name)
+ {
+ int or;
+ relative = NULL;
+ for (or = 0; or < config->num_output; or++)
+ {
+ xf86OutputPtr out_rel = config->output[or];
+ XF86ConfMonitorPtr rel_mon = out_rel->conf_monitor;
+
+ if (rel_mon)
+ {
+ if (xf86nameCompare (rel_mon->mon_identifier,
+ relative_name) == 0)
+ {
+ relative = config->output[or];
+ break;
+ }
+ }
+ if (strcmp (out_rel->name, relative_name) == 0)
+ {
+ relative = config->output[or];
+ break;
+ }
+ }
+ if (!relative)
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Cannot position output %s relative to unknown output %s\n",
+ output->name, relative_name);
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ continue;
+ }
+ if (relative->initial_x == POSITION_UNSET)
+ {
+ keep_going = TRUE;
+ continue;
+ }
+ output->initial_x = relative->initial_x;
+ output->initial_y = relative->initial_y;
+ switch (relation) {
+ case OPTION_BELOW:
+ output->initial_y += xf86ModeHeight (modes[or], relative->initial_rotation);
+ break;
+ case OPTION_RIGHT_OF:
+ output->initial_x += xf86ModeWidth (modes[or], relative->initial_rotation);
+ break;
+ case OPTION_ABOVE:
+ output->initial_y -= xf86ModeHeight (modes[or], relative->initial_rotation);
+ break;
+ case OPTION_LEFT_OF:
+ output->initial_x -= xf86ModeWidth (modes[or], relative->initial_rotation);
+ break;
+ default:
+ break;
+ }
+ any_set = TRUE;
+ continue;
+ }
+
+ /* Nothing set, just stick them at 0,0 */
+ output->initial_x = 0;
+ output->initial_y = 0;
+ any_set = TRUE;
+ }
+ if (!keep_going)
+ break;
+ if (!any_set)
+ {
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ if (output->initial_x == POSITION_UNSET)
+ {
+ xf86DrvMsg (scrn->scrnIndex, X_ERROR,
+ "Output position loop. Moving %s to 0,0\n",
+ output->name);
+ output->initial_x = output->initial_y = 0;
+ break;
+ }
+ }
+ }
+ }
+
+ /*
+ * normalize positions
+ */
+ min_x = 1000000;
+ min_y = 1000000;
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ if (output->initial_x < min_x)
+ min_x = output->initial_x;
+ if (output->initial_y < min_y)
+ min_y = output->initial_y;
+ }
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ output->initial_x -= min_x;
+ output->initial_y -= min_y;
+ }
+ return TRUE;
+}
+
+/*
+ * XXX walk the monitor mode list and prune out duplicates that
+ * are inserted by xf86DDCMonitorSet. In an ideal world, that
+ * function would do this work by itself.
+ */
+
+static void
+xf86PruneDuplicateMonitorModes (MonPtr Monitor)
+{
+ DisplayModePtr master, clone, next;
+
+ for (master = Monitor->Modes;
+ master && master != Monitor->Last;
+ master = master->next)
+ {
+ for (clone = master->next; clone && clone != Monitor->Modes; clone = next)
+ {
+ next = clone->next;
+ if (xf86ModesEqual (master, clone))
+ {
+ if (Monitor->Last == clone)
+ Monitor->Last = clone->prev;
+ xf86DeleteMode (&Monitor->Modes, clone);
+ }
+ }
+ }
+}
+
+/** Return - 0 + if a should be earlier, same or later than b in list
+ */
+static int
+xf86ModeCompare (DisplayModePtr a, DisplayModePtr b)
+{
+ int diff;
+
+ diff = ((b->type & M_T_PREFERRED) != 0) - ((a->type & M_T_PREFERRED) != 0);
+ if (diff)
+ return diff;
+ diff = b->HDisplay * b->VDisplay - a->HDisplay * a->VDisplay;
+ if (diff)
+ return diff;
+ diff = b->Clock - a->Clock;
+ return diff;
+}
+
+/**
+ * Insertion sort input in-place and return the resulting head
+ */
+static DisplayModePtr
+xf86SortModes (DisplayModePtr input)
+{
+ DisplayModePtr output = NULL, i, o, n, *op, prev;
+
+ /* sort by preferred status and pixel area */
+ while (input)
+ {
+ i = input;
+ input = input->next;
+ for (op = &output; (o = *op); op = &o->next)
+ if (xf86ModeCompare (o, i) > 0)
+ break;
+ i->next = *op;
+ *op = i;
+ }
+ /* prune identical modes */
+ for (o = output; o && (n = o->next); o = n)
+ {
+ if (!strcmp (o->name, n->name) && xf86ModesEqual (o, n))
+ {
+ o->next = n->next;
+ xfree (n->name);
+ xfree (n);
+ n = o;
+ }
+ }
+ /* hook up backward links */
+ prev = NULL;
+ for (o = output; o; o = o->next)
+ {
+ o->prev = prev;
+ prev = o;
+ }
+ return output;
+}
+
+#define DEBUG_REPROBE 1
+
+void
+xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o;
+
+ if (maxX == 0 || maxY == 0)
+ xf86RandR12GetOriginalVirtualSize (scrn, &maxX, &maxY);
+
+ /* Elide duplicate modes before defaulting code uses them */
+ xf86PruneDuplicateMonitorModes (scrn->monitor);
+
+ /* Probe the list of modes for each output. */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr mode;
+ DisplayModePtr config_modes = NULL, output_modes, default_modes;
+ char *preferred_mode;
+ xf86MonPtr edid_monitor;
+ XF86ConfMonitorPtr conf_monitor;
+ MonRec mon_rec;
+ int min_clock = 0;
+ int max_clock = 0;
+ double clock;
+ enum { sync_config, sync_edid, sync_default } sync_source = sync_default;
+
+ while (output->probed_modes != NULL)
+ xf86DeleteMode(&output->probed_modes, output->probed_modes);
+
+ /*
+ * Check connection status
+ */
+ output->status = (*output->funcs->detect)(output);
+
+ if (output->status == XF86OutputStatusDisconnected)
+ {
+ xf86OutputSetEDID (output, NULL);
+ continue;
+ }
+
+ memset (&mon_rec, '\0', sizeof (mon_rec));
+
+ conf_monitor = output->conf_monitor;
+
+ if (conf_monitor)
+ {
+ int i;
+
+ for (i = 0; i < conf_monitor->mon_n_hsync; i++)
+ {
+ mon_rec.hsync[mon_rec.nHsync].lo = conf_monitor->mon_hsync[i].lo;
+ mon_rec.hsync[mon_rec.nHsync].hi = conf_monitor->mon_hsync[i].hi;
+ mon_rec.nHsync++;
+ sync_source = sync_config;
+ }
+ for (i = 0; i < conf_monitor->mon_n_vrefresh; i++)
+ {
+ mon_rec.vrefresh[mon_rec.nVrefresh].lo = conf_monitor->mon_vrefresh[i].lo;
+ mon_rec.vrefresh[mon_rec.nVrefresh].hi = conf_monitor->mon_vrefresh[i].hi;
+ mon_rec.nVrefresh++;
+ sync_source = sync_config;
+ }
+ config_modes = xf86GetMonitorModes (scrn, conf_monitor);
+ }
+
+ output_modes = (*output->funcs->get_modes) (output);
+
+ edid_monitor = output->MonInfo;
+
+ if (edid_monitor)
+ {
+ int i;
+ Bool set_hsync = mon_rec.nHsync == 0;
+ Bool set_vrefresh = mon_rec.nVrefresh == 0;
+
+ for (i = 0; i < sizeof (edid_monitor->det_mon) / sizeof (edid_monitor->det_mon[0]); i++)
+ {
+ if (edid_monitor->det_mon[i].type == DS_RANGES)
+ {
+ struct monitor_ranges *ranges = &edid_monitor->det_mon[i].section.ranges;
+ if (set_hsync && ranges->max_h)
+ {
+ mon_rec.hsync[mon_rec.nHsync].lo = ranges->min_h;
+ mon_rec.hsync[mon_rec.nHsync].hi = ranges->max_h;
+ mon_rec.nHsync++;
+ if (sync_source == sync_default)
+ sync_source = sync_edid;
+ }
+ if (set_vrefresh && ranges->max_v)
+ {
+ mon_rec.vrefresh[mon_rec.nVrefresh].lo = ranges->min_v;
+ mon_rec.vrefresh[mon_rec.nVrefresh].hi = ranges->max_v;
+ mon_rec.nVrefresh++;
+ if (sync_source == sync_default)
+ sync_source = sync_edid;
+ }
+ if (ranges->max_clock > max_clock)
+ max_clock = ranges->max_clock;
+ }
+ }
+ }
+
+ if (xf86GetOptValFreq (output->options, OPTION_MIN_CLOCK,
+ OPTUNITS_KHZ, &clock))
+ min_clock = (int) clock;
+ if (xf86GetOptValFreq (output->options, OPTION_MAX_CLOCK,
+ OPTUNITS_KHZ, &clock))
+ max_clock = (int) clock;
+
+ /*
+ * These limits will end up setting a 1024x768@60Hz mode by default,
+ * which seems like a fairly good mode to use when nothing else is
+ * specified
+ */
+ if (mon_rec.nHsync == 0)
+ {
+ mon_rec.hsync[0].lo = 31.0;
+ mon_rec.hsync[0].hi = 55.0;
+ mon_rec.nHsync = 1;
+ }
+ if (mon_rec.nVrefresh == 0)
+ {
+ mon_rec.vrefresh[0].lo = 58.0;
+ mon_rec.vrefresh[0].hi = 62.0;
+ mon_rec.nVrefresh = 1;
+ }
+ default_modes = xf86GetDefaultModes (output->interlaceAllowed,
+ output->doubleScanAllowed);
+
+ if (sync_source == sync_config)
+ {
+ /*
+ * Check output and config modes against sync range from config file
+ */
+ xf86ValidateModesSync (scrn, output_modes, &mon_rec);
+ xf86ValidateModesSync (scrn, config_modes, &mon_rec);
+ }
+ /*
+ * Check default modes against sync range
+ */
+ xf86ValidateModesSync (scrn, default_modes, &mon_rec);
+ /*
+ * Check default modes against monitor max clock
+ */
+ if (max_clock)
+ xf86ValidateModesClocks(scrn, default_modes,
+ &min_clock, &max_clock, 1);
+
+ output->probed_modes = NULL;
+ output->probed_modes = xf86ModesAdd (output->probed_modes, config_modes);
+ output->probed_modes = xf86ModesAdd (output->probed_modes, output_modes);
+ output->probed_modes = xf86ModesAdd (output->probed_modes, default_modes);
+
+ /*
+ * Check all modes against max size
+ */
+ if (maxX && maxY)
+ xf86ValidateModesSize (scrn, output->probed_modes,
+ maxX, maxY, 0);
+
+ /*
+ * Check all modes against output
+ */
+ for (mode = output->probed_modes; mode != NULL; mode = mode->next)
+ if (mode->status == MODE_OK)
+ mode->status = (*output->funcs->mode_valid)(output, mode);
+
+ xf86PruneInvalidModes(scrn, &output->probed_modes, TRUE);
+
+ output->probed_modes = xf86SortModes (output->probed_modes);
+
+ /* Check for a configured preference for a particular mode */
+ preferred_mode = xf86GetOptValString (output->options,
+ OPTION_PREFERRED_MODE);
+
+ if (preferred_mode)
+ {
+ for (mode = output->probed_modes; mode; mode = mode->next)
+ {
+ if (!strcmp (preferred_mode, mode->name))
+ {
+ if (mode != output->probed_modes)
+ {
+ if (mode->prev)
+ mode->prev->next = mode->next;
+ if (mode->next)
+ mode->next->prev = mode->prev;
+ mode->next = output->probed_modes;
+ output->probed_modes->prev = mode;
+ mode->prev = NULL;
+ output->probed_modes = mode;
+ }
+ mode->type |= M_T_PREFERRED;
+ break;
+ }
+ }
+ }
+
+ output->initial_rotation = xf86OutputInitialRotation (output);
+
+#ifdef DEBUG_REPROBE
+ if (output->probed_modes != NULL) {
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "Printing probed modes for output %s\n",
+ output->name);
+ } else {
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "No remaining probed modes for output %s\n",
+ output->name);
+ }
+#endif
+ for (mode = output->probed_modes; mode != NULL; mode = mode->next)
+ {
+ /* The code to choose the best mode per pipe later on will require
+ * VRefresh to be set.
+ */
+ mode->VRefresh = xf86ModeVRefresh(mode);
+ xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
+
+#ifdef DEBUG_REPROBE
+ xf86PrintModeline(scrn->scrnIndex, mode);
+#endif
+ }
+ }
+}
+
+
+/**
+ * Copy one of the output mode lists to the ScrnInfo record
+ */
+
+/* XXX where does this function belong? Here? */
+void
+xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y);
+
+void
+xf86SetScrnInfoModes (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86OutputPtr output;
+ xf86CrtcPtr crtc;
+ DisplayModePtr last, mode;
+
+ output = config->output[config->compat_output];
+ if (!output->crtc)
+ {
+ int o;
+
+ output = NULL;
+ for (o = 0; o < config->num_output; o++)
+ if (config->output[o]->crtc)
+ {
+ config->compat_output = o;
+ output = config->output[o];
+ break;
+ }
+ /* no outputs are active, punt and leave things as they are */
+ if (!output)
+ return;
+ }
+ crtc = output->crtc;
+
+ /* Clear any existing modes from scrn->modes */
+ while (scrn->modes != NULL)
+ xf86DeleteMode(&scrn->modes, scrn->modes);
+
+ /* Set scrn->modes to the mode list for the 'compat' output */
+ scrn->modes = xf86DuplicateModes(scrn, output->probed_modes);
+
+ for (mode = scrn->modes; mode; mode = mode->next)
+ if (xf86ModesEqual (mode, &crtc->desiredMode))
+ break;
+
+ if (scrn->modes != NULL) {
+ /* For some reason, scrn->modes is circular, unlike the other mode
+ * lists. How great is that?
+ */
+ for (last = scrn->modes; last && last->next; last = last->next)
+ ;
+ last->next = scrn->modes;
+ scrn->modes->prev = last;
+ if (mode) {
+ while (scrn->modes != mode)
+ scrn->modes = scrn->modes->next;
+ }
+ }
+ scrn->currentMode = scrn->modes;
+}
+
+/**
+ * Construct default screen configuration
+ *
+ * Given auto-detected (and, eventually, configured) values,
+ * construct a usable configuration for the system
+ *
+ * canGrow indicates that the driver can resize the screen to larger than its
+ * initially configured size via the config->funcs->resize hook. If TRUE, this
+ * function will set virtualX and virtualY to match the initial configuration
+ * and leave config->max{Width,Height} alone. If FALSE, it will bloat
+ * virtual[XY] to include the largest modes and set config->max{Width,Height}
+ * accordingly.
+ */
+
+Bool
+xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int o, c;
+ DisplayModePtr target_mode = NULL;
+ Rotation target_rotation = RR_Rotate_0;
+ xf86CrtcPtr *crtcs;
+ DisplayModePtr *modes;
+ Bool *enabled;
+ int width;
+ int height;
+
+ if (scrn->display->virtualX)
+ width = scrn->display->virtualX;
+ else
+ width = config->maxWidth;
+ if (scrn->display->virtualY)
+ height = scrn->display->virtualY;
+ else
+ height = config->maxHeight;
+
+ xf86ProbeOutputModes (scrn, width, height);
+
+ crtcs = xnfcalloc (config->num_output, sizeof (xf86CrtcPtr));
+ modes = xnfcalloc (config->num_output, sizeof (DisplayModePtr));
+ enabled = xnfcalloc (config->num_output, sizeof (Bool));
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ modes[o] = NULL;
+ enabled[o] = (xf86OutputEnabled (output) &&
+ output->status != XF86OutputStatusDisconnected);
+ }
+
+ /*
+ * Let outputs with preferred modes drive screen size
+ */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ if (enabled[o] &&
+ xf86OutputHasPreferredMode (output, width, height))
+ {
+ target_mode = xf86DefaultMode (output, width, height);
+ target_rotation = output->initial_rotation;
+ if (target_mode)
+ {
+ modes[o] = target_mode;
+ config->compat_output = o;
+ break;
+ }
+ }
+ }
+ if (!target_mode)
+ {
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ if (enabled[o])
+ {
+ target_mode = xf86DefaultMode (output, width, height);
+ target_rotation = output->initial_rotation;
+ if (target_mode)
+ {
+ modes[o] = target_mode;
+ config->compat_output = o;
+ break;
+ }
+ }
+ }
+ }
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ if (enabled[o] && !modes[o])
+ modes[o] = xf86ClosestMode (output, target_mode, target_rotation, width, height);
+ }
+
+ /*
+ * Set the position of each output
+ */
+ if (!xf86InitialOutputPositions (scrn, modes))
+ {
+ xfree (crtcs);
+ xfree (modes);
+ return FALSE;
+ }
+
+ /*
+ * Assign CRTCs to fit output configuration
+ */
+ if (!xf86PickCrtcs (scrn, crtcs, modes, 0, width, height))
+ {
+ xfree (crtcs);
+ xfree (modes);
+ return FALSE;
+ }
+
+ /* XXX override xf86 common frame computation code */
+
+ scrn->display->frameX0 = 0;
+ scrn->display->frameY0 = 0;
+
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ crtc->enabled = FALSE;
+ memset (&crtc->desiredMode, '\0', sizeof (crtc->desiredMode));
+ }
+
+ /*
+ * Set initial configuration
+ */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr mode = modes[o];
+ xf86CrtcPtr crtc = crtcs[o];
+
+ if (mode && crtc)
+ {
+ crtc->desiredMode = *mode;
+ crtc->desiredRotation = output->initial_rotation;
+ crtc->desiredX = output->initial_x;
+ crtc->desiredY = output->initial_y;
+ crtc->enabled = TRUE;
+ crtc->x = output->initial_x;
+ crtc->y = output->initial_y;
+ output->crtc = crtc;
+ }
+ }
+
+ if (scrn->display->virtualX == 0)
+ {
+ /*
+ * Expand virtual size to cover the current config and potential mode
+ * switches, if the driver can't enlarge the screen later.
+ */
+ xf86DefaultScreenLimits (scrn, &width, &height, canGrow);
+
+ scrn->display->virtualX = width;
+ scrn->display->virtualY = height;
+ }
+
+ if (width > scrn->virtualX)
+ scrn->virtualX = width;
+ if (height > scrn->virtualY)
+ scrn->virtualY = height;
+
+ /*
+ * Make sure the configuration isn't too small.
+ */
+ if (width < config->minWidth || height < config->minHeight)
+ return FALSE;
+
+ /*
+ * Limit the crtc config to virtual[XY] if the driver can't grow the
+ * desktop.
+ */
+ if (!canGrow)
+ {
+ xf86CrtcSetSizeRange (scrn, config->minWidth, config->minHeight,
+ width, height);
+ }
+
+ /* Mirror output modes to scrn mode list */
+ xf86SetScrnInfoModes (scrn);
+
+ xfree (crtcs);
+ xfree (modes);
+ return TRUE;
+}
+
+/*
+ * Using the desired mode information in each crtc, set
+ * modes (used in EnterVT functions, or at server startup)
+ */
+
+Bool
+xf86SetDesiredModes (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+ xf86OutputPtr output = NULL;
+ int o;
+
+ if (config->output[config->compat_output]->crtc == crtc)
+ output = config->output[config->compat_output];
+ else
+ {
+ for (o = 0; o < config->num_output; o++)
+ if (config->output[o]->crtc == crtc)
+ {
+ output = config->output[o];
+ break;
+ }
+ }
+ /*
+ * Skip disabled crtcs
+ */
+ if (!output)
+ continue;
+
+ /* Mark that we'll need to re-set the mode for sure */
+ memset(&crtc->mode, 0, sizeof(crtc->mode));
+ if (!crtc->desiredMode.CrtcHDisplay)
+ {
+ DisplayModePtr mode = xf86OutputFindClosestMode (output, scrn->currentMode);
+
+ if (!mode)
+ return FALSE;
+ crtc->desiredMode = *mode;
+ crtc->desiredRotation = RR_Rotate_0;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ }
+
+ if (!xf86CrtcSetMode (crtc, &crtc->desiredMode, crtc->desiredRotation,
+ crtc->desiredX, crtc->desiredY))
+ return FALSE;
+ }
+
+ xf86DisableUnusedFunctions(scrn);
+ return TRUE;
+}
+
+/**
+ * In the current world order, there are lists of modes per output, which may
+ * or may not include the mode that was asked to be set by XFree86's mode
+ * selection. Find the closest one, in the following preference order:
+ *
+ * - Equality
+ * - Closer in size to the requested mode, but no larger
+ * - Closer in refresh rate to the requested mode.
+ */
+
+DisplayModePtr
+xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired)
+{
+ DisplayModePtr best = NULL, scan = NULL;
+
+ for (scan = output->probed_modes; scan != NULL; scan = scan->next)
+ {
+ /* If there's an exact match, we're done. */
+ if (xf86ModesEqual(scan, desired)) {
+ best = desired;
+ break;
+ }
+
+ /* Reject if it's larger than the desired mode. */
+ if (scan->HDisplay > desired->HDisplay ||
+ scan->VDisplay > desired->VDisplay)
+ {
+ continue;
+ }
+
+ /*
+ * If we haven't picked a best mode yet, use the first
+ * one in the size range
+ */
+ if (best == NULL)
+ {
+ best = scan;
+ continue;
+ }
+
+ /* Find if it's closer to the right size than the current best
+ * option.
+ */
+ if ((scan->HDisplay > best->HDisplay &&
+ scan->VDisplay >= best->VDisplay) ||
+ (scan->HDisplay >= best->HDisplay &&
+ scan->VDisplay > best->VDisplay))
+ {
+ best = scan;
+ continue;
+ }
+
+ /* Find if it's still closer to the right refresh than the current
+ * best resolution.
+ */
+ if (scan->HDisplay == best->HDisplay &&
+ scan->VDisplay == best->VDisplay &&
+ (fabs(scan->VRefresh - desired->VRefresh) <
+ fabs(best->VRefresh - desired->VRefresh))) {
+ best = scan;
+ }
+ }
+ return best;
+}
+
+/**
+ * When setting a mode through XFree86-VidModeExtension or XFree86-DGA,
+ * take the specified mode and apply it to the crtc connected to the compat
+ * output. Then, find similar modes for the other outputs, as with the
+ * InitialConfiguration code above. The goal is to clone the desired
+ * mode across all outputs that are currently active.
+ */
+
+Bool
+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;
+ int c;
+
+ /*
+ * Let the compat output drive the final mode selection
+ */
+ compat_mode = xf86OutputFindClosestMode (compat_output, desired);
+ if (compat_mode)
+ desired = compat_mode;
+
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+ DisplayModePtr crtc_mode = NULL;
+ int o;
+
+ if (!crtc->enabled)
+ continue;
+
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ DisplayModePtr output_mode;
+
+ /* skip outputs not on this crtc */
+ if (output->crtc != crtc)
+ continue;
+
+ if (crtc_mode)
+ {
+ output_mode = xf86OutputFindClosestMode (output, crtc_mode);
+ if (output_mode != crtc_mode)
+ output->crtc = NULL;
+ }
+ else
+ crtc_mode = xf86OutputFindClosestMode (output, desired);
+ }
+ if (!xf86CrtcSetMode (crtc, crtc_mode, rotation, 0, 0))
+ ok = FALSE;
+ else
+ {
+ crtc->desiredMode = *crtc_mode;
+ crtc->desiredRotation = rotation;
+ crtc->desiredX = 0;
+ crtc->desiredY = 0;
+ }
+ }
+ xf86DisableUnusedFunctions(pScrn);
+ return ok;
+}
+
+
+/**
+ * Set the DPMS power mode of all outputs and CRTCs.
+ *
+ * If the new mode is off, it will turn off outputs and then CRTCs.
+ * Otherwise, it will affect CRTCs before outputs.
+ */
+void
+xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
+
+ if (!scrn->vtSema)
+ return;
+
+ if (mode == DPMSModeOff) {
+ for (i = 0; i < config->num_output; i++) {
+ xf86OutputPtr output = config->output[i];
+ if (output->crtc != NULL)
+ (*output->funcs->dpms) (output, mode);
+ }
+ }
+
+ for (i = 0; i < config->num_crtc; i++) {
+ xf86CrtcPtr crtc = config->crtc[i];
+ if (crtc->enabled)
+ (*crtc->funcs->dpms) (crtc, mode);
+ }
+
+ if (mode != DPMSModeOff) {
+ for (i = 0; i < config->num_output; i++) {
+ xf86OutputPtr output = config->output[i];
+ if (output->crtc != NULL)
+ (*output->funcs->dpms) (output, mode);
+ }
+ }
+}
+
+/**
+ * Implement the screensaver by just calling down into the driver DPMS hooks.
+ *
+ * Even for monitors with no DPMS support, by the definition of our DPMS hooks,
+ * the outputs will still get disabled (blanked).
+ */
+Bool
+xf86SaveScreen(ScreenPtr pScreen, int mode)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ if (xf86IsUnblank(mode))
+ xf86DPMSSet(pScrn, DPMSModeOn, 0);
+ else
+ xf86DPMSSet(pScrn, DPMSModeOff, 0);
+
+ return TRUE;
+}
+
+/**
+ * Disable all inactive crtcs and outputs
+ */
+void
+xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int o, c;
+
+ for (o = 0; o < xf86_config->num_output; o++)
+ {
+ xf86OutputPtr output = xf86_config->output[o];
+ if (!output->crtc)
+ (*output->funcs->dpms)(output, DPMSModeOff);
+ }
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (!crtc->enabled)
+ {
+ crtc->funcs->dpms(crtc, DPMSModeOff);
+ memset(&crtc->mode, 0, sizeof(crtc->mode));
+ }
+ }
+}
+
+#ifdef RANDR_12_INTERFACE
+
+#define EDID_ATOM_NAME "EDID_DATA"
+
+/**
+ * Set the RandR EDID property
+ */
+static void
+xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len)
+{
+ Atom edid_atom = MakeAtom(EDID_ATOM_NAME, sizeof(EDID_ATOM_NAME), TRUE);
+
+ /* This may get called before the RandR resources have been created */
+ if (output->randr_output == NULL)
+ return;
+
+ if (data_len != 0) {
+ RRChangeOutputProperty(output->randr_output, edid_atom, XA_INTEGER, 8,
+ PropModeReplace, data_len, data, FALSE, TRUE);
+ } else {
+ RRDeleteOutputProperty(output->randr_output, edid_atom);
+ }
+}
+
+#endif
+
+/**
+ * Set the EDID information for the specified output
+ */
+void
+xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
+{
+ ScrnInfoPtr scrn = output->scrn;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+ int i;
+#ifdef RANDR_12_INTERFACE
+ int size;
+#endif
+
+ if (output->MonInfo != NULL)
+ xfree(output->MonInfo);
+
+ output->MonInfo = edid_mon;
+
+ /* Debug info for now, at least */
+ xf86DrvMsg(scrn->scrnIndex, X_INFO, "EDID for output %s\n", output->name);
+ xf86PrintEDID(edid_mon);
+
+ /* Set the DDC properties for the 'compat' output */
+ if (output == config->output[config->compat_output])
+ xf86SetDDCproperties(scrn, edid_mon);
+
+#ifdef RANDR_12_INTERFACE
+ /* Set the RandR output properties */
+ size = 0;
+ if (edid_mon)
+ {
+ if (edid_mon->ver.version == 1)
+ size = 128;
+ else if (edid_mon->ver.version == 2)
+ size = 256;
+ }
+ xf86OutputSetEDIDProperty (output, edid_mon ? edid_mon->rawData : NULL, size);
+#endif
+
+ if (edid_mon)
+ {
+ /* Pull out a phyiscal size from a detailed timing if available. */
+ for (i = 0; i < 4; i++) {
+ if (edid_mon->det_mon[i].type == DT &&
+ edid_mon->det_mon[i].section.d_timings.h_size != 0 &&
+ edid_mon->det_mon[i].section.d_timings.v_size != 0)
+ {
+ output->mm_width = edid_mon->det_mon[i].section.d_timings.h_size;
+ output->mm_height = edid_mon->det_mon[i].section.d_timings.v_size;
+ break;
+ }
+ }
+
+ /* if no mm size is available from a detailed timing, check the max size field */
+ if ((!output->mm_width || !output->mm_height) &&
+ (edid_mon->features.hsize && edid_mon->features.vsize))
+ {
+ output->mm_width = edid_mon->features.hsize * 10;
+ output->mm_height = edid_mon->features.vsize * 10;
+ }
+ }
+}
+
+/**
+ * Return the list of modes supported by the EDID information
+ * stored in 'output'
+ */
+DisplayModePtr
+xf86OutputGetEDIDModes (xf86OutputPtr output)
+{
+ ScrnInfoPtr scrn = output->scrn;
+ xf86MonPtr edid_mon = output->MonInfo;
+
+ if (!edid_mon)
+ return NULL;
+ return xf86DDCGetModes(scrn->scrnIndex, edid_mon);
+}
+
+xf86MonPtr
+xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
+{
+ ScrnInfoPtr scrn = output->scrn;
+
+ return xf86DoEDID_DDC2 (scrn->scrnIndex, pDDCBus);
+}
+
+static char *_xf86ConnectorNames[] = { "None", "VGA", "DVI-I", "DVI-D",
+ "DVI-A", "Composite", "S-Video",
+ "Component", "LFP", "Proprietary" };
+char *
+xf86ConnectorGetName(xf86ConnectorType connector)
+{
+ return _xf86ConnectorNames[connector];
+}
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
new file mode 100644
index 000000000..42daf6079
--- /dev/null
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -0,0 +1,740 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * 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, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+#ifndef _XF86CRTC_H_
+#define _XF86CRTC_H_
+
+#include <edid.h>
+#include "randrstr.h"
+#if XF86_MODES_RENAME
+#include "xf86Rename.h"
+#endif
+#include "xf86Modes.h"
+#include "xf86Cursor.h"
+#include "damage.h"
+
+/* Compat definitions for older X Servers. */
+#ifndef M_T_PREFERRED
+#define M_T_PREFERRED 0x08
+#endif
+#ifndef M_T_DRIVER
+#define M_T_DRIVER 0x40
+#endif
+#ifndef HARDWARE_CURSOR_ARGB
+#define HARDWARE_CURSOR_ARGB 0x00004000
+#endif
+
+typedef struct _xf86Crtc xf86CrtcRec, *xf86CrtcPtr;
+typedef struct _xf86Output xf86OutputRec, *xf86OutputPtr;
+
+/* define a standard for connector types */
+typedef enum _xf86ConnectorType {
+ XF86ConnectorNone,
+ XF86ConnectorVGA,
+ XF86ConnectorDVI_I,
+ XF86ConnectorDVI_D,
+ XF86ConnectorDVI_A,
+ XF86ConnectorComposite,
+ XF86ConnectorSvideo,
+ XF86ConnectorComponent,
+ XF86ConnectorLFP,
+ XF86ConnectorProprietary,
+} xf86ConnectorType;
+
+typedef enum _xf86OutputStatus {
+ XF86OutputStatusConnected,
+ XF86OutputStatusDisconnected,
+ XF86OutputStatusUnknown,
+} xf86OutputStatus;
+
+typedef struct _xf86CrtcFuncs {
+ /**
+ * Turns the crtc on/off, or sets intermediate power levels if available.
+ *
+ * Unsupported intermediate modes drop to the lower power setting. If the
+ * mode is DPMSModeOff, the crtc must be disabled sufficiently for it to
+ * be safe to call mode_set.
+ */
+ void
+ (*dpms)(xf86CrtcPtr crtc,
+ int mode);
+
+ /**
+ * Saves the crtc's state for restoration on VT switch.
+ */
+ void
+ (*save)(xf86CrtcPtr crtc);
+
+ /**
+ * Restore's the crtc's state at VT switch.
+ */
+ void
+ (*restore)(xf86CrtcPtr crtc);
+
+ /**
+ * Lock CRTC prior to mode setting, mostly for DRI.
+ * Returns whether unlock is needed
+ */
+ Bool
+ (*lock) (xf86CrtcPtr crtc);
+
+ /**
+ * Unlock CRTC after mode setting, mostly for DRI
+ */
+ void
+ (*unlock) (xf86CrtcPtr crtc);
+
+ /**
+ * Callback to adjust the mode to be set in the CRTC.
+ *
+ * This allows a CRTC to adjust the clock or even the entire set of
+ * timings, which is used for panels with fixed timings or for
+ * buses with clock limitations.
+ */
+ Bool
+ (*mode_fixup)(xf86CrtcPtr crtc,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode);
+
+ /**
+ * Prepare CRTC for an upcoming mode set.
+ */
+ void
+ (*prepare)(xf86CrtcPtr crtc);
+
+ /**
+ * Callback for setting up a video mode after fixups have been made.
+ */
+ void
+ (*mode_set)(xf86CrtcPtr crtc,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode,
+ int x, int y);
+
+ /**
+ * Commit mode changes to a CRTC
+ */
+ void
+ (*commit)(xf86CrtcPtr crtc);
+
+ /* Set the color ramps for the CRTC to the given values. */
+ void
+ (*gamma_set)(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
+ int size);
+
+ /**
+ * Allocate the shadow area, delay the pixmap creation until needed
+ */
+ void *
+ (*shadow_allocate) (xf86CrtcPtr crtc, int width, int height);
+
+ /**
+ * Create shadow pixmap for rotation support
+ */
+ PixmapPtr
+ (*shadow_create) (xf86CrtcPtr crtc, void *data, int width, int height);
+
+ /**
+ * Destroy shadow pixmap
+ */
+ void
+ (*shadow_destroy) (xf86CrtcPtr crtc, PixmapPtr pPixmap, void *data);
+
+ /**
+ * Set cursor colors
+ */
+ void
+ (*set_cursor_colors) (xf86CrtcPtr crtc, int bg, int fg);
+
+ /**
+ * Set cursor position
+ */
+ void
+ (*set_cursor_position) (xf86CrtcPtr crtc, int x, int y);
+
+ /**
+ * Show cursor
+ */
+ void
+ (*show_cursor) (xf86CrtcPtr crtc);
+
+ /**
+ * Hide cursor
+ */
+ void
+ (*hide_cursor) (xf86CrtcPtr crtc);
+
+ /**
+ * Load monochrome image
+ */
+ void
+ (*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image);
+
+ /**
+ * Load ARGB image
+ */
+ void
+ (*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image);
+
+ /**
+ * Clean up driver-specific bits of the crtc
+ */
+ void
+ (*destroy) (xf86CrtcPtr crtc);
+} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
+
+struct _xf86Crtc {
+ /**
+ * Associated ScrnInfo
+ */
+ ScrnInfoPtr scrn;
+
+ /**
+ * Active state of this CRTC
+ *
+ * Set when this CRTC is driving one or more outputs
+ */
+ Bool enabled;
+
+ /**
+ * Active mode
+ *
+ * This reflects the mode as set in the CRTC currently
+ * It will be cleared when the VT is not active or
+ * during server startup
+ */
+ DisplayModeRec mode;
+ Rotation rotation;
+ PixmapPtr rotatedPixmap;
+ void *rotatedData;
+
+ /**
+ * Position on screen
+ *
+ * Locates this CRTC within the frame buffer
+ */
+ int x, y;
+
+ /**
+ * Desired mode
+ *
+ * This is set to the requested mode, independent of
+ * whether the VT is active. In particular, it receives
+ * the startup configured mode and saves the active mode
+ * on VT switch.
+ */
+ DisplayModeRec desiredMode;
+ Rotation desiredRotation;
+ int desiredX, desiredY;
+
+ /** crtc-specific functions */
+ const xf86CrtcFuncsRec *funcs;
+
+ /**
+ * Driver private
+ *
+ * Holds driver-private information
+ */
+ void *driver_private;
+
+#ifdef RANDR_12_INTERFACE
+ /**
+ * RandR crtc
+ *
+ * When RandR 1.2 is available, this
+ * points at the associated crtc object
+ */
+ RRCrtcPtr randr_crtc;
+#else
+ void *randr_crtc;
+#endif
+
+ /**
+ * Current cursor is ARGB
+ */
+ Bool cursor_argb;
+ /**
+ * Track whether cursor is within CRTC range
+ */
+ Bool cursor_in_range;
+ /**
+ * Track state of cursor associated with this CRTC
+ */
+ Bool cursor_shown;
+};
+
+typedef struct _xf86OutputFuncs {
+ /**
+ * Called to allow the output a chance to create properties after the
+ * RandR objects have been created.
+ */
+ void
+ (*create_resources)(xf86OutputPtr output);
+
+ /**
+ * Turns the output on/off, or sets intermediate power levels if available.
+ *
+ * Unsupported intermediate modes drop to the lower power setting. If the
+ * mode is DPMSModeOff, the output must be disabled, as the DPLL may be
+ * disabled afterwards.
+ */
+ void
+ (*dpms)(xf86OutputPtr output,
+ int mode);
+
+ /**
+ * Saves the output's state for restoration on VT switch.
+ */
+ void
+ (*save)(xf86OutputPtr output);
+
+ /**
+ * Restore's the output's state at VT switch.
+ */
+ void
+ (*restore)(xf86OutputPtr output);
+
+ /**
+ * Callback for testing a video mode for a given output.
+ *
+ * This function should only check for cases where a mode can't be supported
+ * on the output specifically, and not represent generic CRTC limitations.
+ *
+ * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
+ */
+ int
+ (*mode_valid)(xf86OutputPtr output,
+ DisplayModePtr pMode);
+
+ /**
+ * Callback to adjust the mode to be set in the CRTC.
+ *
+ * This allows an output to adjust the clock or even the entire set of
+ * timings, which is used for panels with fixed timings or for
+ * buses with clock limitations.
+ */
+ Bool
+ (*mode_fixup)(xf86OutputPtr output,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode);
+
+ /**
+ * Callback for preparing mode changes on an output
+ */
+ void
+ (*prepare)(xf86OutputPtr output);
+
+ /**
+ * Callback for committing mode changes on an output
+ */
+ void
+ (*commit)(xf86OutputPtr output);
+
+ /**
+ * Callback for setting up a video mode after fixups have been made.
+ *
+ * This is only called while the output is disabled. The dpms callback
+ * must be all that's necessary for the output, to turn the output on
+ * after this function is called.
+ */
+ void
+ (*mode_set)(xf86OutputPtr output,
+ DisplayModePtr mode,
+ DisplayModePtr adjusted_mode);
+
+ /**
+ * Probe for a connected output, and return detect_status.
+ */
+ xf86OutputStatus
+ (*detect)(xf86OutputPtr output);
+
+ /**
+ * Query the device for the modes it provides.
+ *
+ * This function may also update MonInfo, mm_width, and mm_height.
+ *
+ * \return singly-linked list of modes or NULL if no modes found.
+ */
+ DisplayModePtr
+ (*get_modes)(xf86OutputPtr output);
+
+#ifdef RANDR_12_INTERFACE
+ /**
+ * Callback when an output's property has changed.
+ */
+ Bool
+ (*set_property)(xf86OutputPtr output,
+ Atom property,
+ RRPropertyValuePtr value);
+#endif
+ /**
+ * Clean up driver-specific bits of the output
+ */
+ void
+ (*destroy) (xf86OutputPtr output);
+} xf86OutputFuncsRec, *xf86OutputFuncsPtr;
+
+struct _xf86Output {
+ /**
+ * Associated ScrnInfo
+ */
+ ScrnInfoPtr scrn;
+
+ /**
+ * Currently connected crtc (if any)
+ *
+ * If this output is not in use, this field will be NULL.
+ */
+ xf86CrtcPtr crtc;
+
+ /**
+ * Possible CRTCs for this output as a mask of crtc indices
+ */
+ CARD32 possible_crtcs;
+
+ /**
+ * Possible outputs to share the same CRTC as a mask of output indices
+ */
+ CARD32 possible_clones;
+
+ /**
+ * Whether this output can support interlaced modes
+ */
+ Bool interlaceAllowed;
+
+ /**
+ * Whether this output can support double scan modes
+ */
+ Bool doubleScanAllowed;
+
+ /**
+ * List of available modes on this output.
+ *
+ * This should be the list from get_modes(), plus perhaps additional
+ * compatible modes added later.
+ */
+ DisplayModePtr probed_modes;
+
+ /**
+ * Options parsed from the related monitor section
+ */
+ OptionInfoPtr options;
+
+ /**
+ * Configured monitor section
+ */
+ XF86ConfMonitorPtr conf_monitor;
+
+ /**
+ * Desired initial position
+ */
+ int initial_x, initial_y;
+
+ /**
+ * Desired initial rotation
+ */
+ Rotation initial_rotation;
+
+ /**
+ * Current connection status
+ *
+ * This indicates whether a monitor is known to be connected
+ * to this output or not, or whether there is no way to tell
+ */
+ xf86OutputStatus status;
+
+ /** EDID monitor information */
+ xf86MonPtr MonInfo;
+
+ /** subpixel order */
+ int subpixel_order;
+
+ /** Physical size of the currently attached output device. */
+ int mm_width, mm_height;
+
+ /** Output name */
+ char *name;
+
+ /** output-specific functions */
+ const xf86OutputFuncsRec *funcs;
+
+ /** driver private information */
+ void *driver_private;
+
+#ifdef RANDR_12_INTERFACE
+ /**
+ * RandR 1.2 output structure.
+ *
+ * When RandR 1.2 is available, this points at the associated
+ * RandR output structure and is created when this output is created
+ */
+ RROutputPtr randr_output;
+#else
+ void *randr_output;
+#endif
+};
+
+typedef struct _xf86CrtcConfigFuncs {
+ /**
+ * Requests that the driver resize the screen.
+ *
+ * The driver is responsible for updating scrn->virtualX and scrn->virtualY.
+ * If the requested size cannot be set, the driver should leave those values
+ * alone and return FALSE.
+ *
+ * A naive driver that cannot reallocate the screen may simply change
+ * virtual[XY]. A more advanced driver will want to also change the
+ * devPrivate.ptr and devKind of the screen pixmap, update any offscreen
+ * pixmaps it may have moved, and change pScrn->displayWidth.
+ */
+ Bool
+ (*resize)(ScrnInfoPtr scrn,
+ int width,
+ int height);
+} xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr;
+
+typedef struct _xf86CrtcConfig {
+ int num_output;
+ xf86OutputPtr *output;
+ /**
+ * compat_output is used whenever we deal
+ * with legacy code that only understands a single
+ * output. pScrn->modes will be loaded from this output,
+ * adjust frame will whack this output, etc.
+ */
+ int compat_output;
+
+ int num_crtc;
+ xf86CrtcPtr *crtc;
+
+ int minWidth, minHeight;
+ int maxWidth, maxHeight;
+
+ /* For crtc-based rotation */
+ DamagePtr rotation_damage;
+ Bool rotation_damage_registered;
+
+ /* DGA */
+ unsigned int dga_flags;
+ unsigned long dga_address;
+ DGAModePtr dga_modes;
+ int dga_nmode;
+ int dga_width, dga_height, dga_stride;
+ DisplayModePtr dga_save_mode;
+
+ const xf86CrtcConfigFuncsRec *funcs;
+
+ CreateScreenResourcesProcPtr CreateScreenResources;
+
+ CloseScreenProcPtr CloseScreen;
+
+ /* Cursor information */
+ xf86CursorInfoPtr cursor_info;
+ CursorPtr cursor;
+ CARD8 *cursor_image;
+ Bool cursor_on;
+ CARD32 cursor_fg, cursor_bg;
+} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
+
+extern int xf86CrtcConfigPrivateIndex;
+
+#define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr))
+
+/*
+ * Initialize xf86CrtcConfig structure
+ */
+
+void
+xf86CrtcConfigInit (ScrnInfoPtr scrn,
+ const xf86CrtcConfigFuncsRec *funcs);
+
+void
+xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
+ int minWidth, int minHeight,
+ int maxWidth, int maxHeight);
+
+/*
+ * Crtc functions
+ */
+xf86CrtcPtr
+xf86CrtcCreate (ScrnInfoPtr scrn,
+ const xf86CrtcFuncsRec *funcs);
+
+void
+xf86CrtcDestroy (xf86CrtcPtr crtc);
+
+
+/**
+ * Sets the given video mode on the given crtc
+ */
+Bool
+xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
+ int x, int y);
+
+/*
+ * Assign crtc rotation during mode set
+ */
+Bool
+xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation);
+
+/*
+ * Clean up rotation during CloseScreen
+ */
+void
+xf86RotateCloseScreen (ScreenPtr pScreen);
+
+/**
+ * Return whether any output is assigned to the crtc
+ */
+Bool
+xf86CrtcInUse (xf86CrtcPtr crtc);
+
+/*
+ * Output functions
+ */
+xf86OutputPtr
+xf86OutputCreate (ScrnInfoPtr scrn,
+ const xf86OutputFuncsRec *funcs,
+ const char *name);
+
+Bool
+xf86OutputRename (xf86OutputPtr output, const char *name);
+
+void
+xf86OutputDestroy (xf86OutputPtr output);
+
+void
+xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY);
+
+void
+xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
+
+Bool
+xf86CrtcScreenInit (ScreenPtr pScreen);
+
+Bool
+xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow);
+
+void
+xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
+
+Bool
+xf86SaveScreen(ScreenPtr pScreen, int mode);
+
+void
+xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
+
+DisplayModePtr
+xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired);
+
+Bool
+xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation);
+
+/**
+ * Set the EDID information for the specified output
+ */
+void
+xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon);
+
+/**
+ * Return the list of modes supported by the EDID information
+ * stored in 'output'
+ */
+DisplayModePtr
+xf86OutputGetEDIDModes (xf86OutputPtr output);
+
+xf86MonPtr
+xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
+
+/**
+ * Initialize dga for this screen
+ */
+
+Bool
+xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address);
+
+/**
+ * Re-initialize dga for this screen (as when the set of modes changes)
+ */
+
+Bool
+xf86DiDGAReInit (ScreenPtr pScreen);
+
+/*
+ * Set the subpixel order reported for the screen using
+ * the information from the outputs
+ */
+
+void
+xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen);
+
+/*
+ * Get a standard string name for a connector type
+ */
+char *
+xf86ConnectorGetName(xf86ConnectorType connector);
+
+/*
+ * Using the desired mode information in each crtc, set
+ * modes (used in EnterVT functions, or at server startup)
+ */
+
+Bool
+xf86SetDesiredModes (ScrnInfoPtr pScrn);
+
+/**
+ * Initialize the CRTC-based cursor code. CRTC function vectors must
+ * contain relevant cursor setting functions.
+ *
+ * Driver should call this from ScreenInit function
+ */
+Bool
+xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags);
+
+/**
+ * Called when anything on the screen is reconfigured.
+ *
+ * Reloads cursor images as needed, then adjusts cursor positions.
+ *
+ * Driver should call this from crtc commit function.
+ */
+void
+xf86_reload_cursors (ScreenPtr screen);
+
+/**
+ * Called from EnterVT to turn the cursors back on
+ */
+void
+xf86_show_cursors (ScrnInfoPtr scrn);
+
+/**
+ * Called by the driver to turn cursors off
+ */
+void
+xf86_hide_cursors (ScrnInfoPtr scrn);
+
+/**
+ * Clean up CRTC-based cursor code. Driver must call this at CloseScreen time.
+ */
+void
+xf86_cursors_fini (ScreenPtr screen);
+
+#endif /* _XF86CRTC_H_ */
diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
new file mode 100644
index 000000000..009cccf89
--- /dev/null
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -0,0 +1,607 @@
+/*
+ * Copyright © 2007 Keith Packard
+ *
+ * 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, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#include "xf86RandR12.h"
+#include "X11/extensions/render.h"
+#define DPMS_SERVER
+#include "X11/extensions/dpms.h"
+#include "X11/Xatom.h"
+#ifdef RENDER
+#include "picturestr.h"
+#endif
+#include "cursorstr.h"
+
+/*
+ * Given a screen coordinate, rotate back to a cursor source coordinate
+ */
+static void
+xf86_crtc_rotate_coord (Rotation rotation,
+ int width,
+ int height,
+ int x_dst,
+ int y_dst,
+ int *x_src,
+ int *y_src)
+{
+ if (rotation & RR_Reflect_X)
+ x_dst = width - x_dst - 1;
+ if (rotation & RR_Reflect_Y)
+ y_dst = height - y_dst - 1;
+
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ *x_src = x_dst;
+ *y_src = y_dst;
+ break;
+ case RR_Rotate_90:
+ *x_src = height - y_dst - 1;
+ *y_src = x_dst;
+ break;
+ case RR_Rotate_180:
+ *x_src = width - x_dst - 1;
+ *y_src = height - y_dst - 1;
+ break;
+ case RR_Rotate_270:
+ *x_src = y_dst;
+ *y_src = width - x_dst - 1;
+ break;
+ }
+}
+
+/*
+ * Convert an x coordinate to a position within the cursor bitmap
+ */
+static int
+cursor_bitpos (int flags, int x, Bool mask)
+{
+ if (flags & HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK)
+ mask = !mask;
+ if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED)
+ x = (x & ~3) | (3 - (x & 3));
+ if (flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST)
+ x = (x & ~7) | (7 - (x & 7));
+ if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1)
+ x = (x << 1) + mask;
+ else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8)
+ x = ((x & ~7) << 1) | (mask << 3) | (x & 7);
+ else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16)
+ x = ((x & ~15) << 1) | (mask << 4) | (x & 15);
+ else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32)
+ x = ((x & ~31) << 1) | (mask << 5) | (x & 31);
+ else if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64)
+ x = ((x & ~63) << 1) | (mask << 6) | (x & 63);
+ return x;
+}
+
+/*
+ * Fetch one bit from a cursor bitmap
+ */
+static CARD8
+get_bit (CARD8 *image, int stride, int flags, int x, int y, Bool mask)
+{
+ x = cursor_bitpos (flags, x, mask);
+ image += y * stride;
+ return (image[(x >> 3)] >> (x & 7)) & 1;
+}
+
+/*
+ * Set one bit in a cursor bitmap
+ */
+static void
+set_bit (CARD8 *image, int stride, int flags, int x, int y, Bool mask)
+{
+ x = cursor_bitpos (flags, x, mask);
+ image += y * stride;
+ image[(x >> 3)] |= 1 << (x & 7);
+}
+
+/*
+ * Load a two color cursor into a driver that supports only ARGB cursors
+ */
+static void
+xf86_crtc_convert_cursor_to_argb (xf86CrtcPtr crtc, unsigned char *src)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image;
+ int x, y;
+ int xin, yin;
+ int stride = cursor_info->MaxWidth >> 2;
+ int flags = cursor_info->Flags;
+ CARD32 bits;
+
+#ifdef ARGB_CURSOR
+ crtc->cursor_argb = FALSE;
+#endif
+
+ for (y = 0; y < cursor_info->MaxHeight; y++)
+ for (x = 0; x < cursor_info->MaxWidth; x++)
+ {
+ xf86_crtc_rotate_coord (crtc->rotation,
+ cursor_info->MaxWidth,
+ cursor_info->MaxHeight,
+ x, y, &xin, &yin);
+ if (get_bit (src, stride, flags, xin, yin, TRUE) ==
+ ((flags & HARDWARE_CURSOR_INVERT_MASK) == 0))
+ {
+ if (get_bit (src, stride, flags, xin, yin, FALSE))
+ bits = xf86_config->cursor_fg;
+ else
+ bits = xf86_config->cursor_bg;
+ }
+ else
+ bits = 0;
+ cursor_image[y * cursor_info->MaxWidth + x] = bits;
+ }
+ crtc->funcs->load_cursor_argb (crtc, cursor_image);
+}
+
+/*
+ * Set the colors for a two-color cursor (ignore for ARGB cursors)
+ */
+static void
+xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
+{
+ ScreenPtr screen = scrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ CursorPtr cursor = xf86_config->cursor;
+ int c;
+ CARD8 *bits = cursor ? cursor->devPriv[screen->myNum] : NULL;
+
+ /* Save ARGB versions of these colors */
+ xf86_config->cursor_fg = (CARD32) fg | 0xff000000;
+ xf86_config->cursor_bg = (CARD32) bg | 0xff000000;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled && !crtc->cursor_argb)
+ {
+ if (crtc->funcs->load_cursor_image)
+ crtc->funcs->set_cursor_colors (crtc, bg, fg);
+ else if (bits)
+ xf86_crtc_convert_cursor_to_argb (crtc, bits);
+ }
+ }
+}
+
+static void
+xf86_crtc_hide_cursor (xf86CrtcPtr crtc)
+{
+ if (crtc->cursor_shown)
+ {
+ crtc->funcs->hide_cursor (crtc);
+ crtc->cursor_shown = FALSE;
+ }
+}
+
+void
+xf86_hide_cursors (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ xf86_config->cursor_on = FALSE;
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ xf86_crtc_hide_cursor (crtc);
+ }
+}
+
+static void
+xf86_crtc_show_cursor (xf86CrtcPtr crtc)
+{
+ if (!crtc->cursor_shown && crtc->cursor_in_range)
+ {
+ crtc->funcs->show_cursor (crtc);
+ crtc->cursor_shown = TRUE;
+ }
+}
+
+void
+xf86_show_cursors (ScrnInfoPtr scrn)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ xf86_config->cursor_on = TRUE;
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ xf86_crtc_show_cursor (crtc);
+ }
+}
+
+static void
+xf86_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ DisplayModePtr mode = &crtc->mode;
+ int x_temp;
+ int y_temp;
+ Bool in_range;
+
+ /*
+ * Move to crtc coordinate space
+ */
+ x -= crtc->x;
+ y -= crtc->y;
+
+ /*
+ * Rotate
+ */
+ switch ((crtc->rotation) & 0xf) {
+ case RR_Rotate_0:
+ break;
+ case RR_Rotate_90:
+ x_temp = y;
+ y_temp = mode->VDisplay - cursor_info->MaxWidth - x;
+ x = x_temp;
+ y = y_temp;
+ break;
+ case RR_Rotate_180:
+ x_temp = mode->HDisplay - cursor_info->MaxWidth - x;
+ y_temp = mode->VDisplay - cursor_info->MaxHeight - y;
+ x = x_temp;
+ y = y_temp;
+ break;
+ case RR_Rotate_270:
+ x_temp = mode->HDisplay - cursor_info->MaxHeight - y;
+ y_temp = x;
+ x = x_temp;
+ y = y_temp;
+ break;
+ }
+
+ /*
+ * Reflect
+ */
+ if (crtc->rotation & RR_Reflect_X)
+ x = mode->HDisplay - cursor_info->MaxWidth - x;
+ if (crtc->rotation & RR_Reflect_Y)
+ y = mode->VDisplay - cursor_info->MaxHeight - y;
+
+ /*
+ * Disable the cursor when it is outside the viewport
+ */
+ in_range = TRUE;
+ if (x >= mode->HDisplay || y >= mode->VDisplay ||
+ x <= -cursor_info->MaxWidth || y <= -cursor_info->MaxHeight)
+ {
+ in_range = FALSE;
+ x = 0;
+ y = 0;
+ }
+
+ crtc->cursor_in_range = in_range;
+
+ if (in_range)
+ {
+ crtc->funcs->set_cursor_position (crtc, x, y);
+ xf86_crtc_show_cursor (crtc);
+ }
+ else
+ xf86_crtc_hide_cursor (crtc);
+}
+
+static void
+xf86_set_cursor_position (ScrnInfoPtr scrn, int x, int y)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ /* undo what xf86HWCurs did to the coordinates */
+ x += scrn->frameX0;
+ y += scrn->frameY0;
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ xf86_crtc_set_cursor_position (crtc, x, y);
+ }
+}
+
+/*
+ * Load a two-color cursor into a crtc, performing rotation as needed
+ */
+static void
+xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ CARD8 *cursor_image;
+
+#ifdef ARGB_CURSOR
+ crtc->cursor_argb = FALSE;
+#endif
+
+ if (crtc->rotation == RR_Rotate_0)
+ cursor_image = src;
+ else
+ {
+ int x, y;
+ int xin, yin;
+ int stride = cursor_info->MaxWidth >> 2;
+ int flags = cursor_info->Flags;
+
+ cursor_image = xf86_config->cursor_image;
+ memset(cursor_image, 0, cursor_info->MaxWidth * stride);
+
+ for (y = 0; y < cursor_info->MaxHeight; y++)
+ for (x = 0; x < cursor_info->MaxWidth; x++)
+ {
+ xf86_crtc_rotate_coord (crtc->rotation,
+ cursor_info->MaxWidth,
+ cursor_info->MaxHeight,
+ x, y, &xin, &yin);
+ if (get_bit(src, stride, flags, xin, yin, FALSE))
+ set_bit(cursor_image, stride, flags, x, y, FALSE);
+ if (get_bit(src, stride, flags, xin, yin, TRUE))
+ set_bit(cursor_image, stride, flags, x, y, TRUE);
+ }
+ }
+ crtc->funcs->load_cursor_image (crtc, cursor_image);
+}
+
+/*
+ * Load a cursor image into all active CRTCs
+ */
+static void
+xf86_load_cursor_image (ScrnInfoPtr scrn, unsigned char *src)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ {
+ if (crtc->funcs->load_cursor_image)
+ xf86_crtc_load_cursor_image (crtc, src);
+ else if (crtc->funcs->load_cursor_argb)
+ xf86_crtc_convert_cursor_to_argb (crtc, src);
+ }
+ }
+}
+
+static Bool
+xf86_use_hw_cursor (ScreenPtr screen, CursorPtr cursor)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+
+ xf86_config->cursor = cursor;
+
+ if (cursor->bits->width > cursor_info->MaxWidth ||
+ cursor->bits->height> cursor_info->MaxHeight)
+ return FALSE;
+
+ return TRUE;
+}
+
+static Bool
+xf86_use_hw_cursor_argb (ScreenPtr screen, CursorPtr cursor)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+
+ xf86_config->cursor = cursor;
+
+ /* Make sure ARGB support is available */
+ if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
+ return FALSE;
+
+ if (cursor->bits->width > cursor_info->MaxWidth ||
+ cursor->bits->height> cursor_info->MaxHeight)
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+xf86_crtc_load_cursor_argb (xf86CrtcPtr crtc, CursorPtr cursor)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ CARD32 *cursor_image = (CARD32 *) xf86_config->cursor_image;
+ CARD32 *cursor_source = (CARD32 *) cursor->bits->argb;
+ int x, y;
+ int xin, yin;
+ CARD32 bits;
+ int source_width = cursor->bits->width;
+ int source_height = cursor->bits->height;
+ int image_width = cursor_info->MaxWidth;
+ int image_height = cursor_info->MaxHeight;
+
+ for (y = 0; y < image_height; y++)
+ for (x = 0; x < image_width; x++)
+ {
+ xf86_crtc_rotate_coord (crtc->rotation, image_width, image_height,
+ x, y, &xin, &yin);
+ if (xin < source_width && yin < source_height)
+ bits = cursor_source[yin * source_width + xin];
+ else
+ bits = 0;
+ cursor_image[y * image_width + x] = bits;
+ }
+
+ crtc->funcs->load_cursor_argb (crtc, cursor_image);
+}
+
+static void
+xf86_load_cursor_argb (ScrnInfoPtr scrn, CursorPtr cursor)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->enabled)
+ xf86_crtc_load_cursor_argb (crtc, cursor);
+ }
+}
+
+Bool
+xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ xf86CursorInfoPtr cursor_info;
+
+ cursor_info = xf86CreateCursorInfoRec();
+ if (!cursor_info)
+ return FALSE;
+
+ xf86_config->cursor_image = xalloc (max_width * max_height * 4);
+
+ if (!xf86_config->cursor_image)
+ {
+ xf86DestroyCursorInfoRec (cursor_info);
+ return FALSE;
+ }
+
+ xf86_config->cursor_info = cursor_info;
+
+ cursor_info->MaxWidth = max_width;
+ cursor_info->MaxHeight = max_height;
+ cursor_info->Flags = flags;
+
+ cursor_info->SetCursorColors = xf86_set_cursor_colors;
+ cursor_info->SetCursorPosition = xf86_set_cursor_position;
+ cursor_info->LoadCursorImage = xf86_load_cursor_image;
+ cursor_info->HideCursor = xf86_hide_cursors;
+ cursor_info->ShowCursor = xf86_show_cursors;
+ cursor_info->UseHWCursor = xf86_use_hw_cursor;
+#ifdef ARGB_CURSOR
+ if (flags & HARDWARE_CURSOR_ARGB)
+ {
+ cursor_info->UseHWCursorARGB = xf86_use_hw_cursor_argb;
+ cursor_info->LoadCursorARGB = xf86_load_cursor_argb;
+ }
+#endif
+
+ xf86_config->cursor = NULL;
+ xf86_hide_cursors (scrn);
+
+ return xf86InitCursor (screen, cursor_info);
+}
+
+/**
+ * Called when anything on the screen is reconfigured.
+ *
+ * Reloads cursor images as needed, then adjusts cursor positions
+ */
+
+void
+xf86_reload_cursors (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn;
+ xf86CrtcConfigPtr xf86_config;
+ xf86CursorInfoPtr cursor_info;
+ CursorPtr cursor;
+ int x, y;
+
+ /* initial mode setting will not have set a screen yet */
+ if (!screen)
+ return;
+ scrn = xf86Screens[screen->myNum];
+ xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ /* make sure the cursor code has been initialized */
+ cursor_info = xf86_config->cursor_info;
+ if (!cursor_info)
+ return;
+
+ cursor = xf86_config->cursor;
+ GetSpritePosition (&x, &y);
+ if (!(cursor_info->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
+ (*cursor_info->HideCursor)(scrn);
+
+ if (cursor)
+ {
+#ifdef ARGB_CURSOR
+ if (cursor->bits->argb && cursor_info->LoadCursorARGB)
+ (*cursor_info->LoadCursorARGB) (scrn, cursor);
+ else
+#endif
+ (*cursor_info->LoadCursorImage)(cursor_info->pScrn,
+ cursor->devPriv[screen->myNum]);
+
+ (*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y);
+ (*cursor_info->ShowCursor)(cursor_info->pScrn);
+ }
+}
+
+/**
+ * Clean up CRTC-based cursor code
+ */
+void
+xf86_cursors_fini (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (xf86_config->cursor_info)
+ {
+ xf86DestroyCursorInfoRec (xf86_config->cursor_info);
+ xf86_config->cursor_info = NULL;
+ }
+ if (xf86_config->cursor_image)
+ {
+ xfree (xf86_config->cursor_image);
+ xf86_config->cursor_image = NULL;
+ }
+}
diff --git a/hw/xfree86/modes/xf86DiDGA.c b/hw/xfree86/modes/xf86DiDGA.c
new file mode 100644
index 000000000..0964cefa7
--- /dev/null
+++ b/hw/xfree86/modes/xf86DiDGA.c
@@ -0,0 +1,286 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * 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, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include "xf86_OSproc.h"
+#include "dgaproc.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#include "gcstruct.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+
+static Bool
+xf86_dga_get_modes (ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ DGAModePtr modes, mode;
+ DisplayModePtr display_mode;
+ int bpp = scrn->bitsPerPixel >> 3;
+ int num;
+
+ num = 0;
+ display_mode = scrn->modes;
+ while (display_mode)
+ {
+ num++;
+ display_mode = display_mode->next;
+ if (display_mode == scrn->modes)
+ break;
+ }
+
+ if (!num)
+ return FALSE;
+
+ modes = xalloc(num * sizeof(DGAModeRec));
+ if (!modes)
+ return FALSE;
+
+ num = 0;
+ display_mode = scrn->modes;
+ while (display_mode)
+ {
+ mode = modes + num++;
+
+ mode->mode = display_mode;
+ mode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE;
+ mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
+ if (display_mode->Flags & V_DBLSCAN)
+ mode->flags |= DGA_DOUBLESCAN;
+ if (display_mode->Flags & V_INTERLACE)
+ mode->flags |= DGA_INTERLACED;
+ mode->byteOrder = scrn->imageByteOrder;
+ mode->depth = scrn->depth;
+ mode->bitsPerPixel = scrn->bitsPerPixel;
+ mode->red_mask = scrn->mask.red;
+ mode->green_mask = scrn->mask.green;
+ mode->blue_mask = scrn->mask.blue;
+ mode->visualClass = (bpp == 1) ? PseudoColor : TrueColor;
+ mode->viewportWidth = display_mode->HDisplay;
+ mode->viewportHeight = display_mode->VDisplay;
+ mode->xViewportStep = (bpp == 3) ? 2 : 1;
+ mode->yViewportStep = 1;
+ mode->viewportFlags = DGA_FLIP_RETRACE;
+ mode->offset = 0;
+ mode->address = (unsigned char *) xf86_config->dga_address;
+ mode->bytesPerScanline = xf86_config->dga_stride;
+ mode->imageWidth = xf86_config->dga_width;
+ mode->imageHeight = xf86_config->dga_height;
+ mode->pixmapWidth = mode->imageWidth;
+ mode->pixmapHeight = mode->imageHeight;
+ mode->maxViewportX = mode->imageWidth - mode->viewportWidth;
+ mode->maxViewportY = mode->imageHeight - mode->viewportHeight;
+
+ display_mode = display_mode->next;
+ if (display_mode == scrn->modes)
+ break;
+ }
+ if (xf86_config->dga_modes)
+ xfree (xf86_config->dga_modes);
+ xf86_config->dga_nmode = num;
+ xf86_config->dga_modes = modes;
+ return TRUE;
+}
+
+static Bool
+xf86_dga_set_mode(ScrnInfoPtr scrn, DGAModePtr display_mode)
+{
+ ScreenPtr pScreen = scrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (!display_mode)
+ {
+ if (xf86_config->dga_save_mode)
+ {
+ xf86SwitchMode(pScreen, xf86_config->dga_save_mode);
+ xf86_config->dga_save_mode = NULL;
+ }
+ }
+ else
+ {
+ if (!xf86_config->dga_save_mode)
+ {
+ xf86_config->dga_save_mode = scrn->currentMode;
+ xf86SwitchMode(pScreen, display_mode->mode);
+ }
+ }
+ return TRUE;
+}
+
+static int
+xf86_dga_get_viewport(ScrnInfoPtr scrn)
+{
+ return 0;
+}
+
+static void
+xf86_dga_set_viewport(ScrnInfoPtr scrn, int x, int y, int flags)
+{
+ scrn->AdjustFrame(scrn->pScreen->myNum, x, y, flags);
+}
+
+static Bool
+xf86_dga_get_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr *ppDrawable, GCPtr *ppGC)
+{
+ ScreenPtr pScreen = scrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ PixmapPtr pPixmap;
+ GCPtr pGC;
+
+ pPixmap = GetScratchPixmapHeader (pScreen, xf86_config->dga_width, xf86_config->dga_height,
+ scrn->depth, scrn->bitsPerPixel, xf86_config->dga_stride,
+ (char *) scrn->memPhysBase + scrn->fbOffset);
+ if (!pPixmap)
+ return FALSE;
+ pGC = GetScratchGC (scrn->depth, pScreen);
+ if (!pGC)
+ {
+ FreeScratchPixmapHeader (pPixmap);
+ return FALSE;
+ }
+ *ppDrawable = &pPixmap->drawable;
+ *ppGC = pGC;
+ return TRUE;
+}
+
+static void
+xf86_dga_release_drawable_and_gc (ScrnInfoPtr scrn, DrawablePtr pDrawable, GCPtr pGC)
+{
+ FreeScratchGC (pGC);
+ FreeScratchPixmapHeader ((PixmapPtr) pDrawable);
+}
+
+static void
+xf86_dga_fill_rect(ScrnInfoPtr scrn, int x, int y, int w, int h, unsigned long color)
+{
+ GCPtr pGC;
+ DrawablePtr pDrawable;
+ XID vals[1];
+ xRectangle r;
+
+ if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC))
+ return;
+ vals[0] = color;
+ ChangeGC (pGC, GCForeground, vals);
+ ValidateGC (pDrawable, pGC);
+ r.x = x;
+ r.y = y;
+ r.width = w;
+ r.height = h;
+ pGC->ops->PolyFillRect (pDrawable, pGC, 1, &r);
+ xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC);
+}
+
+static void
+xf86_dga_sync(ScrnInfoPtr scrn)
+{
+ ScreenPtr pScreen = scrn->pScreen;
+ WindowPtr pRoot = WindowTable [pScreen->myNum];
+ char buffer[4];
+
+ pScreen->GetImage (&pRoot->drawable, 0, 0, 1, 1, ZPixmap, ~0L, buffer);
+}
+
+static void
+xf86_dga_blit_rect(ScrnInfoPtr scrn, int srcx, int srcy, int w, int h, int dstx, int dsty)
+{
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+
+ if (!xf86_dga_get_drawable_and_gc (scrn, &pDrawable, &pGC))
+ return;
+ ValidateGC (pDrawable, pGC);
+ pGC->ops->CopyArea (pDrawable, pDrawable, pGC, srcx, srcy, w, h, dstx, dsty);
+ xf86_dga_release_drawable_and_gc (scrn, pDrawable, pGC);
+}
+
+static Bool
+xf86_dga_open_framebuffer(ScrnInfoPtr scrn,
+ char **name,
+ unsigned char **mem, int *size, int *offset, int *flags)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ *size = xf86_config->dga_stride * xf86_config->dga_height;
+ *mem = (unsigned char *) (xf86_config->dga_address);
+ *offset = 0;
+ *flags = DGA_NEED_ROOT;
+
+ return TRUE;
+}
+
+static void
+xf86_dga_close_framebuffer(ScrnInfoPtr scrn)
+{
+}
+
+static DGAFunctionRec xf86_dga_funcs = {
+ xf86_dga_open_framebuffer,
+ xf86_dga_close_framebuffer,
+ xf86_dga_set_mode,
+ xf86_dga_set_viewport,
+ xf86_dga_get_viewport,
+ xf86_dga_sync,
+ xf86_dga_fill_rect,
+ xf86_dga_blit_rect,
+ NULL
+};
+
+Bool
+xf86DiDGAReInit (ScreenPtr pScreen)
+{
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ if (!xf86_dga_get_modes (pScreen))
+ return FALSE;
+
+ return DGAReInitModes (pScreen, xf86_config->dga_modes, xf86_config->dga_nmode);
+}
+
+Bool
+xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address)
+{
+ ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+
+ xf86_config->dga_flags = 0;
+ xf86_config->dga_address = dga_address;
+ xf86_config->dga_width = scrn->virtualX;
+ xf86_config->dga_height = scrn->virtualY;
+ xf86_config->dga_stride = scrn->displayWidth * scrn->bitsPerPixel >> 3;
+
+ if (!xf86_dga_get_modes (pScreen))
+ return FALSE;
+
+ return DGAInit(pScreen, &xf86_dga_funcs, xf86_config->dga_modes, xf86_config->dga_nmode);
+}
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
new file mode 100644
index 000000000..c4cf6870b
--- /dev/null
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -0,0 +1,490 @@
+/*
+ * Copyright 2006 Luc Verhaegen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * 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.
+ */
+
+/**
+ * @file This is a copy of edid_modes.c from the X Server, for compatibility
+ * with old X Servers.
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include <X11/Xatom.h>
+#include "property.h"
+#include "propertyst.h"
+#include "xf86DDC.h"
+#include "xf86Crtc.h"
+#include <string.h>
+#include <math.h>
+
+/*
+ * Quirks to work around broken EDID data from various monitors.
+ */
+
+typedef enum {
+ DDC_QUIRK_NONE = 0,
+ /* Force detailed sync polarity to -h +v */
+ DDC_QUIRK_DT_SYNC_HM_VP = 1 << 0,
+ /* First detailed mode is bogus, prefer largest mode at 60hz */
+ DDC_QUIRK_PREFER_LARGE_60 = 1 << 1,
+ /* 135MHz clock is too high, drop a bit */
+ DDC_QUIRK_135_CLOCK_TOO_HIGH = 1 << 2
+} ddc_quirk_t;
+
+static Bool quirk_dt_sync_hm_vp (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Belinea 1924S1W */
+ if (memcmp (DDC->vendor.name, "MAX", 4) == 0 &&
+ DDC->vendor.prod_id == 1932)
+ return TRUE;
+ /* Belinea 10 20 30W */
+ if (memcmp (DDC->vendor.name, "MAX", 4) == 0 &&
+ DDC->vendor.prod_id == 2007)
+ return TRUE;
+ /* ViewSonic VX2025wm (bug #9941) */
+ if (memcmp (DDC->vendor.name, "VSC", 4) == 0 &&
+ DDC->vendor.prod_id == 58653)
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Belinea 10 15 55 */
+ if (memcmp (DDC->vendor.name, "MAX", 4) == 0 &&
+ DDC->vendor.prod_id == 1516)
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool quirk_135_clock_too_high (int scrnIndex, xf86MonPtr DDC)
+{
+ /* Envision Peripherals, Inc. EN-7100e. See bug #9550. */
+ if (memcmp (DDC->vendor.name, "EPI", 4) == 0 &&
+ DDC->vendor.prod_id == 59264)
+ return TRUE;
+
+ return FALSE;
+}
+
+typedef struct {
+ Bool (*detect) (int scrnIndex, xf86MonPtr DDC);
+ ddc_quirk_t quirk;
+ char *description;
+} ddc_quirk_map_t;
+
+static const ddc_quirk_map_t ddc_quirks[] = {
+ {
+ quirk_dt_sync_hm_vp, DDC_QUIRK_DT_SYNC_HM_VP,
+ "Set detailed timing sync polarity to -h +v"
+ },
+ {
+ quirk_prefer_large_60, DDC_QUIRK_PREFER_LARGE_60,
+ "Detailed timing is not preferred, use largest mode at 60Hz"
+ },
+ {
+ quirk_135_clock_too_high, DDC_QUIRK_135_CLOCK_TOO_HIGH,
+ "Recommended 135MHz pixel clock is too high"
+ },
+ {
+ NULL, DDC_QUIRK_NONE,
+ "No known quirks"
+ },
+};
+
+/*
+ * TODO:
+ * - for those with access to the VESA DMT standard; review please.
+ */
+#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DRIVER
+#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
+
+static DisplayModeRec DDCEstablishedModes[17] = {
+ { MODEPREFIX("800x600"), 40000, 800, 840, 968, 1056, 0, 600, 601, 605, 628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@60Hz */
+ { MODEPREFIX("800x600"), 36000, 800, 824, 896, 1024, 0, 600, 601, 603, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@56Hz */
+ { MODEPREFIX("640x480"), 31500, 640, 656, 720, 840, 0, 480, 481, 484, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@75Hz */
+ { MODEPREFIX("640x480"), 31500, 640, 664, 704, 832, 0, 480, 489, 491, 520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@72Hz */
+ { MODEPREFIX("640x480"), 30240, 640, 704, 768, 864, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@67Hz */
+ { MODEPREFIX("640x480"), 25200, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480@60Hz */
+ { MODEPREFIX("720x400"), 35500, 720, 738, 846, 900, 0, 400, 421, 423, 449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400@88Hz */
+ { MODEPREFIX("720x400"), 28320, 720, 738, 846, 900, 0, 400, 412, 414, 449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400@70Hz */
+ { MODEPREFIX("1280x1024"), 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024@75Hz */
+ { MODEPREFIX("1024x768"), 78800, 1024, 1040, 1136, 1312, 0, 768, 769, 772, 800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768@75Hz */
+ { MODEPREFIX("1024x768"), 75000, 1024, 1048, 1184, 1328, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@70Hz */
+ { MODEPREFIX("1024x768"), 65000, 1024, 1048, 1184, 1344, 0, 768, 771, 777, 806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768@60Hz */
+ { MODEPREFIX("1024x768"), 44900, 1024, 1032, 1208, 1264, 0, 768, 768, 776, 817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768@43Hz */
+ { MODEPREFIX("832x624"), 57284, 832, 864, 928, 1152, 0, 624, 625, 628, 667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624@75Hz */
+ { MODEPREFIX("800x600"), 49500, 800, 816, 896, 1056, 0, 600, 601, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@75Hz */
+ { MODEPREFIX("800x600"), 50000, 800, 856, 976, 1040, 0, 600, 637, 643, 666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600@72Hz */
+ { MODEPREFIX("1152x864"), 108000, 1152, 1216, 1344, 1600, 0, 864, 865, 868, 900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864@75Hz */
+};
+
+static DisplayModePtr
+DDCModesFromEstablished(int scrnIndex, struct established_timings *timing,
+ ddc_quirk_t quirks)
+{
+ DisplayModePtr Modes = NULL, Mode = NULL;
+ CARD32 bits = (timing->t1) | (timing->t2 << 8) |
+ ((timing->t_manu & 0x80) << 9);
+ int i;
+
+ for (i = 0; i < 17; i++) {
+ if (bits & (0x01 << i)) {
+ Mode = xf86DuplicateMode(&DDCEstablishedModes[i]);
+ Modes = xf86ModesAdd(Modes, Mode);
+ }
+ }
+
+ return Modes;
+}
+
+/*
+ *
+ */
+static DisplayModePtr
+DDCModesFromStandardTiming(int scrnIndex, struct std_timings *timing,
+ ddc_quirk_t quirks)
+{
+ DisplayModePtr Modes = NULL, Mode = NULL;
+ int i;
+
+ for (i = 0; i < STD_TIMINGS; i++) {
+ if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
+ Mode = xf86CVTMode(timing[i].hsize, timing[i].vsize,
+ timing[i].refresh, FALSE, FALSE);
+ Mode->type = M_T_DRIVER;
+ Modes = xf86ModesAdd(Modes, Mode);
+ }
+ }
+
+ return Modes;
+}
+
+/*
+ *
+ */
+static DisplayModePtr
+DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
+ int preferred, ddc_quirk_t quirks)
+{
+ DisplayModePtr Mode;
+
+ /* We don't do stereo */
+ if (timing->stereo) {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "%s: Ignoring: We don't handle stereo.\n", __func__);
+ return NULL;
+ }
+
+ /* We only do seperate sync currently */
+ if (timing->sync != 0x03) {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "%s: %dx%d Warning: We only handle seperate"
+ " sync.\n", __func__, timing->h_active, timing->v_active);
+ }
+
+ Mode = xnfalloc(sizeof(DisplayModeRec));
+ memset(Mode, 0, sizeof(DisplayModeRec));
+
+ Mode->type = M_T_DRIVER;
+ if (preferred)
+ Mode->type |= M_T_PREFERRED;
+
+ if( ( quirks & DDC_QUIRK_135_CLOCK_TOO_HIGH ) &&
+ timing->clock == 135000000 )
+ Mode->Clock = 108880;
+ else
+ Mode->Clock = timing->clock / 1000.0;
+
+ Mode->HDisplay = timing->h_active;
+ Mode->HSyncStart = timing->h_active + timing->h_sync_off;
+ Mode->HSyncEnd = Mode->HSyncStart + timing->h_sync_width;
+ Mode->HTotal = timing->h_active + timing->h_blanking;
+
+ Mode->VDisplay = timing->v_active;
+ Mode->VSyncStart = timing->v_active + timing->v_sync_off;
+ Mode->VSyncEnd = Mode->VSyncStart + timing->v_sync_width;
+ Mode->VTotal = timing->v_active + timing->v_blanking;
+
+ xf86SetModeDefaultName(Mode);
+
+ /* We ignore h/v_size and h/v_border for now. */
+
+ if (timing->interlaced)
+ Mode->Flags |= V_INTERLACE;
+
+ if (quirks & DDC_QUIRK_DT_SYNC_HM_VP)
+ Mode->Flags |= V_NHSYNC | V_PVSYNC;
+ else
+ {
+ if (timing->misc & 0x02)
+ Mode->Flags |= V_PHSYNC;
+ else
+ Mode->Flags |= V_NHSYNC;
+
+ if (timing->misc & 0x01)
+ Mode->Flags |= V_PVSYNC;
+ else
+ Mode->Flags |= V_NVSYNC;
+ }
+
+ return Mode;
+}
+
+/*
+ *
+ */
+static void
+DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
+{
+ DisplayModePtr Mode = Modes;
+
+ if (!Monitor || !Modes)
+ return;
+
+ /* set up the ranges for scanning through the modes */
+ Monitor->nHsync = 1;
+ Monitor->hsync[0].lo = 1024.0;
+ Monitor->hsync[0].hi = 0.0;
+
+ Monitor->nVrefresh = 1;
+ Monitor->vrefresh[0].lo = 1024.0;
+ Monitor->vrefresh[0].hi = 0.0;
+
+ while (Mode) {
+ if (!Mode->HSync)
+ Mode->HSync = ((float) Mode->Clock ) / ((float) Mode->HTotal);
+
+ if (!Mode->VRefresh)
+ Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
+ ((float) (Mode->HTotal * Mode->VTotal));
+
+ if (Mode->HSync < Monitor->hsync[0].lo)
+ Monitor->hsync[0].lo = Mode->HSync;
+
+ if (Mode->HSync > Monitor->hsync[0].hi)
+ Monitor->hsync[0].hi = Mode->HSync;
+
+ if (Mode->VRefresh < Monitor->vrefresh[0].lo)
+ Monitor->vrefresh[0].lo = Mode->VRefresh;
+
+ if (Mode->VRefresh > Monitor->vrefresh[0].hi)
+ Monitor->vrefresh[0].hi = Mode->VRefresh;
+
+ Mode = Mode->next;
+ }
+}
+
+DisplayModePtr
+xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
+{
+ int preferred, i;
+ DisplayModePtr Modes = NULL, Mode;
+ ddc_quirk_t quirks;
+
+ xf86DrvMsg (scrnIndex, X_INFO, "EDID vendor \"%s\", prod id %d\n",
+ DDC->vendor.name, DDC->vendor.prod_id);
+ quirks = DDC_QUIRK_NONE;
+ for (i = 0; ddc_quirks[i].detect; i++)
+ if (ddc_quirks[i].detect (scrnIndex, DDC))
+ {
+ xf86DrvMsg (scrnIndex, X_INFO, " EDID quirk: %s\n",
+ ddc_quirks[i].description);
+ quirks |= ddc_quirks[i].quirk;
+ }
+
+ preferred = PREFERRED_TIMING_MODE(DDC->features.msc);
+ if (quirks & DDC_QUIRK_PREFER_LARGE_60)
+ preferred = 0;
+
+ for (i = 0; i < DET_TIMINGS; i++) {
+ struct detailed_monitor_section *det_mon = &DDC->det_mon[i];
+
+ switch (det_mon->type) {
+ case DT:
+ Mode = DDCModeFromDetailedTiming(scrnIndex,
+ &det_mon->section.d_timings,
+ preferred,
+ quirks);
+ preferred = 0;
+ Modes = xf86ModesAdd(Modes, Mode);
+ break;
+ case DS_STD_TIMINGS:
+ Mode = DDCModesFromStandardTiming(scrnIndex,
+ det_mon->section.std_t,
+ quirks);
+ Modes = xf86ModesAdd(Modes, Mode);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* Add established timings */
+ Mode = DDCModesFromEstablished(scrnIndex, &DDC->timings1, quirks);
+ Modes = xf86ModesAdd(Modes, Mode);
+
+ /* Add standard timings */
+ Mode = DDCModesFromStandardTiming(scrnIndex, DDC->timings2, quirks);
+ Modes = xf86ModesAdd(Modes, Mode);
+
+ if (quirks & DDC_QUIRK_PREFER_LARGE_60)
+ {
+ DisplayModePtr best = Modes;
+ for (Mode = Modes; Mode; Mode = Mode->next)
+ {
+ if (Mode == best) continue;
+ if (Mode->HDisplay * Mode->VDisplay > best->HDisplay * best->VDisplay)
+ {
+ best = Mode;
+ continue;
+ }
+ if (Mode->HDisplay * Mode->VDisplay == best->HDisplay * best->VDisplay)
+ {
+ double mode_refresh = xf86ModeVRefresh (Mode);
+ double best_refresh = xf86ModeVRefresh (best);
+ double mode_dist = fabs(mode_refresh - 60.0);
+ double best_dist = fabs(best_refresh - 60.0);
+ if (mode_dist < best_dist)
+ {
+ best = Mode;
+ continue;
+ }
+ }
+ }
+ if (best)
+ best->type |= M_T_PREFERRED;
+ }
+ return Modes;
+}
+
+/*
+ * Fill out MonPtr with xf86MonPtr information.
+ */
+void
+xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
+{
+ DisplayModePtr Modes = NULL, Mode;
+ int i, clock;
+ Bool have_hsync = FALSE, have_vrefresh = FALSE;
+
+ if (!Monitor || !DDC)
+ return;
+
+ Monitor->DDC = DDC;
+
+ Monitor->widthmm = 10 * DDC->features.hsize;
+ Monitor->heightmm = 10 * DDC->features.vsize;
+
+ /* If this is a digital display, then we can use reduced blanking */
+ if (DDC->features.input_type)
+ Monitor->reducedblanking = TRUE;
+ /* Allow the user to also enable this through config */
+
+ Modes = xf86DDCGetModes(scrnIndex, DDC);
+
+ /* Skip EDID ranges if they were specified in the config file */
+ have_hsync = (Monitor->nHsync != 0);
+ have_vrefresh = (Monitor->nVrefresh != 0);
+
+ /* Go through the detailed monitor sections */
+ for (i = 0; i < DET_TIMINGS; i++) {
+ switch (DDC->det_mon[i].type) {
+ case DS_RANGES:
+ if (!have_hsync) {
+ if (!Monitor->nHsync)
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Using EDID range info for horizontal sync\n");
+ Monitor->hsync[Monitor->nHsync].lo =
+ DDC->det_mon[i].section.ranges.min_h;
+ Monitor->hsync[Monitor->nHsync].hi =
+ DDC->det_mon[i].section.ranges.max_h;
+ Monitor->nHsync++;
+ } else {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Using hsync ranges from config file\n");
+ }
+
+ if (!have_vrefresh) {
+ if (!Monitor->nVrefresh)
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Using EDID range info for vertical refresh\n");
+ Monitor->vrefresh[Monitor->nVrefresh].lo =
+ DDC->det_mon[i].section.ranges.min_v;
+ Monitor->vrefresh[Monitor->nVrefresh].hi =
+ DDC->det_mon[i].section.ranges.max_v;
+ Monitor->nVrefresh++;
+ } else {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Using vrefresh ranges from config file\n");
+ }
+
+ clock = DDC->det_mon[i].section.ranges.max_clock * 1000;
+ if (clock > Monitor->maxPixClock)
+ Monitor->maxPixClock = clock;
+
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (Modes) {
+ /* Print Modes */
+ xf86DrvMsg(scrnIndex, X_INFO, "Printing DDC gathered Modelines:\n");
+
+ Mode = Modes;
+ while (Mode) {
+ xf86PrintModeline(scrnIndex, Mode);
+ Mode = Mode->next;
+ }
+
+ /* Do we still need ranges to be filled in? */
+ if (!Monitor->nHsync || !Monitor->nVrefresh)
+ DDCGuessRangesFromModes(scrnIndex, Monitor, Modes);
+
+ /* look for last Mode */
+ Mode = Modes;
+
+ while (Mode->next)
+ Mode = Mode->next;
+
+ /* add to MonPtr */
+ if (Monitor->Modes) {
+ Monitor->Last->next = Modes;
+ Modes->prev = Monitor->Last;
+ Monitor->Last = Mode;
+ } else {
+ Monitor->Modes = Modes;
+ Monitor->Last = Mode;
+ }
+ }
+}
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
new file mode 100644
index 000000000..5b52bd76c
--- /dev/null
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -0,0 +1,664 @@
+/* -*- c-basic-offset: 4 -*- */
+/* $XdotOrg: xserver/xorg/hw/xfree86/common/xf86Mode.c,v 1.10 2006/03/07 16:00:57 libv Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.69 2003/10/08 14:58:28 dawes Exp $ */
+/*
+ * Copyright (c) 1997-2003 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>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86Modes.h"
+#include "xf86Priv.h"
+
+extern XF86ConfigPtr xf86configptr;
+
+/**
+ * @file this file contains symbols from xf86Mode.c and friends that are static
+ * there but we still want to use. We need to come up with better API here.
+ */
+
+#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,2,99,2,0)
+/**
+ * Calculates the horizontal sync rate of a mode.
+ *
+ * Exact copy of xf86Mode.c's.
+ */
+double
+xf86ModeHSync(DisplayModePtr mode)
+{
+ double hsync = 0.0;
+
+ if (mode->HSync > 0.0)
+ hsync = mode->HSync;
+ else if (mode->HTotal > 0)
+ hsync = (float)mode->Clock / (float)mode->HTotal;
+
+ return hsync;
+}
+
+/**
+ * Calculates the vertical refresh rate of a mode.
+ *
+ * Exact copy of xf86Mode.c's.
+ */
+double
+xf86ModeVRefresh(DisplayModePtr mode)
+{
+ double refresh = 0.0;
+
+ if (mode->VRefresh > 0.0)
+ refresh = mode->VRefresh;
+ else if (mode->HTotal > 0 && mode->VTotal > 0) {
+ refresh = mode->Clock * 1000.0 / mode->HTotal / mode->VTotal;
+ if (mode->Flags & V_INTERLACE)
+ refresh *= 2.0;
+ if (mode->Flags & V_DBLSCAN)
+ refresh /= 2.0;
+ if (mode->VScan > 1)
+ refresh /= (float)(mode->VScan);
+ }
+ return refresh;
+}
+
+int
+xf86ModeWidth (DisplayModePtr mode, Rotation rotation)
+{
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ case RR_Rotate_180:
+ return mode->HDisplay;
+ case RR_Rotate_90:
+ case RR_Rotate_270:
+ return mode->VDisplay;
+ default:
+ return 0;
+ }
+}
+
+int
+xf86ModeHeight (DisplayModePtr mode, Rotation rotation)
+{
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ case RR_Rotate_180:
+ return mode->VDisplay;
+ case RR_Rotate_90:
+ case RR_Rotate_270:
+ return mode->HDisplay;
+ default:
+ return 0;
+ }
+}
+
+/** Sets a default mode name of <width>x<height> on a mode. */
+void
+xf86SetModeDefaultName(DisplayModePtr mode)
+{
+ if (mode->name != NULL)
+ xfree(mode->name);
+
+ mode->name = XNFprintf("%dx%d", mode->HDisplay, mode->VDisplay);
+}
+
+/*
+ * xf86SetModeCrtc
+ *
+ * Initialises the Crtc parameters for a mode. The initialisation includes
+ * adjustments for interlaced and double scan modes.
+ *
+ * Exact copy of xf86Mode.c's.
+ */
+void
+xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
+{
+ if ((p == NULL) || ((p->type & M_T_CRTC_C) == M_T_BUILTIN))
+ return;
+
+ p->CrtcHDisplay = p->HDisplay;
+ p->CrtcHSyncStart = p->HSyncStart;
+ p->CrtcHSyncEnd = p->HSyncEnd;
+ p->CrtcHTotal = p->HTotal;
+ p->CrtcHSkew = p->HSkew;
+ p->CrtcVDisplay = p->VDisplay;
+ p->CrtcVSyncStart = p->VSyncStart;
+ p->CrtcVSyncEnd = p->VSyncEnd;
+ p->CrtcVTotal = p->VTotal;
+ if (p->Flags & V_INTERLACE) {
+ if (adjustFlags & INTERLACE_HALVE_V) {
+ p->CrtcVDisplay /= 2;
+ p->CrtcVSyncStart /= 2;
+ p->CrtcVSyncEnd /= 2;
+ p->CrtcVTotal /= 2;
+ }
+ /* Force interlaced modes to have an odd VTotal */
+ /* maybe we should only do this when INTERLACE_HALVE_V is set? */
+ p->CrtcVTotal |= 1;
+ }
+
+ if (p->Flags & V_DBLSCAN) {
+ p->CrtcVDisplay *= 2;
+ p->CrtcVSyncStart *= 2;
+ p->CrtcVSyncEnd *= 2;
+ p->CrtcVTotal *= 2;
+ }
+ if (p->VScan > 1) {
+ p->CrtcVDisplay *= p->VScan;
+ p->CrtcVSyncStart *= p->VScan;
+ p->CrtcVSyncEnd *= p->VScan;
+ p->CrtcVTotal *= p->VScan;
+ }
+ p->CrtcVBlankStart = min(p->CrtcVSyncStart, p->CrtcVDisplay);
+ p->CrtcVBlankEnd = max(p->CrtcVSyncEnd, p->CrtcVTotal);
+ p->CrtcHBlankStart = min(p->CrtcHSyncStart, p->CrtcHDisplay);
+ p->CrtcHBlankEnd = max(p->CrtcHSyncEnd, p->CrtcHTotal);
+
+ p->CrtcHAdjusted = FALSE;
+ p->CrtcVAdjusted = FALSE;
+}
+
+/**
+ * Allocates and returns a copy of pMode, including pointers within pMode.
+ */
+DisplayModePtr
+xf86DuplicateMode(DisplayModePtr pMode)
+{
+ DisplayModePtr pNew;
+
+ pNew = xnfalloc(sizeof(DisplayModeRec));
+ *pNew = *pMode;
+ pNew->next = NULL;
+ pNew->prev = NULL;
+ if (pNew->name == NULL) {
+ xf86SetModeDefaultName(pMode);
+ } else {
+ pNew->name = xnfstrdup(pMode->name);
+ }
+
+ return pNew;
+}
+
+/**
+ * Duplicates every mode in the given list and returns a pointer to the first
+ * mode.
+ *
+ * \param modeList doubly-linked mode list
+ */
+DisplayModePtr
+xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
+{
+ DisplayModePtr first = NULL, last = NULL;
+ DisplayModePtr mode;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ DisplayModePtr new;
+
+ new = xf86DuplicateMode(mode);
+
+ /* Insert pNew into modeList */
+ if (last) {
+ last->next = new;
+ new->prev = last;
+ } else {
+ first = new;
+ new->prev = NULL;
+ }
+ new->next = NULL;
+ last = new;
+ }
+
+ return first;
+}
+
+/**
+ * Returns true if the given modes should program to the same timings.
+ *
+ * This doesn't use Crtc values, as it might be used on ModeRecs without the
+ * Crtc values set. So, it's assumed that the other numbers are enough.
+ *
+ * This isn't in xf86Modes.c, but it might deserve to be there.
+ */
+Bool
+xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
+{
+ if (pMode1->Clock == pMode2->Clock &&
+ pMode1->HDisplay == pMode2->HDisplay &&
+ pMode1->HSyncStart == pMode2->HSyncStart &&
+ pMode1->HSyncEnd == pMode2->HSyncEnd &&
+ pMode1->HTotal == pMode2->HTotal &&
+ pMode1->HSkew == pMode2->HSkew &&
+ pMode1->VDisplay == pMode2->VDisplay &&
+ pMode1->VSyncStart == pMode2->VSyncStart &&
+ pMode1->VSyncEnd == pMode2->VSyncEnd &&
+ pMode1->VTotal == pMode2->VTotal &&
+ pMode1->VScan == pMode2->VScan &&
+ pMode1->Flags == pMode2->Flags)
+ {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+/* exact copy of xf86Mode.c */
+static void
+add(char **p, char *new)
+{
+ *p = xnfrealloc(*p, strlen(*p) + strlen(new) + 2);
+ strcat(*p, " ");
+ strcat(*p, new);
+}
+
+/**
+ * Print out a modeline.
+ *
+ * Convenient VRefresh printing was added, though, compared to xf86Mode.c
+ */
+void
+xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
+{
+ char tmp[256];
+ char *flags = xnfcalloc(1, 1);
+
+ if (mode->HSkew) {
+ snprintf(tmp, 256, "hskew %i", mode->HSkew);
+ add(&flags, tmp);
+ }
+ if (mode->VScan) {
+ snprintf(tmp, 256, "vscan %i", mode->VScan);
+ add(&flags, tmp);
+ }
+ if (mode->Flags & V_INTERLACE) add(&flags, "interlace");
+ if (mode->Flags & V_CSYNC) add(&flags, "composite");
+ if (mode->Flags & V_DBLSCAN) add(&flags, "doublescan");
+ if (mode->Flags & V_BCAST) add(&flags, "bcast");
+ if (mode->Flags & V_PHSYNC) add(&flags, "+hsync");
+ if (mode->Flags & V_NHSYNC) add(&flags, "-hsync");
+ if (mode->Flags & V_PVSYNC) add(&flags, "+vsync");
+ if (mode->Flags & V_NVSYNC) add(&flags, "-vsync");
+ if (mode->Flags & V_PCSYNC) add(&flags, "+csync");
+ if (mode->Flags & V_NCSYNC) add(&flags, "-csync");
+#if 0
+ if (mode->Flags & V_CLKDIV2) add(&flags, "vclk/2");
+#endif
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Modeline \"%s\"x%.01f %6.2f %i %i %i %i %i %i %i %i%s "
+ "(%.01f kHz)\n",
+ mode->name, mode->VRefresh, mode->Clock/1000., mode->HDisplay,
+ mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
+ mode->VDisplay, mode->VSyncStart, mode->VSyncEnd,
+ mode->VTotal, flags, xf86ModeHSync(mode));
+ xfree(flags);
+}
+#endif /* XORG_VERSION_CURRENT <= 7.2.99.2 */
+
+/**
+ * Marks as bad any modes with unsupported flags.
+ *
+ * \param modeList doubly-linked or circular list of modes.
+ * \param flags flags supported by the driver.
+ *
+ * \bug only V_INTERLACE and V_DBLSCAN are supported. Is that enough?
+ *
+ * This is not in xf86Modes.c, but would be part of the proposed new API.
+ */
+void
+xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int flags)
+{
+ DisplayModePtr mode;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ if (mode->Flags & V_INTERLACE && !(flags & V_INTERLACE))
+ mode->status = MODE_NO_INTERLACE;
+ if (mode->Flags & V_DBLSCAN && !(flags & V_DBLSCAN))
+ mode->status = MODE_NO_DBLESCAN;
+ }
+}
+
+/**
+ * Marks as bad any modes extending beyond the given max X, Y, or pitch.
+ *
+ * \param modeList doubly-linked or circular list of modes.
+ *
+ * This is not in xf86Modes.c, but would be part of the proposed new API.
+ */
+void
+xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int maxX, int maxY, int maxPitch)
+{
+ DisplayModePtr mode;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ if (maxPitch > 0 && mode->HDisplay > maxPitch)
+ mode->status = MODE_BAD_WIDTH;
+
+ if (maxX > 0 && mode->HDisplay > maxX)
+ mode->status = MODE_VIRTUAL_X;
+
+ if (maxY > 0 && mode->VDisplay > maxY)
+ mode->status = MODE_VIRTUAL_Y;
+
+ if (mode->next == modeList)
+ break;
+ }
+}
+
+/**
+ * Marks as bad any modes that aren't supported by the given monitor's
+ * hsync and vrefresh ranges.
+ *
+ * \param modeList doubly-linked or circular list of modes.
+ *
+ * This is not in xf86Modes.c, but would be part of the proposed new API.
+ */
+void
+xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ MonPtr mon)
+{
+ DisplayModePtr mode;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ Bool bad;
+ int i;
+
+ bad = TRUE;
+ for (i = 0; i < mon->nHsync; i++) {
+ if (xf86ModeHSync(mode) >= mon->hsync[i].lo &&
+ xf86ModeHSync(mode) <= mon->hsync[i].hi)
+ {
+ bad = FALSE;
+ }
+ }
+ if (bad)
+ mode->status = MODE_HSYNC;
+
+ bad = TRUE;
+ for (i = 0; i < mon->nVrefresh; i++) {
+ if (xf86ModeVRefresh(mode) >= mon->vrefresh[i].lo &&
+ xf86ModeVRefresh(mode) <= mon->vrefresh[i].hi)
+ {
+ bad = FALSE;
+ }
+ }
+ if (bad)
+ mode->status = MODE_VSYNC;
+
+ if (mode->next == modeList)
+ break;
+ }
+}
+
+/**
+ * Marks as bad any modes extending beyond outside of the given clock ranges.
+ *
+ * \param modeList doubly-linked or circular list of modes.
+ * \param min pointer to minimums of clock ranges
+ * \param max pointer to maximums of clock ranges
+ * \param n_ranges number of ranges.
+ *
+ * This is not in xf86Modes.c, but would be part of the proposed new API.
+ */
+void
+xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int *min, int *max, int n_ranges)
+{
+ DisplayModePtr mode;
+ int i;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ Bool good = FALSE;
+ for (i = 0; i < n_ranges; i++) {
+ if (mode->Clock >= min[i] && mode->Clock <= max[i]) {
+ good = TRUE;
+ break;
+ }
+ }
+ if (!good)
+ mode->status = MODE_CLOCK_RANGE;
+ }
+}
+
+/**
+ * If the user has specified a set of mode names to use, mark as bad any modes
+ * not listed.
+ *
+ * The user mode names specified are prefixes to names of modes, so "1024x768"
+ * will match modes named "1024x768", "1024x768x75", "1024x768-good", but
+ * "1024x768x75" would only match "1024x768x75" from that list.
+ *
+ * MODE_BAD is used as the rejection flag, for lack of a better flag.
+ *
+ * \param modeList doubly-linked or circular list of modes.
+ *
+ * This is not in xf86Modes.c, but would be part of the proposed new API.
+ */
+void
+xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
+{
+ DisplayModePtr mode;
+
+ if (pScrn->display->modes[0] == NULL)
+ return;
+
+ for (mode = modeList; mode != NULL; mode = mode->next) {
+ int i;
+ Bool good = FALSE;
+
+ for (i = 0; pScrn->display->modes[i] != NULL; i++) {
+ if (strncmp(pScrn->display->modes[i], mode->name,
+ strlen(pScrn->display->modes[i])) == 0) {
+ good = TRUE;
+ break;
+ }
+ }
+ if (!good)
+ mode->status = MODE_BAD;
+ }
+}
+
+
+/**
+ * Frees any modes from the list with a status other than MODE_OK.
+ *
+ * \param modeList pointer to a doubly-linked or circular list of modes.
+ * \param verbose determines whether the reason for mode invalidation is
+ * printed.
+ *
+ * This is not in xf86Modes.c, but would be part of the proposed new API.
+ */
+void
+xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
+ Bool verbose)
+{
+ DisplayModePtr mode;
+
+ for (mode = *modeList; mode != NULL;) {
+ DisplayModePtr next = mode->next, first = *modeList;
+
+ if (mode->status != MODE_OK) {
+ if (verbose) {
+ char *type = "";
+ if (mode->type & M_T_BUILTIN)
+ type = "built-in ";
+ else if (mode->type & M_T_DEFAULT)
+ type = "default ";
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Not using %smode \"%s\" (%s)\n", type, mode->name,
+ xf86ModeStatusToString(mode->status));
+ }
+ xf86DeleteMode(modeList, mode);
+ }
+
+ if (next == first)
+ break;
+ mode = next;
+ }
+}
+
+/**
+ * Adds the new mode into the mode list, and returns the new list
+ *
+ * \param modes doubly-linked mode list.
+ */
+DisplayModePtr
+xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
+{
+ if (modes == NULL)
+ return new;
+
+ if (new) {
+ DisplayModePtr mode = modes;
+
+ while (mode->next)
+ mode = mode->next;
+
+ mode->next = new;
+ new->prev = mode;
+ }
+
+ return modes;
+}
+
+/**
+ * Build a mode list from a list of config file modes
+ */
+static DisplayModePtr
+xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
+{
+ DisplayModePtr head = NULL, prev = NULL, mode;
+
+ for (; conf_mode; conf_mode = (XF86ConfModeLinePtr) conf_mode->list.next)
+ {
+ mode = xcalloc(1, sizeof(DisplayModeRec));
+ if (!mode)
+ continue;
+ mode->name = xstrdup(conf_mode->ml_identifier);
+ if (!mode->name)
+ {
+ xfree (mode);
+ continue;
+ }
+ mode->type = 0;
+ mode->Clock = conf_mode->ml_clock;
+ mode->HDisplay = conf_mode->ml_hdisplay;
+ mode->HSyncStart = conf_mode->ml_hsyncstart;
+ mode->HSyncEnd = conf_mode->ml_hsyncend;
+ mode->HTotal = conf_mode->ml_htotal;
+ mode->VDisplay = conf_mode->ml_vdisplay;
+ mode->VSyncStart = conf_mode->ml_vsyncstart;
+ mode->VSyncEnd = conf_mode->ml_vsyncend;
+ mode->VTotal = conf_mode->ml_vtotal;
+ mode->Flags = conf_mode->ml_flags;
+ mode->HSkew = conf_mode->ml_hskew;
+ mode->VScan = conf_mode->ml_vscan;
+
+ mode->prev = prev;
+ mode->next = NULL;
+ if (prev)
+ prev->next = mode;
+ else
+ head = mode;
+ prev = mode;
+ }
+ return head;
+}
+
+/**
+ * Build a mode list from a monitor configuration
+ */
+DisplayModePtr
+xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
+{
+ DisplayModePtr modes = NULL;
+ XF86ConfModesLinkPtr modes_link;
+
+ if (!conf_monitor)
+ return NULL;
+
+ /*
+ * first we collect the mode lines from the UseModes directive
+ */
+ for (modes_link = conf_monitor->mon_modes_sect_lst;
+ modes_link;
+ modes_link = modes_link->list.next)
+ {
+ /* If this modes link hasn't been resolved, go look it up now */
+ if (!modes_link->ml_modes)
+ modes_link->ml_modes = xf86findModes (modes_link->ml_modes_str,
+ xf86configptr->conf_modes_lst);
+ if (modes_link->ml_modes)
+ modes = xf86ModesAdd (modes,
+ xf86GetConfigModes (modes_link->ml_modes->mon_modeline_lst));
+ }
+
+ return xf86ModesAdd (modes,
+ xf86GetConfigModes (conf_monitor->mon_modeline_lst));
+}
+
+/**
+ * Build a mode list containing all of the default modes
+ */
+DisplayModePtr
+xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
+{
+ DisplayModePtr head = NULL, prev = NULL, mode;
+ int i;
+
+ for (i = 0; xf86DefaultModes[i].name != NULL; i++)
+ {
+ DisplayModePtr defMode = &xf86DefaultModes[i];
+
+ if (!interlaceAllowed && (defMode->Flags & V_INTERLACE))
+ continue;
+ if (!doubleScanAllowed && (defMode->Flags & V_DBLSCAN))
+ continue;
+
+ mode = xalloc(sizeof(DisplayModeRec));
+ if (!mode)
+ continue;
+ memcpy(mode,&xf86DefaultModes[i],sizeof(DisplayModeRec));
+ mode->name = xstrdup(xf86DefaultModes[i].name);
+ if (!mode->name)
+ {
+ xfree (mode);
+ continue;
+ }
+ mode->prev = prev;
+ mode->next = NULL;
+ if (prev)
+ prev->next = mode;
+ else
+ head = mode;
+ prev = mode;
+ }
+ return head;
+}
diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h
new file mode 100644
index 000000000..2bd4edeba
--- /dev/null
+++ b/hw/xfree86/modes/xf86Modes.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright © 2006 Intel Corporation
+ *
+ * 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.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#ifndef _XF86MODES_H_
+#define _XF86MODES_H_
+
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xorgVersion.h"
+#include "edid.h"
+#include "xf86Parser.h"
+#if XF86_MODES_RENAME
+#include "xf86Rename.h"
+#endif
+
+double xf86ModeHSync(DisplayModePtr mode);
+double xf86ModeVRefresh(DisplayModePtr mode);
+
+int
+xf86ModeWidth (DisplayModePtr mode, Rotation rotation);
+
+int
+xf86ModeHeight (DisplayModePtr mode, Rotation rotation);
+
+DisplayModePtr xf86DuplicateMode(DisplayModePtr pMode);
+DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn,
+ DisplayModePtr modeList);
+void xf86SetModeDefaultName(DisplayModePtr mode);
+void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
+Bool xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2);
+void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
+DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
+
+DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
+DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
+ Bool Reduced, Bool Interlaced);
+
+void
+xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int flags);
+
+void
+xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int *min, int *max, int n_ranges);
+
+void
+xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int maxX, int maxY, int maxPitch);
+
+void
+xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ MonPtr mon);
+
+void
+xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
+ Bool verbose);
+
+void
+xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
+ int flags);
+
+void
+xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
+
+DisplayModePtr
+xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
+
+DisplayModePtr
+xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed);
+
+#endif /* _XF86MODES_H_ */
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
new file mode 100644
index 000000000..6f52ee2d9
--- /dev/null
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -0,0 +1,1088 @@
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.3 2004/07/30 21:53:09 eich Exp $ */
+/*
+ * $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.7tsi Exp $
+ *
+ * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * 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, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86.h"
+#include "os.h"
+#include "mibank.h"
+#include "globals.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86DDC.h"
+#include "mipointer.h"
+#include "windowstr.h"
+#include <randrstr.h>
+#include <X11/extensions/render.h>
+
+#include "xf86Crtc.h"
+#include "xf86RandR12.h"
+
+typedef struct _xf86RandR12Info {
+ int virtualX;
+ int virtualY;
+ int mmWidth;
+ int mmHeight;
+ int maxX;
+ int maxY;
+ Rotation rotation; /* current mode */
+ Rotation supported_rotations; /* driver supported */
+} XF86RandRInfoRec, *XF86RandRInfoPtr;
+
+#ifdef RANDR_12_INTERFACE
+static Bool xf86RandR12Init12 (ScreenPtr pScreen);
+static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
+#endif
+
+static int xf86RandR12Index;
+static int xf86RandR12Generation;
+
+#define XF86RANDRINFO(p) \
+ ((XF86RandRInfoPtr)(p)->devPrivates[xf86RandR12Index].ptr)
+
+static int
+xf86RandR12ModeRefresh (DisplayModePtr mode)
+{
+ if (mode->VRefresh)
+ return (int) (mode->VRefresh + 0.5);
+ else
+ return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5);
+}
+
+static Bool
+xf86RandR12GetInfo (ScreenPtr pScreen, Rotation *rotations)
+{
+ RRScreenSizePtr pSize;
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ DisplayModePtr mode;
+ int refresh0 = 60;
+ int maxX = 0, maxY = 0;
+
+ *rotations = randrp->supported_rotations;
+
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = scrp->virtualX;
+ randrp->virtualY = scrp->virtualY;
+ }
+
+ /* Re-probe the outputs for new monitors or modes */
+ xf86ProbeOutputModes (scrp, 0, 0);
+ xf86SetScrnInfoModes (scrp);
+ xf86DiDGAReInit (pScreen);
+
+ for (mode = scrp->modes; ; mode = mode->next)
+ {
+ int refresh = xf86RandR12ModeRefresh (mode);
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ if (maxX < mode->HDisplay)
+ maxX = mode->HDisplay;
+ if (maxY < mode->VDisplay)
+ maxY = mode->VDisplay;
+ }
+ if (mode == scrp->modes)
+ refresh0 = refresh;
+ pSize = RRRegisterSize (pScreen,
+ mode->HDisplay, mode->VDisplay,
+ randrp->mmWidth, randrp->mmHeight);
+ if (!pSize)
+ return FALSE;
+ RRRegisterRate (pScreen, pSize, refresh);
+
+ if (xf86ModesEqual(mode, scrp->currentMode) &&
+ mode->HDisplay == scrp->virtualX &&
+ mode->VDisplay == scrp->virtualY)
+ {
+ RRSetCurrentConfig (pScreen, randrp->rotation, refresh, pSize);
+ }
+ if (mode->next == scrp->modes)
+ break;
+ }
+
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ randrp->maxX = maxX;
+ randrp->maxY = maxY;
+ }
+
+ if (scrp->currentMode->HDisplay != randrp->virtualX ||
+ scrp->currentMode->VDisplay != randrp->virtualY)
+ {
+ pSize = RRRegisterSize (pScreen,
+ randrp->virtualX, randrp->virtualY,
+ randrp->mmWidth,
+ randrp->mmHeight);
+ if (!pSize)
+ return FALSE;
+ RRRegisterRate (pScreen, pSize, refresh0);
+ if (scrp->virtualX == randrp->virtualX &&
+ scrp->virtualY == randrp->virtualY)
+ {
+ RRSetCurrentConfig (pScreen, randrp->rotation, refresh0, pSize);
+ }
+ }
+
+ return TRUE;
+}
+
+static Bool
+xf86RandR12SetMode (ScreenPtr pScreen,
+ DisplayModePtr mode,
+ Bool useVirtual,
+ int mmWidth,
+ int mmHeight)
+{
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ int oldWidth = pScreen->width;
+ int oldHeight = pScreen->height;
+ int oldmmWidth = pScreen->mmWidth;
+ int oldmmHeight = pScreen->mmHeight;
+ WindowPtr pRoot = WindowTable[pScreen->myNum];
+ DisplayModePtr currentMode = NULL;
+ Bool ret = TRUE;
+ PixmapPtr pspix = NULL;
+
+ if (pRoot)
+ (*scrp->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+ if (useVirtual)
+ {
+ scrp->virtualX = randrp->virtualX;
+ scrp->virtualY = randrp->virtualY;
+ }
+ else
+ {
+ scrp->virtualX = mode->HDisplay;
+ scrp->virtualY = mode->VDisplay;
+ }
+
+ if(randrp->rotation & (RR_Rotate_90 | RR_Rotate_270))
+ {
+ /* If the screen is rotated 90 or 270 degrees, swap the sizes. */
+ pScreen->width = scrp->virtualY;
+ pScreen->height = scrp->virtualX;
+ pScreen->mmWidth = mmHeight;
+ pScreen->mmHeight = mmWidth;
+ }
+ else
+ {
+ pScreen->width = scrp->virtualX;
+ pScreen->height = scrp->virtualY;
+ pScreen->mmWidth = mmWidth;
+ pScreen->mmHeight = mmHeight;
+ }
+ if (scrp->currentMode == mode) {
+ /* Save current mode */
+ currentMode = scrp->currentMode;
+ /* Reset, just so we ensure the drivers SwitchMode is called */
+ scrp->currentMode = NULL;
+ }
+ /*
+ * We know that if the driver failed to SwitchMode to the rotated
+ * version, then it should revert back to it's prior mode.
+ */
+ if (!xf86SwitchMode (pScreen, mode))
+ {
+ ret = FALSE;
+ scrp->virtualX = pScreen->width = oldWidth;
+ scrp->virtualY = pScreen->height = oldHeight;
+ pScreen->mmWidth = oldmmWidth;
+ pScreen->mmHeight = oldmmHeight;
+ scrp->currentMode = currentMode;
+ }
+ /*
+ * Get the new Screen pixmap ptr as SwitchMode might have called
+ * ModifyPixmapHeader and xf86EnableDisableFBAccess will put it back...
+ * Unfortunately.
+ */
+ pspix = (*pScreen->GetScreenPixmap) (pScreen);
+ if (pspix->devPrivate.ptr)
+ scrp->pixmapPrivate = pspix->devPrivate;
+
+ /*
+ * Make sure the layout is correct
+ */
+ xf86ReconfigureLayout();
+
+ /*
+ * Make sure the whole screen is visible
+ */
+ xf86SetViewport (pScreen, pScreen->width, pScreen->height);
+ xf86SetViewport (pScreen, 0, 0);
+ if (pRoot)
+ (*scrp->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+ return ret;
+}
+
+Bool
+xf86RandR12SetConfig (ScreenPtr pScreen,
+ Rotation rotation,
+ int rate,
+ RRScreenSizePtr pSize)
+{
+ ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ DisplayModePtr mode;
+ int px, py;
+ Bool useVirtual = FALSE;
+ int maxX = 0, maxY = 0;
+ Rotation oldRotation = randrp->rotation;
+
+ randrp->rotation = rotation;
+
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = scrp->virtualX;
+ randrp->virtualY = scrp->virtualY;
+ }
+
+ miPointerPosition (&px, &py);
+ for (mode = scrp->modes; ; mode = mode->next)
+ {
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ if (maxX < mode->HDisplay)
+ maxX = mode->HDisplay;
+ if (maxY < mode->VDisplay)
+ maxY = mode->VDisplay;
+ }
+ if (mode->HDisplay == pSize->width &&
+ mode->VDisplay == pSize->height &&
+ (rate == 0 || xf86RandR12ModeRefresh (mode) == rate))
+ break;
+ if (mode->next == scrp->modes)
+ {
+ if (pSize->width == randrp->virtualX &&
+ pSize->height == randrp->virtualY)
+ {
+ mode = scrp->modes;
+ useVirtual = TRUE;
+ break;
+ }
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ randrp->maxX = maxX;
+ randrp->maxY = maxY;
+ }
+ return FALSE;
+ }
+ }
+
+ if (randrp->maxX == 0 || randrp->maxY == 0)
+ {
+ randrp->maxX = maxX;
+ randrp->maxY = maxY;
+ }
+
+ if (!xf86RandR12SetMode (pScreen, mode, useVirtual, pSize->mmWidth,
+ pSize->mmHeight)) {
+ randrp->rotation = oldRotation;
+ return FALSE;
+ }
+
+ /*
+ * Move the cursor back where it belongs; SwitchMode repositions it
+ */
+ if (pScreen == miPointerCurrentScreen ())
+ {
+ px = (px >= pScreen->width ? (pScreen->width - 1) : px);
+ py = (py >= pScreen->height ? (pScreen->height - 1) : py);
+
+ xf86SetViewport(pScreen, px, py);
+
+ (*pScreen->SetCursorPosition) (pScreen, px, py, FALSE);
+ }
+
+ return TRUE;
+}
+
+static Bool
+xf86RandR12ScreenSetSize (ScreenPtr pScreen,
+ CARD16 width,
+ CARD16 height,
+ CARD32 mmWidth,
+ CARD32 mmHeight)
+{
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ WindowPtr pRoot = WindowTable[pScreen->myNum];
+ Bool ret = FALSE;
+
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = pScrn->virtualX;
+ randrp->virtualY = pScrn->virtualY;
+ }
+ if (pRoot)
+ (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+
+ /* Let the driver update virtualX and virtualY */
+ if (!(*config->funcs->resize)(pScrn, width, height))
+ goto finish;
+
+ ret = TRUE;
+
+ pScreen->width = width;
+ pScreen->height = height;
+ pScreen->mmWidth = mmWidth;
+ pScreen->mmHeight = mmHeight;
+
+ xf86SetViewport (pScreen, pScreen->width-1, pScreen->height-1);
+ xf86SetViewport (pScreen, 0, 0);
+
+finish:
+ if (pRoot)
+ (*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+#if RANDR_12_INTERFACE
+ if (WindowTable[pScreen->myNum] && ret)
+ RRScreenSizeNotify (pScreen);
+#endif
+ return ret;
+}
+
+Rotation
+xf86RandR12GetRotation(ScreenPtr pScreen)
+{
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+
+ return randrp->rotation;
+}
+
+Bool
+xf86RandR12CreateScreenResources (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+ int c;
+ int width, height;
+ int mmWidth, mmHeight;
+#ifdef PANORAMIX
+ /* XXX disable RandR when using Xinerama */
+ if (!noPanoramiXExtension)
+ return TRUE;
+#endif
+
+ /*
+ * Compute size of screen
+ */
+ width = 0; height = 0;
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+ int crtc_width = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
+ int crtc_height = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
+
+ if (crtc->enabled && crtc_width > width)
+ width = crtc_width;
+ if (crtc->enabled && crtc_height > height)
+ height = crtc_height;
+ }
+
+ if (width && height)
+ {
+ /*
+ * Compute physical size of screen
+ */
+ if (monitorResolution)
+ {
+ mmWidth = width * 25.4 / monitorResolution;
+ mmHeight = height * 25.4 / monitorResolution;
+ }
+ else
+ {
+ xf86OutputPtr output = config->output[config->compat_output];
+ xf86CrtcPtr crtc = output->crtc;
+
+ if (crtc && crtc->mode.HDisplay &&
+ output->mm_width && output->mm_height)
+ {
+ /*
+ * If the output has a mode and a declared size, use that
+ * to scale the screen size
+ */
+ DisplayModePtr mode = &crtc->mode;
+ mmWidth = output->mm_width * width / mode->HDisplay;
+ mmHeight = output->mm_height * height / mode->VDisplay;
+ }
+ else
+ {
+ /*
+ * Otherwise, just set the screen to 96dpi
+ */
+ mmWidth = width * 25.4 / 96;
+ mmHeight = height * 25.4 / 96;
+ }
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Setting screen physical size to %d x %d\n",
+ mmWidth, mmHeight);
+ xf86RandR12ScreenSetSize (pScreen,
+ width,
+ height,
+ mmWidth,
+ mmHeight);
+ }
+
+ if (randrp->virtualX == -1 || randrp->virtualY == -1)
+ {
+ randrp->virtualX = pScrn->virtualX;
+ randrp->virtualY = pScrn->virtualY;
+ }
+ xf86CrtcSetScreenSubpixelOrder (pScreen);
+#if RANDR_12_INTERFACE
+ if (xf86RandR12CreateScreenResources12 (pScreen))
+ return TRUE;
+#endif
+ return TRUE;
+}
+
+
+Bool
+xf86RandR12Init (ScreenPtr pScreen)
+{
+ rrScrPrivPtr rp;
+ XF86RandRInfoPtr randrp;
+
+#ifdef PANORAMIX
+ /* XXX disable RandR when using Xinerama */
+ if (!noPanoramiXExtension)
+ return TRUE;
+#endif
+ if (xf86RandR12Generation != serverGeneration)
+ {
+ xf86RandR12Index = AllocateScreenPrivateIndex();
+ xf86RandR12Generation = serverGeneration;
+ }
+
+ randrp = xalloc (sizeof (XF86RandRInfoRec));
+ if (!randrp)
+ return FALSE;
+
+ if (!RRScreenInit(pScreen))
+ {
+ xfree (randrp);
+ return FALSE;
+ }
+ rp = rrGetScrPriv(pScreen);
+ rp->rrGetInfo = xf86RandR12GetInfo;
+ rp->rrSetConfig = xf86RandR12SetConfig;
+
+ randrp->virtualX = -1;
+ randrp->virtualY = -1;
+ randrp->mmWidth = pScreen->mmWidth;
+ randrp->mmHeight = pScreen->mmHeight;
+
+ randrp->rotation = RR_Rotate_0; /* initial rotated mode */
+
+ randrp->supported_rotations = RR_Rotate_0;
+
+ randrp->maxX = randrp->maxY = 0;
+
+ pScreen->devPrivates[xf86RandR12Index].ptr = randrp;
+
+#if RANDR_12_INTERFACE
+ if (!xf86RandR12Init12 (pScreen))
+ return FALSE;
+#endif
+ return TRUE;
+}
+
+void
+xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
+{
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+#if RANDR_12_INTERFACE
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ int c;
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+
+ for (c = 0; c < config->num_crtc; c++) {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ RRCrtcSetRotations (crtc->randr_crtc, rotations);
+ }
+#endif
+ randrp->supported_rotations = rotations;
+}
+
+void
+xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y)
+{
+ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+
+ if (xf86RandR12Generation != serverGeneration ||
+ XF86RANDRINFO(pScreen)->virtualX == -1)
+ {
+ *x = pScrn->virtualX;
+ *y = pScrn->virtualY;
+ } else {
+ XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
+
+ *x = randrp->virtualX;
+ *y = randrp->virtualY;
+ }
+}
+
+#if RANDR_12_INTERFACE
+
+#define FLAG_BITS (RR_HSyncPositive | \
+ RR_HSyncNegative | \
+ RR_VSyncPositive | \
+ RR_VSyncNegative | \
+ RR_Interlace | \
+ RR_DoubleScan | \
+ RR_CSync | \
+ RR_CSyncPositive | \
+ RR_CSyncNegative | \
+ RR_HSkewPresent | \
+ RR_BCast | \
+ RR_PixelMultiplex | \
+ RR_DoubleClock | \
+ RR_ClockDivideBy2)
+
+static Bool
+xf86RandRModeMatches (RRModePtr randr_mode,
+ DisplayModePtr mode)
+{
+#if 0
+ if (match_name)
+ {
+ /* check for same name */
+ int len = strlen (mode->name);
+ if (randr_mode->mode.nameLength != len) return FALSE;
+ if (memcmp (randr_mode->name, mode->name, len) != 0) return FALSE;
+ }
+#endif
+
+ /* check for same timings */
+ if (randr_mode->mode.dotClock / 1000 != mode->Clock) return FALSE;
+ if (randr_mode->mode.width != mode->HDisplay) return FALSE;
+ if (randr_mode->mode.hSyncStart != mode->HSyncStart) return FALSE;
+ if (randr_mode->mode.hSyncEnd != mode->HSyncEnd) return FALSE;
+ if (randr_mode->mode.hTotal != mode->HTotal) return FALSE;
+ if (randr_mode->mode.hSkew != mode->HSkew) return FALSE;
+ if (randr_mode->mode.height != mode->VDisplay) return FALSE;
+ if (randr_mode->mode.vSyncStart != mode->VSyncStart) return FALSE;
+ if (randr_mode->mode.vSyncEnd != mode->VSyncEnd) return FALSE;
+ if (randr_mode->mode.vTotal != mode->VTotal) return FALSE;
+
+ /* check for same flags (using only the XF86 valid flag bits) */
+ if ((randr_mode->mode.modeFlags & FLAG_BITS) != (mode->Flags & FLAG_BITS))
+ return FALSE;
+
+ /* everything matches */
+ return TRUE;
+}
+
+static Bool
+xf86RandR12CrtcNotify (RRCrtcPtr randr_crtc)
+{
+ ScreenPtr pScreen = randr_crtc->pScreen;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ RRModePtr randr_mode = NULL;
+ int x;
+ int y;
+ Rotation rotation;
+ int numOutputs;
+ RROutputPtr *randr_outputs;
+ RROutputPtr randr_output;
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+ xf86OutputPtr output;
+ int i, j;
+ DisplayModePtr mode = &crtc->mode;
+ Bool ret;
+
+ randr_outputs = ALLOCATE_LOCAL(config->num_output * sizeof (RROutputPtr));
+ if (!randr_outputs)
+ return FALSE;
+ x = crtc->x;
+ y = crtc->y;
+ rotation = crtc->rotation;
+ numOutputs = 0;
+ randr_mode = NULL;
+ for (i = 0; i < config->num_output; i++)
+ {
+ output = config->output[i];
+ if (output->crtc == crtc)
+ {
+ randr_output = output->randr_output;
+ randr_outputs[numOutputs++] = randr_output;
+ /*
+ * We make copies of modes, so pointer equality
+ * isn't sufficient
+ */
+ for (j = 0; j < randr_output->numModes + randr_output->numUserModes; j++)
+ {
+ RRModePtr m = (j < randr_output->numModes ?
+ randr_output->modes[j] :
+ randr_output->userModes[j-randr_output->numModes]);
+
+ if (xf86RandRModeMatches (m, mode))
+ {
+ randr_mode = m;
+ break;
+ }
+ }
+ }
+ }
+ ret = RRCrtcNotify (randr_crtc, randr_mode, x, y,
+ rotation, numOutputs, randr_outputs);
+ DEALLOCATE_LOCAL(randr_outputs);
+ return ret;
+}
+
+/*
+ * Convert a RandR mode to a DisplayMode
+ */
+static void
+xf86RandRModeConvert (ScrnInfoPtr scrn,
+ RRModePtr randr_mode,
+ DisplayModePtr mode)
+{
+ mode->prev = NULL;
+ mode->next = NULL;
+ mode->name = NULL;
+ mode->status = MODE_OK;
+ mode->type = 0;
+
+ mode->Clock = randr_mode->mode.dotClock / 1000;
+
+ mode->HDisplay = randr_mode->mode.width;
+ mode->HSyncStart = randr_mode->mode.hSyncStart;
+ mode->HSyncEnd = randr_mode->mode.hSyncEnd;
+ mode->HTotal = randr_mode->mode.hTotal;
+ mode->HSkew = randr_mode->mode.hSkew;
+
+ mode->VDisplay = randr_mode->mode.height;
+ mode->VSyncStart = randr_mode->mode.vSyncStart;
+ mode->VSyncEnd = randr_mode->mode.vSyncEnd;
+ mode->VTotal = randr_mode->mode.vTotal;
+ mode->VScan = 0;
+
+ mode->Flags = randr_mode->mode.modeFlags & FLAG_BITS;
+
+ xf86SetModeCrtc (mode, scrn->adjustFlags);
+}
+
+static Bool
+xf86RandR12CrtcSet (ScreenPtr pScreen,
+ RRCrtcPtr randr_crtc,
+ RRModePtr randr_mode,
+ int x,
+ int y,
+ Rotation rotation,
+ int num_randr_outputs,
+ RROutputPtr *randr_outputs)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+ Bool changed = FALSE;
+ int o, ro;
+ xf86CrtcPtr *save_crtcs;
+ Bool save_enabled = crtc->enabled;
+
+ save_crtcs = ALLOCATE_LOCAL(config->num_crtc * sizeof (xf86CrtcPtr));
+ if ((randr_mode != NULL) != crtc->enabled)
+ changed = TRUE;
+ else if (randr_mode && !xf86RandRModeMatches (randr_mode, &crtc->mode))
+ changed = TRUE;
+
+ if (rotation != crtc->rotation)
+ changed = TRUE;
+
+ if (x != crtc->x || y != crtc->y)
+ changed = TRUE;
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ xf86CrtcPtr new_crtc;
+
+ save_crtcs[o] = output->crtc;
+
+ if (output->crtc == crtc)
+ new_crtc = NULL;
+ else
+ new_crtc = output->crtc;
+ for (ro = 0; ro < num_randr_outputs; ro++)
+ if (output->randr_output == randr_outputs[ro])
+ {
+ new_crtc = crtc;
+ break;
+ }
+ if (new_crtc != output->crtc)
+ {
+ changed = TRUE;
+ output->crtc = new_crtc;
+ }
+ }
+ /* XXX need device-independent mode setting code through an API */
+ if (changed)
+ {
+ crtc->enabled = randr_mode != NULL;
+
+ if (randr_mode)
+ {
+ DisplayModeRec mode;
+
+ xf86RandRModeConvert (pScrn, randr_mode, &mode);
+ if (!xf86CrtcSetMode (crtc, &mode, rotation, x, y))
+ {
+ crtc->enabled = save_enabled;
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+ output->crtc = save_crtcs[o];
+ }
+ DEALLOCATE_LOCAL(save_crtcs);
+ return FALSE;
+ }
+ /*
+ * Save the last successful setting for EnterVT
+ */
+ crtc->desiredMode = mode;
+ crtc->desiredRotation = rotation;
+ crtc->desiredX = x;
+ crtc->desiredY = y;
+ }
+ xf86DisableUnusedFunctions (pScrn);
+ }
+ DEALLOCATE_LOCAL(save_crtcs);
+ return xf86RandR12CrtcNotify (randr_crtc);
+}
+
+static Bool
+xf86RandR12CrtcSetGamma (ScreenPtr pScreen,
+ RRCrtcPtr randr_crtc)
+{
+ xf86CrtcPtr crtc = randr_crtc->devPrivate;
+
+ if (crtc->funcs->gamma_set == NULL)
+ return FALSE;
+
+ crtc->funcs->gamma_set(crtc, randr_crtc->gammaRed, randr_crtc->gammaGreen,
+ randr_crtc->gammaBlue, randr_crtc->gammaSize);
+
+ return TRUE;
+}
+
+static Bool
+xf86RandR12OutputSetProperty (ScreenPtr pScreen,
+ RROutputPtr randr_output,
+ Atom property,
+ RRPropertyValuePtr value)
+{
+ xf86OutputPtr output = randr_output->devPrivate;
+
+ /* If we don't have any property handler, then we don't care what the
+ * user is setting properties to.
+ */
+ if (output->funcs->set_property == NULL)
+ return TRUE;
+
+ return output->funcs->set_property(output, property, value);
+}
+
+static Bool
+xf86RandR12OutputValidateMode (ScreenPtr pScreen,
+ RROutputPtr randr_output,
+ RRModePtr randr_mode)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86OutputPtr output = randr_output->devPrivate;
+ DisplayModeRec mode;
+
+ xf86RandRModeConvert (pScrn, randr_mode, &mode);
+ if (output->funcs->mode_valid (output, &mode) != MODE_OK)
+ return FALSE;
+ return TRUE;
+}
+
+static void
+xf86RandR12ModeDestroy (ScreenPtr pScreen, RRModePtr randr_mode)
+{
+}
+
+/**
+ * Given a list of xf86 modes and a RandR Output object, construct
+ * RandR modes and assign them to the output
+ */
+static Bool
+xf86RROutputSetModes (RROutputPtr randr_output, DisplayModePtr modes)
+{
+ DisplayModePtr mode;
+ RRModePtr *rrmodes = NULL;
+ int nmode = 0;
+ int npreferred = 0;
+ Bool ret = TRUE;
+ int pref;
+
+ for (mode = modes; mode; mode = mode->next)
+ nmode++;
+
+ if (nmode) {
+ rrmodes = xalloc (nmode * sizeof (RRModePtr));
+
+ if (!rrmodes)
+ return FALSE;
+ nmode = 0;
+
+ for (pref = 1; pref >= 0; pref--) {
+ for (mode = modes; mode; mode = mode->next) {
+ if ((pref != 0) == ((mode->type & M_T_PREFERRED) != 0)) {
+ xRRModeInfo modeInfo;
+ RRModePtr rrmode;
+
+ modeInfo.nameLength = strlen (mode->name);
+ modeInfo.width = mode->HDisplay;
+ modeInfo.dotClock = mode->Clock * 1000;
+ modeInfo.hSyncStart = mode->HSyncStart;
+ modeInfo.hSyncEnd = mode->HSyncEnd;
+ modeInfo.hTotal = mode->HTotal;
+ modeInfo.hSkew = mode->HSkew;
+
+ modeInfo.height = mode->VDisplay;
+ modeInfo.vSyncStart = mode->VSyncStart;
+ modeInfo.vSyncEnd = mode->VSyncEnd;
+ modeInfo.vTotal = mode->VTotal;
+ modeInfo.modeFlags = mode->Flags;
+
+ rrmode = RRModeGet (&modeInfo, mode->name);
+ if (rrmode) {
+ rrmodes[nmode++] = rrmode;
+ npreferred += pref;
+ }
+ }
+ }
+ }
+ }
+
+ ret = RROutputSetModes (randr_output, rrmodes, nmode, npreferred);
+ xfree (rrmodes);
+ return ret;
+}
+
+/*
+ * Mirror the current mode configuration to RandR
+ */
+static Bool
+xf86RandR12SetInfo12 (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ RROutputPtr *clones;
+ RRCrtcPtr *crtcs;
+ int ncrtc;
+ int o, c, l;
+ RRCrtcPtr randr_crtc;
+ int nclone;
+
+ clones = ALLOCATE_LOCAL(config->num_output * sizeof (RROutputPtr));
+ crtcs = ALLOCATE_LOCAL (config->num_crtc * sizeof (RRCrtcPtr));
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ ncrtc = 0;
+ for (c = 0; c < config->num_crtc; c++)
+ if (output->possible_crtcs & (1 << c))
+ crtcs[ncrtc++] = config->crtc[c]->randr_crtc;
+
+ if (output->crtc)
+ randr_crtc = output->crtc->randr_crtc;
+ else
+ randr_crtc = NULL;
+
+ if (!RROutputSetCrtcs (output->randr_output, crtcs, ncrtc))
+ {
+ DEALLOCATE_LOCAL (crtcs);
+ DEALLOCATE_LOCAL (clones);
+ return FALSE;
+ }
+
+ RROutputSetCrtc (output->randr_output, randr_crtc);
+ RROutputSetPhysicalSize(output->randr_output,
+ output->mm_width,
+ output->mm_height);
+ xf86RROutputSetModes (output->randr_output, output->probed_modes);
+
+ switch (output->status) {
+ case XF86OutputStatusConnected:
+ RROutputSetConnection (output->randr_output, RR_Connected);
+ break;
+ case XF86OutputStatusDisconnected:
+ RROutputSetConnection (output->randr_output, RR_Disconnected);
+ break;
+ case XF86OutputStatusUnknown:
+ RROutputSetConnection (output->randr_output, RR_UnknownConnection);
+ break;
+ }
+
+ RROutputSetSubpixelOrder (output->randr_output, output->subpixel_order);
+
+ /*
+ * Valid clones
+ */
+ nclone = 0;
+ for (l = 0; l < config->num_output; l++)
+ {
+ xf86OutputPtr clone = config->output[l];
+
+ if (l != o && (output->possible_clones & (1 << l)))
+ clones[nclone++] = clone->randr_output;
+ }
+ if (!RROutputSetClones (output->randr_output, clones, nclone))
+ {
+ DEALLOCATE_LOCAL (crtcs);
+ DEALLOCATE_LOCAL (clones);
+ return FALSE;
+ }
+ }
+ DEALLOCATE_LOCAL (crtcs);
+ DEALLOCATE_LOCAL (clones);
+ return TRUE;
+}
+
+
+
+/*
+ * Query the hardware for the current state, then mirror
+ * that to RandR
+ */
+static Bool
+xf86RandR12GetInfo12 (ScreenPtr pScreen, Rotation *rotations)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+
+ xf86ProbeOutputModes (pScrn, 0, 0);
+ xf86SetScrnInfoModes (pScrn);
+ xf86DiDGAReInit (pScreen);
+ return xf86RandR12SetInfo12 (pScreen);
+}
+
+static Bool
+xf86RandR12CreateObjects12 (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+ int o;
+
+ if (!RRInit ())
+ return FALSE;
+
+ /*
+ * Configure crtcs
+ */
+ for (c = 0; c < config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = config->crtc[c];
+
+ crtc->randr_crtc = RRCrtcCreate (pScreen, crtc);
+ RRCrtcGammaSetSize (crtc->randr_crtc, 256);
+ }
+ /*
+ * Configure outputs
+ */
+ for (o = 0; o < config->num_output; o++)
+ {
+ xf86OutputPtr output = config->output[o];
+
+ output->randr_output = RROutputCreate (pScreen, output->name,
+ strlen (output->name),
+ output);
+
+ if (output->funcs->create_resources != NULL)
+ output->funcs->create_resources(output);
+ RRPostPendingProperties (output->randr_output);
+ }
+ return TRUE;
+}
+
+static Bool
+xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
+{
+ int c;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+
+ for (c = 0; c < config->num_crtc; c++)
+ xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
+
+
+ RRScreenSetSizeRange (pScreen, config->minWidth, config->minHeight,
+ config->maxWidth, config->maxHeight);
+ return TRUE;
+}
+
+static void
+xf86RandR12PointerMoved (int scrnIndex, int x, int y)
+{
+}
+
+static Bool
+xf86RandR12Init12 (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ rrScrPrivPtr rp = rrGetScrPriv(pScreen);
+
+ rp->rrGetInfo = xf86RandR12GetInfo12;
+ rp->rrScreenSetSize = xf86RandR12ScreenSetSize;
+ rp->rrCrtcSet = xf86RandR12CrtcSet;
+ rp->rrCrtcSetGamma = xf86RandR12CrtcSetGamma;
+ rp->rrOutputSetProperty = xf86RandR12OutputSetProperty;
+ rp->rrOutputValidateMode = xf86RandR12OutputValidateMode;
+ rp->rrModeDestroy = xf86RandR12ModeDestroy;
+ rp->rrSetConfig = NULL;
+ pScrn->PointerMoved = xf86RandR12PointerMoved;
+ if (!xf86RandR12CreateObjects12 (pScreen))
+ return FALSE;
+
+ /*
+ * Configure output modes
+ */
+ if (!xf86RandR12SetInfo12 (pScreen))
+ return FALSE;
+ return TRUE;
+}
+
+#endif
+
+Bool
+xf86RandR12PreInit (ScrnInfoPtr pScrn)
+{
+ return TRUE;
+}
diff --git a/hw/xfree86/modes/xf86RandR12.h b/hw/xfree86/modes/xf86RandR12.h
new file mode 100644
index 000000000..8a4668b46
--- /dev/null
+++ b/hw/xfree86/modes/xf86RandR12.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * 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, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _XF86_RANDR_H_
+#define _XF86_RANDR_H_
+#include <randrstr.h>
+#include <X11/extensions/render.h>
+
+Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen);
+Bool xf86RandR12Init(ScreenPtr pScreen);
+void xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotation);
+Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate,
+ RRScreenSizePtr pSize);
+Rotation xf86RandR12GetRotation(ScreenPtr pScreen);
+void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y);
+Bool xf86RandR12PreInit (ScrnInfoPtr pScrn);
+
+#endif /* _XF86_RANDR_H_ */
diff --git a/hw/xfree86/modes/xf86Rename.h b/hw/xfree86/modes/xf86Rename.h
new file mode 100644
index 000000000..9dcfef5da
--- /dev/null
+++ b/hw/xfree86/modes/xf86Rename.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * 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, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifndef _XF86RENAME_H_
+#define _XF86RENAME_H_
+
+#include "local_xf86Rename.h"
+
+#define xf86CrtcConfigInit XF86NAME(xf86CrtcConfigInit)
+#define xf86CrtcConfigPrivateIndex XF86NAME(xf86CrtcConfigPrivateIndex)
+#define xf86CrtcCreate XF86NAME(xf86CrtcCreate)
+#define xf86CrtcDestroy XF86NAME(xf86CrtcDestroy)
+#define xf86CrtcInUse XF86NAME(xf86CrtcInUse)
+#define xf86CrtcRotate XF86NAME(xf86CrtcRotate)
+#define xf86CrtcScreenInit XF86NAME(xf86CrtcScreenInit)
+#define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode)
+#define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange)
+#define xf86CVTMode XF86NAME(xf86CVTMode)
+#define xf86DisableUnusedFunctions XF86NAME(xf86DisableUnusedFunctions)
+#define xf86DPMSSet XF86NAME(xf86DPMSSet)
+#define xf86DuplicateMode XF86NAME(xf86DuplicateMode)
+#define xf86DuplicateModes XF86NAME(xf86DuplicateModes)
+#define xf86GetDefaultModes XF86NAME(xf86GetDefaultModes)
+#define xf86GetMonitorModes XF86NAME(xf86GetMonitorModes)
+#define xf86InitialConfiguration XF86NAME(xf86InitialConfiguration)
+#define xf86ModeHSync XF86NAME(xf86ModeHSync)
+#define xf86ModesAdd XF86NAME(xf86ModesAdd)
+#define xf86ModesEqual XF86NAME(xf86ModesEqual)
+#define xf86ModeVRefresh XF86NAME(xf86ModeVRefresh)
+#define xf86OutputCreate XF86NAME(xf86OutputCreate)
+#define xf86OutputDestroy XF86NAME(xf86OutputDestroy)
+#define xf86OutputGetEDID XF86NAME(xf86OutputGetEDID)
+#define xf86OutputGetEDIDModes XF86NAME(xf86OutputGetEDIDModes)
+#define xf86OutputRename XF86NAME(xf86OutputRename)
+#define xf86OutputSetEDID XF86NAME(xf86OutputSetEDID)
+#define xf86PrintModeline XF86NAME(xf86PrintModeline)
+#define xf86ProbeOutputModes XF86NAME(xf86ProbeOutputModes)
+#define xf86PruneInvalidModes XF86NAME(xf86PruneInvalidModes)
+#define xf86SetModeCrtc XF86NAME(xf86SetModeCrtc)
+#define xf86SetModeDefaultName XF86NAME(xf86SetModeDefaultName)
+#define xf86SetScrnInfoModes XF86NAME(xf86SetScrnInfoModes)
+#define xf86ValidateModesClocks XF86NAME(xf86ValidateModesClocks)
+#define xf86ValidateModesFlags XF86NAME(xf86ValidateModesFlags)
+#define xf86ValidateModesSize XF86NAME(xf86ValidateModesSize)
+#define xf86ValidateModesSync XF86NAME(xf86ValidateModesSync)
+#define xf86ValidateModesUserConfig XF86NAME(xf86ValidateModesUserConfig)
+#define xf86DiDGAInit XF86NAME(xf86DiDGAInit)
+#define xf86DiDGAReInit XF86NAME(xf86DiDGAReInit)
+#define xf86DDCGetModes XF86NAME(xf86DDCGetModes)
+#define xf86RandR12CreateScreenResources XF86NAME(xf86RandR12CreateScreenResources)
+#define xf86RandR12GetOriginalVirtualSize XF86NAME(xf86RandR12GetOriginalVirtualSize)
+#define xf86RandR12GetRotation XF86NAME(xf86RandR12GetRotation)
+#define xf86RandR12Init XF86NAME(xf86RandR12Init)
+#define xf86RandR12PreInit XF86NAME(xf86RandR12PreInit)
+#define xf86RandR12SetConfig XF86NAME(xf86RandR12SetConfig)
+#define xf86RandR12SetRotations XF86NAME(xf86RandR12SetRotations)
+#define xf86SaveScreen XF86NAME(xf86SaveScreen)
+#define xf86CrtcSetScreenSubpixelOrder XF86NAME(xf86CrtcSetScreenSubpixelOrder)
+#define xf86ModeWidth XF86NAME(xf86ModeWidth)
+#define xf86ModeHeight XF86NAME(xf86ModeHeight)
+#define xf86OutputFindClosestMode XF86NAME(xf86OutputFindClosestMode)
+#define xf86SetSingleMode XF86NAME(xf86SetSingleMode)
+#define xf86SetDesiredModes XF86NAME(xf86SetDesiredModes)
+
+#endif /* _XF86RENAME_H_ */
diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
new file mode 100644
index 000000000..e8fafd073
--- /dev/null
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -0,0 +1,464 @@
+/*
+ * Copyright © 2006 Keith Packard
+ *
+ * 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, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS 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.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "xf86.h"
+#include "xf86DDC.h"
+#include "fb.h"
+#include "windowstr.h"
+#include "xf86Crtc.h"
+#include "xf86Modes.h"
+#include "xf86RandR12.h"
+#include "X11/extensions/render.h"
+#define DPMS_SERVER
+#include "X11/extensions/dpms.h"
+#include "X11/Xatom.h"
+
+/* borrowed from composite extension, move to Render and publish? */
+
+static VisualPtr
+compGetWindowVisual (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ VisualID vid = wVisual (pWin);
+ int i;
+
+ for (i = 0; i < pScreen->numVisuals; i++)
+ if (pScreen->visuals[i].vid == vid)
+ return &pScreen->visuals[i];
+ return 0;
+}
+
+static PictFormatPtr
+compWindowFormat (WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ return PictureMatchVisual (pScreen, pWin->drawable.depth,
+ compGetWindowVisual (pWin));
+}
+
+static void
+xf86TranslateBox (BoxPtr b, int dx, int dy)
+{
+ b->x1 += dx;
+ b->y1 += dy;
+ b->x2 += dx;
+ b->y2 += dy;
+}
+
+static void
+xf86TransformBox (BoxPtr dst, BoxPtr src, Rotation rotation,
+ int xoff, int yoff,
+ int dest_width, int dest_height)
+{
+ BoxRec stmp = *src;
+
+ xf86TranslateBox (&stmp, -xoff, -yoff);
+ switch (rotation & 0xf) {
+ default:
+ case RR_Rotate_0:
+ *dst = stmp;
+ break;
+ case RR_Rotate_90:
+ dst->x1 = stmp.y1;
+ dst->y1 = dest_height - stmp.x2;
+ dst->x2 = stmp.y2;
+ dst->y2 = dest_height - stmp.x1;
+ break;
+ case RR_Rotate_180:
+ dst->x1 = dest_width - stmp.x2;
+ dst->y1 = dest_height - stmp.y2;
+ dst->x2 = dest_width - stmp.x1;
+ dst->y2 = dest_height - stmp.y1;
+ break;
+ case RR_Rotate_270:
+ dst->x1 = dest_width - stmp.y2;
+ dst->y1 = stmp.x1;
+ dst->y2 = stmp.x2;
+ dst->x2 = dest_width - stmp.y1;
+ break;
+ }
+ if (rotation & RR_Reflect_X) {
+ int x1 = dst->x1;
+ dst->x1 = dest_width - dst->x2;
+ dst->x2 = dest_width - x1;
+ }
+ if (rotation & RR_Reflect_Y) {
+ int y1 = dst->y1;
+ dst->y1 = dest_height - dst->y2;
+ dst->y2 = dest_height - y1;
+ }
+}
+
+static void
+xf86RotateCrtcRedisplay (xf86CrtcPtr crtc, RegionPtr region)
+{
+ ScrnInfoPtr scrn = crtc->scrn;
+ ScreenPtr screen = scrn->pScreen;
+ WindowPtr root = WindowTable[screen->myNum];
+ PixmapPtr dst_pixmap = crtc->rotatedPixmap;
+ PictFormatPtr format = compWindowFormat (WindowTable[screen->myNum]);
+ int error;
+ PicturePtr src, dst;
+ PictTransform transform;
+ int n = REGION_NUM_RECTS(region);
+ BoxPtr b = REGION_RECTS(region);
+ XID include_inferiors = IncludeInferiors;
+
+ src = CreatePicture (None,
+ &root->drawable,
+ format,
+ CPSubwindowMode,
+ &include_inferiors,
+ serverClient,
+ &error);
+ if (!src)
+ return;
+
+ dst = CreatePicture (None,
+ &dst_pixmap->drawable,
+ format,
+ 0L,
+ NULL,
+ serverClient,
+ &error);
+ if (!dst)
+ return;
+
+ memset (&transform, '\0', sizeof (transform));
+ transform.matrix[2][2] = IntToxFixed(1);
+ transform.matrix[0][2] = IntToxFixed(crtc->x);
+ transform.matrix[1][2] = IntToxFixed(crtc->y);
+ switch (crtc->rotation & 0xf) {
+ default:
+ case RR_Rotate_0:
+ transform.matrix[0][0] = IntToxFixed(1);
+ transform.matrix[1][1] = IntToxFixed(1);
+ break;
+ case RR_Rotate_90:
+ transform.matrix[0][1] = IntToxFixed(-1);
+ transform.matrix[1][0] = IntToxFixed(1);
+ transform.matrix[0][2] += IntToxFixed(crtc->mode.VDisplay);
+ break;
+ case RR_Rotate_180:
+ transform.matrix[0][0] = IntToxFixed(-1);
+ transform.matrix[1][1] = IntToxFixed(-1);
+ transform.matrix[0][2] += IntToxFixed(crtc->mode.HDisplay);
+ transform.matrix[1][2] += IntToxFixed(crtc->mode.VDisplay);
+ break;
+ case RR_Rotate_270:
+ transform.matrix[0][1] = IntToxFixed(1);
+ transform.matrix[1][0] = IntToxFixed(-1);
+ transform.matrix[1][2] += IntToxFixed(crtc->mode.HDisplay);
+ break;
+ }
+
+ /* handle reflection */
+ if (crtc->rotation & RR_Reflect_X)
+ {
+ /* XXX figure this out */
+ }
+ if (crtc->rotation & RR_Reflect_Y)
+ {
+ /* XXX figure this out too */
+ }
+
+ error = SetPictureTransform (src, &transform);
+ if (error)
+ return;
+
+ while (n--)
+ {
+ BoxRec dst_box;
+
+ xf86TransformBox (&dst_box, b, crtc->rotation,
+ crtc->x, crtc->y,
+ crtc->mode.HDisplay, crtc->mode.VDisplay);
+ CompositePicture (PictOpSrc,
+ src, NULL, dst,
+ dst_box.x1, dst_box.y1, 0, 0, dst_box.x1, dst_box.y1,
+ dst_box.x2 - dst_box.x1,
+ dst_box.y2 - dst_box.y1);
+ b++;
+ }
+ FreePicture (src, None);
+ FreePicture (dst, None);
+}
+
+static void
+xf86CrtcDamageShadow (xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ BoxRec damage_box;
+ RegionRec damage_region;
+ ScreenPtr pScreen = pScrn->pScreen;
+
+ damage_box.x1 = crtc->x;
+ damage_box.x2 = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
+ damage_box.y1 = crtc->y;
+ damage_box.y2 = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
+ REGION_INIT (pScreen, &damage_region, &damage_box, 1);
+ DamageDamageRegion (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
+ &damage_region);
+ REGION_UNINIT (pScreen, &damage_region);
+}
+
+static void
+xf86RotatePrepare (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->rotatedData && !crtc->rotatedPixmap)
+ {
+ crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
+ crtc->rotatedData,
+ crtc->mode.HDisplay,
+ crtc->mode.VDisplay);
+ if (!xf86_config->rotation_damage_registered)
+ {
+ /* Hook damage to screen pixmap */
+ DamageRegister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
+ xf86_config->rotation_damage);
+ xf86_config->rotation_damage_registered = TRUE;
+ }
+
+ xf86CrtcDamageShadow (crtc);
+ }
+ }
+}
+
+static void
+xf86RotateRedisplay(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ DamagePtr damage = xf86_config->rotation_damage;
+ RegionPtr region;
+
+ if (!damage)
+ return;
+ xf86RotatePrepare (pScreen);
+ region = DamageRegion(damage);
+ if (REGION_NOTEMPTY(pScreen, region))
+ {
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ {
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
+
+ if (crtc->rotation != RR_Rotate_0)
+ {
+ BoxRec box;
+ RegionRec crtc_damage;
+
+ /* compute portion of damage that overlaps crtc */
+ box.x1 = crtc->x;
+ box.x2 = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
+ box.y1 = crtc->y;
+ box.y2 = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
+ REGION_INIT(pScreen, &crtc_damage, &box, 1);
+ REGION_INTERSECT (pScreen, &crtc_damage, &crtc_damage, region);
+
+ /* update damaged region */
+ if (REGION_NOTEMPTY(pScreen, &crtc_damage))
+ xf86RotateCrtcRedisplay (crtc, &crtc_damage);
+
+ REGION_UNINIT (pScreen, &crtc_damage);
+ }
+ }
+ DamageEmpty(damage);
+ }
+}
+
+static void
+xf86RotateBlockHandler(pointer data, OSTimePtr pTimeout, pointer pRead)
+{
+ ScreenPtr pScreen = (ScreenPtr) data;
+
+ xf86RotateRedisplay(pScreen);
+}
+
+static void
+xf86RotateWakeupHandler(pointer data, int i, pointer LastSelectMask)
+{
+}
+
+static void
+xf86RotateDestroy (xf86CrtcPtr crtc)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ ScreenPtr pScreen = pScrn->pScreen;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ int c;
+
+ /* Free memory from rotation */
+ if (crtc->rotatedPixmap || crtc->rotatedData)
+ {
+ crtc->funcs->shadow_destroy (crtc, crtc->rotatedPixmap, crtc->rotatedData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
+ }
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ if (crtc->rotatedPixmap || crtc->rotatedData)
+ return;
+
+ /*
+ * Clean up damage structures when no crtcs are rotated
+ */
+ if (xf86_config->rotation_damage)
+ {
+ /* Free damage structure */
+ if (xf86_config->rotation_damage_registered)
+ {
+ DamageUnregister (&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
+ xf86_config->rotation_damage);
+ xf86_config->rotation_damage_registered = FALSE;
+ }
+ DamageDestroy (xf86_config->rotation_damage);
+ xf86_config->rotation_damage = NULL;
+ /* Free block/wakeup handler */
+ RemoveBlockAndWakeupHandlers (xf86RotateBlockHandler,
+ xf86RotateWakeupHandler,
+ (pointer) pScreen);
+ }
+}
+
+void
+xf86RotateCloseScreen (ScreenPtr screen)
+{
+ ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
+ int c;
+
+ for (c = 0; c < xf86_config->num_crtc; c++)
+ xf86RotateDestroy (xf86_config->crtc[c]);
+}
+
+Bool
+xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
+{
+ ScrnInfoPtr pScrn = crtc->scrn;
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ ScreenPtr pScreen = pScrn->pScreen;
+
+ if (rotation == RR_Rotate_0)
+ {
+ xf86RotateDestroy (crtc);
+ }
+ else
+ {
+ /*
+ * these are the size of the shadow pixmap, which
+ * matches the mode, not the pre-rotated copy in the
+ * frame buffer
+ */
+ int width = mode->HDisplay;
+ int height = mode->VDisplay;
+ void *shadowData = crtc->rotatedData;
+ PixmapPtr shadow = crtc->rotatedPixmap;
+ int old_width = shadow ? shadow->drawable.width : 0;
+ int old_height = shadow ? shadow->drawable.height : 0;
+
+ /* Allocate memory for rotation */
+ if (old_width != width || old_height != height)
+ {
+ if (shadow || shadowData)
+ {
+ crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
+ }
+ shadowData = crtc->funcs->shadow_allocate (crtc, width, height);
+ if (!shadowData)
+ goto bail1;
+ crtc->rotatedData = shadowData;
+ /* shadow will be damaged in xf86RotatePrepare */
+ }
+ else
+ {
+ /* mark shadowed area as damaged so it will be repainted */
+ xf86CrtcDamageShadow (crtc);
+ }
+
+ if (!xf86_config->rotation_damage)
+ {
+ /* Create damage structure */
+ xf86_config->rotation_damage = DamageCreate (NULL, NULL,
+ DamageReportNone,
+ TRUE, pScreen, pScreen);
+ if (!xf86_config->rotation_damage)
+ goto bail2;
+
+ /* Assign block/wakeup handler */
+ if (!RegisterBlockAndWakeupHandlers (xf86RotateBlockHandler,
+ xf86RotateWakeupHandler,
+ (pointer) pScreen))
+ {
+ goto bail3;
+ }
+ }
+ if (0)
+ {
+bail3:
+ DamageDestroy (xf86_config->rotation_damage);
+ xf86_config->rotation_damage = NULL;
+
+bail2:
+ if (shadow || shadowData)
+ {
+ crtc->funcs->shadow_destroy (crtc, shadow, shadowData);
+ crtc->rotatedPixmap = NULL;
+ crtc->rotatedData = NULL;
+ }
+bail1:
+ if (old_width && old_height)
+ crtc->rotatedPixmap = crtc->funcs->shadow_create (crtc,
+ NULL,
+ old_width,
+ old_height);
+ return FALSE;
+ }
+ }
+
+ /* All done */
+ return TRUE;
+}
diff --git a/hw/xfree86/modes/xf86cvt.c b/hw/xfree86/modes/xf86cvt.c
new file mode 100644
index 000000000..69ccc4259
--- /dev/null
+++ b/hw/xfree86/modes/xf86cvt.c
@@ -0,0 +1,308 @@
+/*
+ * Copyright 2005-2006 Luc Verhaegen.
+ *
+ * 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.
+ */
+
+/**
+ * @file This is a copy of xf86cvt.c from the X Server, for compatibility with
+ * old servers (pre-1.2).
+ */
+
+/*
+ * The reason for having this function in a file of its own is
+ * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode
+ * code is shared directly.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#else
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#endif
+
+#include "xf86.h"
+#include "xf86Modes.h"
+
+#include <string.h>
+
+/*
+ * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.
+ *
+ * These calculations are stolen from the CVT calculation spreadsheet written
+ * by Graham Loveridge. He seems to be claiming no copyright and there seems to
+ * be no license attached to this. He apparently just wants to see his name
+ * mentioned.
+ *
+ * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls
+ *
+ * Comments and structure corresponds to the comments and structure of the xls.
+ * This should ease importing of future changes to the standard (not very
+ * likely though).
+ *
+ * About margins; i'm sure that they are to be the bit between HDisplay and
+ * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and
+ * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking
+ * outside sync "margin" for some reason. Since we prefer seeing proper
+ * blanking instead of the overscan colour, and since the Crtc* values will
+ * probably get altered after us, we will disable margins altogether. With
+ * these calculations, Margins will plainly expand H/VDisplay, and we don't
+ * want that. -- libv
+ *
+ */
+_X_EXPORT DisplayModePtr
+xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
+ Bool Interlaced)
+{
+ DisplayModeRec *Mode = xnfalloc(sizeof(DisplayModeRec));
+
+ /* 1) top/bottom margin size (% of height) - default: 1.8 */
+#define CVT_MARGIN_PERCENTAGE 1.8
+
+ /* 2) character cell horizontal granularity (pixels) - default 8 */
+#define CVT_H_GRANULARITY 8
+
+ /* 4) Minimum vertical porch (lines) - default 3 */
+#define CVT_MIN_V_PORCH 3
+
+ /* 4) Minimum number of vertical back porch lines - default 6 */
+#define CVT_MIN_V_BPORCH 6
+
+ /* Pixel Clock step (kHz) */
+#define CVT_CLOCK_STEP 250
+
+ Bool Margins = FALSE;
+ float VFieldRate, HPeriod;
+ int HDisplayRnd, HMargin;
+ int VDisplayRnd, VMargin, VSync;
+ float Interlace; /* Please rename this */
+
+ memset(Mode, 0, sizeof(DisplayModeRec));
+
+ /* CVT default is 60.0Hz */
+ if (!VRefresh)
+ VRefresh = 60.0;
+
+ /* 1. Required field rate */
+ if (Interlaced)
+ VFieldRate = VRefresh * 2;
+ else
+ VFieldRate = VRefresh;
+
+ /* 2. Horizontal pixels */
+ HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY);
+
+ /* 3. Determine left and right borders */
+ if (Margins) {
+ /* right margin is actually exactly the same as left */
+ HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
+ HMargin -= HMargin % CVT_H_GRANULARITY;
+ } else
+ HMargin = 0;
+
+ /* 4. Find total active pixels */
+ Mode->HDisplay = HDisplayRnd + 2*HMargin;
+
+ /* 5. Find number of lines per field */
+ if (Interlaced)
+ VDisplayRnd = VDisplay / 2;
+ else
+ VDisplayRnd = VDisplay;
+
+ /* 6. Find top and bottom margins */
+ /* nope. */
+ if (Margins)
+ /* top and bottom margins are equal again. */
+ VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
+ else
+ VMargin = 0;
+
+ Mode->VDisplay = VDisplay + 2*VMargin;
+
+ /* 7. Interlace */
+ if (Interlaced)
+ Interlace = 0.5;
+ else
+ Interlace = 0.0;
+
+ /* Determine VSync Width from aspect ratio */
+ if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay))
+ VSync = 4;
+ else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay))
+ VSync = 5;
+ else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay))
+ VSync = 6;
+ else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay))
+ VSync = 7;
+ else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay))
+ VSync = 7;
+ else /* Custom */
+ VSync = 10;
+
+ if (!Reduced) { /* simplified GTF calculation */
+
+ /* 4) Minimum time of vertical sync + back porch interval (µs)
+ * default 550.0 */
+#define CVT_MIN_VSYNC_BP 550.0
+
+ /* 3) Nominal HSync width (% of line period) - default 8 */
+#define CVT_HSYNC_PERCENTAGE 8
+
+ float HBlankPercentage;
+ int VSyncAndBackPorch, VBackPorch;
+ int HBlank;
+
+ /* 8. Estimated Horizontal period */
+ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) /
+ (VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace);
+
+ /* 9. Find number of lines in sync + backporch */
+ if (((int)(CVT_MIN_VSYNC_BP / HPeriod) + 1) < (VSync + CVT_MIN_V_PORCH))
+ VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH;
+ else
+ VSyncAndBackPorch = (int)(CVT_MIN_VSYNC_BP / HPeriod) + 1;
+
+ /* 10. Find number of lines in back porch */
+ VBackPorch = VSyncAndBackPorch - VSync;
+
+ /* 11. Find total number of lines in vertical field */
+ Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace
+ + CVT_MIN_V_PORCH;
+
+ /* 5) Definition of Horizontal blanking time limitation */
+ /* Gradient (%/kHz) - default 600 */
+#define CVT_M_FACTOR 600
+
+ /* Offset (%) - default 40 */
+#define CVT_C_FACTOR 40
+
+ /* Blanking time scaling factor - default 128 */
+#define CVT_K_FACTOR 128
+
+ /* Scaling factor weighting - default 20 */
+#define CVT_J_FACTOR 20
+
+#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256
+#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \
+ CVT_J_FACTOR
+
+ /* 12. Find ideal blanking duty cycle from formula */
+ HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod/1000.0;
+
+ /* 13. Blanking time */
+ if (HBlankPercentage < 20)
+ HBlankPercentage = 20;
+
+ HBlank = Mode->HDisplay * HBlankPercentage/(100.0 - HBlankPercentage);
+ HBlank -= HBlank % (2*CVT_H_GRANULARITY);
+
+ /* 14. Find total number of pixels in a line. */
+ Mode->HTotal = Mode->HDisplay + HBlank;
+
+ /* Fill in HSync values */
+ Mode->HSyncEnd = Mode->HDisplay + HBlank / 2;
+
+ Mode->HSyncStart = Mode->HSyncEnd -
+ (Mode->HTotal * CVT_HSYNC_PERCENTAGE) / 100;
+ Mode->HSyncStart += CVT_H_GRANULARITY -
+ Mode->HSyncStart % CVT_H_GRANULARITY;
+
+ /* Fill in VSync values */
+ Mode->VSyncStart = Mode->VDisplay + CVT_MIN_V_PORCH;
+ Mode->VSyncEnd = Mode->VSyncStart + VSync;
+
+ } else { /* Reduced blanking */
+ /* Minimum vertical blanking interval time (µs) - default 460 */
+#define CVT_RB_MIN_VBLANK 460.0
+
+ /* Fixed number of clocks for horizontal sync */
+#define CVT_RB_H_SYNC 32.0
+
+ /* Fixed number of clocks for horizontal blanking */
+#define CVT_RB_H_BLANK 160.0
+
+ /* Fixed number of lines for vertical front porch - default 3 */
+#define CVT_RB_VFPORCH 3
+
+ int VBILines;
+
+ /* 8. Estimate Horizontal period. */
+ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) /
+ (VDisplayRnd + 2*VMargin);
+
+ /* 9. Find number of lines in vertical blanking */
+ VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1;
+
+ /* 10. Check if vertical blanking is sufficient */
+ if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH))
+ VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH;
+
+ /* 11. Find total number of lines in vertical field */
+ Mode->VTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines;
+
+ /* 12. Find total number of pixels in a line */
+ Mode->HTotal = Mode->HDisplay + CVT_RB_H_BLANK;
+
+ /* Fill in HSync values */
+ Mode->HSyncEnd = Mode->HDisplay + CVT_RB_H_BLANK / 2;
+ Mode->HSyncStart = Mode->HSyncEnd - CVT_RB_H_SYNC;
+
+ /* Fill in VSync values */
+ Mode->VSyncStart = Mode->VDisplay + CVT_RB_VFPORCH;
+ Mode->VSyncEnd = Mode->VSyncStart + VSync;
+ }
+
+ /* 15/13. Find pixel clock frequency (kHz for xf86) */
+ Mode->Clock = Mode->HTotal * 1000.0 / HPeriod;
+ Mode->Clock -= Mode->Clock % CVT_CLOCK_STEP;
+
+ /* 16/14. Find actual Horizontal Frequency (kHz) */
+ Mode->HSync = ((float) Mode->Clock) / ((float) Mode->HTotal);
+
+ /* 17/15. Find actual Field rate */
+ Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) /
+ ((float) (Mode->HTotal * Mode->VTotal));
+
+ /* 18/16. Find actual vertical frame frequency */
+ /* ignore - just set the mode flag for interlaced */
+ if (Interlaced)
+ Mode->VTotal *= 2;
+
+ {
+ char Name[256];
+ Name[0] = 0;
+
+ snprintf(Name, 256, "%dx%d", HDisplay, VDisplay);
+
+ Mode->name = xnfalloc(strlen(Name) + 1);
+ memcpy(Mode->name, Name, strlen(Name) + 1);
+ }
+
+ if (Reduced)
+ Mode->Flags |= V_PHSYNC | V_NVSYNC;
+ else
+ Mode->Flags |= V_NHSYNC | V_PVSYNC;
+
+ if (Interlaced)
+ Mode->Flags |= V_INTERLACE;
+
+ return Mode;
+}
diff --git a/hw/xfree86/os-support/bus/axpPci.c b/hw/xfree86/os-support/bus/axpPci.c
index 1f1547798..e2f086c53 100644
--- a/hw/xfree86/os-support/bus/axpPci.c
+++ b/hw/xfree86/os-support/bus/axpPci.c
@@ -217,7 +217,8 @@ axpPciInit()
* only set up the root bus for each domain (hose) and the bridged
* buses will be set up as they are found.
*/
- bus = PCI_MAKE_BUS(domain, 0);
+ /* make a bus with both the domain and the root bus in it */
+ bus = PCI_MAKE_BUS(domain, pDomain->root_bus);
pciBusInfo[bus] = xnfalloc(sizeof(pciBusInfo_t));
(void)memset(pciBusInfo[bus], 0, sizeof(pciBusInfo_t));
@@ -246,7 +247,7 @@ axpPciBusFromTag(PCITAG tag)
|| !(pDomain = pBusInfo->pciBusPriv)
|| (pDomain->domain != PCI_DOM_FROM_TAG(tag))) return -1;
- bus = PCI_BUS_NO_DOMAIN(bus) + pDomain->root_bus;
+ bus = PCI_BUS_NO_DOMAIN(bus); /* should just be root_bus */
dfn = PCI_DFN_FROM_TAG(tag);
if (_iobase(IOBASE_HOSE, -1, bus, dfn) != pDomain->hose) return -1;
diff --git a/hw/xfree86/os-support/shared/libc_wrapper.c b/hw/xfree86/os-support/shared/libc_wrapper.c
index 4c4af4c24..a459d5d70 100644
--- a/hw/xfree86/os-support/shared/libc_wrapper.c
+++ b/hw/xfree86/os-support/shared/libc_wrapper.c
@@ -628,7 +628,7 @@ typedef struct _xf86_file_ {
char* fname;
} XF86FILE_priv;
-XF86FILE_priv stdhnd[3] = {
+static XF86FILE_priv stdhnd[3] = {
{ 0, XF86FILE_magic, NULL, "$stdinp$" },
{ 0, XF86FILE_magic, NULL, "$stdout$" },
{ 0, XF86FILE_magic, NULL, "$stderr$" }
diff --git a/hw/xfree86/os-support/solaris/Makefile.am b/hw/xfree86/os-support/solaris/Makefile.am
index 57ec89e57..d01e2e676 100644
--- a/hw/xfree86/os-support/solaris/Makefile.am
+++ b/hw/xfree86/os-support/solaris/Makefile.am
@@ -19,9 +19,9 @@ solaris-$(SOLARIS_INOUT_ARCH).il: solaris-${SOLARIS_INOUT_ARCH}.S
noinst_LTLIBRARIES = libsolaris.la
libsolaris_la_SOURCES = sun_bios.c sun_init.c \
- sun_mouse.c sun_vid.c sun_bell.c $(AGP_SRC) \
+ sun_mouse.c sun_vid.c sun_bell.c $(AGP_SRC) sun_apm.c \
$(srcdir)/../shared/libc_wrapper.c \
- $(srcdir)/../shared/kmod_noop.c $(srcdir)/../shared/pm_noop.c \
+ $(srcdir)/../shared/kmod_noop.c \
$(srcdir)/../shared/posix_tty.c $(srcdir)/../shared/sigiostubs.c \
$(srcdir)/../shared/stdPci.c $(srcdir)/../shared/stdResource.c \
$(VTSW_SRC)
diff --git a/hw/xfree86/os-support/solaris/sun_apm.c b/hw/xfree86/os-support/solaris/sun_apm.c
new file mode 100644
index 000000000..a9657fd55
--- /dev/null
+++ b/hw/xfree86/os-support/solaris/sun_apm.c
@@ -0,0 +1,232 @@
+/* Based on hw/xfree86/os-support/bsd/bsd_apm.c which bore no explicit
+ * copyright notice, so is covered by the following notice:
+ *
+ * Copyright (C) 1994-2003 The XFree86 Project, Inc. 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 XFREE86 PROJECT 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 XFree86 Project 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
+ * XFree86 Project.
+ */
+
+/* Copyright 2005 Sun Microsystems, Inc. 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, 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 Software 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
+ * MERCHANTABILITY, 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 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.
+ *
+ * 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.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "os.h"
+#include "xf86.h"
+#include "xf86Priv.h"
+#define XF86_OS_PRIVS
+#include "xf86_OSproc.h"
+#include "xf86_OSlib.h"
+
+#ifndef PLEASE_FIX_THIS
+#define APM_STANDBY_REQ 0xa01
+#define APM_SUSPEND_REQ 0xa02
+#define APM_NORMAL_RESUME 0xa03
+#define APM_CRIT_RESUME 0xa04
+#define APM_BATTERY_LOW 0xa05
+#define APM_POWER_CHANGE 0xa06
+#define APM_UPDATE_TIME 0xa07
+#define APM_CRIT_SUSPEND_REQ 0xa08
+#define APM_USER_STANDBY_REQ 0xa09
+#define APM_USER_SUSPEND_REQ 0xa0a
+#define APM_SYS_STANDBY_RESUME 0xa0b
+#define APM_IOC_NEXTEVENT 0xa0c
+#define APM_IOC_RESUME 0xa0d
+#define APM_IOC_SUSPEND 0xa0e
+#define APM_IOC_STANDBY 0xa0f
+#endif
+
+typedef struct apm_event_info
+{
+ int type;
+} apm_event_info;
+
+/*
+ This may be replaced with a better device name
+ very soon...
+*/
+#define APM_DEVICE "/dev/srn"
+#define APM_DEVICE1 "/dev/apm"
+
+static pointer APMihPtr = NULL;
+static void sunCloseAPM(void);
+
+static struct {
+ u_int apmBsd;
+ pmEvent xf86;
+} sunToXF86Array [] = {
+ { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY },
+ { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND },
+ { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME },
+ { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME },
+ { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY },
+ { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE },
+ { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME },
+ { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND },
+ { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY },
+ { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND },
+ { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME },
+#ifdef APM_CAPABILITY_CHANGE
+ { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED },
+#endif
+};
+
+#define numApmEvents (sizeof(sunToXF86Array) / sizeof(sunToXF86Array[0]))
+
+static pmEvent
+sunToXF86(int type)
+{
+ int i;
+
+ for (i = 0; i < numApmEvents; i++) {
+ if (type == sunToXF86Array[i].apmBsd) {
+ return sunToXF86Array[i].xf86;
+ }
+ }
+ return XF86_APM_UNKNOWN;
+}
+
+/*
+ * APM events can be requested direclty from /dev/apm
+ */
+static int
+sunPMGetEventFromOS(int fd, pmEvent *events, int num)
+{
+ struct apm_event_info sunEvent;
+ int i;
+
+ for (i = 0; i < num; i++) {
+
+ if (ioctl(fd, APM_IOC_NEXTEVENT, &sunEvent) < 0) {
+ if (errno != EAGAIN) {
+ xf86Msg(X_WARNING, "sunPMGetEventFromOS: APM_IOC_NEXTEVENT"
+ " errno = %d\n", errno);
+ }
+ break;
+ }
+ events[i] = sunToXF86(sunEvent.type);
+ }
+ xf86Msg(X_WARNING, "Got some events\n");
+ return i;
+}
+
+static pmWait
+sunPMConfirmEventToOs(int fd, pmEvent event)
+{
+ switch (event) {
+/* XXX: NOT CURRENTLY RETURNED FROM OS */
+ case XF86_APM_SYS_STANDBY:
+ case XF86_APM_USER_STANDBY:
+ if (ioctl( fd, APM_IOC_STANDBY, NULL ) == 0)
+ return PM_WAIT; /* should we stop the Xserver in standby, too? */
+ else
+ return PM_NONE;
+ case XF86_APM_SYS_SUSPEND:
+ case XF86_APM_CRITICAL_SUSPEND:
+ case XF86_APM_USER_SUSPEND:
+ xf86Msg(X_WARNING, "Got SUSPENDED\n");
+ if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0)
+ return PM_CONTINUE;
+ else {
+ xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_SUSPEND"
+ " errno = %d\n", errno);
+ return PM_FAILED;
+ }
+ case XF86_APM_STANDBY_RESUME:
+ case XF86_APM_NORMAL_RESUME:
+ case XF86_APM_CRITICAL_RESUME:
+ case XF86_APM_STANDBY_FAILED:
+ case XF86_APM_SUSPEND_FAILED:
+ xf86Msg(X_WARNING, "Got RESUME\n");
+ if (ioctl( fd, APM_IOC_RESUME, NULL ) == 0)
+ return PM_CONTINUE;
+ else {
+ xf86Msg(X_WARNING, "sunPMConfirmEventToOs: APM_IOC_RESUME"
+ " errno = %d\n", errno);
+ return PM_FAILED;
+ }
+ default:
+ return PM_NONE;
+ }
+}
+
+PMClose
+xf86OSPMOpen(void)
+{
+ int fd;
+
+ if (APMihPtr || !xf86Info.pmFlag) {
+ return NULL;
+ }
+
+ if ((fd = open(APM_DEVICE, O_RDWR)) == -1) {
+ if ((fd = open(APM_DEVICE1, O_RDWR)) == -1) {
+ return NULL;
+ }
+ }
+ xf86PMGetEventFromOs = sunPMGetEventFromOS;
+ xf86PMConfirmEventToOs = sunPMConfirmEventToOs;
+ APMihPtr = xf86AddInputHandler(fd, xf86HandlePMEvents, NULL);
+ return sunCloseAPM;
+}
+
+static void
+sunCloseAPM(void)
+{
+ int fd;
+
+ if (APMihPtr) {
+ fd = xf86RemoveInputHandler(APMihPtr);
+ close(fd);
+ APMihPtr = NULL;
+ }
+}
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index 97f872301..27f766d9c 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -130,8 +130,8 @@ typedef signed long xf86ssize_t;
# include <errno.h>
# if defined(_NEED_SYSI86)
-# include <sys/immu.h>
# if !(defined (sun) && defined (SVR4))
+# include <sys/immu.h>
# include <sys/region.h>
# endif
# include <sys/proc.h>
diff --git a/hw/xfree86/parser/DRI.c b/hw/xfree86/parser/DRI.c
index dc75cd23f..18644bcc7 100644
--- a/hw/xfree86/parser/DRI.c
+++ b/hw/xfree86/parser/DRI.c
@@ -48,7 +48,21 @@ static xf86ConfigSymTabRec DRITab[] =
#define CLEANUP xf86freeBuffersList
-XF86ConfBuffersPtr
+static void
+xf86freeBuffersList (XF86ConfBuffersPtr ptr)
+{
+ XF86ConfBuffersPtr prev;
+
+ while (ptr) {
+ TestFree (ptr->buf_flags);
+ TestFree (ptr->buf_comment);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+static XF86ConfBuffersPtr
xf86parseBuffers (void)
{
int token;
@@ -169,18 +183,3 @@ xf86freeDRI (XF86ConfDRIPtr ptr)
TestFree (ptr->dri_comment);
xf86conffree (ptr);
}
-
-void
-xf86freeBuffersList (XF86ConfBuffersPtr ptr)
-{
- XF86ConfBuffersPtr prev;
-
- while (ptr) {
- TestFree (ptr->buf_flags);
- TestFree (ptr->buf_comment);
- prev = ptr;
- ptr = ptr->list.next;
- xf86conffree (prev);
- }
-}
-
diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c
index 7ab70d1a8..4adea1ade 100644
--- a/hw/xfree86/parser/Flags.c
+++ b/hw/xfree86/parser/Flags.c
@@ -441,15 +441,6 @@ xf86uLongToString(unsigned long i)
return s;
}
-void
-xf86debugListOptions(XF86OptionPtr Options)
-{
- while (Options) {
- ErrorF("Option: %s Value: %s\n",Options->opt_name,Options->opt_val);
- Options = Options->list.next;
- }
-}
-
XF86OptionPtr
xf86parseOption(XF86OptionPtr head)
{
diff --git a/hw/xfree86/parser/Layout.c b/hw/xfree86/parser/Layout.c
index b9f4e9e6a..5d1348acb 100644
--- a/hw/xfree86/parser/Layout.c
+++ b/hw/xfree86/parser/Layout.c
@@ -382,24 +382,7 @@ xf86printLayoutSection (FILE * cf, XF86ConfLayoutPtr ptr)
}
}
-void
-xf86freeLayoutList (XF86ConfLayoutPtr ptr)
-{
- XF86ConfLayoutPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->lay_identifier);
- TestFree (ptr->lay_comment);
- xf86freeAdjacencyList (ptr->lay_adjacency_lst);
- xf86freeInputrefList (ptr->lay_input_lst);
- prev = ptr;
- ptr = ptr->list.next;
- xf86conffree (prev);
- }
-}
-
-void
+static void
xf86freeAdjacencyList (XF86ConfAdjacencyPtr ptr)
{
XF86ConfAdjacencyPtr prev;
@@ -419,7 +402,7 @@ xf86freeAdjacencyList (XF86ConfAdjacencyPtr ptr)
}
-void
+static void
xf86freeInputrefList (XF86ConfInputrefPtr ptr)
{
XF86ConfInputrefPtr prev;
@@ -435,6 +418,23 @@ xf86freeInputrefList (XF86ConfInputrefPtr ptr)
}
+void
+xf86freeLayoutList (XF86ConfLayoutPtr ptr)
+{
+ XF86ConfLayoutPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->lay_identifier);
+ TestFree (ptr->lay_comment);
+ xf86freeAdjacencyList (ptr->lay_adjacency_lst);
+ xf86freeInputrefList (ptr->lay_input_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
#define CheckScreen(str, ptr)\
if (str[0] != '\0') \
{ \
diff --git a/hw/xfree86/parser/Makefile.am b/hw/xfree86/parser/Makefile.am
index 1c1ba3f13..849ee8bab 100644
--- a/hw/xfree86/parser/Makefile.am
+++ b/hw/xfree86/parser/Makefile.am
@@ -36,4 +36,6 @@ EXTRA_DIST = \
cpconfig.c
sdk_HEADERS = \
- $(LIBHEADERS)
+ $(LIBHEADERS) \
+ xf86Parser.h \
+ xf86Optrec.h
diff --git a/hw/xfree86/parser/Module.c b/hw/xfree86/parser/Module.c
index f3ed9d19f..81eff18ae 100644
--- a/hw/xfree86/parser/Module.c
+++ b/hw/xfree86/parser/Module.c
@@ -83,7 +83,7 @@ static xf86ConfigSymTabRec ModuleTab[] =
#define CLEANUP xf86freeModules
-XF86LoadPtr
+static XF86LoadPtr
xf86parseModuleSubSection (XF86LoadPtr head, char *name)
{
int token;
diff --git a/hw/xfree86/parser/Monitor.c b/hw/xfree86/parser/Monitor.c
index 9dd0b1b1c..4bff4b23b 100644
--- a/hw/xfree86/parser/Monitor.c
+++ b/hw/xfree86/parser/Monitor.c
@@ -124,7 +124,21 @@ static xf86ConfigSymTabRec ModeTab[] =
#define CLEANUP xf86freeModeLineList
-XF86ConfModeLinePtr
+static void
+xf86freeModeLineList (XF86ConfModeLinePtr ptr)
+{
+ XF86ConfModeLinePtr prev;
+ while (ptr)
+ {
+ TestFree (ptr->ml_identifier);
+ TestFree (ptr->ml_comment);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+static XF86ConfModeLinePtr
xf86parseModeLine (void)
{
int token;
@@ -253,7 +267,7 @@ xf86parseModeLine (void)
return (ptr);
}
-XF86ConfModeLinePtr
+static XF86ConfModeLinePtr
xf86parseVerboseMode (void)
{
int token, token2;
@@ -830,20 +844,6 @@ xf86freeModesList (XF86ConfModesPtr ptr)
}
}
-void
-xf86freeModeLineList (XF86ConfModeLinePtr ptr)
-{
- XF86ConfModeLinePtr prev;
- while (ptr)
- {
- TestFree (ptr->ml_identifier);
- TestFree (ptr->ml_comment);
- prev = ptr;
- ptr = ptr->list.next;
- xf86conffree (prev);
- }
-}
-
XF86ConfMonitorPtr
xf86findMonitor (const char *ident, XF86ConfMonitorPtr p)
{
diff --git a/hw/xfree86/parser/Screen.c b/hw/xfree86/parser/Screen.c
index b7a64b035..79e1d24ef 100644
--- a/hw/xfree86/parser/Screen.c
+++ b/hw/xfree86/parser/Screen.c
@@ -83,7 +83,7 @@ static xf86ConfigSymTabRec DisplayTab[] =
#define CLEANUP xf86freeDisplayList
-XF86ConfDisplayPtr
+static XF86ConfDisplayPtr
xf86parseDisplaySubSection (void)
{
int token;
diff --git a/hw/xfree86/parser/Vendor.c b/hw/xfree86/parser/Vendor.c
index 3e9358b3b..d1e608067 100644
--- a/hw/xfree86/parser/Vendor.c
+++ b/hw/xfree86/parser/Vendor.c
@@ -75,7 +75,7 @@ static xf86ConfigSymTabRec VendorSubTab[] =
#define CLEANUP xf86freeVendorSubList
-XF86ConfVendSubPtr
+static XF86ConfVendSubPtr
xf86parseVendorSubSection (void)
{
int has_ident = FALSE;
@@ -242,16 +242,3 @@ xf86freeVendorSubList (XF86ConfVendSubPtr ptr)
xf86conffree (prev);
}
}
-
-XF86ConfVendorPtr
-xf86findVendor (const char *name, XF86ConfVendorPtr list)
-{
- while (list)
- {
- if (xf86nameCompare (list->vnd_identifier, name) == 0)
- return (list);
- list = list->list.next;
- }
- return (NULL);
-}
-
diff --git a/hw/xfree86/parser/Video.c b/hw/xfree86/parser/Video.c
index fa0ff7833..a8912cf44 100644
--- a/hw/xfree86/parser/Video.c
+++ b/hw/xfree86/parser/Video.c
@@ -74,7 +74,23 @@ static xf86ConfigSymTabRec VideoPortTab[] =
#define CLEANUP xf86freeVideoPortList
-XF86ConfVideoPortPtr
+static void
+xf86freeVideoPortList (XF86ConfVideoPortPtr ptr)
+{
+ XF86ConfVideoPortPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->vp_identifier);
+ TestFree (ptr->vp_comment);
+ xf86optionListFree (ptr->vp_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ xf86conffree (prev);
+ }
+}
+
+static XF86ConfVideoPortPtr
xf86parseVideoPortSubSection (void)
{
int has_ident = FALSE;
@@ -266,22 +282,6 @@ xf86freeVideoAdaptorList (XF86ConfVideoAdaptorPtr ptr)
}
}
-void
-xf86freeVideoPortList (XF86ConfVideoPortPtr ptr)
-{
- XF86ConfVideoPortPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->vp_identifier);
- TestFree (ptr->vp_comment);
- xf86optionListFree (ptr->vp_option_lst);
- prev = ptr;
- ptr = ptr->list.next;
- xf86conffree (prev);
- }
-}
-
XF86ConfVideoAdaptorPtr
xf86findVideoAdaptor (const char *ident, XF86ConfVideoAdaptorPtr p)
{
diff --git a/hw/xfree86/parser/configProcs.h b/hw/xfree86/parser/configProcs.h
index 0b989054b..3c9ce7a83 100644
--- a/hw/xfree86/parser/configProcs.h
+++ b/hw/xfree86/parser/configProcs.h
@@ -49,30 +49,23 @@ int xf86validateInput (XF86ConfigPtr p);
XF86ConfLayoutPtr xf86parseLayoutSection(void);
void xf86printLayoutSection(FILE *cf, XF86ConfLayoutPtr ptr);
void xf86freeLayoutList(XF86ConfLayoutPtr ptr);
-void xf86freeAdjacencyList(XF86ConfAdjacencyPtr ptr);
-void xf86freeInputrefList(XF86ConfInputrefPtr ptr);
int xf86validateLayout(XF86ConfigPtr p);
/* Module.c */
-XF86LoadPtr xf86parseModuleSubSection(XF86LoadPtr head, char *name);
XF86ConfModulePtr xf86parseModuleSection(void);
void xf86printModuleSection(FILE *cf, XF86ConfModulePtr ptr);
XF86LoadPtr xf86addNewLoadDirective(XF86LoadPtr head, char *name, int type, XF86OptionPtr opts);
void xf86freeModules(XF86ConfModulePtr ptr);
/* Monitor.c */
-XF86ConfModeLinePtr xf86parseModeLine(void);
-XF86ConfModeLinePtr xf86parseVerboseMode(void);
XF86ConfMonitorPtr xf86parseMonitorSection(void);
XF86ConfModesPtr xf86parseModesSection(void);
void xf86printMonitorSection(FILE *cf, XF86ConfMonitorPtr ptr);
void xf86printModesSection(FILE *cf, XF86ConfModesPtr ptr);
void xf86freeMonitorList(XF86ConfMonitorPtr ptr);
void xf86freeModesList(XF86ConfModesPtr ptr);
-void xf86freeModeLineList(XF86ConfModeLinePtr ptr);
int xf86validateMonitor(XF86ConfigPtr p, XF86ConfScreenPtr screen);
/* Pointer.c */
XF86ConfInputPtr xf86parsePointerSection(void);
/* Screen.c */
-XF86ConfDisplayPtr xf86parseDisplaySubSection(void);
XF86ConfScreenPtr xf86parseScreenSection(void);
void xf86printScreenSection(FILE *cf, XF86ConfScreenPtr ptr);
void xf86freeScreenList(XF86ConfScreenPtr ptr);
@@ -82,34 +75,25 @@ void xf86freeModeList(XF86ModePtr ptr);
int xf86validateScreen(XF86ConfigPtr p);
/* Vendor.c */
XF86ConfVendorPtr xf86parseVendorSection(void);
-XF86ConfVendSubPtr xf86parseVendorSubSection (void);
void xf86freeVendorList(XF86ConfVendorPtr p);
void xf86printVendorSection(FILE * cf, XF86ConfVendorPtr ptr);
void xf86freeVendorSubList (XF86ConfVendSubPtr ptr);
/* Video.c */
-XF86ConfVideoPortPtr xf86parseVideoPortSubSection(void);
XF86ConfVideoAdaptorPtr xf86parseVideoAdaptorSection(void);
void xf86printVideoAdaptorSection(FILE *cf, XF86ConfVideoAdaptorPtr ptr);
void xf86freeVideoAdaptorList(XF86ConfVideoAdaptorPtr ptr);
-void xf86freeVideoPortList(XF86ConfVideoPortPtr ptr);
-/* read.c */
-int xf86validateConfig(XF86ConfigPtr p);
/* scan.c */
-unsigned int xf86strToUL(char *str);
int xf86getToken(xf86ConfigSymTabRec *tab);
int xf86getSubToken(char **comment);
int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec *tab);
void xf86unGetToken(int token);
char *xf86tokenString(void);
void xf86parseError(char *format, ...);
-void xf86parseWarning(char *format, ...);
void xf86validationError(char *format, ...);
void xf86setSection(char *section);
int xf86getStringToken(xf86ConfigSymTabRec *tab);
/* write.c */
/* DRI.c */
-XF86ConfBuffersPtr xf86parseBuffers (void);
-void xf86freeBuffersList (XF86ConfBuffersPtr ptr);
XF86ConfDRIPtr xf86parseDRISection (void);
void xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr);
void xf86freeDRI (XF86ConfDRIPtr ptr);
diff --git a/hw/xfree86/parser/read.c b/hw/xfree86/parser/read.c
index b6b3bc377..9f79696ac 100644
--- a/hw/xfree86/parser/read.c
+++ b/hw/xfree86/parser/read.c
@@ -73,6 +73,25 @@ static xf86ConfigSymTabRec TopLevelTab[] =
#define CLEANUP xf86freeConfig
+/*
+ * This function resolves name references and reports errors if the named
+ * objects cannot be found.
+ */
+static int
+xf86validateConfig (XF86ConfigPtr p)
+{
+ if (!xf86validateDevice (p))
+ return FALSE;
+ if (!xf86validateScreen (p))
+ return FALSE;
+ if (!xf86validateInput (p))
+ return FALSE;
+ if (!xf86validateLayout (p))
+ return FALSE;
+
+ return (TRUE);
+}
+
XF86ConfigPtr
xf86readConfigFile (void)
{
@@ -219,25 +238,6 @@ xf86readConfigFile (void)
#undef CLEANUP
/*
- * This function resolves name references and reports errors if the named
- * objects cannot be found.
- */
-int
-xf86validateConfig (XF86ConfigPtr p)
-{
- if (!xf86validateDevice (p))
- return FALSE;
- if (!xf86validateScreen (p))
- return FALSE;
- if (!xf86validateInput (p))
- return FALSE;
- if (!xf86validateLayout (p))
- return FALSE;
-
- return (TRUE);
-}
-
-/*
* adds an item to the end of the linked list. Any record whose first field
* is a GenericListRec can be cast to this type and used with this function.
* A pointer to the head of the list is returned to handle the addition of
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index f81c45afe..68e7ec650 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -116,7 +116,7 @@ extern char *__XOS2RedirRoot(char *path);
* A portable, but restricted, version of strtoul(). It only understands
* hex, octal, and decimal. But it's good enough for our needs.
*/
-unsigned int
+static unsigned int
xf86strToUL (char *str)
{
int base = 10;
@@ -922,20 +922,6 @@ xf86parseError (char *format,...)
}
void
-xf86parseWarning (char *format,...)
-{
- va_list ap;
-
- ErrorF ("Parse warning on line %d of section %s in file %s\n\t",
- configLineNo, configSection, configPath);
- va_start (ap, format);
- VErrorF (format, ap);
- va_end (ap);
-
- ErrorF ("\n");
-}
-
-void
xf86validationError (char *format,...)
{
va_list ap;
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
index a6829273c..89de97bbb 100644
--- a/hw/xfree86/parser/xf86Parser.h
+++ b/hw/xfree86/parser/xf86Parser.h
@@ -469,7 +469,6 @@ XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p);
XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p);
XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p);
XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p);
-XF86ConfVendorPtr xf86findVendor(const char *name, XF86ConfVendorPtr list);
XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident,
XF86ConfVideoAdaptorPtr p);
diff --git a/hw/xfree86/ramdac/Makefile.am b/hw/xfree86/ramdac/Makefile.am
index 8d944455f..2b84cb4dd 100644
--- a/hw/xfree86/ramdac/Makefile.am
+++ b/hw/xfree86/ramdac/Makefile.am
@@ -1,8 +1,6 @@
-module_LTLIBRARIES = libramdac.la
+noinst_LIBRARIES = libramdac.a
-libramdac_la_LDFLAGS = -avoid-version
-
-libramdac_la_SOURCES = xf86RamDacMod.c xf86RamDac.c xf86RamDacCmap.c \
+libramdac_a_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \
xf86BitOrder.c
diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index a903f7f02..457807698 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -199,10 +199,11 @@ xf86CursorEnableDisableFBAccess(
pScreen->devPrivates[xf86CursorScreenIndex].ptr;
if (!enable && ScreenPriv->CurrentCursor != NullCursor) {
- ScreenPriv->SavedCursor = ScreenPriv->CurrentCursor;
+ CursorPtr currentCursor = ScreenPriv->CurrentCursor;
xf86CursorSetCursor(pScreen, NullCursor, ScreenPriv->x, ScreenPriv->y);
ScreenPriv->isUp = FALSE;
ScreenPriv->SWCursor = TRUE;
+ ScreenPriv->SavedCursor = currentCursor;
}
if (ScreenPriv->EnableDisableFBAccess)
diff --git a/hw/xfree86/ramdac/xf86Cursor.h b/hw/xfree86/ramdac/xf86Cursor.h
index 08cca6b96..469f48f01 100644
--- a/hw/xfree86/ramdac/xf86Cursor.h
+++ b/hw/xfree86/ramdac/xf86Cursor.h
@@ -44,5 +44,8 @@ void xf86ForceHWCursor (ScreenPtr pScreen, Bool on);
#define HARDWARE_CURSOR_NIBBLE_SWAPPED 0x00000800
#define HARDWARE_CURSOR_SHOW_TRANSPARENT 0x00001000
#define HARDWARE_CURSOR_UPDATE_UNHIDDEN 0x00002000
+#ifdef ARGB_CURSOR
+#define HARDWARE_CURSOR_ARGB 0x00004000
+#endif
#endif /* _XF86CURSOR_H */
diff --git a/hw/xfree86/ramdac/xf86RamDacMod.c b/hw/xfree86/ramdac/xf86RamDacMod.c
deleted file mode 100644
index b4187a953..000000000
--- a/hw/xfree86/ramdac/xf86RamDacMod.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 1998 by Alan Hourihane, Wigan, England.
- *
- * 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, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE 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.
- *
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- *
- * Generic RAMDAC module.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Module.h"
-
-static XF86ModuleVersionInfo VersRec = {
- "ramdac",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- 0, 1, 0,
- ABI_CLASS_VIDEODRV,
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0, 0, 0, 0}
-};
-
-_X_EXPORT XF86ModuleData ramdacModuleData = { &VersRec, NULL, NULL };
diff --git a/hw/xfree86/x86emu/prim_ops.c b/hw/xfree86/x86emu/prim_ops.c
index 461e09e3e..b9e7257ca 100644
--- a/hw/xfree86/x86emu/prim_ops.c
+++ b/hw/xfree86/x86emu/prim_ops.c
@@ -2082,7 +2082,7 @@ Implements the IMUL instruction and side effects.
void imul_long_direct(u32 *res_lo, u32* res_hi,u32 d, u32 s)
{
#ifdef __HAS_LONG_LONG__
- s64 res = (s32)d * (s32)s;
+ s64 res = (s64)(s32)d * (s32)s;
*res_lo = (u32)res;
*res_hi = (u32)(res >> 32);
@@ -2174,7 +2174,7 @@ Implements the MUL instruction and side effects.
void mul_long(u32 s)
{
#ifdef __HAS_LONG_LONG__
- u64 res = (u32)M.x86.R_EAX * (u32)s;
+ u64 res = (u64)M.x86.R_EAX * s;
M.x86.R_EAX = (u32)res;
M.x86.R_EDX = (u32)(res >> 32);
diff --git a/hw/xfree86/xaa/Makefile.am b/hw/xfree86/xaa/Makefile.am
index 5d529b118..6ed8303a4 100644
--- a/hw/xfree86/xaa/Makefile.am
+++ b/hw/xfree86/xaa/Makefile.am
@@ -9,6 +9,7 @@ MSB_3_FIXED = mf3-xaaBitmap.c mf3-xaaStipple.c
POLYSEG = s-xaaLine.c s-xaaDashLine.c
libxaa_la_LDFLAGS = -avoid-version
+libxaa_la_LIBADD = $(top_builddir)/miext/cw/libcw.la
module_LTLIBRARIES = libxaa.la
libxaa_la_SOURCES = xaaInit.c xaaGC.c xaaInitAccel.c xaaFallback.c \
diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c
index 1542fc26e..79a0e4ceb 100644
--- a/hw/xfree86/xaa/xaaInit.c
+++ b/hw/xfree86/xaa/xaaInit.c
@@ -227,6 +227,14 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
if(infoRec->Flags & MICROSOFT_ZERO_LINE_BIAS)
miSetZeroLineBias(pScreen, OCTANT1 | OCTANT2 | OCTANT3 | OCTANT4);
+#ifdef COMPOSITE
+ /* Initialize the composite wrapper. This needs to happen after the
+ * wrapping above (so it comes before us), but before all other extensions,
+ * so it doesn't confuse them. (particularly damage).
+ */
+ miInitializeCompositeWrapper(pScreen);
+#endif
+
return TRUE;
}
diff --git a/hw/xfree86/xf4bpp/Makefile.am b/hw/xfree86/xf4bpp/Makefile.am
index 8fddb6b6a..5eab92f6f 100644
--- a/hw/xfree86/xf4bpp/Makefile.am
+++ b/hw/xfree86/xf4bpp/Makefile.am
@@ -20,7 +20,6 @@ libxf4bpp_la_SOURCES = \
ppcPixmap.c \
ppcPntWin.c \
ppcPolyPnt.c \
- ppcPolyRec.c \
ppcQuery.c \
ppcRslvC.c \
ppcSetSp.c \
diff --git a/hw/xfree86/xf4bpp/offscreen.c b/hw/xfree86/xf4bpp/offscreen.c
index f35bde7dd..654be829d 100644
--- a/hw/xfree86/xf4bpp/offscreen.c
+++ b/hw/xfree86/xf4bpp/offscreen.c
@@ -301,25 +301,6 @@ DoMono
}
void
-xf4bppOffDrawMonoImage( pWin, data, x, y, w, h, fg, alu, planes )
-WindowPtr pWin; /* GJA */
-unsigned char *data;
-int x, y, w, h ;
-unsigned long int fg ;
-int alu ;
-unsigned long int planes;
-{
-
- if ( ( alu == GXnoop ) || !( planes &= VGA_ALLPLANES ) )
- return ;
-
- DoMono( pWin, w, x, y, (const unsigned char *) data, h,
- w, ( ( w + 31 ) & ~31 ) >> 3, h, 0, 0, alu,
- (int)planes, (int)fg) ;
-
-}
-
-void
xf4bppOffFillStipple( pWin, pStipple, fg, alu, planes, x, y, w, h, xSrc, ySrc )
WindowPtr pWin; /* GJA */
register PixmapPtr const pStipple ;
diff --git a/hw/xfree86/xf4bpp/ppcGC.c b/hw/xfree86/xf4bpp/ppcGC.c
index 8153051f0..81441efd7 100644
--- a/hw/xfree86/xf4bpp/ppcGC.c
+++ b/hw/xfree86/xf4bpp/ppcGC.c
@@ -90,10 +90,9 @@ SOFTWARE.
| GCFunction | GCPlaneMask | GCFillStyle | GC_CALL_VALIDATE_BIT \
| GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode )
+static void xf4bppValidateGC(GCPtr, unsigned long, DrawablePtr);
+static void xf4bppDestroyGC(GC *);
-/* GJA -- we modified the following function to get rid of
- * the records in file vgaData.c
- */
static GCFuncs vgaGCFuncs = {
xf4bppValidateGC,
(void (*)(GCPtr, unsigned long))NoopDDA,
@@ -196,7 +195,7 @@ register GCPtr pGC ;
return TRUE ;
}
-void
+static void
xf4bppDestroyGC( pGC )
register GC *pGC ;
@@ -292,7 +291,7 @@ return 0 ;
CT_other ==> pCompositeClip is the pixmap bounding box
*/
-void
+static void
xf4bppValidateGC( pGC, changes, pDrawable )
GCPtr pGC;
unsigned long changes;
diff --git a/hw/xfree86/xf4bpp/ppcPixmap.c b/hw/xfree86/xf4bpp/ppcPixmap.c
index 9f4cdc99a..9b2defda1 100644
--- a/hw/xfree86/xf4bpp/ppcPixmap.c
+++ b/hw/xfree86/xf4bpp/ppcPixmap.c
@@ -120,12 +120,8 @@ xf4bppCreatePixmap( pScreen, width, height, depth )
pPixmap->devKind = size;
pPixmap->refcnt = 1 ;
size = height * pPixmap->devKind ;
-#ifdef PIXPRIV
pPixmap->devPrivate.ptr = (pointer) (((CARD8*)pPixmap)
+ pScreen->totalPixmapSize);
-#else
- pPixmap->devPrivate.ptr = (pointer) (pPixmap + 1);
-#endif
bzero( (char *) pPixmap->devPrivate.ptr, size ) ;
return pPixmap ;
}
diff --git a/hw/xfree86/xf4bpp/ppcPolyRec.c b/hw/xfree86/xf4bpp/ppcPolyRec.c
deleted file mode 100644
index d7f866232..000000000
--- a/hw/xfree86/xf4bpp/ppcPolyRec.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright IBM Corporation 1987,1988,1989
- *
- * 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 IBM not be
- * used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission.
- *
- * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * IBM 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.
- *
-*/
-/***********************************************************
-
-Copyright (c) 1987 X Consortium
-
-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
-X CONSORTIUM 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 X Consortium 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 X Consortium.
-
-
-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.
-
-******************************************************************/
-/* $XConsortium: ppcPolyRec.c /main/4 1996/02/21 17:58:11 kaleb $ */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf4bpp.h"
-
-void
-xf4bppPolyRectangle(pDraw, pGC, nrects, pRects)
- DrawablePtr pDraw;
- GCPtr pGC;
- int nrects;
- xRectangle *pRects;
-{
- int i;
- xRectangle *pR = pRects;
- xRectangle *tmprects, *tmprectsinit;
- int lw, fs, ss;
-
- if ( ! ( tmprectsinit = tmprects = (xRectangle *)ALLOCATE_LOCAL( ( sizeof ( xRectangle ) * nrects ) << 2 ) ) )
- return;
-
- lw = pGC->lineWidth;
- ss = lw >> 1; /* skinny side of line */
- fs = ( lw + 1 ) >> 1; /* fat side of line */
-
- for (i=0; i<nrects; i++)
- {
- tmprects->x = pR->x - ss;
- tmprects->y = pR->y - ss;
- tmprects->width = pR->width + lw;
- tmprects->height = lw;
- tmprects++;
-
- tmprects->x = pR->x - ss;
- tmprects->y = pR->y + fs;
- tmprects->width = lw;
- tmprects->height = pR->height - lw;
- tmprects++;
-
- tmprects->x = pR->x + pR->width - ss;
- tmprects->y = pR->y + fs;
- tmprects->width = lw;
- tmprects->height = pR->height - lw;
- tmprects++;
-
- tmprects->x = pR->x - ss;
- tmprects->y = pR->y + pR->height - ss;
- tmprects->width = pR->width + lw;
- tmprects->height = lw;
- tmprects++;
-
- pR++;
- }
-
- (* pGC->ops->PolyFillRect)( pDraw, pGC, nrects << 2, tmprectsinit );
-
- DEALLOCATE_LOCAL( tmprectsinit );
- return ;
-}
diff --git a/hw/xfree86/xf4bpp/xf4bpp.h b/hw/xfree86/xf4bpp/xf4bpp.h
index 8d2da35a5..01512a8fb 100644
--- a/hw/xfree86/xf4bpp/xf4bpp.h
+++ b/hw/xfree86/xf4bpp/xf4bpp.h
@@ -149,14 +149,6 @@ void xf4bppTilePixmapFS(
Bool xf4bppCreateGC(
GCPtr
);
-void xf4bppDestroyGC(
- GC *
-);
-void xf4bppValidateGC(
- GCPtr,
- unsigned long,
- DrawablePtr
-);
/* ppcGetSp.c */
void xf4bppGetSpans(
diff --git a/hw/xgl/egl/kinput.c b/hw/xgl/egl/kinput.c
index b374bf580..5fd23f568 100644
--- a/hw/xgl/egl/kinput.c
+++ b/hw/xgl/egl/kinput.c
@@ -41,7 +41,7 @@
#ifdef XKB
#define XKB_IN_SERVER
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#endif
static DeviceIntPtr pKdKeyboard, pKdPointer;
diff --git a/hw/xgl/glx/xglx.c b/hw/xgl/glx/xglx.c
index 57cb84702..92974f0d4 100644
--- a/hw/xgl/glx/xglx.c
+++ b/hw/xgl/glx/xglx.c
@@ -50,7 +50,7 @@
#ifdef XKB
#include <X11/extensions/XKB.h>
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XKBconfig.h>
extern Bool
diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c
index 57f3a688f..1ec0609d9 100644
--- a/hw/xnest/Display.c
+++ b/hw/xnest/Display.c
@@ -39,7 +39,7 @@ XVisualInfo *xnestVisuals;
int xnestNumVisuals;
int xnestDefaultVisualIndex;
Colormap *xnestDefaultColormaps;
-int xnestNumDefaultColormaps;
+static int xnestNumDefaultColormaps;
int *xnestDepths;
int xnestNumDepths;
XPixmapFormatValues *xnestPixmapFormats;
diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c
index 0dacae70b..bb3cb1376 100644
--- a/hw/xnest/Keyboard.c
+++ b/hw/xnest/Keyboard.c
@@ -36,7 +36,7 @@ is" without express or implied warranty.
#ifdef XKB
#include <X11/extensions/XKB.h>
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XKBconfig.h>
extern Bool
diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c
index aa8bed933..612df8dac 100644
--- a/hw/xnest/Pixmap.c
+++ b/hw/xnest/Pixmap.c
@@ -32,9 +32,7 @@ is" without express or implied warranty.
#include "Screen.h"
#include "XNPixmap.h"
-#ifdef PIXPRIV
int xnestPixmapPrivateIndex;
-#endif
PixmapPtr
xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth)
@@ -57,12 +55,8 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth)
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pPixmap->refcnt = 1;
pPixmap->devKind = PixmapBytePad(width, depth);
-#ifdef PIXPRIV
pPixmap->devPrivates[xnestPixmapPrivateIndex].ptr =
(pointer)((char *)pPixmap + pScreen->totalPixmapSize);
-#else
- pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
-#endif
if (width && height)
xnestPixmapPriv(pPixmap)->pixmap =
XCreatePixmap(xnestDisplay,
diff --git a/hw/xnest/Screen.c b/hw/xnest/Screen.c
index 8e86efbdb..e66b4f743 100644
--- a/hw/xnest/Screen.c
+++ b/hw/xnest/Screen.c
@@ -49,9 +49,7 @@ Window xnestScreenSaverWindows[MAXSCREENS];
extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
#endif
-#ifdef PIXPRIV
-int xnestScreenGeneration = -1;
-#endif
+static int xnestScreenGeneration = -1;
ScreenPtr
xnestScreen(Window window)
@@ -154,7 +152,6 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
sizeof(xnestPrivGC))))
return False;
-#ifdef PIXPRIV
if (xnestScreenGeneration != serverGeneration) {
if ((xnestPixmapPrivateIndex = AllocatePixmapPrivateIndex()) < 0)
return False;
@@ -164,7 +161,6 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
if (!AllocatePixmapPrivate(pScreen,xnestPixmapPrivateIndex,
sizeof (xnestPrivPixmap)))
return False;
-#endif
visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec));
numVisuals = 0;
diff --git a/hw/xnest/XNPixmap.h b/hw/xnest/XNPixmap.h
index 77cba24af..6971b1162 100644
--- a/hw/xnest/XNPixmap.h
+++ b/hw/xnest/XNPixmap.h
@@ -15,21 +15,14 @@ is" without express or implied warranty.
#ifndef XNESTPIXMAP_H
#define XNESTPIXMAP_H
-#ifdef PIXPRIV
extern int xnestPixmapPrivateIndex;
-#endif
typedef struct {
Pixmap pixmap;
} xnestPrivPixmap;
-#ifdef PIXPRIV
#define xnestPixmapPriv(pPixmap) \
((xnestPrivPixmap *)((pPixmap)->devPrivates[xnestPixmapPrivateIndex].ptr))
-#else
-#define xnestPixmapPriv(pPixmap) \
- ((xnestPrivPixmap *)((pPixmap)->devPrivate.ptr))
-#endif
#define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap)
diff --git a/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.am b/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.am
index 5be5419ba..7a7ecc31a 100644
--- a/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.am
+++ b/hw/xprint/config/C/print/models/CANONC3200-PS/fonts/Makefile.am
@@ -1,6 +1,6 @@
xpcdir = @xpconfigdir@/C/print/models/CANONC3200-PS/fonts
-parentdir = @xpconfigdir@/C/print/models/PSdefault/fonts
+parentdir = ../../PSdefault/fonts
XPFONTS = \
AvantGarde-Book.pmf \
@@ -19,10 +19,10 @@ XPFONTS = \
LubalinGraph-BookOblique.pmf \
LubalinGraph-Demi.pmf \
LubalinGraph-DemiOblique.pmf \
- NewCenturySchlbk-Bold.pmf \
- NewCenturySchlbk-BoldItalic.pmf \
- NewCenturySchlbk-Italic.pmf \
- NewCenturySchlbk-Roman.pmf \
+ NewCentSchlbk-Bold.pmf \
+ NewCentSchlbk-BoldItal.pmf \
+ NewCentSchlbk-Ital.pmf \
+ NewCentSchlbk-Roman.pmf \
Souvenir-Demi.pmf \
Souvenir-DemiItalic.pmf \
Souvenir-Light.pmf \
diff --git a/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.am b/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.am
index 2ff9ab7e7..f4f4243e9 100644
--- a/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.am
+++ b/hw/xprint/config/C/print/models/HPLJ4050-PS/fonts/Makefile.am
@@ -1,6 +1,6 @@
xpcdir = @xpconfigdir@/C/print/models/HPLJ4050-PS/fonts
-parentdir = @xpconfigdir@/C/print/models/PSdefault/fonts
+parentdir = ../../PSdefault/fonts
XPFONTS = \
AvantGarde-Book.pmf \
@@ -19,10 +19,10 @@ XPFONTS = \
LubalinGraph-BookOblique.pmf \
LubalinGraph-Demi.pmf \
LubalinGraph-DemiOblique.pmf \
- NewCenturySchlbk-Bold.pmf \
- NewCenturySchlbk-BoldItalic.pmf \
- NewCenturySchlbk-Italic.pmf \
- NewCenturySchlbk-Roman.pmf \
+ NewCentSchlbk-Bold.pmf \
+ NewCentSchlbk-BoldItal.pmf \
+ NewCentSchlbk-Ital.pmf \
+ NewCentSchlbk-Roman.pmf \
Souvenir-Demi.pmf \
Souvenir-DemiItalic.pmf \
Souvenir-Light.pmf \
diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am b/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am
index e7ddb6c0f..40f1e3da5 100644
--- a/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am
+++ b/hw/xprint/config/C/print/models/PSdefault/fonts/Makefile.am
@@ -17,9 +17,10 @@ dist_xpc_DATA = \
LubalinGraph-Book.pmf \
LubalinGraph-DemiOblique.pmf \
LubalinGraph-Demi.pmf \
- NewCenturySchlbk-Bold.pmf \
- NewCenturySchlbk-Italic.pmf \
- NewCenturySchlbk-Roman.pmf \
+ NewCentSchlbk-Bold.pmf \
+ NewCentSchlbk-BoldItal.pmf \
+ NewCentSchlbk-Ital.pmf \
+ NewCentSchlbk-Roman.pmf \
Souvenir-DemiItalic.pmf \
Souvenir-Demi.pmf \
Souvenir-LightItalic.pmf \
diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCenturySchlbk-Bold.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Bold.pmf
index ab22aabf5..ab22aabf5 100644
--- a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCenturySchlbk-Bold.pmf
+++ b/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Bold.pmf
Binary files differ
diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCenturySchlbk-BoldItalic.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-BoldItal.pmf
index e68811eb7..e68811eb7 100644
--- a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCenturySchlbk-BoldItalic.pmf
+++ b/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-BoldItal.pmf
Binary files differ
diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCenturySchlbk-Italic.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Ital.pmf
index 390f223cb..390f223cb 100644
--- a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCenturySchlbk-Italic.pmf
+++ b/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Ital.pmf
Binary files differ
diff --git a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCenturySchlbk-Roman.pmf b/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Roman.pmf
index 655b9b6c0..655b9b6c0 100644
--- a/hw/xprint/config/C/print/models/PSdefault/fonts/NewCenturySchlbk-Roman.pmf
+++ b/hw/xprint/config/C/print/models/PSdefault/fonts/NewCentSchlbk-Roman.pmf
Binary files differ
diff --git a/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.am b/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.am
index 8cc269459..d1ee6cf42 100644
--- a/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.am
+++ b/hw/xprint/config/C/print/models/SPSPARC2/fonts/Makefile.am
@@ -1,6 +1,6 @@
xpcdir = @xpconfigdir@/C/print/models/SPSPARC2/fonts
-parentdir = @xpconfigdir@/C/print/models/PSdefault/fonts
+parentdir = ../../PSdefault/fonts
XPFONTS = \
Courier-Bold.pmf \
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 39a5eda7f..9457c9cc7 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -44,7 +44,7 @@ from The Open Group.
#include <mntent.h>
#endif
#if defined(XKB) && defined(WIN32)
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#endif
#ifdef RELOCATE_PROJECTROOT
#include <shlobj.h>
diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c
index e3d18083e..2c1877172 100644
--- a/hw/xwin/winconfig.c
+++ b/hw/xwin/winconfig.c
@@ -40,7 +40,7 @@
#ifndef XKB_IN_SERVER
#define XKB_IN_SERVER
#endif
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#endif
#ifdef XWIN_XF86CONFIG
diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index 164e39160..d574f2053 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -44,7 +44,7 @@
#ifndef XKB_IN_SERVER
#define XKB_IN_SERVER
#endif
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#endif
static Bool g_winKeyState[NUM_KEYCODES];
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 458e3a11a..62e109b48 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -35,6 +35,9 @@
/* Support Damage extension */
#undef DAMAGE
+/* Build for darwin with Quartz support */
+#undef DARWIN_WITH_QUARTZ
+
/* Use OsVendorInit */
#undef DDXOSINIT
@@ -420,7 +423,17 @@
#undef XVENDORNAME
/* Endian order */
-#undef X_BYTE_ORDER
+#undef _X_BYTE_ORDER
+/* Deal with multiple architecture compiles on Mac OS X */
+#ifndef __APPLE_CC__
+#define X_BYTE_ORDER _X_BYTE_ORDER
+#else
+#ifdef __BIG_ENDIAN__
+#define X_BYTE_ORDER X_BIG_ENDIAN
+#else
+#define X_BYTE_ORDER X_LITTLE_ENDIAN
+#endif
+#endif
/* Enable GNU and other extensions to the C environment for GLIBC */
#undef _GNU_SOURCE
diff --git a/include/dix.h b/include/dix.h
index 5c2c5b862..2d452d1c7 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -81,59 +81,6 @@ SOFTWARE.
return(BadIDChoice);\
}
-/*
- * We think that most hardware implementations of DBE will want
- * LookupID*(dbe_back_buffer_id) to return the window structure that the
- * id is a back buffer for. Since both front and back buffers will
- * return the same structure, you need to be able to distinguish
- * somewhere what kind of buffer (front/back) was being asked for, so
- * that ddx can render to the right place. That's the problem that the
- * following code solves. Note: we couldn't embed this in the LookupID*
- * functions because the VALIDATE_DRAWABLE_AND_GC macro often circumvents
- * those functions by checking a one-element cache. That's why we're
- * mucking with VALIDATE_DRAWABLE_AND_GC.
- *
- * If you put -DNEED_DBE_BUF_BITS into PervasiveDBEDefines, the window
- * structure will have two additional bits defined, srcBuffer and
- * dstBuffer, and their values will be maintained via the macros
- * SET_DBE_DSTBUF and SET_DBE_SRCBUF (below). If you also
- * put -DNEED_DBE_BUF_VALIDATE into PervasiveDBEDefines, the function
- * DbeValidateBuffer will be called any time the bits change to give you
- * a chance to do some setup. See the DBE code for more details on this
- * function. We put in these levels of conditionality so that you can do
- * just what you need to do, and no more. If neither of these defines
- * are used, the bits won't be there, and VALIDATE_DRAWABLE_AND_GC will
- * be unchanged. dpw
- */
-
-#if defined(NEED_DBE_BUF_BITS)
-#define SET_DBE_DSTBUF(_pDraw, _drawID) \
- SET_DBE_BUF(_pDraw, _drawID, dstBuffer, TRUE)
-#define SET_DBE_SRCBUF(_pDraw, _drawID) \
- SET_DBE_BUF(_pDraw, _drawID, srcBuffer, FALSE)
-#if defined (NEED_DBE_BUF_VALIDATE)
-#define SET_DBE_BUF(_pDraw, _drawID, _whichBuffer, _dstbuf) \
- if (_pDraw->type == DRAWABLE_WINDOW)\
- {\
- int thisbuf = (_pDraw->id == _drawID);\
- if (thisbuf != ((WindowPtr)_pDraw)->_whichBuffer)\
- {\
- ((WindowPtr)_pDraw)->_whichBuffer = thisbuf;\
- DbeValidateBuffer((WindowPtr)_pDraw, _drawID, _dstbuf);\
- }\
- }
-#else /* want buffer bits, but don't need to call DbeValidateBuffer */
-#define SET_DBE_BUF(_pDraw, _drawID, _whichBuffer, _dstbuf) \
- if (_pDraw->type == DRAWABLE_WINDOW)\
- {\
- ((WindowPtr)_pDraw)->_whichBuffer = (_pDraw->id == _drawID);\
- }
-#endif /* NEED_DBE_BUF_VALIDATE */
-#else /* don't want buffer bits in window */
-#define SET_DBE_DSTBUF(_pDraw, _drawID) /**/
-#define SET_DBE_SRCBUF(_pDraw, _drawID) /**/
-#endif /* NEED_DBE_BUF_BITS */
-
#define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, pGC, client)\
if ((stuff->gc == INVALID) || (client->lastGCID != stuff->gc) ||\
(client->lastDrawableID != drawID))\
@@ -158,7 +105,6 @@ SOFTWARE.
pGC = client->lastGC;\
pDraw = client->lastDrawable;\
}\
- SET_DBE_DSTBUF(pDraw, drawID);\
if (pGC->serialNumber != pDraw->serialNumber)\
ValidateGC(pDraw, pGC);
@@ -220,8 +166,6 @@ extern int dixDestroyPixmap(
pointer /*value*/,
XID /*pid*/);
-extern void CloseDownRetainedResources(void);
-
extern void InitClient(
ClientPtr /*client*/,
int /*i*/,
@@ -243,25 +187,10 @@ extern void DeleteWindowFromAnySelections(
extern void MarkClientException(
ClientPtr /*client*/);
-extern int GetGeometry(
- ClientPtr /*client*/,
- xGetGeometryReply* /* wa */);
-
extern int SendConnSetup(
ClientPtr /*client*/,
char* /*reason*/);
-extern int DoGetImage(
- ClientPtr /*client*/,
- int /*format*/,
- Drawable /*drawable*/,
- int /*x*/,
- int /*y*/,
- int /*width*/,
- int /*height*/,
- Mask /*planemask*/,
- xGetImageReply ** /*im_return*/);
-
#if defined(DDXBEFORERESET)
extern void ddxBeforeReset (void);
#endif
@@ -632,10 +561,6 @@ typedef struct _CallbackProcs {
DeleteCallbackListProcPtr DeleteCallbackList;
} CallbackFuncsRec, *CallbackFuncsPtr;
-extern Bool CreateCallbackList(
- CallbackListPtr * /*pcbl*/,
- CallbackFuncsPtr /*cbfuncs*/);
-
extern Bool AddCallback(
CallbackListPtr * /*pcbl*/,
CallbackProcPtr /*callback*/,
diff --git a/include/exevents.h b/include/exevents.h
index 7fbaddbb5..69d4abc4c 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -148,10 +148,6 @@ extern void DeleteWindowFromAnyExtEvents(
WindowPtr /* pWin */,
Bool /* freeResources */);
-extern void DeleteDeviceFromAnyExtEvents(
- WindowPtr /* pWin */,
- DeviceIntPtr /* dev */);
-
extern int MaybeSendDeviceMotionNotifyHint (
deviceKeyButtonPointer * /* pEvents */,
Mask /* mask */);
@@ -164,11 +160,6 @@ extern void CheckDeviceGrabAndHintWindow (
ClientPtr /* client */,
Mask /* deliveryMask */);
-extern Mask DeviceEventMaskForClient(
- DeviceIntPtr /* dev */,
- WindowPtr /* pWin */,
- ClientPtr /* client */);
-
extern void MaybeStopDeviceHint(
DeviceIntPtr /* dev */,
ClientPtr /* client */);
@@ -179,13 +170,6 @@ extern int DeviceEventSuppressForWindow(
Mask /* mask */,
int /* maskndx */);
-void FindInterestedChildren(
- DeviceIntPtr /* dev */,
- WindowPtr /* p1 */,
- Mask /* mask */,
- xEvent * /* ev */,
- int /* count */);
-
void SendEventToAllWindows(
DeviceIntPtr /* dev */,
Mask /* mask */,
diff --git a/include/extinit.h b/include/extinit.h
index 2087d74d6..e616b6d93 100644
--- a/include/extinit.h
+++ b/include/extinit.h
@@ -37,93 +37,6 @@ XInputExtensionInit(
void
);
-
-int
-ProcIDispatch (
- ClientPtr /* client */
- );
-
-int
-SProcIDispatch(
- ClientPtr /* client */
- );
-
-void
-SReplyIDispatch (
- ClientPtr /* client */,
- int /* len */,
- xGrabDeviceReply * /* rep */
- );
-
-void
-SEventIDispatch (
- xEvent * /* from */,
- xEvent * /* to */
- );
-
-void
-SEventDeviceValuator (
- deviceValuator * /* from */,
- deviceValuator * /* to */
- );
-
-void
-SEventFocus (
- deviceFocus * /* from */,
- deviceFocus * /* to */
- );
-
-void
-SDeviceStateNotifyEvent (
- deviceStateNotify * /* from */,
- deviceStateNotify * /* to */
- );
-
-void
-SDeviceKeyStateNotifyEvent (
- deviceKeyStateNotify * /* from */,
- deviceKeyStateNotify * /* to */
- );
-
-void
-SDeviceButtonStateNotifyEvent (
- deviceButtonStateNotify * /* from */,
- deviceButtonStateNotify * /* to */
- );
-
-void
-SChangeDeviceNotifyEvent (
- changeDeviceNotify * /* from */,
- changeDeviceNotify * /* to */
- );
-
-void
-SDeviceMappingNotifyEvent (
- deviceMappingNotify * /* from */,
- deviceMappingNotify * /* to */
- );
-
-void
-SDevicePresenceNotifyEvent (
- devicePresenceNotify * /* from */,
- devicePresenceNotify * /* to */
- );
-
-void
-FixExtensionEvents (
- ExtensionEntry * /* extEntry */
- );
-
-void
-RestoreExtensionEvents (
- void
- );
-
-void
-IResetProc(
- ExtensionEntry * /* unused */
- );
-
void
AssignTypeAndName (
DeviceIntPtr /* dev */,
@@ -131,41 +44,9 @@ AssignTypeAndName (
char * /* name */
);
-void
-MakeDeviceTypeAtoms (
- void
-);
-
DeviceIntPtr
LookupDeviceIntRec (
CARD8 /* id */
);
-void
-SetExclusiveAccess (
- Mask /* mask */
- );
-
-void
-AllowPropagateSuppress (
- Mask /* mask */
- );
-
-Mask
-GetNextExtEventMask (
- void
-);
-
-void
-SetMaskForExtEvent(
- Mask /* mask */,
- int /* event */
- );
-
-void
-SetEventInfo(
- Mask /* mask */,
- int /* constant */
- );
-
#endif /* EXTINIT_H */
diff --git a/include/extnsionst.h b/include/extnsionst.h
index 38d4bd7d9..28ae1d539 100644
--- a/include/extnsionst.h
+++ b/include/extnsionst.h
@@ -85,32 +85,11 @@ extern void NotImplemented ( /* FIXME: this may move to another file... */
xEvent *,
xEvent *);
-typedef void (* ExtensionLookupProc)(
-#ifdef EXTENSION_PROC_ARGS
- EXTENSION_PROC_ARGS
-#else
- /* args no longer indeterminate */
- char *name,
- GCPtr pGC
-#endif
-);
-
-typedef struct _ProcEntry {
- char *name;
- ExtensionLookupProc proc;
-} ProcEntryRec, *ProcEntryPtr;
-
-typedef struct _ScreenProcEntry {
- int num;
- ProcEntryPtr procList;
-} ScreenProcEntry;
-
#define SetGCVector(pGC, VectorElement, NewRoutineAddress, Atom) \
pGC->VectorElement = NewRoutineAddress;
#define GetGCValue(pGC, GCElement) (pGC->GCElement)
-
extern ExtensionEntry *AddExtension(
char* /*name*/,
int /*NumEvents*/,
@@ -128,20 +107,6 @@ extern Bool AddExtensionAlias(
extern ExtensionEntry *CheckExtension(const char *extname);
extern ExtensionEntry *GetExtensionEntry(int major);
-extern ExtensionLookupProc LookupProc(
- char* /*name*/,
- GCPtr /*pGC*/);
-
-extern Bool RegisterProc(
- char* /*name*/,
- GCPtr /*pGC*/,
- ExtensionLookupProc /*proc*/);
-
-extern Bool RegisterScreenProc(
- char* /*name*/,
- ScreenPtr /*pScreen*/,
- ExtensionLookupProc /*proc*/);
-
extern void DeclareExtensionSecurity(
char * /*extname*/,
Bool /*secure*/);
diff --git a/include/gc.h b/include/gc.h
index 6c7add620..3b7e38e02 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -126,11 +126,6 @@ extern int FreeGC(
pointer /*pGC*/,
XID /*gid*/);
-extern void SetGCMask(
- GCPtr /*pGC*/,
- Mask /*selectMask*/,
- Mask /*newDataMask*/);
-
extern GCPtr CreateScratchGC(
ScreenPtr /*pScreen*/,
unsigned /*depth*/);
diff --git a/include/globals.h b/include/globals.h
index 821b12bdb..e23ce7798 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -44,10 +44,6 @@ extern Bool DPMSCapableFlag;
#endif
#ifdef PANORAMIX
-extern Bool PanoramiXMapped;
-extern Bool PanoramiXVisibilityNotifySent;
-extern Bool PanoramiXWindowExposureSent;
-extern Bool PanoramiXOneExposeRequest;
extern Bool PanoramiXExtensionDisabledHack;
#endif
diff --git a/include/inputstr.h b/include/inputstr.h
index ada94e6b4..8f4e9b9d1 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -62,7 +62,7 @@ SOFTWARE.
#define EMASKSIZE MAX_DEVICES
-extern int CoreDevicePrivatesIndex, CoreDevicePrivatesGeneration;
+extern int CoreDevicePrivatesIndex;
/* Kludge: OtherClients and InputClients must be compatible, see code */
diff --git a/include/os.h b/include/os.h
index d4eed220f..7399436fb 100644
--- a/include/os.h
+++ b/include/os.h
@@ -348,12 +348,6 @@ extern void InitAuthorization(char * /*filename*/);
extern void RegisterAuthorizations(void);
-extern XID AuthorizationToID (
- unsigned short name_length,
- char *name,
- unsigned short data_length,
- char *data);
-
extern int AuthorizationFromID (
XID id,
unsigned short *name_lenp,
@@ -402,14 +396,6 @@ extern int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/);
extern void ddxUseMsg(void);
-/*
- * idiom processing stuff
- */
-
-extern xReqPtr PeekNextRequest(xReqPtr req, ClientPtr client, Bool readmore);
-
-extern void SkipRequests(xReqPtr req, ClientPtr client, int numskipped);
-
/* int ReqLen(xReq *req, ClientPtr client)
* Given a pointer to a *complete* request, return its length in bytes.
* Note that if the request is a big request (as defined in the Big
diff --git a/include/pixmapstr.h b/include/pixmapstr.h
index 628465b97..93bd45db8 100644
--- a/include/pixmapstr.h
+++ b/include/pixmapstr.h
@@ -86,9 +86,7 @@ typedef struct _Pixmap {
int refcnt;
int devKind;
DevUnion devPrivate;
-#ifdef PIXPRIV
DevUnion *devPrivates; /* real devPrivates like gcs & windows */
-#endif
#ifdef COMPOSITE
short screen_x;
short screen_y;
diff --git a/include/screenint.h b/include/screenint.h
index e60c2480c..1f1434a84 100644
--- a/include/screenint.h
+++ b/include/screenint.h
@@ -86,8 +86,6 @@ extern int AddScreen(
int /*argc*/,
char** /*argv*/);
-#ifdef PIXPRIV
-
extern void ResetPixmapPrivates(void);
extern int AllocatePixmapPrivateIndex(void);
@@ -97,8 +95,6 @@ extern Bool AllocatePixmapPrivate(
int /* index */,
unsigned /* amount */);
-#endif /* PIXPRIV */
-
extern void ResetColormapPrivates(void);
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 36135153f..110f4dce9 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -558,11 +558,9 @@ typedef struct _Screen {
PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */
-#ifdef PIXPRIV
int PixmapPrivateLen;
unsigned int *PixmapPrivateSizes;
unsigned int totalPixmapSize;
-#endif
MarkWindowProcPtr MarkWindow;
MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
diff --git a/include/swaprep.h b/include/swaprep.h
index 8a9dcf036..bebd3a814 100644
--- a/include/swaprep.h
+++ b/include/swaprep.h
@@ -91,9 +91,6 @@ extern void SQueryPointerReply(
int /* size */,
xQueryPointerReply * /* pRep */);
-extern void SwapTimecoord(
- xTimecoord * /* pCoord */);
-
extern void SwapTimeCoordWrite(
ClientPtr /* pClient */,
int /* size */,
@@ -174,9 +171,6 @@ extern void SAllocColorPlanesReply(
int /* size */,
xAllocColorPlanesReply * /* pRep */);
-extern void SwapRGB(
- xrgb * /* prgb */);
-
extern void SQColorsExtend(
ClientPtr /* pClient */,
int /* size */,
@@ -255,18 +249,6 @@ extern void WriteSConnectionInfo(
unsigned long /* size */,
char * /* pInfo */);
-extern void SwapConnSetup(
- xConnSetup * /* pConnSetup */,
- xConnSetup * /* pConnSetupT */);
-
-extern void SwapWinRoot(
- xWindowRoot * /* pRoot */,
- xWindowRoot * /* pRootT */);
-
-extern void SwapVisual(
- xVisualType * /* pVis */,
- xVisualType * /* pVisT */);
-
extern void SwapConnSetupPrefix(
xConnSetupPrefix * /* pcspFrom */,
xConnSetupPrefix * /* pcspTo */);
diff --git a/include/window.h b/include/window.h
index bddeb252b..cd8c5b283 100644
--- a/include/window.h
+++ b/include/window.h
@@ -93,14 +93,6 @@ extern Bool CreateRootWindow(
extern void InitRootWindow(
WindowPtr /*pWin*/);
-extern void ClippedRegionFromBox(
- WindowPtr /*pWin*/,
- RegionPtr /*Rgn*/,
- int /*x*/,
- int /*y*/,
- int /*w*/,
- int /*h*/);
-
typedef WindowPtr (* RealChildHeadProc) (WindowPtr pWin);
void RegisterRealChildHeadProc (RealChildHeadProc proc);
@@ -205,12 +197,6 @@ extern void UnmapSubwindows(
extern void HandleSaveSet(
ClientPtr /*client*/);
-extern Bool VisibleBoundingBoxFromPoint(
- WindowPtr /*pWin*/,
- int /*x*/,
- int /*y*/,
- BoxPtr /*box*/);
-
extern Bool PointInWindowIsVisible(
WindowPtr /*pWin*/,
int /*x*/,
@@ -235,9 +221,6 @@ extern void CheckWindowOptionalNeed(
extern Bool MakeWindowOptional(
WindowPtr /*pWin*/);
-extern void DisposeWindowOptional(
- WindowPtr /*pWin*/);
-
extern WindowPtr MoveWindowInStack(
WindowPtr /*pWin*/,
WindowPtr /*pNextSib*/);
@@ -271,7 +254,5 @@ extern void DisableMapUnmapEvents(
WindowPtr /* pWin */ );
extern void EnableMapUnmapEvents(
WindowPtr /* pWin */ );
-extern Bool MapUnmapEventsEnabled(
- WindowPtr /* pWin */ );
#endif /* WINDOW_H */
diff --git a/include/windowstr.h b/include/windowstr.h
index a37dc6b75..9fd6d768c 100644
--- a/include/windowstr.h
+++ b/include/windowstr.h
@@ -129,12 +129,6 @@ typedef struct _Window {
unsigned viewable:1; /* realized && InputOutput */
unsigned dontPropagate:3;/* index into DontPropagateMasks */
unsigned forcedBS:1; /* system-supplied backingStore */
-#ifdef NEED_DBE_BUF_BITS
-#define DBE_FRONT_BUFFER 1
-#define DBE_BACK_BUFFER 0
- unsigned dstBuffer:1; /* destination buffer for rendering */
- unsigned srcBuffer:1; /* source buffer for rendering */
-#endif
#ifdef COMPOSITE
unsigned redirectDraw:1; /* rendering is redirected from here */
#endif
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
new file mode 100644
index 000000000..5edee539b
--- /dev/null
+++ b/include/xkbsrv.h
@@ -0,0 +1,1022 @@
+/************************************************************
+Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
+
+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 Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS 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.
+
+********************************************************/
+
+#ifndef _XKBSRV_H_
+#define _XKBSRV_H_
+
+#ifdef XKB_IN_SERVER
+#define XkbAllocClientMap SrvXkbAllocClientMap
+#define XkbAllocServerMap SrvXkbAllocServerMap
+#define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey
+#define XkbCopyKeyTypes SrvXkbCopyKeyTypes
+#define XkbFreeClientMap SrvXkbFreeClientMap
+#define XkbFreeServerMap SrvXkbFreeServerMap
+#define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols
+#define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey
+#define XkbResizeKeyActions SrvXkbResizeKeyActions
+#define XkbResizeKeySyms SrvXkbResizeKeySyms
+#define XkbResizeKeyType SrvXkbResizeKeyType
+#define XkbAllocCompatMap SrvXkbAllocCompatMap
+#define XkbAllocControls SrvXkbAllocControls
+#define XkbAllocIndicatorMaps SrvXkbAllocIndicatorMaps
+#define XkbAllocKeyboard SrvXkbAllocKeyboard
+#define XkbAllocNames SrvXkbAllocNames
+#define XkbFreeCompatMap SrvXkbFreeCompatMap
+#define XkbFreeKeyboard SrvXkbFreeKeyboard
+#define XkbFreeNames SrvXkbFreeNames
+#define XkbLatchModifiers SrvXkbLatchModifiers
+#define XkbLatchGroup SrvXkbLatchGroup
+#define XkbVirtualModsToReal SrvXkbVirtualModsToReal
+#define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange
+#define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges
+#endif
+
+#include <X11/extensions/XKBstr.h>
+#include <X11/extensions/XKBproto.h>
+#include "inputstr.h"
+
+typedef struct _XkbInterest {
+ DeviceIntPtr dev;
+ ClientPtr client;
+ XID resource;
+ struct _XkbInterest * next;
+ CARD16 extDevNotifyMask;
+ CARD16 stateNotifyMask;
+ CARD16 namesNotifyMask;
+ CARD32 ctrlsNotifyMask;
+ CARD8 compatNotifyMask;
+ BOOL bellNotifyMask;
+ BOOL actionMessageMask;
+ CARD16 accessXNotifyMask;
+ CARD32 iStateNotifyMask;
+ CARD32 iMapNotifyMask;
+ CARD16 altSymsNotifyMask;
+ CARD32 autoCtrls;
+ CARD32 autoCtrlValues;
+} XkbInterestRec,*XkbInterestPtr;
+
+typedef struct _XkbRadioGroup {
+ CARD8 flags;
+ CARD8 nMembers;
+ CARD8 dfltDown;
+ CARD8 currentDown;
+ CARD8 members[XkbRGMaxMembers];
+} XkbRadioGroupRec, *XkbRadioGroupPtr;
+
+typedef struct _XkbEventCause {
+ CARD8 kc;
+ CARD8 event;
+ CARD8 mjr;
+ CARD8 mnr;
+ ClientPtr client;
+} XkbEventCauseRec,*XkbEventCausePtr;
+#define XkbSetCauseKey(c,k,e) { (c)->kc= (k),(c)->event= (e),\
+ (c)->mjr= (c)->mnr= 0; \
+ (c)->client= NULL; }
+#define XkbSetCauseReq(c,j,n,cl) { (c)->kc= (c)->event= 0,\
+ (c)->mjr= (j),(c)->mnr= (n);\
+ (c)->client= (cl); }
+#define XkbSetCauseCoreReq(c,e,cl) XkbSetCauseReq(c,e,0,cl)
+#define XkbSetCauseXkbReq(c,e,cl) XkbSetCauseReq(c,XkbReqCode,e,cl)
+#define XkbSetCauseUnknown(c) XkbSetCauseKey(c,0,0)
+
+#define _OFF_TIMER 0
+#define _KRG_WARN_TIMER 1
+#define _KRG_TIMER 2
+#define _SK_TIMEOUT_TIMER 3
+#define _ALL_TIMEOUT_TIMER 4
+
+#define _BEEP_NONE 0
+#define _BEEP_FEATURE_ON 1
+#define _BEEP_FEATURE_OFF 2
+#define _BEEP_FEATURE_CHANGE 3
+#define _BEEP_SLOW_WARN 4
+#define _BEEP_SLOW_PRESS 5
+#define _BEEP_SLOW_ACCEPT 6
+#define _BEEP_SLOW_REJECT 7
+#define _BEEP_SLOW_RELEASE 8
+#define _BEEP_STICKY_LATCH 9
+#define _BEEP_STICKY_LOCK 10
+#define _BEEP_STICKY_UNLOCK 11
+#define _BEEP_LED_ON 12
+#define _BEEP_LED_OFF 13
+#define _BEEP_LED_CHANGE 14
+#define _BEEP_BOUNCE_REJECT 15
+
+typedef struct _XkbSrvInfo {
+ XkbStateRec prev_state;
+ XkbStateRec state;
+ XkbDescPtr desc;
+
+ DeviceIntPtr device;
+ KbdCtrlProcPtr kbdProc;
+
+ XkbRadioGroupPtr radioGroups;
+ CARD8 nRadioGroups;
+ CARD8 clearMods;
+ CARD8 setMods;
+ INT16 groupChange;
+
+ CARD16 dfltPtrDelta;
+
+ double mouseKeysCurve;
+ double mouseKeysCurveFactor;
+ INT16 mouseKeysDX;
+ INT16 mouseKeysDY;
+ CARD8 mouseKeysFlags;
+ Bool mouseKeysAccel;
+ CARD8 mouseKeysCounter;
+
+ CARD8 lockedPtrButtons;
+ CARD8 shiftKeyCount;
+ KeyCode mouseKey;
+ KeyCode inactiveKey;
+ KeyCode slowKey;
+ KeyCode repeatKey;
+ CARD8 krgTimerActive;
+ CARD8 beepType;
+ CARD8 beepCount;
+
+ CARD32 flags;
+ CARD32 lastPtrEventTime;
+ CARD32 lastShiftEventTime;
+ OsTimerPtr beepTimer;
+ OsTimerPtr mouseKeyTimer;
+ OsTimerPtr slowKeysTimer;
+ OsTimerPtr bounceKeysTimer;
+ OsTimerPtr repeatKeyTimer;
+ OsTimerPtr krgTimer;
+} XkbSrvInfoRec, *XkbSrvInfoPtr;
+
+#define XkbSLI_IsDefault (1L<<0)
+#define XkbSLI_HasOwnState (1L<<1)
+
+typedef struct _XkbSrvLedInfo {
+ CARD16 flags;
+ CARD16 class;
+ CARD16 id;
+ union {
+ KbdFeedbackPtr kf;
+ LedFeedbackPtr lf;
+ } fb;
+
+ CARD32 physIndicators;
+ CARD32 autoState;
+ CARD32 explicitState;
+ CARD32 effectiveState;
+
+ CARD32 mapsPresent;
+ CARD32 namesPresent;
+ XkbIndicatorMapPtr maps;
+ Atom * names;
+
+ CARD32 usesBase;
+ CARD32 usesLatched;
+ CARD32 usesLocked;
+ CARD32 usesEffective;
+ CARD32 usesCompat;
+ CARD32 usesControls;
+
+ CARD32 usedComponents;
+} XkbSrvLedInfoRec, *XkbSrvLedInfoPtr;
+
+/*
+ * Settings for xkbClientFlags field (used by DIX)
+ * These flags _must_ not overlap with XkbPCF_*
+ */
+#define _XkbClientInitialized (1<<15)
+
+#define _XkbWantsDetectableAutoRepeat(c)\
+ ((c)->xkbClientFlags&XkbPCF_DetectableAutoRepeatMask)
+
+/*
+ * Settings for flags field
+ */
+#define _XkbStateNotifyInProgress (1<<0)
+
+typedef struct
+{
+ ProcessInputProc processInputProc;
+ ProcessInputProc realInputProc;
+ DeviceUnwrapProc unwrapProc;
+} xkbDeviceInfoRec, *xkbDeviceInfoPtr;
+
+#define WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \
+ device->public.processInputProc = proc; \
+ oldprocs->processInputProc = \
+ oldprocs->realInputProc = device->public.realInputProc; \
+ device->public.realInputProc = proc; \
+ oldprocs->unwrapProc = device->unwrapProc; \
+ device->unwrapProc = unwrapproc;
+
+#define COND_WRAP_PROCESS_INPUT_PROC(device, oldprocs, proc, unwrapproc) \
+ if (device->public.processInputProc == device->public.realInputProc)\
+ device->public.processInputProc = proc; \
+ oldprocs->processInputProc = \
+ oldprocs->realInputProc = device->public.realInputProc; \
+ device->public.realInputProc = proc; \
+ oldprocs->unwrapProc = device->unwrapProc; \
+ device->unwrapProc = unwrapproc;
+
+#define UNWRAP_PROCESS_INPUT_PROC(device, oldprocs) \
+ device->public.processInputProc = oldprocs->processInputProc; \
+ device->public.realInputProc = oldprocs->realInputProc; \
+ device->unwrapProc = oldprocs->unwrapProc;
+
+#define XKBDEVICEINFO(dev) ((xkbDeviceInfoPtr) (dev)->devPrivates[xkbDevicePrivateIndex].ptr)
+
+/***====================================================================***/
+
+
+/***====================================================================***/
+
+#define XkbAX_KRGMask (XkbSlowKeysMask|XkbBounceKeysMask)
+#define XkbAllFilteredEventsMask \
+ (XkbAccessXKeysMask|XkbRepeatKeysMask|XkbMouseKeysAccelMask|XkbAX_KRGMask)
+
+/***====================================================================***/
+
+extern int XkbReqCode;
+extern int XkbEventBase;
+extern int XkbDisableLockActions;
+extern char * XkbBaseDirectory;
+extern char * XkbBinDirectory;
+extern char * XkbInitialMap;
+extern unsigned int XkbXIUnsupported;
+
+extern Bool noXkbExtension;
+
+extern pointer XkbLastRepeatEvent;
+
+extern CARD32 xkbDebugFlags;
+
+#define _XkbAlloc(s) xalloc((s))
+#define _XkbCalloc(n,s) Xcalloc((n)*(s))
+#define _XkbRealloc(o,s) Xrealloc((o),(s))
+#define _XkbTypedAlloc(t) ((t *)xalloc(sizeof(t)))
+#define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n)*sizeof(t)))
+#define _XkbTypedRealloc(o,n,t) \
+ ((o)?(t *)Xrealloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t))
+#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t))
+#define _XkbFree(p) Xfree(p)
+
+#define _XkbLibError(c,l,d) \
+ { _XkbErrCode= (c); _XkbErrLocation= (l); _XkbErrData= (d); }
+#define _XkbErrCode2(a,b) ((XID)((((unsigned int)(a))<<24)|((b)&0xffffff)))
+#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c))
+#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d)))
+
+extern int DeviceKeyPress,DeviceKeyRelease;
+extern int DeviceButtonPress,DeviceButtonRelease;
+
+#ifdef XINPUT
+#define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress))
+#define _XkbIsReleaseEvent(t) (((t)==KeyRelease)||((t)==DeviceKeyRelease))
+#else
+#define _XkbIsPressEvent(t) ((t)==KeyPress)
+#define _XkbIsReleaseEvent(t) ((t)==KeyRelease)
+#endif
+
+#define _XkbCoreKeycodeInRange(c,k) (((k)>=(c)->curKeySyms.minKeyCode)&&\
+ ((k)<=(c)->curKeySyms.maxKeyCode))
+#define _XkbCoreNumKeys(c) ((c)->curKeySyms.maxKeyCode-\
+ (c)->curKeySyms.minKeyCode+1)
+
+#define XConvertCase(s,l,u) XkbConvertCase(s,l,u)
+#undef IsKeypadKey
+#define IsKeypadKey(s) XkbKSIsKeypad(s)
+
+#define Status int
+#define XPointer pointer
+#define Display struct _XDisplay
+
+#ifndef True
+#define True 1
+#define False 0
+#endif
+
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define PATH_MAX MAXPATHLEN
+#else
+#define PATH_MAX 1024
+#endif
+#endif
+
+_XFUNCPROTOBEGIN
+
+extern void XkbUseMsg(
+ void
+);
+
+extern int XkbProcessArguments(
+ int /* argc */,
+ char ** /* argv */,
+ int /* i */
+);
+
+extern void XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc);
+
+extern void XkbFreeCompatMap(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ Bool /* freeMap */
+);
+
+extern void XkbFreeNames(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ Bool /* freeMap */
+);
+
+extern DeviceIntPtr _XkbLookupAnyDevice(
+ int /* id */,
+ int * /* why_rtrn */
+);
+
+extern DeviceIntPtr _XkbLookupKeyboard(
+ int /* id */,
+ int * /* why_rtrn */
+);
+
+extern DeviceIntPtr _XkbLookupBellDevice(
+ int /* id */,
+ int * /* why_rtrn */
+);
+
+extern DeviceIntPtr _XkbLookupLedDevice(
+ int /* id */,
+ int * /* why_rtrn */
+);
+
+extern DeviceIntPtr _XkbLookupButtonDevice(
+ int /* id */,
+ int * /* why_rtrn */
+);
+
+extern XkbDescPtr XkbAllocKeyboard(
+ void
+);
+
+extern Status XkbAllocClientMap(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ unsigned int /* nTypes */
+);
+
+extern Status XkbAllocServerMap(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ unsigned int /* nNewActions */
+);
+
+extern void XkbFreeClientMap(
+ XkbDescPtr /* xkb */,
+ unsigned int /* what */,
+ Bool /* freeMap */
+);
+
+extern void XkbFreeServerMap(
+ XkbDescPtr /* xkb */,
+ unsigned int /* what */,
+ Bool /* freeMap */
+);
+
+extern Status XkbAllocIndicatorMaps(
+ XkbDescPtr /* xkb */
+);
+
+extern Status XkbAllocCompatMap(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ unsigned int /* nInterpret */
+);
+
+extern Status XkbAllocNames(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ int /* nTotalRG */,
+ int /* nTotalAliases */
+);
+
+extern Status XkbAllocControls(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which*/
+);
+
+extern Status XkbCopyKeyTypes(
+ XkbKeyTypePtr /* from */,
+ XkbKeyTypePtr /* into */,
+ int /* num_types */
+);
+
+extern Status XkbResizeKeyType(
+ XkbDescPtr /* xkb */,
+ int /* type_ndx */,
+ int /* map_count */,
+ Bool /* want_preserve */,
+ int /* new_num_lvls */
+);
+
+extern void XkbFreeKeyboard(
+ XkbDescPtr /* xkb */,
+ unsigned int /* which */,
+ Bool /* freeDesc */
+);
+
+extern void XkbSetActionKeyMods(
+ XkbDescPtr /* xkb */,
+ XkbAction * /* act */,
+ unsigned int /* mods */
+);
+
+extern Bool XkbCheckActionVMods(
+ XkbDescPtr /* xkb */,
+ XkbAction * /* act */,
+ unsigned int /* changed */
+);
+
+extern unsigned int XkbMaskForVMask(
+ XkbDescPtr /* xkb */,
+ unsigned int /* vmask */
+);
+
+extern Bool XkbVirtualModsToReal(
+ XkbDescPtr /* xkb */,
+ unsigned int /* virtua_mask */,
+ unsigned int * /* mask_rtrn */
+);
+
+extern unsigned int XkbAdjustGroup(
+ int /* group */,
+ XkbControlsPtr /* ctrls */
+);
+
+extern KeySym *XkbResizeKeySyms(
+ XkbDescPtr /* xkb */,
+ int /* key */,
+ int /* needed */
+);
+
+extern XkbAction *XkbResizeKeyActions(
+ XkbDescPtr /* xkb */,
+ int /* key */,
+ int /* needed */
+);
+
+extern void XkbUpdateKeyTypesFromCore(
+ DeviceIntPtr /* pXDev */,
+ KeyCode /* first */,
+ CARD8 /* num */,
+ XkbChangesPtr /* pChanges */
+);
+
+extern void XkbUpdateDescActions(
+ XkbDescPtr /* xkb */,
+ KeyCode /* first */,
+ CARD8 /* num */,
+ XkbChangesPtr /* changes */
+);
+
+extern void XkbUpdateActions(
+ DeviceIntPtr /* pXDev */,
+ KeyCode /* first */,
+ CARD8 /* num */,
+ XkbChangesPtr /* pChanges */,
+ unsigned int * /* needChecksRtrn */,
+ XkbEventCausePtr /* cause */
+);
+
+extern void XkbUpdateCoreDescription(
+ DeviceIntPtr /* keybd */,
+ Bool /* resize */
+);
+
+extern void XkbApplyMappingChange(
+ DeviceIntPtr /* pXDev */,
+ CARD8 /* request */,
+ KeyCode /* firstKey */,
+ CARD8 /* num */,
+ ClientPtr /* client */
+);
+
+extern void XkbSetIndicators(
+ DeviceIntPtr /* pXDev */,
+ CARD32 /* affect */,
+ CARD32 /* values */,
+ XkbEventCausePtr /* cause */
+);
+
+extern void XkbUpdateIndicators(
+ DeviceIntPtr /* keybd */,
+ CARD32 /* changed */,
+ Bool /* check_edevs */,
+ XkbChangesPtr /* pChanges */,
+ XkbEventCausePtr /* cause */
+);
+
+extern XkbSrvLedInfoPtr XkbAllocSrvLedInfo(
+ DeviceIntPtr /* dev */,
+ KbdFeedbackPtr /* kf */,
+ LedFeedbackPtr /* lf */,
+ unsigned int /* needed_parts */
+);
+
+extern XkbSrvLedInfoPtr XkbFindSrvLedInfo(
+ DeviceIntPtr /* dev */,
+ unsigned int /* class */,
+ unsigned int /* id */,
+ unsigned int /* needed_parts */
+);
+
+extern void XkbApplyLedNameChanges(
+ DeviceIntPtr /* dev */,
+ XkbSrvLedInfoPtr /* sli */,
+ unsigned int /* changed_names */,
+ xkbExtensionDeviceNotify * /* ed */,
+ XkbChangesPtr /* changes */,
+ XkbEventCausePtr /* cause */
+);
+
+extern void XkbApplyLedMapChanges(
+ DeviceIntPtr /* dev */,
+ XkbSrvLedInfoPtr /* sli */,
+ unsigned int /* changed_maps */,
+ xkbExtensionDeviceNotify * /* ed */,
+ XkbChangesPtr /* changes */,
+ XkbEventCausePtr /* cause */
+);
+
+extern void XkbApplyLedStateChanges(
+ DeviceIntPtr /* dev */,
+ XkbSrvLedInfoPtr /* sli */,
+ unsigned int /* changed_leds */,
+ xkbExtensionDeviceNotify * /* ed */,
+ XkbChangesPtr /* changes */,
+ XkbEventCausePtr /* cause */
+);
+
+extern void XkbFlushLedEvents(
+ DeviceIntPtr /* dev */,
+ DeviceIntPtr /* kbd */,
+ XkbSrvLedInfoPtr /* sli */,
+ xkbExtensionDeviceNotify * /* ed */,
+ XkbChangesPtr /* changes */,
+ XkbEventCausePtr /* cause */
+);
+
+extern unsigned int XkbIndicatorsToUpdate(
+ DeviceIntPtr /* dev */,
+ unsigned long /* state_changes */,
+ Bool /* enabled_ctrl_changes */
+);
+
+extern void XkbComputeDerivedState(
+ XkbSrvInfoPtr /* xkbi */
+);
+
+extern void XkbCheckSecondaryEffects(
+ XkbSrvInfoPtr /* xkbi */,
+ unsigned int /* which */,
+ XkbChangesPtr /* changes */,
+ XkbEventCausePtr /* cause */
+);
+
+extern void XkbCheckIndicatorMaps(
+ DeviceIntPtr /* dev */,
+ XkbSrvLedInfoPtr /* sli */,
+ unsigned int /* which */
+);
+
+extern unsigned int XkbStateChangedFlags(
+ XkbStatePtr /* old */,
+ XkbStatePtr /* new */
+);
+
+extern void XkbSendStateNotify(
+ DeviceIntPtr /* kbd */,
+ xkbStateNotify * /* pSN */
+);
+
+extern void XkbSendMapNotify(
+ DeviceIntPtr /* kbd */,
+ xkbMapNotify * /* ev */
+);
+
+extern int XkbComputeControlsNotify(
+ DeviceIntPtr /* kbd */,
+ XkbControlsPtr /* old */,
+ XkbControlsPtr /* new */,
+ xkbControlsNotify * /* pCN */,
+ Bool /* forceCtrlProc */
+);
+
+extern void XkbSendControlsNotify(
+ DeviceIntPtr /* kbd */,
+ xkbControlsNotify * /* ev */
+);
+
+extern void XkbSendCompatMapNotify(
+ DeviceIntPtr /* kbd */,
+ xkbCompatMapNotify * /* ev */
+);
+
+extern void XkbHandleBell(
+ BOOL /* force */,
+ BOOL /* eventOnly */,
+ DeviceIntPtr /* kbd */,
+ CARD8 /* percent */,
+ pointer /* ctrl */,
+ CARD8 /* class */,
+ Atom /* name */,
+ WindowPtr /* pWin */,
+ ClientPtr /* pClient */
+);
+
+extern void XkbSendAccessXNotify(
+ DeviceIntPtr /* kbd */,
+ xkbAccessXNotify * /* pEv */
+);
+
+extern void XkbSendNamesNotify(
+ DeviceIntPtr /* kbd */,
+ xkbNamesNotify * /* ev */
+);
+
+extern void XkbSendCompatNotify(
+ DeviceIntPtr /* kbd */,
+ xkbCompatMapNotify * /* ev */
+);
+
+extern void XkbSendActionMessage(
+ DeviceIntPtr /* kbd */,
+ xkbActionMessage * /* ev */
+);
+
+extern void XkbSendExtensionDeviceNotify(
+ DeviceIntPtr /* kbd */,
+ ClientPtr /* client */,
+ xkbExtensionDeviceNotify * /* ev */
+);
+
+extern void XkbSendNotification(
+ DeviceIntPtr /* kbd */,
+ XkbChangesPtr /* pChanges */,
+ XkbEventCausePtr /* cause */
+);
+
+extern void XkbProcessKeyboardEvent(
+ struct _xEvent * /* xE */,
+ DeviceIntPtr /* keybd */,
+ int /* count */
+);
+
+extern void XkbHandleActions(
+ DeviceIntPtr /* dev */,
+ DeviceIntPtr /* kbd */,
+ struct _xEvent * /* xE */,
+ int /* count */
+);
+
+extern Bool XkbEnableDisableControls(
+ XkbSrvInfoPtr /* xkbi */,
+ unsigned long /* change */,
+ unsigned long /* newValues */,
+ XkbChangesPtr /* changes */,
+ XkbEventCausePtr /* cause */
+);
+
+extern void AccessXInit(
+ DeviceIntPtr /* dev */
+);
+
+extern Bool AccessXFilterPressEvent(
+ register struct _xEvent * /* xE */,
+ register DeviceIntPtr /* keybd */,
+ int /* count */
+);
+
+extern Bool AccessXFilterReleaseEvent(
+ register struct _xEvent * /* xE */,
+ register DeviceIntPtr /* keybd */,
+ int /* count */
+);
+
+extern void AccessXCancelRepeatKey(
+ XkbSrvInfoPtr /* xkbi */,
+ KeyCode /* key */
+);
+
+extern void AccessXComputeCurveFactor(
+ XkbSrvInfoPtr /* xkbi */,
+ XkbControlsPtr /* ctrls */
+);
+
+extern XkbInterestPtr XkbFindClientResource(
+ DevicePtr /* inDev */,
+ ClientPtr /* client */
+);
+
+extern XkbInterestPtr XkbAddClientResource(
+ DevicePtr /* inDev */,
+ ClientPtr /* client */,
+ XID /* id */
+);
+
+extern int XkbRemoveResourceClient(
+ DevicePtr /* inDev */,
+ XID /* id */
+);
+
+extern int XkbDDXInitDevice(
+ DeviceIntPtr /* dev */
+);
+
+extern int XkbDDXAccessXBeep(
+ DeviceIntPtr /* dev */,
+ unsigned int /* what */,
+ unsigned int /* which */
+);
+
+extern void XkbDDXKeyClick(
+ DeviceIntPtr /* dev */,
+ int /* keycode */,
+ int /* synthetic */
+);
+
+extern int XkbDDXUsesSoftRepeat(
+ DeviceIntPtr /* dev */
+);
+
+extern void XkbDDXKeybdCtrlProc(
+ DeviceIntPtr /* dev */,
+ KeybdCtrl * /* ctrl */
+);
+
+extern void XkbDDXChangeControls(
+ DeviceIntPtr /* dev */,
+ XkbControlsPtr /* old */,
+ XkbControlsPtr /* new */
+);
+
+extern void XkbDDXUpdateDeviceIndicators(
+ DeviceIntPtr /* dev */,
+ XkbSrvLedInfoPtr /* sli */,
+ CARD32 /* newState */
+);
+
+extern void XkbDDXFakePointerButton(
+ int /* event */,
+ int /* button */
+);
+
+extern void XkbDDXFakePointerMotion(
+ unsigned int /* flags */,
+ int /* x */,
+ int /* y */
+);
+
+extern void XkbDDXFakeDeviceButton(
+ DeviceIntPtr /* dev */,
+ Bool /* press */,
+ int /* button */
+);
+
+extern int XkbDDXTerminateServer(
+ DeviceIntPtr /* dev */,
+ KeyCode /* key */,
+ XkbAction * /* act */
+);
+
+extern int XkbDDXSwitchScreen(
+ DeviceIntPtr /* dev */,
+ KeyCode /* key */,
+ XkbAction * /* act */
+);
+
+extern int XkbDDXPrivate(
+ DeviceIntPtr /* dev */,
+ KeyCode /* key */,
+ XkbAction * /* act */
+);
+
+extern void XkbDisableComputedAutoRepeats(
+ DeviceIntPtr /* pXDev */,
+ unsigned int /* key */
+);
+
+extern void XkbSetRepeatKeys(
+ DeviceIntPtr /* pXDev */,
+ int /* key */,
+ int /* onoff */
+);
+
+extern int XkbLatchModifiers(
+ DeviceIntPtr /* pXDev */,
+ CARD8 /* mask */,
+ CARD8 /* latches */
+);
+
+extern int XkbLatchGroup(
+ DeviceIntPtr /* pXDev */,
+ int /* group */
+);
+
+extern void XkbClearAllLatchesAndLocks(
+ DeviceIntPtr /* dev */,
+ XkbSrvInfoPtr /* xkbi */,
+ Bool /* genEv */,
+ XkbEventCausePtr /* cause */
+);
+
+extern void XkbSetRulesDflts(
+ char * /* rulesFile */,
+ char * /* model */,
+ char * /* layout */,
+ char * /* variant */,
+ char * /* options */
+);
+
+extern void XkbInitDevice(
+ DeviceIntPtr /* pXDev */
+);
+
+extern Bool XkbInitKeyboardDeviceStruct(
+ DeviceIntPtr /* pXDev */,
+ XkbComponentNamesPtr /* pNames */,
+ KeySymsPtr /* pSyms */,
+ CARD8 /* pMods */[],
+ BellProcPtr /* bellProc */,
+ KbdCtrlProcPtr /* ctrlProc */
+);
+
+extern int SProcXkbDispatch(
+ ClientPtr /* client */
+);
+
+extern XkbGeometryPtr XkbLookupNamedGeometry(
+ DeviceIntPtr /* dev */,
+ Atom /* name */,
+ Bool * /* shouldFree */
+);
+
+extern char * _XkbDupString(
+ char * /* str */
+);
+
+extern void XkbConvertCase(
+ KeySym /* sym */,
+ KeySym * /* lower */,
+ KeySym * /* upper */
+);
+
+extern Status XkbChangeKeycodeRange(
+ XkbDescPtr /* xkb */,
+ int /* minKC */,
+ int /* maxKC */,
+ XkbChangesPtr /* changes */
+);
+
+extern int XkbFinishDeviceInit(
+ DeviceIntPtr /* pXDev */
+);
+
+extern void XkbFreeSrvLedInfo(
+ XkbSrvLedInfoPtr /* sli */
+);
+
+extern void XkbFreeInfo(
+ XkbSrvInfoPtr /* xkbi */
+);
+
+extern Status XkbChangeTypesOfKey(
+ XkbDescPtr /* xkb */,
+ int /* key */,
+ int /* nGroups */,
+ unsigned int /* groups */,
+ int * /* newTypesIn */,
+ XkbMapChangesPtr /* changes */
+);
+
+extern int XkbKeyTypesForCoreSymbols(
+ XkbDescPtr /* xkb */,
+ int /* map_width */,
+ KeySym * /* core_syms */,
+ unsigned int /* protected */,
+ int * /* types_inout */,
+ KeySym * /* xkb_syms_rtrn */
+);
+
+extern Bool XkbApplyCompatMapToKey(
+ XkbDescPtr /* xkb */,
+ KeyCode /* key */,
+ XkbChangesPtr /* changes */
+);
+
+extern Bool XkbApplyVirtualModChanges(
+ XkbDescPtr /* xkb */,
+ unsigned int /* changed */,
+ XkbChangesPtr /* changes */
+);
+
+extern void XkbSendNewKeyboardNotify(
+ DeviceIntPtr /* kbd */,
+ xkbNewKeyboardNotify * /* pNKN */
+);
+
+#ifdef XKBSRV_NEED_FILE_FUNCS
+
+#include <X11/extensions/XKMformat.h>
+#include <X11/extensions/XKBfile.h>
+#include <X11/extensions/XKBrules.h>
+
+#define _XkbListKeymaps 0
+#define _XkbListKeycodes 1
+#define _XkbListTypes 2
+#define _XkbListCompat 3
+#define _XkbListSymbols 4
+#define _XkbListGeometry 5
+#define _XkbListNumComponents 6
+
+typedef struct _XkbSrvListInfo {
+ int szPool;
+ int nPool;
+ char * pool;
+
+ int maxRtrn;
+ int nTotal;
+
+ char * pattern[_XkbListNumComponents];
+ int nFound[_XkbListNumComponents];
+} XkbSrvListInfoRec,*XkbSrvListInfoPtr;
+
+extern Status XkbDDXList(
+ DeviceIntPtr /* dev */,
+ XkbSrvListInfoPtr /* listing */,
+ ClientPtr /* client */
+);
+
+extern unsigned int XkbDDXLoadKeymapByNames(
+ DeviceIntPtr /* keybd */,
+ XkbComponentNamesPtr /* names */,
+ unsigned int /* want */,
+ unsigned int /* need */,
+ XkbFileInfoPtr /* finfoRtrn */,
+ char * /* keymapNameRtrn */,
+ int /* keymapNameRtrnLen */
+);
+
+extern Bool XkbDDXNamesFromRules(
+ DeviceIntPtr /* keybd */,
+ char * /* rules */,
+ XkbRF_VarDefsPtr /* defs */,
+ XkbComponentNamesPtr /* names */
+);
+
+extern Bool XkbDDXApplyConfig(
+ XPointer /* cfg_in */,
+ XkbSrvInfoPtr /* xkbi */
+);
+
+extern XPointer XkbDDXPreloadConfig(
+ char ** /* rulesFileRtrn */,
+ XkbRF_VarDefsPtr /* defs */,
+ XkbComponentNamesPtr /* names */,
+ DeviceIntPtr /* dev */
+);
+
+extern int _XkbStrCaseCmp(
+ char * /* str1 */,
+ char * /* str2 */
+);
+
+#endif /* XKBSRV_NEED_FILE_FUNCS */
+
+_XFUNCPROTOEND
+
+#define XkbAtomGetString(d,s) NameForAtom(s)
+
+#endif /* _XKBSRV_H_ */
diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in
index 48196d8b6..7b2a4d193 100644
--- a/include/xorg-server.h.in
+++ b/include/xorg-server.h.in
@@ -191,7 +191,17 @@
#undef XVENDORNAME
/* Endian order */
-#undef X_BYTE_ORDER
+#undef _X_BYTE_ORDER
+/* Deal with multiple architecture compiles on Mac OS X */
+#ifndef __APPLE_CC__
+#define X_BYTE_ORDER _X_BYTE_ORDER
+#else
+#ifdef __BIG_ENDIAN__
+#define X_BYTE_ORDER X_BIG_ENDIAN
+#else
+#define X_BYTE_ORDER X_LITTLE_ENDIAN
+#endif
+#endif
/* BSD-compliant source */
#undef _BSD_SOURCE
diff --git a/mfb/mfbpixmap.c b/mfb/mfbpixmap.c
index 5ec8502cb..e34972451 100644
--- a/mfb/mfbpixmap.c
+++ b/mfb/mfbpixmap.c
@@ -101,12 +101,8 @@ mfbCreatePixmap (pScreen, width, height, depth)
pPixmap->drawable.height = height;
pPixmap->devKind = paddedWidth;
pPixmap->refcnt = 1;
-#ifdef PIXPRIV
pPixmap->devPrivate.ptr = datasize ?
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
-#else
- pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
-#endif
return pPixmap;
}
diff --git a/mi/mi.h b/mi/mi.h
index 8d9d120bd..c71c9b7c0 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -85,18 +85,6 @@ extern RegionPtr miCopyArea(
int /*yOut*/
);
-extern void miOpqStipDrawable(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- RegionPtr /*prgnSrc*/,
- MiBits * /*pbits*/,
- int /*srcx*/,
- int /*w*/,
- int /*h*/,
- int /*dstx*/,
- int /*dsty*/
-);
-
extern RegionPtr miCopyPlane(
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
@@ -144,15 +132,6 @@ extern void miRecolorCursor(
/* midash.c */
-extern miDashPtr miDashLine(
- int /*npt*/,
- DDXPointPtr /*ppt*/,
- unsigned int /*nDash*/,
- unsigned char * /*pDash*/,
- unsigned int /*offset*/,
- int * /*pnseg*/
-);
-
extern void miStepDash(
int /*dist*/,
int * /*pDashIndex*/,
@@ -186,6 +165,9 @@ extern void mieqProcessInputEvents(
void
);
+typedef void (*mieqHandler)(int, xEventPtr, DeviceIntPtr, int);
+void mieqSetHandler(int event, mieqHandler handler);
+
/* miexpose.c */
extern RegionPtr miHandleExposures(
@@ -323,16 +305,6 @@ extern void miPolySegment(
/* mipolytext.c */
-extern int miPolyText(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- char * /*chars*/,
- FontEncoding /*fontEncoding*/
-);
-
extern int miPolyText8(
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
@@ -351,16 +323,6 @@ extern int miPolyText16(
unsigned short * /*chars*/
);
-extern int miImageText(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- int /*x*/,
- int /*y*/,
- int /*count*/,
- char * /*chars*/,
- FontEncoding /*fontEncoding*/
-);
-
extern void miImageText8(
DrawablePtr /*pDraw*/,
GCPtr /*pGC*/,
@@ -400,10 +362,6 @@ extern Bool miRectAlloc(
int /*n*/
);
-extern void miSetExtents(
- RegionPtr /*pReg*/
-);
-
extern int miFindMaxBand(
RegionPtr /*prgn*/
);
@@ -414,7 +372,6 @@ extern Bool miValidRegion(
);
#endif
-extern Bool miRegionDataCopy(RegionPtr dst, RegionPtr src);
extern Bool miRegionBroken(RegionPtr pReg);
/* miscrinit.c */
@@ -429,11 +386,6 @@ extern Bool miModifyPixmapHeader(
pointer /*pPixData*/
);
-extern Bool miCloseScreen(
- int /*index*/,
- ScreenPtr /*pScreen*/
-);
-
extern Bool miCreateScreenResources(
ScreenPtr /*pScreen*/
);
diff --git a/mi/miarc.c b/mi/miarc.c
index 2b3a0cbbc..2bbbb0e7f 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -246,7 +246,7 @@ typedef struct _miPolyArc {
static CARD32 gcvals[6];
static void fillSpans(DrawablePtr pDrawable, GCPtr pGC);
-static void newFinalSpan(int y, register int xmin, register int xmax);
+static void newFinalSpan(int y, int xmin, int xmax);
static void drawArc(xArc *tarc, int l, int a0, int a1, miArcFacePtr right,
miArcFacePtr left);
static void drawZeroArc(DrawablePtr pDraw, GCPtr pGC, xArc *tarc, int lw,
@@ -284,7 +284,7 @@ miArcSegment(
{
int l = pGC->lineWidth;
int a0, a1, startAngle, endAngle;
- miArcFacePtr temp;
+ miArcFacePtr temp;
if (!l)
l = 1;
@@ -425,15 +425,8 @@ static unsigned long lrustamp;
static arcCacheRec *lastCacheHit = &arcCache[0];
static RESTYPE cacheType;
-/*
- * External so it can be called when low on memory.
- * Call with a zero ID in that case.
- */
-/*ARGSUSED*/
-int
-miFreeArcCache (data, id)
- pointer data;
- XID id;
+static int
+miFreeArcCache (pointer data, XID id)
{
int k;
arcCacheRec *cent;
@@ -461,11 +454,11 @@ miComputeCircleSpans(
xArc *parc,
miArcSpanData *spdata)
{
- register miArcSpan *span;
+ miArcSpan *span;
int doinner;
- register int x, y, e;
+ int x, y, e;
int xk, yk, xm, ym, dx, dy;
- register int slw, inslw;
+ int slw, inslw;
int inx = 0, iny, ine = 0;
int inxk = 0, inyk = 0, inxm = 0, inym = 0;
@@ -529,7 +522,7 @@ miComputeEllipseSpans(
xArc *parc,
miArcSpanData *spdata)
{
- register miArcSpan *span;
+ miArcSpan *span;
double w, h, r, xorg;
double Hs, Hf, WH, K, Vk, Nk, Fk, Vr, N, Nc, Z, rs;
double A, T, b, d, x, y, t, inx, outx = 0.0, hepp, hepm;
@@ -859,13 +852,13 @@ tailX(
static miArcSpanData *
miComputeWideEllipse(
- int lw,
- register xArc *parc,
- Bool *mustFree)
+ int lw,
+ xArc *parc,
+ Bool *mustFree)
{
- register miArcSpanData *spdata;
- register arcCacheRec *cent, *lruent;
- register int k;
+ miArcSpanData *spdata;
+ arcCacheRec *cent, *lruent;
+ int k;
arcCacheRec fakeent;
if (!lw)
@@ -943,14 +936,14 @@ miFillWideEllipse(
xArc *parc)
{
DDXPointPtr points;
- register DDXPointPtr pts;
+ DDXPointPtr pts;
int *widths;
- register int *wids;
+ int *wids;
miArcSpanData *spdata;
Bool mustFree;
- register miArcSpan *span;
- register int xorg, yorgu, yorgl;
- register int n;
+ miArcSpan *span;
+ int xorg, yorgu, yorgl;
+ int n;
yorgu = parc->height + pGC->lineWidth;
n = (sizeof(int) * 2) * yorgu;
@@ -1077,20 +1070,20 @@ miPolyArc(pDraw, pGC, narcs, parcs)
int narcs;
xArc *parcs;
{
- register int i;
- xArc *parc;
- int xMin, xMax, yMin, yMax;
- int pixmapWidth = 0, pixmapHeight = 0;
- int xOrg = 0, yOrg = 0;
- int width;
- Bool fTricky;
- DrawablePtr pDrawTo;
- CARD32 fg, bg;
- GCPtr pGCTo;
- miPolyArcPtr polyArcs;
- int cap[2], join[2];
- int iphase;
- int halfWidth;
+ int i;
+ xArc *parc;
+ int xMin, xMax, yMin, yMax;
+ int pixmapWidth = 0, pixmapHeight = 0;
+ int xOrg = 0, yOrg = 0;
+ int width;
+ Bool fTricky;
+ DrawablePtr pDrawTo;
+ CARD32 fg, bg;
+ GCPtr pGCTo;
+ miPolyArcPtr polyArcs;
+ int cap[2], join[2];
+ int iphase;
+ int halfWidth;
width = pGC->lineWidth;
if(width == 0 && pGC->lineStyle == LineSolid)
@@ -3136,12 +3129,12 @@ struct finalSpanChunk {
static struct finalSpanChunk *chunks;
-struct finalSpan *
-realAllocSpan ()
+static struct finalSpan *
+realAllocSpan (void)
{
- register struct finalSpanChunk *newChunk;
- register struct finalSpan *span;
- register int i;
+ struct finalSpanChunk *newChunk;
+ struct finalSpan *span;
+ int i;
newChunk = (struct finalSpanChunk *) xalloc (sizeof (struct finalSpanChunk));
if (!newChunk)
@@ -3179,14 +3172,14 @@ fillSpans (
DrawablePtr pDrawable,
GCPtr pGC)
{
- register struct finalSpan *span;
- register DDXPointPtr xSpan;
- register int *xWidth;
- register int i;
- register struct finalSpan **f;
- register int spany;
- DDXPointPtr xSpans;
- int *xWidths;
+ struct finalSpan *span;
+ DDXPointPtr xSpan;
+ int *xWidth;
+ int i;
+ struct finalSpan **f;
+ int spany;
+ DDXPointPtr xSpans;
+ int *xWidths;
if (nspans == 0)
return;
@@ -3280,13 +3273,13 @@ realFindSpan (int y)
static void
newFinalSpan (
int y,
- register int xmin,
- register int xmax)
+ int xmin,
+ int xmax)
{
- register struct finalSpan *x;
- register struct finalSpan **f;
- struct finalSpan *oldx;
- struct finalSpan *prev;
+ struct finalSpan *x;
+ struct finalSpan **f;
+ struct finalSpan *oldx;
+ struct finalSpan *prev;
f = findSpan (y);
if (!f)
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index bf0e29ac0..e61855a93 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -76,12 +76,12 @@ extern int ffs(int);
_X_EXPORT RegionPtr
miCopyArea(pSrcDrawable, pDstDrawable,
pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut)
- register DrawablePtr pSrcDrawable;
- register DrawablePtr pDstDrawable;
- GCPtr pGC;
- int xIn, yIn;
- int widthSrc, heightSrc;
- int xOut, yOut;
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
+ GCPtr pGC;
+ int xIn, yIn;
+ int widthSrc, heightSrc;
+ int xOut, yOut;
{
DDXPointPtr ppt, pptFirst;
unsigned int *pwidthFirst, *pwidth, *pbits;
@@ -400,13 +400,9 @@ miGetPlane(
* Note how the clipped out bits of the bitmap are always the background
* color so that the stipple never causes FillRect to draw them.
*/
-void
-miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty)
- DrawablePtr pDraw;
- GCPtr pGC;
- RegionPtr prgnSrc;
- MiBits *pbits;
- int srcx, w, h, dstx, dsty;
+static void
+miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
+ MiBits *pbits, int srcx, int w, int h, int dstx, int dsty)
{
int oldfill, i;
unsigned long oldfg;
diff --git a/mi/mibstore.c b/mi/mibstore.c
index 6653c2345..70839ce31 100644
--- a/mi/mibstore.c
+++ b/mi/mibstore.c
@@ -152,11 +152,11 @@ static void miBSClearBackingRegion(WindowPtr pWin, RegionPtr pRgn);
#define copyData(src,dst,n,morecopy) \
{ \
- register short *srcCopy = (short *)(src); \
- register short *dstCopy = (short *)(dst); \
- register int i; \
- register int bsx = pBackingStore->x; \
- register int bsy = pBackingStore->y; \
+ short *srcCopy = (short *)(src); \
+ short *dstCopy = (short *)(dst); \
+ int i; \
+ int bsx = pBackingStore->x; \
+ int bsy = pBackingStore->y; \
for (i = n; --i >= 0; ) \
{ \
*dstCopy++ = *srcCopy++ - bsx; \
@@ -1010,7 +1010,7 @@ miBSSetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted)
DrawablePtr pDrawable;
GCPtr pGC;
char *psrc;
- register DDXPointPtr ppt;
+ DDXPointPtr ppt;
int *pwidth;
int nspans;
int fSorted;
@@ -1150,8 +1150,8 @@ miBSDoCopy(
} *boxes; /* Array of box/drawable pairs covering
* source box. */
int *sequence; /* Sequence of boxes to move */
- register int i, j, k, l, y;
- register BoxPtr pBox;
+ int i, j, k, l, y;
+ BoxPtr pBox;
int dx, dy, nrects;
Bool graphicsExposures;
CopyPlaneProcPtr pixCopyProc;
@@ -1591,7 +1591,7 @@ static RegionPtr
miBSCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane)
DrawablePtr pSrc;
DrawablePtr pDst;
- register GC *pGC;
+ GC *pGC;
int srcx,
srcy;
int w,
@@ -1901,9 +1901,9 @@ miBSPolyArc(pDrawable, pGC, narcs, parcs)
static void
miBSFillPolygon(pDrawable, pGC, shape, mode, count, pPts)
DrawablePtr pDrawable;
- register GCPtr pGC;
+ GCPtr pGC;
int shape, mode;
- register int count;
+ int count;
DDXPointPtr pPts;
{
DDXPointPtr pPtsCopy;
@@ -2546,8 +2546,8 @@ static void
miBSAllocate(pWin)
WindowPtr pWin;
{
- register miBSWindowPtr pBackingStore;
- register ScreenPtr pScreen;
+ miBSWindowPtr pBackingStore;
+ ScreenPtr pScreen;
if (pWin->drawable.pScreen->backingStoreSupport == NotUseful)
return;
@@ -2648,7 +2648,7 @@ miBSFree(pWin)
WindowPtr pWin;
{
miBSWindowPtr pBackingStore;
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
pScreen = pWin->drawable.pScreen;
@@ -2792,9 +2792,9 @@ miResizeBackingStore(
*/
static void
miBSSaveDoomedAreas(pWin, pObscured, dx, dy)
- register WindowPtr pWin;
- RegionPtr pObscured;
- int dx, dy;
+ WindowPtr pWin;
+ RegionPtr pObscured;
+ int dx, dy;
{
miBSWindowPtr pBackingStore;
ScreenPtr pScreen;
@@ -2899,14 +2899,14 @@ miBSSaveDoomedAreas(pWin, pObscured, dx, dy)
*/
static RegionPtr
miBSRestoreAreas(pWin, prgnExposed)
- register WindowPtr pWin;
+ WindowPtr pWin;
RegionPtr prgnExposed;
{
PixmapPtr pBackingPixmap;
miBSWindowPtr pBackingStore;
RegionPtr prgnSaved;
RegionPtr prgnRestored;
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
RegionPtr exposures = prgnExposed;
pScreen = pWin->drawable.pScreen;
@@ -3097,15 +3097,15 @@ miBSTranslateBackingStore(pWin, windx, windy, oldClip, oldx, oldy)
int oldx; /* old window position */
int oldy;
{
- register miBSWindowPtr pBackingStore;
- register RegionPtr pSavedRegion;
- register RegionPtr newSaved, doomed;
- register ScreenPtr pScreen;
- BoxRec extents;
- int scrdx; /* bit translation distance on screen */
- int scrdy;
- int dx; /* distance window moved on screen */
- int dy;
+ miBSWindowPtr pBackingStore;
+ RegionPtr pSavedRegion;
+ RegionPtr newSaved, doomed;
+ ScreenPtr pScreen;
+ BoxRec extents;
+ int scrdx; /* bit translation distance on screen */
+ int scrdy;
+ int dx; /* distance window moved on screen */
+ int dy;
pScreen = pWin->drawable.pScreen;
pBackingStore = (miBSWindowPtr)(pWin->backStorage);
@@ -3815,9 +3815,9 @@ miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane)
miBSWindowPtr pBackingStore;
CopyPlaneProcPtr copyProc;
GCPtr pScratchGC;
- register BoxPtr pBox;
- register int i;
- register int dx, dy;
+ BoxPtr pBox;
+ int i;
+ int dx, dy;
BITS32 gcMask;
if (!REGION_NOTEMPTY(pGC->pScreen, prgnExposed))
diff --git a/mi/micmap.c b/mi/micmap.c
index 987affe96..977c587a0 100644
--- a/mi/micmap.c
+++ b/mi/micmap.c
@@ -125,8 +125,8 @@ miResolveColor(unsigned short *pred, unsigned short *pgreen,
_X_EXPORT Bool
miInitializeColormap(ColormapPtr pmap)
{
- register unsigned i;
- register VisualPtr pVisual;
+ unsigned i;
+ VisualPtr pVisual;
unsigned lim, maxent, shift;
pVisual = pmap->pVisual;
@@ -211,13 +211,13 @@ _X_EXPORT int
miExpandDirectColors(ColormapPtr pmap, int ndef, xColorItem *indefs,
xColorItem *outdefs)
{
- register int red, green, blue;
- int maxred, maxgreen, maxblue;
- int stepred, stepgreen, stepblue;
- VisualPtr pVisual;
- register int pixel;
- register int nresult;
- register int i;
+ int red, green, blue;
+ int maxred, maxgreen, maxblue;
+ int stepred, stepgreen, stepblue;
+ VisualPtr pVisual;
+ int pixel;
+ int nresult;
+ int i;
pVisual = pmap->pVisual;
diff --git a/mi/midash.c b/mi/midash.c
index 6dd161a39..912fb0389 100644
--- a/mi/midash.c
+++ b/mi/midash.c
@@ -54,196 +54,6 @@ SOFTWARE.
static miDashPtr CheckDashStorage(miDashPtr *ppseg, int nseg, int *pnsegMax);
-/* return a list of DashRec. there will be an extra
-entry at the end holding the last point of the polyline.
- this means that the code that actually draws dashes can
-get a pair of points for every dash. only the point in the last
-dash record is useful; the other fields are not used.
- nseg is the number of segments, not the number of points.
-
-example:
-
- dash1.start
- dash2.start
- dash3.start
- last-point
-
-defines a list of segments
- (dash1.pt, dash2.pt)
- (dash2.pt, dash3.pt)
- (dash3.pt, last-point)
-and nseg == 3.
-
-NOTE:
- EVEN_DASH == ~ODD_DASH
-
-NOTE ALSO:
- miDashLines may return 0 segments, going from pt[0] to pt[0] with one dash.
-*/
-
-miDashPtr
-miDashLine(npt, ppt, nDash, pDash, offset, pnseg)
-int npt;
-DDXPointPtr ppt;
-unsigned int nDash;
-unsigned char *pDash;
-unsigned int offset;
-int *pnseg;
-{
- DDXPointRec pt1, pt2;
- int lenCur; /* npt used from this dash */
- int lenMax; /* npt in this dash */
- int iDash = 0; /* index of current dash */
- int which; /* EVEN_DASH or ODD_DASH */
- miDashPtr pseg; /* list of dash segments */
- miDashPtr psegBase; /* start of list */
- int nseg = 0; /* number of dashes so far */
- int nsegMax = 0; /* num segs we can fit in this list */
-
- int x, y, len;
- int adx, ady, signdx, signdy;
- int du, dv, e1, e2, e, base_e = 0;
-
- lenCur = offset;
- which = EVEN_DASH;
- while(lenCur >= pDash[iDash])
- {
- lenCur -= pDash[iDash];
- iDash++;
- if (iDash >= nDash)
- iDash = 0;
- which = ~which;
- }
- lenMax = pDash[iDash];
-
- psegBase = (miDashPtr)NULL;
- pt2 = ppt[0]; /* just in case there is only one point */
-
- while(--npt)
- {
- if (PtEqual(ppt[0], ppt[1]))
- {
- ppt++;
- continue; /* no duplicated points in polyline */
- }
- pt1 = *ppt++;
- pt2 = *ppt;
-
- adx = pt2.x - pt1.x;
- ady = pt2.y - pt1.y;
- signdx = sign(adx);
- signdy = sign(ady);
- adx = abs(adx);
- ady = abs(ady);
-
- if (adx > ady)
- {
- du = adx;
- dv = ady;
- len = adx;
- }
- else
- {
- du = ady;
- dv = adx;
- len = ady;
- }
-
- e1 = dv * 2;
- e2 = e1 - 2*du;
- e = e1 - du;
- x = pt1.x;
- y = pt1.y;
-
- nseg++;
- pseg = CheckDashStorage(&psegBase, nseg, &nsegMax);
- if (!pseg)
- return (miDashPtr)NULL;
- pseg->pt = pt1;
- pseg->e1 = e1;
- pseg->e2 = e2;
- base_e = pseg->e = e;
- pseg->which = which;
- pseg->newLine = 1;
-
- while (len--)
- {
- if (adx > ady)
- {
- /* X_AXIS */
- if (((signdx > 0) && (e < 0)) ||
- ((signdx <=0) && (e <=0))
- )
- {
- e += e1;
- }
- else
- {
- y += signdy;
- e += e2;
- }
- x += signdx;
- }
- else
- {
- /* Y_AXIS */
- if (((signdx > 0) && (e < 0)) ||
- ((signdx <=0) && (e <=0))
- )
- {
- e +=e1;
- }
- else
- {
- x += signdx;
- e += e2;
- }
- y += signdy;
- }
-
- lenCur++;
- if (lenCur >= lenMax && (len || npt <= 1))
- {
- nseg++;
- pseg = CheckDashStorage(&psegBase, nseg, &nsegMax);
- if (!pseg)
- return (miDashPtr)NULL;
- pseg->pt.x = x;
- pseg->pt.y = y;
- pseg->e1 = e1;
- pseg->e2 = e2;
- pseg->e = e;
- which = ~which;
- pseg->which = which;
- pseg->newLine = 0;
-
- /* move on to next dash */
- iDash++;
- if (iDash >= nDash)
- iDash = 0;
- lenMax = pDash[iDash];
- lenCur = 0;
- }
- } /* while len-- */
- } /* while --npt */
-
- if (lenCur == 0 && nseg != 0)
- {
- nseg--;
- which = ~which;
- }
- *pnseg = nseg;
- pseg = CheckDashStorage(&psegBase, nseg+1, &nsegMax);
- if (!pseg)
- return (miDashPtr)NULL;
- pseg->pt = pt2;
- pseg->e = base_e;
- pseg->which = which;
- pseg->newLine = 0;
- return psegBase;
-}
-
-
#define NSEGDELTA 16
/* returns a pointer to the pseg[nseg-1], growing the storage as
@@ -251,8 +61,7 @@ necessary. this interface seems unnecessarily cumbersome.
*/
-static
-miDashPtr
+static miDashPtr
CheckDashStorage(
miDashPtr *ppseg, /* base pointer */
int nseg, /* number of segment we want to write to */
diff --git a/mi/mieq.c b/mi/mieq.c
index 507cdd337..5bd87ebdb 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -74,6 +74,7 @@ typedef struct _EventQueue {
EventRec events[QUEUE_SIZE]; /* static allocation for signals */
ScreenPtr pEnqueueScreen; /* screen events are being delivered to */
ScreenPtr pDequeueScreen; /* screen events are being dispatched to */
+ mieqHandler handlers[128]; /* custom event handler */
} EventQueueRec, *EventQueuePtr;
static EventQueueRec miEventQueue;
@@ -81,11 +82,15 @@ static EventQueueRec miEventQueue;
Bool
mieqInit()
{
+ int i;
+
miEventQueue.head = miEventQueue.tail = 0;
miEventQueue.lastEventTime = GetTimeInMillis ();
miEventQueue.lastMotion = FALSE;
miEventQueue.pEnqueueScreen = screenInfo.screens[0];
miEventQueue.pDequeueScreen = miEventQueue.pEnqueueScreen;
+ for (i = 0; i < 128; i++)
+ miEventQueue.handlers[i] = NULL;
SetInputCheck(&miEventQueue.head, &miEventQueue.tail);
return TRUE;
}
@@ -178,6 +183,16 @@ mieqSwitchScreen(ScreenPtr pScreen, Bool fromDIX)
miEventQueue.pDequeueScreen = pScreen;
}
+void
+mieqSetHandler(int event, mieqHandler handler)
+{
+ if (handler && miEventQueue.handlers[event])
+ ErrorF("mieq: warning: overriding existing handler %p with %p for "
+ "event %d\n", miEventQueue.handlers[event], handler, event);
+
+ miEventQueue.handlers[event] = handler;
+}
+
/* Call this from ProcessInputEvents(). */
void
mieqProcessInputEvents()
@@ -215,6 +230,15 @@ mieqProcessInputEvents()
else
++miEventQueue.head;
+ /* If someone's registered a custom event handler, let them
+ * steal it. */
+ if (miEventQueue.handlers[e->event->u.u.type]) {
+ miEventQueue.handlers[e->event->u.u.type](miEventQueue.pDequeueScreen->myNum,
+ e->event, dev,
+ e->nevents);
+ return;
+ }
+
/* If this is a core event, make sure our keymap, et al, is
* changed to suit. */
if (e->event[0].u.u.type == KeyPress ||
diff --git a/mi/miexpose.c b/mi/miexpose.c
index 1ca5fc965..df04bd291 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -130,15 +130,15 @@ exposing is done by the backing store's GraphicsExpose function, of course.
_X_EXPORT RegionPtr
miHandleExposures(pSrcDrawable, pDstDrawable,
pGC, srcx, srcy, width, height, dstx, dsty, plane)
- register DrawablePtr pSrcDrawable;
- register DrawablePtr pDstDrawable;
+ DrawablePtr pSrcDrawable;
+ DrawablePtr pDstDrawable;
GCPtr pGC;
int srcx, srcy;
int width, height;
int dstx, dsty;
unsigned long plane;
{
- register ScreenPtr pscr;
+ ScreenPtr pscr;
RegionPtr prgnSrcClip; /* drawable-relative source clip */
RegionRec rgnSrcRec;
RegionPtr prgnDstClip; /* drawable-relative dest clip */
@@ -387,9 +387,9 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
if (pRgn && !REGION_NIL(pRgn))
{
xEvent *pEvent;
- register xEvent *pe;
- register BoxPtr pBox;
- register int i;
+ xEvent *pe;
+ BoxPtr pBox;
+ int i;
int numRects;
numRects = REGION_NUM_RECTS(pRgn);
@@ -431,12 +431,12 @@ void
miSendExposures(pWin, pRgn, dx, dy)
WindowPtr pWin;
RegionPtr pRgn;
- register int dx, dy;
+ int dx, dy;
{
- register BoxPtr pBox;
+ BoxPtr pBox;
int numRects;
- register xEvent *pEvent, *pe;
- register int i;
+ xEvent *pEvent, *pe;
+ int i;
pBox = REGION_RECTS(pRgn);
numRects = REGION_NUM_RECTS(pRgn);
@@ -493,7 +493,7 @@ miSendExposures(pWin, pRgn, dx, dy)
_X_EXPORT void
miWindowExposures(pWin, prgn, other_exposed)
WindowPtr pWin;
- register RegionPtr prgn, other_exposed;
+ RegionPtr prgn, other_exposed;
{
RegionPtr exposures = prgn;
if (pWin->backStorage && prgn)
@@ -629,7 +629,7 @@ tossGC (
_X_EXPORT void
miPaintWindow(pWin, prgn, what)
-register WindowPtr pWin;
+WindowPtr pWin;
RegionPtr prgn;
int what;
{
@@ -657,10 +657,10 @@ int what;
BoxRec box;
WindowPtr pBgWin;
GCPtr pGC;
- register int i;
- register BoxPtr pbox;
- register ScreenPtr pScreen = pWin->drawable.pScreen;
- register xRectangle *prect;
+ int i;
+ BoxPtr pbox;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ xRectangle *prect;
int numRects;
gcmask = 0;
diff --git a/mi/mifillarc.c b/mi/mifillarc.c
index 66063166a..c561b1f5b 100644
--- a/mi/mifillarc.c
+++ b/mi/mifillarc.c
@@ -54,8 +54,8 @@ Author: Bob Scheifler, MIT X Consortium
_X_EXPORT void
miFillArcSetup(arc, info)
- register xArc *arc;
- register miFillArcRec *info;
+ xArc *arc;
+ miFillArcRec *info;
{
info->y = arc->height >> 1;
info->dy = arc->height & 1;
@@ -107,10 +107,8 @@ miFillArcSetup(arc, info)
}
}
-void
-miFillArcDSetup(arc, info)
- register xArc *arc;
- register miFillArcDRec *info;
+static void
+miFillArcDSetup(xArc *arc, miFillArcDRec *info)
{
/* h^2 * (2x - 2xorg)^2 = w^2 * h^2 - w^2 * (2y - 2yorg)^2 */
/* even: xorg = yorg = 0 odd: xorg = .5, yorg = -.5 */
@@ -141,13 +139,13 @@ miFillArcDSetup(arc, info)
static void
miGetArcEdge(
- register xArc *arc,
- register miSliceEdgePtr edge,
+ xArc *arc,
+ miSliceEdgePtr edge,
int k,
Bool top,
Bool left )
{
- register int xady, y;
+ int xady, y;
y = arc->height >> 1;
if (!(arc->width & 1))
@@ -188,15 +186,9 @@ miGetArcEdge(
}
}
-void
-miEllipseAngleToSlope (angle, width, height, dxp, dyp, d_dxp, d_dyp)
- int angle;
- int width;
- int height;
- int *dxp;
- int *dyp;
- double *d_dxp;
- double *d_dyp;
+static void
+miEllipseAngleToSlope (int angle, int width, int height, int *dxp, int *dyp,
+ double *d_dxp, double *d_dyp)
{
int dx, dy;
double d_dx, d_dy, scale;
@@ -271,13 +263,13 @@ miEllipseAngleToSlope (angle, width, height, dxp, dyp, d_dxp, d_dyp)
static void
miGetPieEdge(
- register xArc *arc,
- register int angle,
- register miSliceEdgePtr edge,
+ xArc *arc,
+ int angle,
+ miSliceEdgePtr edge,
Bool top,
Bool left )
{
- register int k;
+ int k;
int dx, dy;
miEllipseAngleToSlope (angle, arc->width, arc->height, &dx, &dy, 0, 0);
@@ -316,11 +308,11 @@ miGetPieEdge(
_X_EXPORT void
miFillArcSliceSetup(arc, slice, pGC)
- register xArc *arc;
- register miArcSliceRec *slice;
+ xArc *arc;
+ miArcSliceRec *slice;
GCPtr pGC;
{
- register int angle1, angle2;
+ int angle1, angle2;
angle1 = arc->angle1;
if (arc->angle2 < 0)
@@ -550,14 +542,14 @@ miFillEllipseI(
GCPtr pGC,
xArc *arc )
{
- register int x, y, e;
+ int x, y, e;
int yk, xk, ym, xm, dx, dy, xorg, yorg;
int slw;
miFillArcRec info;
DDXPointPtr points;
- register DDXPointPtr pts;
+ DDXPointPtr pts;
int *widths;
- register int *wids;
+ int *wids;
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * arc->height);
if (!points)
@@ -593,14 +585,14 @@ miFillEllipseD(
GCPtr pGC,
xArc *arc )
{
- register int x, y;
+ int x, y;
int xorg, yorg, dx, dy, slw;
double e, yk, xk, ym, xm;
miFillArcDRec info;
DDXPointPtr points;
- register DDXPointPtr pts;
+ DDXPointPtr pts;
int *widths;
- register int *wids;
+ int *wids;
points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * arc->height);
if (!points)
@@ -659,14 +651,14 @@ miFillArcSliceI(
xArc *arc )
{
int yk, xk, ym, xm, dx, dy, xorg, yorg, slw;
- register int x, y, e;
+ int x, y, e;
miFillArcRec info;
miArcSliceRec slice;
int ya, xl, xr, xc;
DDXPointPtr points;
- register DDXPointPtr pts;
+ DDXPointPtr pts;
int *widths;
- register int *wids;
+ int *wids;
miFillArcSetup(arc, &info);
miFillArcSliceSetup(arc, &slice, pGC);
@@ -721,16 +713,16 @@ miFillArcSliceD(
GCPtr pGC,
xArc *arc )
{
- register int x, y;
+ int x, y;
int dx, dy, xorg, yorg, slw;
double e, yk, xk, ym, xm;
miFillArcDRec info;
miArcSliceRec slice;
int ya, xl, xr, xc;
DDXPointPtr points;
- register DDXPointPtr pts;
+ DDXPointPtr pts;
int *widths;
- register int *wids;
+ int *wids;
miFillArcDSetup(arc, &info);
miFillArcSliceSetup(arc, &slice, pGC);
@@ -790,8 +782,8 @@ miPolyFillArc(pDraw, pGC, narcs, parcs)
int narcs;
xArc *parcs;
{
- register int i;
- register xArc *arc;
+ int i;
+ xArc *arc;
for(i = narcs, arc = parcs; --i >= 0; arc++)
{
diff --git a/mi/mifillarc.h b/mi/mifillarc.h
index 53f6f23ea..3e3bb9858 100644
--- a/mi/mifillarc.h
+++ b/mi/mifillarc.h
@@ -176,35 +176,11 @@ typedef struct _miArcSlice {
#define miFillInArcLower(slw) (((iny + dy) != 0) && \
((slw > 1) || (ine != inxk)))
-extern int miFreeArcCache(
- pointer /*data*/,
- XID /*id*/
-);
-
-extern struct finalSpan *realAllocSpan(
- void
-);
-
extern void miFillArcSetup(
xArc * /*arc*/,
miFillArcRec * /*info*/
);
-extern void miFillArcDSetup(
- xArc * /*arc*/,
- miFillArcDRec * /*info*/
-);
-
-extern void miEllipseAngleToSlope(
- int /*angle*/,
- int /*width*/,
- int /*height*/,
- int * /*dxp*/,
- int * /*dyp*/,
- double * /*d_dxp*/,
- double * /*d_dyp*/
-);
-
extern void miFillArcSliceSetup(
xArc * /*arc*/,
miArcSliceRec * /*slice*/,
diff --git a/mi/mifillrct.c b/mi/mifillrct.c
index 78e89d69c..ca7e86445 100644
--- a/mi/mifillrct.c
+++ b/mi/mifillrct.c
@@ -74,16 +74,16 @@ miPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
xRectangle *prectInit; /* Pointer to first rectangle to fill */
{
int i;
- register int height;
- register int width;
- register xRectangle *prect;
- int xorg;
- register int yorg;
- int maxheight;
- DDXPointPtr pptFirst;
- register DDXPointPtr ppt;
- int *pwFirst;
- register int *pw;
+ int height;
+ int width;
+ xRectangle *prect;
+ int xorg;
+ int yorg;
+ int maxheight;
+ DDXPointPtr pptFirst;
+ DDXPointPtr ppt;
+ int *pwFirst;
+ int *pw;
if (pGC->miTranslate)
{
diff --git a/mi/mifpolycon.c b/mi/mifpolycon.c
index 57229f639..7bc1bb278 100644
--- a/mi/mifpolycon.c
+++ b/mi/mifpolycon.c
@@ -55,7 +55,7 @@ SOFTWARE.
#include "pixmapstr.h"
#include "mifpoly.h"
-static int GetFPolyYBounds(register SppPointPtr pts, int n, double yFtrans,
+static int GetFPolyYBounds(SppPointPtr pts, int n, double yFtrans,
int *by, int *ty);
#ifdef ICEILTEMPDECL
@@ -101,7 +101,7 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
*width,
*FirstWidth, /* output buffer */
*Marked; /* set if this vertex has been used */
- register int left, right, /* indices to first endpoints */
+ int left, right, /* indices to first endpoints */
nextleft,
nextright; /* indices to second endpoints */
DDXPointPtr ptsOut,
@@ -251,13 +251,13 @@ miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
static
int
GetFPolyYBounds(
- register SppPointPtr pts,
+ SppPointPtr pts,
int n,
double yFtrans,
int *by,
int *ty)
{
- register SppPointPtr ptMin;
+ SppPointPtr ptMin;
double ymin, ymax;
SppPointPtr ptsStart = pts;
diff --git a/mi/miglblt.c b/mi/miglblt.c
index db299a8ae..4db3eb62f 100644
--- a/mi/miglblt.c
+++ b/mi/miglblt.c
@@ -92,18 +92,18 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
{
int width, height;
PixmapPtr pPixmap;
- int nbyLine; /* bytes per line of padded pixmap */
+ int nbyLine; /* bytes per line of padded pixmap */
FontPtr pfont;
GCPtr pGCtmp;
- register int i;
- register int j;
- unsigned char *pbits; /* buffer for PutImage */
- register unsigned char *pb; /* temp pointer into buffer */
- register CharInfoPtr pci; /* currect char info */
- register unsigned char *pglyph; /* pointer bits in glyph */
- int gWidth, gHeight; /* width and height of glyph */
- register int nbyGlyphWidth; /* bytes per scanline of glyph */
- int nbyPadGlyph; /* server padded line of glyph */
+ int i;
+ int j;
+ unsigned char *pbits; /* buffer for PutImage */
+ unsigned char *pb; /* temp pointer into buffer */
+ CharInfoPtr pci; /* currect char info */
+ unsigned char *pglyph; /* pointer bits in glyph */
+ int gWidth, gHeight; /* width and height of glyph */
+ int nbyGlyphWidth; /* bytes per scanline of glyph */
+ int nbyPadGlyph; /* server padded line of glyph */
XID gcvals[3];
diff --git a/mi/miinitext.c b/mi/miinitext.c
index cb3447372..0fc6d1521 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -338,16 +338,18 @@ extern void XFree86DGAExtensionInit(INITARGS);
#endif
#ifdef GLXEXT
typedef struct __GLXprovider __GLXprovider;
+#ifdef INXDARWINAPP
+extern __GLXprovider* __DarwinglXMesaProvider;
+extern void DarwinGlxPushProvider(__GLXprovider *impl);
+extern void DarwinGlxExtensionInit(INITARGS);
+extern void DarwinGlxWrapInitVisuals(miInitVisualsProcPtr *);
+#else
extern __GLXprovider __glXMesaProvider;
extern void GlxPushProvider(__GLXprovider *impl);
-#ifndef __DARWIN__
extern void GlxExtensionInit(INITARGS);
extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
-#else
-extern void DarwinGlxExtensionInit(INITARGS);
-extern void DarwinGlxWrapInitVisuals(miInitVisualsProcPtr *);
-#endif
-#endif
+#endif // INXDARWINAPP
+#endif // GLXEXT
#ifdef XF86DRI
extern void XFree86DRIExtensionInit(INITARGS);
#endif
@@ -629,15 +631,16 @@ InitExtensions(argc, argv)
if (!noXFree86DRIExtension) XFree86DRIExtensionInit();
#endif
#endif
-#ifdef GLXEXT
+#ifdef GLXEXT
+#ifdef INXDARWINAPP
+ DarwinGlxPushProvider(__DarwinglXMesaProvider);
+ if (!noGlxExtension) DarwinGlxExtensionInit();
+#else
GlxPushProvider(&__glXMesaProvider);
-#ifndef __DARWIN__
if (!noGlxExtension) GlxExtensionInit();
-#else
- if (!noGlxExtension) DarwinGlxExtensionInit();
-#endif
-#endif
+#endif // INXDARWINAPP
+#endif // GLXEXT
#ifdef XFIXES
/* must be before Render to layer DisplayCursor correctly */
if (!noXFixesExtension) XFixesExtensionInit();
diff --git a/mi/miline.h b/mi/miline.h
index 7028485f0..b97b8cf9d 100644
--- a/mi/miline.h
+++ b/mi/miline.h
@@ -109,7 +109,7 @@ extern void miSetZeroLineBias(
}
#define SWAPINT(i, j) \
-{ register int _t = i; i = j; j = _t; }
+{ int _t = i; i = j; j = _t; }
#define SWAPPT(i, j) \
{ DDXPointRec _t; _t = i; i = j; j = _t; }
diff --git a/mi/mioverlay.c b/mi/mioverlay.c
index c02ea2dc5..9701001d6 100644
--- a/mi/mioverlay.c
+++ b/mi/mioverlay.c
@@ -54,8 +54,8 @@ typedef struct {
} miOverlayScreenRec, *miOverlayScreenPtr;
static unsigned long miOverlayGeneration = 0;
-int miOverlayWindowIndex = -1;
-int miOverlayScreenIndex = -1;
+static int miOverlayWindowIndex = -1;
+static int miOverlayScreenIndex = -1;
static void RebuildTree(WindowPtr);
static Bool HasUnderlayChildren(WindowPtr);
@@ -1019,7 +1019,7 @@ miOverlayMoveWindow(
static void
miOverlayWindowExposures(
WindowPtr pWin,
- register RegionPtr prgn,
+ RegionPtr prgn,
RegionPtr other_exposed
){
RegionPtr exposures = prgn;
@@ -1106,7 +1106,7 @@ miOverlayRecomputeExposures (
WindowPtr pWin,
pointer value
){
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
miOverlayTwoRegions *pValid = (miOverlayTwoRegions*)value;
miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
@@ -1161,10 +1161,10 @@ miOverlayResizeWindow(
DDXPointRec oldpt;
RegionPtr oldRegion = NULL, oldRegion2 = NULL;
WindowPtr pFirstChange;
- register WindowPtr pChild;
+ WindowPtr pChild;
RegionPtr gravitate[StaticGravity + 1];
RegionPtr gravitate2[StaticGravity + 1];
- register unsigned g;
+ unsigned g;
int nx, ny; /* destination x,y */
int newx, newy; /* new inner window position */
RegionPtr pRegion = NULL;
@@ -1669,7 +1669,7 @@ miOverlayChangeBorderWidth(
unsigned int width
){
int oldwidth;
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
Bool WasViewable = (Bool)(pWin->viewable);
Bool HadBorder;
#ifdef DO_SAVE_UNDERS
diff --git a/mi/mipointer.c b/mi/mipointer.c
index c28911bc6..b86a26a97 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -1,9 +1,4 @@
/*
- * mipointer.c
- */
-
-
-/*
Copyright 1989, 1998 The Open Group
@@ -70,6 +65,8 @@ static Bool miPointerSetCursorPosition(ScreenPtr pScreen, int x, int y,
static Bool miPointerCloseScreen(int index, ScreenPtr pScreen);
static void miPointerMove(ScreenPtr pScreen, int x, int y, unsigned long time);
+static xEvent* events; /* for WarpPointer MotionNotifies */
+
_X_EXPORT Bool
miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate)
ScreenPtr pScreen;
@@ -128,6 +125,9 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate)
miPointer.confined = FALSE;
miPointer.x = 0;
miPointer.y = 0;
+
+ events = NULL;
+
return TRUE;
}
@@ -144,6 +144,8 @@ miPointerCloseScreen (index, pScreen)
miPointer.pSpriteScreen = 0;
pScreen->CloseScreen = pScreenPriv->CloseScreen;
xfree ((pointer) pScreenPriv);
+ xfree ((pointer) events);
+ events = NULL;
return (*pScreen->CloseScreen) (index, pScreen);
}
@@ -402,6 +404,27 @@ miPointerAbsoluteCursor (int x, int y, unsigned long time)
miPointerSetPosition(inputInfo.pointer, &x, &y, time);
}
+/* Move the pointer on the current screen, and update the sprite. */
+static void
+miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
+ unsigned long time)
+{
+ SetupScreen(pScreen);
+
+ if (pDev && (pDev->coreEvents || pDev == inputInfo.pointer) &&
+ !pScreenPriv->waitForUpdate && pScreen == miPointer.pSpriteScreen)
+ {
+ miPointer.devx = x;
+ miPointer.devy = y;
+ if(!miPointer.pCursor->bits->emptyMask)
+ (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
+ }
+
+ miPointer.x = x;
+ miPointer.y = y;
+ miPointer.pScreen = pScreen;
+}
+
_X_EXPORT void
miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y, unsigned long time)
{
@@ -466,49 +489,29 @@ miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
void
miPointerMove (ScreenPtr pScreen, int x, int y, unsigned long time)
{
- miPointerMoved(inputInfo.pointer, pScreen, x, y, time);
-}
-
-/* Move the pointer on the current screen, and update the sprite. */
-void
-miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
- unsigned long time)
-{
- xEvent* events;
int i, nevents;
int valuators[2];
- SetupScreen(pScreen);
-
- if (pDev && (pDev->coreEvents || pDev == inputInfo.pointer) &&
- !pScreenPriv->waitForUpdate && pScreen == miPointer.pSpriteScreen)
- {
- miPointer.devx = x;
- miPointer.devy = y;
- if(!miPointer.pCursor->bits->emptyMask)
- (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
- }
-
- miPointer.x = x;
- miPointer.y = y;
- miPointer.pScreen = pScreen;
+ miPointerMoved(inputInfo.pointer, pScreen, x, y, time);
/* generate motion notify */
valuators[0] = x;
valuators[1] = y;
- events = (xEvent*)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
if (!events)
{
- FatalError("Could not allocate event store.\n");
- return;
+ events = (xEvent*)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+
+ if (!events)
+ {
+ FatalError("Could not allocate event store.\n");
+ return;
+ }
}
- nevents = GetPointerEvents(events, pDev, MotionNotify, 0,
+ nevents = GetPointerEvents(events, inputInfo.pointer, MotionNotify, 0,
POINTER_ABSOLUTE, 0, 2, valuators);
for (i = 0; i < nevents; i++)
- mieqEnqueue(pDev, &events[i]);
-
- xfree(events);
+ mieqEnqueue(inputInfo.pointer, &events[i]);
}
diff --git a/mi/mipointer.h b/mi/mipointer.h
index 30e89444b..1bce42c26 100644
--- a/mi/mipointer.h
+++ b/mi/mipointer.h
@@ -1,10 +1,4 @@
/*
- * mipointer.h
- *
- */
-
-
-/*
Copyright 1989, 1998 The Open Group
@@ -172,15 +166,6 @@ extern void miPointerSetPosition(
extern void miPointerUpdateSprite(
DeviceIntPtr pDev);
-/* Moves the sprite to x, y on the current screen, and updates the event
- * history. */
-extern void miPointerMoved(
- DeviceIntPtr pDev,
- ScreenPtr pScreen,
- int x,
- int y,
- unsigned long time);
-
extern int miPointerScreenIndex;
#endif /* MIPOINTER_H */
diff --git a/mi/mipoly.c b/mi/mipoly.c
index b514b5ed2..ea0406f88 100644
--- a/mi/mipoly.c
+++ b/mi/mipoly.c
@@ -70,14 +70,14 @@ SOFTWARE.
_X_EXPORT void
miFillPolygon(dst, pgc, shape, mode, count, pPts)
DrawablePtr dst;
- register GCPtr pgc;
+ GCPtr pgc;
int shape, mode;
- register int count;
+ int count;
DDXPointPtr pPts;
{
int i;
- register int xorg, yorg;
- register DDXPointPtr ppt;
+ int xorg, yorg;
+ DDXPointPtr ppt;
if (count == 0)
return;
diff --git a/mi/mipoly.h b/mi/mipoly.h
index 8e04f6737..c1bab4943 100644
--- a/mi/mipoly.h
+++ b/mi/mipoly.h
@@ -180,14 +180,6 @@ typedef struct _ScanLineListBlock {
/* mipolyutil.c */
-extern Bool miInsertEdgeInET(
- EdgeTable * /*ET*/,
- EdgeTableEntry * /*ETE*/,
- int /*scanline*/,
- ScanLineListBlock ** /*SLLBlock*/,
- int * /*iSLLBlock*/
-);
-
extern Bool miCreateETandAET(
int /*count*/,
DDXPointPtr /*pts*/,
diff --git a/mi/mipolycon.c b/mi/mipolycon.c
index b5ab89364..e2d666e51 100644
--- a/mi/mipolycon.c
+++ b/mi/mipolycon.c
@@ -78,9 +78,9 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
int count; /* number of points */
DDXPointPtr ptsIn; /* the points */
{
- register int xl = 0, xr = 0; /* x vals of left and right edges */
- register int dl = 0, dr = 0; /* decision variables */
- register int ml = 0, m1l = 0;/* left edge slope and slope+1 */
+ int xl = 0, xr = 0; /* x vals of left and right edges */
+ int dl = 0, dr = 0; /* decision variables */
+ int ml = 0, m1l = 0;/* left edge slope and slope+1 */
int mr = 0, m1r = 0; /* right edge slope and slope+1 */
int incr1l = 0, incr2l = 0; /* left edge error increments */
int incr1r = 0, incr2r = 0; /* right edge error increments */
@@ -221,7 +221,7 @@ miFillConvexPoly(dst, pgc, count, ptsIn)
static int
getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty)
{
- register DDXPointPtr ptMin;
+ DDXPointPtr ptMin;
int ymin, ymax;
DDXPointPtr ptsStart = pts;
diff --git a/mi/mipolygen.c b/mi/mipolygen.c
index 34da21f9e..0d2ecc430 100644
--- a/mi/mipolygen.c
+++ b/mi/mipolygen.c
@@ -72,12 +72,12 @@ miFillGeneralPoly(dst, pgc, count, ptsIn)
int count; /* number of points */
DDXPointPtr ptsIn; /* the points */
{
- register EdgeTableEntry *pAET; /* the Active Edge Table */
- register int y; /* the current scanline */
- register int nPts = 0; /* number of pts in buffer */
- register EdgeTableEntry *pWETE; /* Winding Edge Table */
- register ScanLineList *pSLL; /* Current ScanLineList */
- register DDXPointPtr ptsOut; /* ptr to output buffers */
+ EdgeTableEntry *pAET; /* the Active Edge Table */
+ int y; /* the current scanline */
+ int nPts = 0; /* number of pts in buffer */
+ EdgeTableEntry *pWETE; /* Winding Edge Table */
+ ScanLineList *pSLL; /* Current ScanLineList */
+ DDXPointPtr ptsOut; /* ptr to output buffers */
int *width;
DDXPointRec FirstPoint[NUMPTSTOBUFFER]; /* the output buffers */
int FirstWidth[NUMPTSTOBUFFER];
diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c
index 245bda317..afe3f724a 100644
--- a/mi/mipolypnt.c
+++ b/mi/mipolypnt.c
@@ -70,7 +70,7 @@ miPolyPoint(pDrawable, pGC, mode, npt, pptInit)
XID fsOld, fsNew;
int *pwidthInit, *pwidth;
int i;
- register xPoint *ppt;
+ xPoint *ppt;
/* make pointlist origin relative */
if (mode == CoordModePrevious)
diff --git a/mi/mipolytext.c b/mi/mipolytext.c
index 6af02e046..82b16f7d2 100644
--- a/mi/mipolytext.c
+++ b/mi/mipolytext.c
@@ -66,30 +66,6 @@ SOFTWARE.
#include "dixfontstr.h"
#include "mi.h"
-int
-miPolyText(pDraw, pGC, x, y, count, chars, fontEncoding)
- DrawablePtr pDraw;
- GCPtr pGC;
- int x, y;
- int count;
- char *chars;
- FontEncoding fontEncoding;
-{
- unsigned long n, i;
- int w;
- CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
-
- GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
- fontEncoding, &n, charinfo);
- w = 0;
- for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
- if (n != 0)
- (*pGC->ops->PolyGlyphBlt)(
- pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(pGC->font));
- return x+w;
-}
-
-
_X_EXPORT int
miPolyText8(pDraw, pGC, x, y, count, chars)
DrawablePtr pDraw;
@@ -112,7 +88,6 @@ miPolyText8(pDraw, pGC, x, y, count, chars)
return x+w;
}
-
_X_EXPORT int
miPolyText16(pDraw, pGC, x, y, count, chars)
DrawablePtr pDraw;
@@ -136,31 +111,6 @@ miPolyText16(pDraw, pGC, x, y, count, chars)
return x+w;
}
-
-int
-miImageText(pDraw, pGC, x, y, count, chars, fontEncoding)
- DrawablePtr pDraw;
- GCPtr pGC;
- int x, y;
- int count;
- char *chars;
- FontEncoding fontEncoding;
-{
- unsigned long n, i;
- FontPtr font = pGC->font;
- int w;
- CharInfoPtr charinfo[255];
-
- GetGlyphs(font, (unsigned long)count, (unsigned char *)chars,
- fontEncoding, &n, charinfo);
- w = 0;
- for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
- if (n !=0 )
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font));
- return x+w;
-}
-
-
_X_EXPORT void
miImageText8(pDraw, pGC, x, y, count, chars)
DrawablePtr pDraw;
@@ -179,7 +129,6 @@ miImageText8(pDraw, pGC, x, y, count, chars)
(*pGC->ops->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, FONTGLYPHS(font));
}
-
_X_EXPORT void
miImageText16(pDraw, pGC, x, y, count, chars)
DrawablePtr pDraw;
diff --git a/mi/mipolyutil.c b/mi/mipolyutil.c
index 5443ba5c3..6ec860a25 100644
--- a/mi/mipolyutil.c
+++ b/mi/mipolyutil.c
@@ -73,16 +73,12 @@ SOFTWARE.
* bucket. Finally, we can insert it.
*
*/
-Bool
-miInsertEdgeInET(ET, ETE, scanline, SLLBlock, iSLLBlock)
- EdgeTable *ET;
- EdgeTableEntry *ETE;
- int scanline;
- ScanLineListBlock **SLLBlock;
- int *iSLLBlock;
+static Bool
+miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline,
+ ScanLineListBlock **SLLBlock, int *iSLLBlock)
{
- register EdgeTableEntry *start, *prev;
- register ScanLineList *pSLL, *pPrevSLL;
+ EdgeTableEntry *start, *prev;
+ ScanLineList *pSLL, *pPrevSLL;
ScanLineListBlock *tmpSLLBlock;
/*
@@ -166,15 +162,15 @@ miInsertEdgeInET(ET, ETE, scanline, SLLBlock, iSLLBlock)
Bool
miCreateETandAET(count, pts, ET, AET, pETEs, pSLLBlock)
- register int count;
- register DDXPointPtr pts;
+ int count;
+ DDXPointPtr pts;
EdgeTable *ET;
EdgeTableEntry *AET;
- register EdgeTableEntry *pETEs;
+ EdgeTableEntry *pETEs;
ScanLineListBlock *pSLLBlock;
{
- register DDXPointPtr top, bottom;
- register DDXPointPtr PrevPt, CurrPt;
+ DDXPointPtr top, bottom;
+ DDXPointPtr PrevPt, CurrPt;
int iSLLBlock = 0;
int dy;
@@ -262,10 +258,10 @@ miCreateETandAET(count, pts, ET, AET, pETEs, pSLLBlock)
void
miloadAET(AET, ETEs)
- register EdgeTableEntry *AET, *ETEs;
+ EdgeTableEntry *AET, *ETEs;
{
- register EdgeTableEntry *pPrevAET;
- register EdgeTableEntry *tmp;
+ EdgeTableEntry *pPrevAET;
+ EdgeTableEntry *tmp;
pPrevAET = AET;
AET = AET->next;
@@ -310,11 +306,11 @@ miloadAET(AET, ETEs)
*/
void
micomputeWAET(AET)
- register EdgeTableEntry *AET;
+ EdgeTableEntry *AET;
{
- register EdgeTableEntry *pWETE;
- register int inside = 1;
- register int isInside = 0;
+ EdgeTableEntry *pWETE;
+ int inside = 1;
+ int isInside = 0;
AET->nextWETE = (EdgeTableEntry *)NULL;
pWETE = AET;
@@ -349,12 +345,12 @@ micomputeWAET(AET)
int
miInsertionSort(AET)
- register EdgeTableEntry *AET;
+ EdgeTableEntry *AET;
{
- register EdgeTableEntry *pETEchase;
- register EdgeTableEntry *pETEinsert;
- register EdgeTableEntry *pETEchaseBackTMP;
- register int changed = 0;
+ EdgeTableEntry *pETEchase;
+ EdgeTableEntry *pETEinsert;
+ EdgeTableEntry *pETEchaseBackTMP;
+ int changed = 0;
AET = AET->next;
while (AET)
@@ -386,9 +382,9 @@ miInsertionSort(AET)
*/
void
miFreeStorage(pSLLBlock)
- register ScanLineListBlock *pSLLBlock;
+ ScanLineListBlock *pSLLBlock;
{
- register ScanLineListBlock *tmpSLLBlock;
+ ScanLineListBlock *tmpSLLBlock;
while (pSLLBlock)
{
diff --git a/mi/mipushpxl.c b/mi/mipushpxl.c
index 6526aa02b..3695f30da 100644
--- a/mi/mipushpxl.c
+++ b/mi/mipushpxl.c
@@ -85,11 +85,11 @@ miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
int dx, dy, xOrg, yOrg;
{
int h, dxDivPPW, ibEnd;
- MiBits *pwLineStart;
- register MiBits *pw, *pwEnd;
- register MiBits msk;
- register int ib, w;
- register int ipt; /* index into above arrays */
+ MiBits *pwLineStart;
+ MiBits *pw, *pwEnd;
+ MiBits msk;
+ int ib, w;
+ int ipt; /* index into above arrays */
Bool fInBox;
DDXPointRec pt[NPT], ptThisLine;
int width[NPT];
diff --git a/mi/miregion.c b/mi/miregion.c
index 0db46dcf5..e980ad18e 100644
--- a/mi/miregion.c
+++ b/mi/miregion.c
@@ -221,14 +221,14 @@ _X_EXPORT BoxRec miEmptyBox = {0, 0, 0, 0};
_X_EXPORT RegDataRec miEmptyData = {0, 0};
RegDataRec miBrokenData = {0, 0};
-RegionRec miBrokenRegion = { { 0, 0, 0, 0 }, &miBrokenData };
+static RegionRec miBrokenRegion = { { 0, 0, 0, 0 }, &miBrokenData };
_X_EXPORT void
miPrintRegion(rgn)
RegionPtr rgn;
{
int num, size;
- register int i;
+ int i;
BoxPtr rects;
num = REGION_NUM_RECTS(rgn);
@@ -275,7 +275,7 @@ Bool
miValidRegion(reg)
RegionPtr reg;
{
- register int i, numRects;
+ int i, numRects;
if ((reg->extents.x1 > reg->extents.x2) ||
(reg->extents.y1 > reg->extents.y2))
@@ -289,7 +289,7 @@ miValidRegion(reg)
return (!reg->data);
else
{
- register BoxPtr pboxP, pboxN;
+ BoxPtr pboxP, pboxN;
BoxRec box;
pboxP = REGION_RECTS(reg);
@@ -331,7 +331,7 @@ miRegionCreate(rect, size)
BoxPtr rect;
int size;
{
- register RegionPtr pReg;
+ RegionPtr pReg;
pReg = (RegionPtr)xalloc(sizeof(RegionRec));
if (!pReg)
@@ -414,7 +414,7 @@ miRegionBreak (pReg)
_X_EXPORT Bool
miRectAlloc(
- register RegionPtr pRgn,
+ RegionPtr pRgn,
int n)
{
RegDataPtr data;
@@ -455,8 +455,8 @@ miRectAlloc(
_X_EXPORT Bool
miRegionCopy(dst, src)
- register RegionPtr dst;
- register RegionPtr src;
+ RegionPtr dst;
+ RegionPtr src;
{
good(dst);
good(src);
@@ -508,14 +508,14 @@ miRegionCopy(dst, src)
*/
INLINE static int
miCoalesce (
- register RegionPtr pReg, /* Region to coalesce */
+ RegionPtr pReg, /* Region to coalesce */
int prevStart, /* Index of start of previous band */
int curStart) /* Index of start of current band */
{
- register BoxPtr pPrevBox; /* Current box in previous band */
- register BoxPtr pCurBox; /* Current box in current band */
- register int numRects; /* Number rectangles in both bands */
- register int y2; /* Bottom of current band */
+ BoxPtr pPrevBox; /* Current box in previous band */
+ BoxPtr pCurBox; /* Current box in current band */
+ int numRects; /* Number rectangles in both bands */
+ int y2; /* Bottom of current band */
/*
* Figure out how many rectangles are in the band.
*/
@@ -592,14 +592,14 @@ miCoalesce (
INLINE static Bool
miAppendNonO (
- register RegionPtr pReg,
- register BoxPtr r,
- BoxPtr rEnd,
- register int y1,
- register int y2)
+ RegionPtr pReg,
+ BoxPtr r,
+ BoxPtr rEnd,
+ int y1,
+ int y2)
{
- register BoxPtr pNextRect;
- register int newRects;
+ BoxPtr pNextRect;
+ int newRects;
newRects = rEnd - r;
@@ -691,25 +691,25 @@ miRegionOp(
/* in region 2 ? */
Bool *pOverlap)
{
- register BoxPtr r1; /* Pointer into first region */
- register BoxPtr r2; /* Pointer into 2d region */
- BoxPtr r1End; /* End of 1st region */
- BoxPtr r2End; /* End of 2d region */
- short ybot; /* Bottom of intersection */
- short ytop; /* Top of intersection */
- RegDataPtr oldData; /* Old data for newReg */
- int prevBand; /* Index of start of
- * previous band in newReg */
- int curBand; /* Index of start of current
- * band in newReg */
- register BoxPtr r1BandEnd; /* End of current band in r1 */
- register BoxPtr r2BandEnd; /* End of current band in r2 */
- short top; /* Top of non-overlapping band */
- short bot; /* Bottom of non-overlapping band*/
- register int r1y1; /* Temps for r1->y1 and r2->y1 */
- register int r2y1;
- int newSize;
- int numRects;
+ BoxPtr r1; /* Pointer into first region */
+ BoxPtr r2; /* Pointer into 2d region */
+ BoxPtr r1End; /* End of 1st region */
+ BoxPtr r2End; /* End of 2d region */
+ short ybot; /* Bottom of intersection */
+ short ytop; /* Top of intersection */
+ RegDataPtr oldData; /* Old data for newReg */
+ int prevBand; /* Index of start of
+ * previous band in newReg */
+ int curBand; /* Index of start of current
+ * band in newReg */
+ BoxPtr r1BandEnd; /* End of current band in r1 */
+ BoxPtr r2BandEnd; /* End of current band in r2 */
+ short top; /* Top of non-overlapping band */
+ short bot; /* Bottom of non-overlapping band*/
+ int r1y1; /* Temps for r1->y1 and r2->y1 */
+ int r2y1;
+ int newSize;
+ int numRects;
/*
* Break any region computed from a broken region
@@ -913,11 +913,11 @@ miRegionOp(
*
*-----------------------------------------------------------------------
*/
-void
+static void
miSetExtents (pReg)
- register RegionPtr pReg;
+ RegionPtr pReg;
{
- register BoxPtr pBox, pBoxEnd;
+ BoxPtr pBox, pBoxEnd;
if (!pReg->data)
return;
@@ -974,18 +974,18 @@ miSetExtents (pReg)
/*ARGSUSED*/
static Bool
miIntersectO (
- register RegionPtr pReg,
- register BoxPtr r1,
+ RegionPtr pReg,
+ BoxPtr r1,
BoxPtr r1End,
- register BoxPtr r2,
+ BoxPtr r2,
BoxPtr r2End,
short y1,
short y2,
Bool *pOverlap)
{
- register int x1;
- register int x2;
- register BoxPtr pNextRect;
+ int x1;
+ int x2;
+ BoxPtr pNextRect;
pNextRect = REGION_TOP(pReg);
@@ -1022,9 +1022,9 @@ miIntersectO (
_X_EXPORT Bool
miIntersect(newReg, reg1, reg2)
- register RegionPtr newReg; /* destination Region */
- register RegionPtr reg1;
- register RegionPtr reg2; /* source regions */
+ RegionPtr newReg; /* destination Region */
+ RegionPtr reg1;
+ RegionPtr reg2; /* source regions */
{
good(reg1);
good(reg2);
@@ -1117,18 +1117,18 @@ miIntersect(newReg, reg1, reg2)
*/
static Bool
miUnionO (
- register RegionPtr pReg,
- register BoxPtr r1,
- BoxPtr r1End,
- register BoxPtr r2,
- BoxPtr r2End,
- short y1,
- short y2,
- Bool *pOverlap)
+ RegionPtr pReg,
+ BoxPtr r1,
+ BoxPtr r1End,
+ BoxPtr r2,
+ BoxPtr r2End,
+ short y1,
+ short y2,
+ Bool *pOverlap)
{
- register BoxPtr pNextRect;
- register int x1; /* left and right side of current union */
- register int x2;
+ BoxPtr pNextRect;
+ int x1; /* left and right side of current union */
+ int x2;
assert (y1 < y2);
assert(r1 != r1End && r2 != r2End);
@@ -1178,8 +1178,8 @@ miUnionO (
_X_EXPORT Bool
miUnion(newReg, reg1, reg2)
RegionPtr newReg; /* destination Region */
- register RegionPtr reg1;
- register RegionPtr reg2; /* source regions */
+ RegionPtr reg1;
+ RegionPtr reg2; /* source regions */
{
Bool overlap; /* result ignored */
@@ -1276,8 +1276,8 @@ miUnion(newReg, reg1, reg2)
*/
_X_EXPORT Bool
miRegionAppend(dstrgn, rgn)
- register RegionPtr dstrgn;
- register RegionPtr rgn;
+ RegionPtr dstrgn;
+ RegionPtr rgn;
{
int numRects, dnumRects, size;
BoxPtr new, old;
@@ -1307,7 +1307,7 @@ miRegionAppend(dstrgn, rgn)
dstrgn->extents = rgn->extents;
else if (dstrgn->extents.x2 > dstrgn->extents.x1)
{
- register BoxPtr first, last;
+ BoxPtr first, last;
first = old;
last = REGION_BOXPTR(dstrgn) + (dnumRects - 1);
@@ -1371,13 +1371,13 @@ miRegionAppend(dstrgn, rgn)
static void
QuickSortRects(
- register BoxRec rects[],
- register int numRects)
+ BoxRec rects[],
+ int numRects)
{
- register int y1;
- register int x1;
- register int i, j;
- register BoxPtr r;
+ int y1;
+ int x1;
+ int i, j;
+ BoxPtr r;
/* Always called with numRects > 1 */
@@ -1472,17 +1472,17 @@ miRegionValidate(badreg, pOverlap)
int curBand;
} RegionInfo;
- int numRects; /* Original numRects for badreg */
- RegionInfo *ri; /* Array of current regions */
- int numRI; /* Number of entries used in ri */
- int sizeRI; /* Number of entries available in ri */
- int i; /* Index into rects */
- register int j; /* Index into ri */
- register RegionInfo *rit; /* &ri[j] */
- register RegionPtr reg; /* ri[j].reg */
- register BoxPtr box; /* Current box in rects */
- register BoxPtr riBox; /* Last box in ri[j].reg */
- register RegionPtr hreg; /* ri[j_half].reg */
+ int numRects; /* Original numRects for badreg */
+ RegionInfo *ri; /* Array of current regions */
+ int numRI; /* Number of entries used in ri */
+ int sizeRI; /* Number of entries available in ri */
+ int i; /* Index into rects */
+ int j; /* Index into ri */
+ RegionInfo *rit; /* &ri[j] */
+ RegionPtr reg; /* ri[j].reg */
+ BoxPtr box; /* Current box in rects */
+ BoxPtr riBox; /* Last box in ri[j].reg */
+ RegionPtr hreg; /* ri[j_half].reg */
Bool ret = TRUE;
*pOverlap = FALSE;
@@ -1654,13 +1654,13 @@ bail:
_X_EXPORT RegionPtr
miRectsToRegion(nrects, prect, ctype)
int nrects;
- register xRectangle *prect;
+ xRectangle *prect;
int ctype;
{
- register RegionPtr pRgn;
- register RegDataPtr pData;
- register BoxPtr pBox;
- register int i;
+ RegionPtr pRgn;
+ RegDataPtr pData;
+ BoxPtr pBox;
+ int i;
int x1, y1, x2, y2;
pRgn = miRegionCreate(NullBox, 0);
@@ -1754,17 +1754,17 @@ miRectsToRegion(nrects, prect, ctype)
/*ARGSUSED*/
static Bool
miSubtractO (
- register RegionPtr pReg,
- register BoxPtr r1,
- BoxPtr r1End,
- register BoxPtr r2,
- BoxPtr r2End,
- register short y1,
- short y2,
- Bool *pOverlap)
+ RegionPtr pReg,
+ BoxPtr r1,
+ BoxPtr r1End,
+ BoxPtr r2,
+ BoxPtr r2End,
+ short y1,
+ short y2,
+ Bool *pOverlap)
{
- register BoxPtr pNextRect;
- register int x1;
+ BoxPtr pNextRect;
+ int x1;
x1 = r1->x1;
@@ -1878,9 +1878,9 @@ miSubtractO (
*/
_X_EXPORT Bool
miSubtract(regD, regM, regS)
- register RegionPtr regD;
- register RegionPtr regM;
- register RegionPtr regS;
+ RegionPtr regD;
+ RegionPtr regM;
+ RegionPtr regS;
{
Bool overlap; /* result ignored */
@@ -2003,15 +2003,15 @@ miInverse(newReg, reg1, invRect)
_X_EXPORT int
miRectIn(region, prect)
- register RegionPtr region;
- register BoxPtr prect;
+ RegionPtr region;
+ BoxPtr prect;
{
- register int x;
- register int y;
- register BoxPtr pbox;
- register BoxPtr pboxEnd;
- int partIn, partOut;
- int numRects;
+ int x;
+ int y;
+ BoxPtr pbox;
+ BoxPtr pboxEnd;
+ int partIn, partOut;
+ int numRects;
good(region);
numRects = REGION_NUM_RECTS(region);
@@ -2099,13 +2099,13 @@ miRectIn(region, prect)
_X_EXPORT void
miTranslateRegion(pReg, x, y)
- register RegionPtr pReg;
- register int x;
- register int y;
+ RegionPtr pReg;
+ int x;
+ int y;
{
int x1, x2, y1, y2;
- register int nbox;
- register BoxPtr pbox;
+ int nbox;
+ BoxPtr pbox;
good(pReg);
pReg->extents.x1 = x1 = pReg->extents.x1 + x;
@@ -2144,7 +2144,7 @@ miTranslateRegion(pReg, x, y)
pReg->extents.y2 = MAXSHORT;
if (pReg->data && (nbox = pReg->data->numRects))
{
- register BoxPtr pboxout;
+ BoxPtr pboxout;
for (pboxout = pbox = REGION_BOXPTR(pReg); nbox--; pbox++)
{
@@ -2182,35 +2182,6 @@ miTranslateRegion(pReg, x, y)
}
}
-Bool
-miRegionDataCopy(
- register RegionPtr dst,
- register RegionPtr src)
-{
- good(dst);
- good(src);
- if (dst->data)
- return TRUE;
- if (dst == src)
- return TRUE;
- if (!src->data || !src->data->size)
- {
- xfreeData(dst);
- dst->data = (RegDataPtr)NULL;
- return TRUE;
- }
- if (!dst->data || (dst->data->size < src->data->numRects))
- {
- xfreeData(dst);
- dst->data = xallocData(src->data->numRects);
- if (!dst->data)
- return miRegionBreak (dst);
- }
- dst->data->size = src->data->size;
- dst->data->numRects = src->data->numRects;
- return TRUE;
-}
-
_X_EXPORT void
miRegionReset(pReg, pBox)
RegionPtr pReg;
@@ -2226,11 +2197,11 @@ miRegionReset(pReg, pBox)
_X_EXPORT Bool
miPointInRegion(pReg, x, y, box)
- register RegionPtr pReg;
- register int x, y;
+ RegionPtr pReg;
+ int x, y;
BoxPtr box; /* "return" value */
{
- register BoxPtr pbox, pboxEnd;
+ BoxPtr pbox, pboxEnd;
int numRects;
good(pReg);
@@ -2294,8 +2265,8 @@ miRegionExtents(pReg)
#define ExchangeSpans(a, b) \
{ \
- DDXPointRec tpt; \
- register int tw; \
+ DDXPointRec tpt; \
+ int tw; \
\
tpt = spans[a]; spans[a] = spans[b]; spans[b] = tpt; \
tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \
@@ -2307,13 +2278,13 @@ miRegionExtents(pReg)
*/
static void QuickSortSpans(
- register DDXPointRec spans[],
- register int widths[],
- register int numSpans)
+ DDXPointRec spans[],
+ int widths[],
+ int numSpans)
{
- register int y;
- register int i, j, m;
- register DDXPointPtr r;
+ int y;
+ int i, j, m;
+ DDXPointPtr r;
/* Always called with numSpans > 1 */
/* Sorts only by y, doesn't bother to sort by x */
@@ -2323,7 +2294,7 @@ static void QuickSortSpans(
if (numSpans < 9)
{
/* Do insertion sort */
- register int yprev;
+ int yprev;
yprev = spans[0].y;
i = 1;
@@ -2412,18 +2383,18 @@ static void QuickSortSpans(
_X_EXPORT int
miClipSpans(
- RegionPtr prgnDst,
- register DDXPointPtr ppt,
- register int *pwidth,
- int nspans,
- register DDXPointPtr pptNew,
- int *pwidthNew,
- int fSorted)
+ RegionPtr prgnDst,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ DDXPointPtr pptNew,
+ int *pwidthNew,
+ int fSorted)
{
- register DDXPointPtr pptLast;
- int *pwidthNewStart; /* the vengeance of Xerox! */
- register int y, x1, x2;
- register int numRects;
+ DDXPointPtr pptLast;
+ int *pwidthNewStart; /* the vengeance of Xerox! */
+ int y, x1, x2;
+ int numRects;
good(prgnDst);
pptLast = ppt + nspans;
@@ -2435,7 +2406,7 @@ miClipSpans(
/* It doesn't pay much to make use of fSorted in this case,
so we lump everything together. */
- register int clipx1, clipx2, clipy1, clipy2;
+ int clipx1, clipx2, clipy1, clipy2;
clipx1 = prgnDst->extents.x1;
clipy1 = prgnDst->extents.y1;
@@ -2467,10 +2438,10 @@ miClipSpans(
else if ((numRects = prgnDst->data->numRects))
{
/* Have to clip against many boxes */
- BoxPtr pboxBandStart, pboxBandEnd;
- register BoxPtr pbox;
- register BoxPtr pboxLast;
- register int clipy1, clipy2;
+ BoxPtr pboxBandStart, pboxBandEnd;
+ BoxPtr pbox;
+ BoxPtr pboxLast;
+ int clipy1, clipy2;
/* In this case, taking advantage of sorted spans gains more than
the sorting costs. */
@@ -2493,7 +2464,7 @@ miClipSpans(
x2 = x1 + *pwidth;
do
{ /* For each box in band */
- register int newx1, newx2;
+ int newx1, newx2;
newx1 = x1;
newx2 = x2;
@@ -2531,10 +2502,10 @@ _X_EXPORT int
miFindMaxBand(prgn)
RegionPtr prgn;
{
- register int nbox;
- register BoxPtr pbox;
- register int nThisBand;
- register int nMaxBand = 0;
+ int nbox;
+ BoxPtr pbox;
+ int nThisBand;
+ int nMaxBand = 0;
short yThisBand;
good(prgn);
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index ac1b82336..cc40cbede 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -126,12 +126,8 @@ miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind,
return TRUE;
}
-
-/*ARGSUSED*/
-Bool
-miCloseScreen (iScreen, pScreen)
- int iScreen;
- ScreenPtr pScreen;
+static Bool
+miCloseScreen (int iScreen, ScreenPtr pScreen)
{
return ((*pScreen->DestroyPixmap)((PixmapPtr)pScreen->devPrivate));
}
@@ -185,7 +181,7 @@ miCreateScreenResources(pScreen)
Bool
miScreenDevPrivateInit(pScreen, width, pbits)
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
int width;
pointer pbits;
{
@@ -207,7 +203,7 @@ miScreenDevPrivateInit(pScreen, width, pbits)
_X_EXPORT Bool
miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
rootDepth, numDepths, depths, rootVisual, numVisuals, visuals)
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
pointer pbits; /* pointer to screen bits */
int xsize, ysize; /* in pixels */
int dpix, dpiy; /* dots per inch */
@@ -312,7 +308,7 @@ miAllocateGCPrivateIndex()
}
_X_EXPORT int miZeroLineScreenIndex;
-unsigned int miZeroLineGeneration = 0;
+static unsigned int miZeroLineGeneration = 0;
_X_EXPORT void
miSetZeroLineBias(pScreen, bias)
diff --git a/mi/mispans.c b/mi/mispans.c
index 4c8b6d698..530d9dff2 100644
--- a/mi/mispans.c
+++ b/mi/mispans.c
@@ -78,9 +78,7 @@ void miInitSpanGroup(spanGroup)
#define YMIN(spans) (spans->points[0].y)
#define YMAX(spans) (spans->points[spans->count-1].y)
-void miSubtractSpans (spanGroup, sub)
- SpanGroup *spanGroup;
- Spans *sub;
+static void miSubtractSpans (SpanGroup *spanGroup, Spans *sub)
{
int i, subCount, spansCount;
int ymin, ymax, xmin, xmax;
@@ -188,8 +186,8 @@ void miAppendSpans(spanGroup, otherGroup, spans)
SpanGroup *otherGroup;
Spans *spans;
{
- register int ymin, ymax;
- register int spansCount;
+ int ymin, ymax;
+ int spansCount;
spansCount = spans->count;
if (spansCount > 0) {
@@ -226,21 +224,21 @@ void miFreeSpanGroup(spanGroup)
}
static void QuickSortSpansX(
- register DDXPointRec points[],
- register int widths[],
- register int numSpans )
+ DDXPointRec points[],
+ int widths[],
+ int numSpans )
{
- register int x;
- register int i, j, m;
- register DDXPointPtr r;
+ int x;
+ int i, j, m;
+ DDXPointPtr r;
/* Always called with numSpans > 1 */
/* Sorts only by x, as all y should be the same */
#define ExchangeSpans(a, b) \
{ \
- DDXPointRec tpt; \
- register int tw; \
+ DDXPointRec tpt; \
+ int tw; \
\
tpt = points[a]; points[a] = points[b]; points[b] = tpt; \
tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \
@@ -249,7 +247,7 @@ static void QuickSortSpansX(
do {
if (numSpans < 9) {
/* Do insertion sort */
- register int xprev;
+ int xprev;
xprev = points[0].x;
i = 1;
@@ -313,14 +311,14 @@ static void QuickSortSpansX(
static int UniquifySpansX(
- Spans *spans,
- register DDXPointRec *newPoints,
- register int *newWidths )
+ Spans *spans,
+ DDXPointRec *newPoints,
+ int *newWidths )
{
- register int newx1, newx2, oldpt, i, y;
- register DDXPointRec *oldPoints;
- register int *oldWidths;
- int *startNewWidths;
+ int newx1, newx2, oldpt, i, y;
+ DDXPointRec *oldPoints;
+ int *oldWidths;
+ int *startNewWidths;
/* Always called with numSpans > 1 */
/* Uniquify the spans, and stash them into newPoints and newWidths. Return the
@@ -364,9 +362,8 @@ static int UniquifySpansX(
return (newWidths - startNewWidths) + 1;
} /* UniquifySpansX */
-void
-miDisposeSpanGroup (spanGroup)
- SpanGroup *spanGroup;
+static void
+miDisposeSpanGroup (SpanGroup *spanGroup)
{
int i;
Spans *spans;
@@ -384,16 +381,16 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
GCPtr pGC;
SpanGroup *spanGroup;
{
- register int i;
- register Spans *spans;
- register Spans *yspans;
- register int *ysizes;
- register int ymin, ylength;
+ int i;
+ Spans *spans;
+ Spans *yspans;
+ int *ysizes;
+ int ymin, ylength;
/* Outgoing spans for one big call to FillSpans */
- register DDXPointPtr points;
- register int *widths;
- register int count;
+ DDXPointPtr points;
+ int *widths;
+ int count;
if (spanGroup->count == 0) return;
@@ -538,24 +535,3 @@ void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
spanGroup->ymin = MAXSHORT;
spanGroup->ymax = MINSHORT;
}
-
-
-void miFillSpanGroup(pDraw, pGC, spanGroup)
- DrawablePtr pDraw;
- GCPtr pGC;
- SpanGroup *spanGroup;
-{
- register int i;
- register Spans *spans;
-
- for (i = 0, spans = spanGroup->group; i != spanGroup->count; i++, spans++) {
- (*pGC->ops->FillSpans)
- (pDraw, pGC, spans->count, spans->points, spans->widths, TRUE);
- xfree(spans->points);
- xfree(spans->widths);
- }
-
- spanGroup->count = 0;
- spanGroup->ymin = MAXSHORT;
- spanGroup->ymax = MINSHORT;
-} /* FillSpanGroup */
diff --git a/mi/mispans.h b/mi/mispans.h
index 5b141afe2..258b29279 100644
--- a/mi/mispans.h
+++ b/mi/mispans.h
@@ -71,13 +71,6 @@ extern void miAppendSpans(
Spans * /*spans*/
);
-/* Paint a span group, possibly with some overlap */
-extern void miFillSpanGroup(
- DrawablePtr /*pDraw*/,
- GCPtr /*pGC*/,
- SpanGroup * /*spanGroup*/
-);
-
/* Paint a span group, insuring that each pixel is painted at most once */
extern void miFillUniqueSpanGroup(
DrawablePtr /*pDraw*/,
@@ -90,15 +83,6 @@ extern void miFreeSpanGroup(
SpanGroup * /*spanGroup*/
);
-extern void miSubtractSpans(
- SpanGroup * /*spanGroup*/,
- Spans * /*sub*/
-);
-
-extern void miDisposeSpanGroup(
- SpanGroup * /*spanGroup*/
-);
-
extern int miClipSpans(
RegionPtr /*prgnDst*/,
DDXPointPtr /*ppt*/,
diff --git a/mi/misprite.c b/mi/misprite.c
index 286c7552a..c0560a4bb 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -320,11 +320,11 @@ miSpriteGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart)
if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp)
{
- register DDXPointPtr pts;
- register int *widths;
- register int nPts;
- register int xorg,
- yorg;
+ DDXPointPtr pts;
+ int *widths;
+ int nPts;
+ int xorg,
+ yorg;
xorg = pDrawable->x;
yorg = pDrawable->y;
diff --git a/mi/mivaltree.c b/mi/mivaltree.c
index 0e5ed61e7..92ea0a8a9 100644
--- a/mi/mivaltree.c
+++ b/mi/mivaltree.c
@@ -112,13 +112,13 @@ miShapedWindowIn (pScreen, universe, bounding, rect, x, y)
ScreenPtr pScreen;
RegionPtr universe, bounding;
BoxPtr rect;
- register int x, y;
+ int x, y;
{
- BoxRec box;
- register BoxPtr boundBox;
- int nbox;
- Bool someIn, someOut;
- register int t, x1, y1, x2, y2;
+ BoxRec box;
+ BoxPtr boundBox;
+ int nbox;
+ Bool someIn, someOut;
+ int t, x1, y1, x2, y2;
nbox = REGION_NUM_RECTS (bounding);
boundBox = REGION_RECTS (bounding);
@@ -202,16 +202,16 @@ miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip,
*/
static void
miComputeClips (
- register WindowPtr pParent,
- register ScreenPtr pScreen,
- register RegionPtr universe,
+ WindowPtr pParent,
+ ScreenPtr pScreen,
+ RegionPtr universe,
VTKind kind,
RegionPtr exposed ) /* for intermediate calculations */
{
int dx,
dy;
RegionRec childUniverse;
- register WindowPtr pChild;
+ WindowPtr pChild;
int oldVis, newVis;
BoxRec borderSize;
RegionRec childUnion;
@@ -535,10 +535,10 @@ miComputeClips (
static void
miTreeObscured(
- register WindowPtr pParent )
+ WindowPtr pParent )
{
- register WindowPtr pChild;
- register int oldVis;
+ WindowPtr pChild;
+ int oldVis;
pChild = pParent;
while (1)
@@ -609,8 +609,8 @@ miValidateTree (pParent, pChild, kind)
RegionRec childUnion; /* the space covered by borderSize for
* all marked children */
RegionRec exposed; /* For intermediate calculations */
- register ScreenPtr pScreen;
- register WindowPtr pWin;
+ ScreenPtr pScreen;
+ WindowPtr pWin;
Bool overlap;
int viewvals;
Bool forward;
diff --git a/mi/miwideline.c b/mi/miwideline.c
index d57c2eaa7..08e4aa33e 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -56,10 +56,10 @@ from The Open Group.
ICEILTEMPDECL
#endif
-static void miLineArc(DrawablePtr pDraw, register GCPtr pGC,
+static void miLineArc(DrawablePtr pDraw, GCPtr pGC,
unsigned long pixel, SpanDataPtr spanData,
- register LineFacePtr leftFace,
- register LineFacePtr rightFace,
+ LineFacePtr leftFace,
+ LineFacePtr rightFace,
double xorg, double yorg, Bool isInt);
@@ -67,24 +67,18 @@ static void miLineArc(DrawablePtr pDraw, register GCPtr pGC,
* spans-based polygon filler
*/
-void
-miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
- left, right, left_count, right_count)
- DrawablePtr pDrawable;
- GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- int y; /* start y coordinate */
- int overall_height; /* height of entire segment */
- PolyEdgePtr left, right;
- int left_count, right_count;
+static void
+miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
+ SpanDataPtr spanData, int y, int overall_height,
+ PolyEdgePtr left, PolyEdgePtr right,
+ int left_count, int right_count)
{
- register int left_x = 0, left_e = 0;
+ int left_x = 0, left_e = 0;
int left_stepx = 0;
int left_signdx = 0;
int left_dy = 0, left_dx = 0;
- register int right_x = 0, right_e = 0;
+ int right_x = 0, right_e = 0;
int right_stepx = 0;
int right_signdx = 0;
int right_dy = 0, right_dx = 0;
@@ -92,10 +86,10 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
int height = 0;
int left_height = 0, right_height = 0;
- register DDXPointPtr ppt;
+ DDXPointPtr ppt;
DDXPointPtr pptInit = NULL;
- register int *pwidth;
- int *pwidthInit = NULL;
+ int *pwidth;
+ int *pwidthInit = NULL;
XID oldPixel;
int xorg;
Spans spanRec;
@@ -203,8 +197,8 @@ miFillRectPolyHelper (
int w,
int h)
{
- register DDXPointPtr ppt;
- register int *pwidth;
+ DDXPointPtr ppt;
+ int *pwidth;
XID oldPixel;
Spans spanRec;
xRectangle rect;
@@ -265,10 +259,10 @@ _X_EXPORT /* static */ int
miPolyBuildEdge (x0, y0, k, dx, dy, xi, yi, left, edge)
double x0, y0;
double k; /* x0 * dy - y0 * dx */
- register int dx, dy;
+ int dx, dy;
int xi, yi;
int left;
- register PolyEdgePtr edge;
+ PolyEdgePtr edge;
{
int x, y, e;
int xady;
@@ -322,23 +316,23 @@ miPolyBuildEdge (x0, y0, k, dx, dy, xi, yi, left, edge)
_X_EXPORT /* static */ int
miPolyBuildPoly (vertices, slopes, count, xi, yi, left, right, pnleft, pnright, h)
- register PolyVertexPtr vertices;
- register PolySlopePtr slopes;
- int count;
- int xi, yi;
- PolyEdgePtr left, right;
- int *pnleft, *pnright;
- int *h;
+ PolyVertexPtr vertices;
+ PolySlopePtr slopes;
+ int count;
+ int xi, yi;
+ PolyEdgePtr left, right;
+ int *pnleft, *pnright;
+ int *h;
{
- int top, bottom;
- double miny, maxy;
- register int i;
- int j;
- int clockwise;
- int slopeoff;
- register int s;
- register int nright, nleft;
- int y, lasty = 0, bottomy, topy = 0;
+ int top, bottom;
+ double miny, maxy;
+ int i;
+ int j;
+ int clockwise;
+ int slopeoff;
+ int s;
+ int nright, nleft;
+ int y, lasty = 0, bottomy, topy = 0;
/* find the top of the polygon */
maxy = miny = vertices[0].y;
@@ -467,12 +461,12 @@ miLineOnePoint (
static void
miLineJoin (
- DrawablePtr pDrawable,
- GCPtr pGC,
- unsigned long pixel,
- SpanDataPtr spanData,
- register LineFacePtr pLeft,
- register LineFacePtr pRight)
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ LineFacePtr pLeft,
+ LineFacePtr pRight)
{
double mx = 0, my = 0;
double denom = 0.0;
@@ -624,9 +618,9 @@ miLineArcI (
DDXPointPtr points,
int *widths)
{
- register DDXPointPtr tpts, bpts;
- register int *twids, *bwids;
- register int x, y, e, ex, slw;
+ DDXPointPtr tpts, bpts;
+ int *twids, *bwids;
+ int x, y, e, ex, slw;
tpts = points;
twids = widths;
@@ -717,8 +711,8 @@ miLineArcD (
int edgey2,
Bool edgeleft2)
{
- register DDXPointPtr pts;
- register int *wids;
+ DDXPointPtr pts;
+ int *wids;
double radius, x0, y0, el, er, yk, xlk, xrk, k;
int xbase, ybase, y, boty, xl, xr, xcl, xcr;
int ymin, ymax;
@@ -873,11 +867,8 @@ miLineArcD (
return (pts - points);
}
-int
-miRoundJoinFace (face, edge, leftEdge)
- register LineFacePtr face;
- register PolyEdgePtr edge;
- Bool *leftEdge;
+static int
+miRoundJoinFace (LineFacePtr face, PolyEdgePtr edge, Bool *leftEdge)
{
int y;
int dx, dy;
@@ -924,7 +915,7 @@ miRoundJoinFace (face, edge, leftEdge)
_X_EXPORT void
miRoundJoinClip (pLeft, pRight, edge1, edge2, y1, y2, left1, left2)
- register LineFacePtr pLeft, pRight;
+ LineFacePtr pLeft, pRight;
PolyEdgePtr edge1, edge2;
int *y1, *y2;
Bool *left1, *left2;
@@ -949,14 +940,14 @@ miRoundJoinClip (pLeft, pRight, edge1, edge2, y1, y2, left1, left2)
_X_EXPORT int
miRoundCapClip (face, isInt, edge, leftEdge)
- register LineFacePtr face;
+ LineFacePtr face;
Bool isInt;
- register PolyEdgePtr edge;
+ PolyEdgePtr edge;
Bool *leftEdge;
{
- int y;
- register int dx, dy;
- double xa, ya, k;
+ int y;
+ int dx, dy;
+ double xa, ya, k;
Bool left;
dx = -face->dy;
@@ -999,15 +990,15 @@ miRoundCapClip (face, isInt, edge, leftEdge)
static void
miLineArc (
- DrawablePtr pDraw,
- register GCPtr pGC,
- unsigned long pixel,
- SpanDataPtr spanData,
- register LineFacePtr leftFace,
- register LineFacePtr rightFace,
- double xorg,
- double yorg,
- Bool isInt)
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ LineFacePtr leftFace,
+ LineFacePtr rightFace,
+ double xorg,
+ double yorg,
+ Bool isInt)
{
DDXPointPtr points;
int *widths;
@@ -1114,16 +1105,10 @@ miLineArc (
}
}
-void
-miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg, isInt)
- DrawablePtr pDrawable;
- register GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- register LineFacePtr face;
- Bool isLeft;
- double xorg, yorg;
- Bool isInt;
+static void
+miLineProjectingCap (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
+ SpanDataPtr spanData, LineFacePtr face, Bool isLeft,
+ double xorg, double yorg, Bool isInt)
{
int xorgi = 0, yorgi = 0;
int lw;
@@ -1286,18 +1271,18 @@ miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg,
static void
miWideSegment (
- DrawablePtr pDrawable,
- GCPtr pGC,
- unsigned long pixel,
- SpanDataPtr spanData,
- register int x1,
- register int y1,
- register int x2,
- register int y2,
- Bool projectLeft,
- Bool projectRight,
- register LineFacePtr leftFace,
- register LineFacePtr rightFace)
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ Bool projectLeft,
+ Bool projectRight,
+ LineFacePtr leftFace,
+ LineFacePtr rightFace)
{
double l, L, r;
double xa, ya;
@@ -1506,11 +1491,8 @@ miWideSegment (
}
}
-SpanDataPtr
-miSetupSpanData (pGC, spanData, npt)
- register GCPtr pGC;
- SpanDataPtr spanData;
- int npt;
+static SpanDataPtr
+miSetupSpanData (GCPtr pGC, SpanDataPtr spanData, int npt)
{
if ((npt < 3 && pGC->capStyle != CapRound) || miSpansEasyRop(pGC->alu))
return (SpanDataPtr) NULL;
@@ -1520,11 +1502,8 @@ miSetupSpanData (pGC, spanData, npt)
return spanData;
}
-void
-miCleanupSpanData (pDrawable, pGC, spanData)
- DrawablePtr pDrawable;
- GCPtr pGC;
- SpanDataPtr spanData;
+static void
+miCleanupSpanData (DrawablePtr pDrawable, GCPtr pGC, SpanDataPtr spanData)
{
if (pGC->lineStyle == LineDoubleDash)
{
@@ -1552,21 +1531,21 @@ miCleanupSpanData (pDrawable, pGC, spanData)
_X_EXPORT void
miWideLine (pDrawable, pGC, mode, npt, pPts)
DrawablePtr pDrawable;
- register GCPtr pGC;
+ GCPtr pGC;
int mode;
- register int npt;
- register DDXPointPtr pPts;
+ int npt;
+ DDXPointPtr pPts;
{
- int x1, y1, x2, y2;
- SpanDataRec spanDataRec;
- SpanDataPtr spanData;
- unsigned long pixel;
- Bool projectLeft, projectRight;
- LineFaceRec leftFace, rightFace, prevRightFace;
- LineFaceRec firstFace;
- register int first;
- Bool somethingDrawn = FALSE;
- Bool selfJoin;
+ int x1, y1, x2, y2;
+ SpanDataRec spanDataRec;
+ SpanDataPtr spanData;
+ long pixel;
+ Bool projectLeft, projectRight;
+ LineFaceRec leftFace, rightFace, prevRightFace;
+ LineFaceRec firstFace;
+ int first;
+ Bool somethingDrawn = FALSE;
+ Bool selfJoin;
spanData = miSetupSpanData (pGC, &spanDataRec, npt);
pixel = pGC->fgPixel;
@@ -1693,7 +1672,7 @@ miWideLine (pDrawable, pGC, mode, npt, pPts)
static void
miWideDashSegment (
DrawablePtr pDrawable,
- register GCPtr pGC,
+ GCPtr pGC,
SpanDataPtr spanData,
int *pDashOffset,
int *pDashIndex,
@@ -2050,25 +2029,25 @@ miWideDashSegment (
_X_EXPORT void
miWideDash (pDrawable, pGC, mode, npt, pPts)
DrawablePtr pDrawable;
- register GCPtr pGC;
+ GCPtr pGC;
int mode;
- register int npt;
- register DDXPointPtr pPts;
+ int npt;
+ DDXPointPtr pPts;
{
- int x1, y1, x2, y2;
- unsigned long pixel;
- Bool projectLeft, projectRight;
- LineFaceRec leftFace, rightFace, prevRightFace;
- LineFaceRec firstFace;
- int first;
- int dashIndex, dashOffset;
- register int prevDashIndex;
- SpanDataRec spanDataRec;
- SpanDataPtr spanData;
- Bool somethingDrawn = FALSE;
- Bool selfJoin;
- Bool endIsFg = FALSE, startIsFg = FALSE;
- Bool firstIsFg = FALSE, prevIsFg = FALSE;
+ int x1, y1, x2, y2;
+ unsigned long pixel;
+ Bool projectLeft, projectRight;
+ LineFaceRec leftFace, rightFace, prevRightFace;
+ LineFaceRec firstFace;
+ int first;
+ int dashIndex, dashOffset;
+ int prevDashIndex;
+ SpanDataRec spanDataRec;
+ SpanDataPtr spanData;
+ Bool somethingDrawn = FALSE;
+ Bool selfJoin;
+ Bool endIsFg = FALSE, startIsFg = FALSE;
+ Bool firstIsFg = FALSE, prevIsFg = FALSE;
#if 0
/* XXX backward compatibility */
diff --git a/mi/miwideline.h b/mi/miwideline.h
index 8cfa63008..9d1aa03cb 100644
--- a/mi/miwideline.h
+++ b/mi/miwideline.h
@@ -153,24 +153,6 @@ typedef struct _LineFace {
} \
}
-extern void miFillPolyHelper(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- unsigned long /*pixel*/,
- SpanDataPtr /*spanData*/,
- int /*y*/,
- int /*overall_height*/,
- PolyEdgePtr /*left*/,
- PolyEdgePtr /*right*/,
- int /*left_count*/,
- int /*right_count*/
-);
-extern int miRoundJoinFace(
- LineFacePtr /*face*/,
- PolyEdgePtr /*edge*/,
- Bool * /*leftEdge*/
-);
-
extern void miRoundJoinClip(
LineFacePtr /*pLeft*/,
LineFacePtr /*pRight*/,
@@ -189,30 +171,6 @@ extern int miRoundCapClip(
Bool * /*leftEdge*/
);
-extern void miLineProjectingCap(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- unsigned long /*pixel*/,
- SpanDataPtr /*spanData*/,
- LineFacePtr /*face*/,
- Bool /*isLeft*/,
- double /*xorg*/,
- double /*yorg*/,
- Bool /*isInt*/
-);
-
-extern SpanDataPtr miSetupSpanData(
- GCPtr /*pGC*/,
- SpanDataPtr /*spanData*/,
- int /*npt*/
-);
-
-extern void miCleanupSpanData(
- DrawablePtr /*pDrawable*/,
- GCPtr /*pGC*/,
- SpanDataPtr /*spanData*/
-);
-
extern int miPolyBuildEdge(double x0, double y0, double k, int dx, int dy,
int xi, int yi, int left, PolyEdgePtr edge);
extern int miPolyBuildPoly(PolyVertexPtr vertices, PolySlopePtr slopes,
diff --git a/mi/miwindow.c b/mi/miwindow.c
index cd6bb8df3..6ca2e1e38 100644
--- a/mi/miwindow.c
+++ b/mi/miwindow.c
@@ -160,12 +160,12 @@ miClearToBackground(pWin, x, y, w, h, generateExposures)
*/
static Bool
miCheckSubSaveUnder(
- register WindowPtr pParent, /* Parent to check */
+ WindowPtr pParent, /* Parent to check */
WindowPtr pFirst, /* first reconfigured window */
RegionPtr pRegion) /* Initial area obscured by saveUnder */
{
- register WindowPtr pChild; /* Current child */
- register ScreenPtr pScreen; /* Screen to use */
+ WindowPtr pChild; /* Current child */
+ ScreenPtr pScreen; /* Screen to use */
RegionRec SubRegion; /* Area of children obscured */
Bool res = FALSE; /* result */
Bool subInited=FALSE;/* SubRegion initialized */
@@ -268,12 +268,12 @@ miCheckSubSaveUnder(
*/
Bool
miChangeSaveUnder(pWin, first)
- register WindowPtr pWin;
+ WindowPtr pWin;
WindowPtr first; /* First window to check.
* Used when pWin was restacked */
{
RegionRec rgn; /* Area obscured by saveUnder windows */
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
Bool res;
if (!deltaSaveUndersViewable && !numSaveUndersViewable)
@@ -309,7 +309,7 @@ miPostChangeSaveUnder(pWin, pFirst)
WindowPtr pWin;
WindowPtr pFirst;
{
- register WindowPtr pParent, pChild;
+ WindowPtr pParent, pChild;
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
if (!(pParent = pWin->parent))
@@ -342,9 +342,9 @@ miPostChangeSaveUnder(pWin, pFirst)
void
miMarkWindow(pWin)
- register WindowPtr pWin;
+ WindowPtr pWin;
{
- register ValidatePtr val;
+ ValidatePtr val;
if (pWin->valdata)
return;
@@ -362,8 +362,8 @@ miMarkOverlappedWindows(pWin, pFirst, ppLayerWin)
WindowPtr pFirst;
WindowPtr *ppLayerWin;
{
- register BoxPtr box;
- register WindowPtr pChild, pLast;
+ BoxPtr box;
+ WindowPtr pChild, pLast;
Bool anyMarked = FALSE;
MarkWindowProcPtr MarkWindow = pWin->drawable.pScreen->MarkWindow;
ScreenPtr pScreen;
@@ -449,8 +449,8 @@ _X_EXPORT void
miHandleValidateExposures(pWin)
WindowPtr pWin;
{
- register WindowPtr pChild;
- register ValidatePtr val;
+ WindowPtr pChild;
+ ValidatePtr val;
ScreenPtr pScreen;
WindowExposuresProcPtr WindowExposures;
@@ -487,7 +487,7 @@ miHandleValidateExposures(pWin)
void
miMoveWindow(pWin, x, y, pNextSib, kind)
- register WindowPtr pWin;
+ WindowPtr pWin;
int x,y;
WindowPtr pNextSib;
VTKind kind;
@@ -498,7 +498,7 @@ miMoveWindow(pWin, x, y, pNextSib, kind)
RegionPtr oldRegion = NULL;
DDXPointRec oldpt;
Bool anyMarked = FALSE;
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
WindowPtr windowToValidate;
#ifdef DO_SAVE_UNDERS
Bool dosave = FALSE;
@@ -576,10 +576,10 @@ miMoveWindow(pWin, x, y, pNextSib, kind)
static int
miRecomputeExposures (
- register WindowPtr pWin,
+ WindowPtr pWin,
pointer value) /* must conform to VisitWindowProcPtr */
{
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
RegionPtr pValid = (RegionPtr)value;
if (pWin->valdata)
@@ -604,7 +604,7 @@ miRecomputeExposures (
void
miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
- register WindowPtr pWin;
+ WindowPtr pWin;
int x,y;
unsigned int w, h;
WindowPtr pSib;
@@ -620,11 +620,11 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
DDXPointRec oldpt;
RegionPtr oldRegion = NULL;
Bool anyMarked = FALSE;
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
WindowPtr pFirstChange;
- register WindowPtr pChild;
+ WindowPtr pChild;
RegionPtr gravitate[StaticGravity + 1];
- register unsigned g;
+ unsigned g;
int nx, ny; /* destination x,y */
int newx, newy; /* new inner window position */
RegionPtr pRegion = NULL;
@@ -981,10 +981,10 @@ miGetLayerWindow(pWin)
_X_EXPORT void
miSetShape(pWin)
- register WindowPtr pWin;
+ WindowPtr pWin;
{
Bool WasViewable = (Bool)(pWin->viewable);
- register ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
Bool anyMarked = FALSE;
RegionPtr pOldClip = NULL, bsExposed;
#ifdef DO_SAVE_UNDERS
@@ -1081,12 +1081,12 @@ miSetShape(pWin)
_X_EXPORT void
miChangeBorderWidth(pWin, width)
- register WindowPtr pWin;
+ WindowPtr pWin;
unsigned int width;
{
int oldwidth;
Bool anyMarked = FALSE;
- register ScreenPtr pScreen;
+ ScreenPtr pScreen;
Bool WasViewable = (Bool)(pWin->viewable);
Bool HadBorder;
#ifdef DO_SAVE_UNDERS
diff --git a/mi/mizerarc.c b/mi/mizerarc.c
index 33e1acc19..9d4715a30 100644
--- a/mi/mizerarc.c
+++ b/mi/mizerarc.c
@@ -97,8 +97,8 @@ static miZeroArcPtRec oob = {65536, 65536, 0};
_X_EXPORT Bool
miZeroArcSetup(arc, info, ok360)
- register xArc *arc;
- register miZeroArcRec *info;
+ xArc *arc;
+ miZeroArcRec *info;
Bool ok360;
{
int l;
@@ -401,14 +401,12 @@ miZeroArcSetup(arc, info, ok360)
#define DoPix(idx,xval,yval) if (mask & (1 << idx)) Pixelate(xval, yval);
-DDXPointPtr
-miZeroArcPts(arc, pts)
- xArc *arc;
- register DDXPointPtr pts;
+static DDXPointPtr
+miZeroArcPts(xArc *arc, DDXPointPtr pts)
{
miZeroArcRec info;
- register int x, y, a, b, d, mask;
- register int k1, k3, dx, dy;
+ int x, y, a, b, d, mask;
+ int k1, k3, dx, dy;
Bool do360;
do360 = miZeroArcSetup(arc, &info, TRUE);
@@ -509,14 +507,14 @@ miZeroArcDashPts(
GCPtr pGC,
xArc *arc,
DashInfo *dinfo,
- register DDXPointPtr points,
+ DDXPointPtr points,
int maxPts,
- register DDXPointPtr *evenPts,
- register DDXPointPtr *oddPts )
+ DDXPointPtr *evenPts,
+ DDXPointPtr *oddPts )
{
miZeroArcRec info;
- register int x, y, a, b, d, mask;
- register int k1, k3, dx, dy;
+ int x, y, a, b, d, mask;
+ int k1, k3, dx, dy;
int dashRemaining;
DDXPointPtr arcPts[4];
DDXPointPtr startPts[5], endPts[5];
@@ -715,11 +713,11 @@ miZeroPolyArc(pDraw, pGC, narcs, parcs)
xArc *parcs;
{
int maxPts = 0;
- register int n, maxw = 0;
- register xArc *arc;
- register int i;
+ int n, maxw = 0;
+ xArc *arc;
+ int i;
DDXPointPtr points, pts, oddPts;
- register DDXPointPtr pt;
+ DDXPointPtr pt;
int numPts;
Bool dospans;
int *widths = NULL;
diff --git a/mi/mizerarc.h b/mi/mizerarc.h
index 8119d885e..28ebbe030 100644
--- a/mi/mizerarc.h
+++ b/mi/mizerarc.h
@@ -124,9 +124,3 @@ extern Bool miZeroArcSetup(
miZeroArcRec * /*info*/,
Bool /*ok360*/
);
-
-extern DDXPointPtr miZeroArcPts(
- xArc * /*arc*/,
- DDXPointPtr /*pts*/
-);
-
diff --git a/miext/Makefile.am b/miext/Makefile.am
index 4fa584b35..f138963b4 100644
--- a/miext/Makefile.am
+++ b/miext/Makefile.am
@@ -2,4 +2,7 @@ SUBDIRS = damage shadow
if COMPOSITE
SUBDIRS += cw
endif
+if XQUARTZ
+SUBDIRS += rootless
+endif
DIST_SUBDIRS = damage shadow cw rootless
diff --git a/miext/cw/cw.c b/miext/cw/cw.c
index f60f8cf28..69502711a 100644
--- a/miext/cw/cw.c
+++ b/miext/cw/cw.c
@@ -50,7 +50,6 @@ int cwWindowIndex;
#ifdef RENDER
int cwPictureIndex;
#endif
-static Bool cwDisabled[MAXSCREENS];
static unsigned long cwGeneration = 0;
extern GCOps cwGCOps;
@@ -619,9 +618,9 @@ void
miInitializeCompositeWrapper(ScreenPtr pScreen)
{
cwScreenPtr pScreenPriv;
-
- if (cwDisabled[pScreen->myNum])
- return;
+#ifdef RENDER
+ Bool has_render = GetPictureScreenIfSet(pScreen) != NULL;
+#endif
if (cwGeneration != serverGeneration)
{
@@ -631,7 +630,8 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
cwGCIndex = AllocateGCPrivateIndex();
cwWindowIndex = AllocateWindowPrivateIndex();
#ifdef RENDER
- cwPictureIndex = AllocatePicturePrivateIndex();
+ if (has_render)
+ cwPictureIndex = AllocatePicturePrivateIndex();
#endif
cwGeneration = serverGeneration;
}
@@ -640,8 +640,10 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
if (!AllocateWindowPrivate(pScreen, cwWindowIndex, 0))
return;
#ifdef RENDER
- if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0))
- return;
+ if (has_render) {
+ if (!AllocatePicturePrivate(pScreen, cwPictureIndex, 0))
+ return;
+ }
#endif
pScreenPriv = (cwScreenPtr)xalloc(sizeof(cwScreenRec));
if (!pScreenPriv)
@@ -661,17 +663,11 @@ miInitializeCompositeWrapper(ScreenPtr pScreen)
SCREEN_EPILOGUE(pScreen, GetWindowPixmap, cwGetWindowPixmap);
#ifdef RENDER
- if (GetPictureScreen (pScreen))
+ if (has_render)
cwInitializeRender(pScreen);
#endif
}
-_X_EXPORT void
-miDisableCompositeWrapper(ScreenPtr pScreen)
-{
- cwDisabled[pScreen->myNum] = TRUE;
-}
-
static Bool
cwCloseScreen (int i, ScreenPtr pScreen)
{
diff --git a/miext/cw/cw.h b/miext/cw/cw.h
index 09cfc7828..69abbbfed 100644
--- a/miext/cw/cw.h
+++ b/miext/cw/cw.h
@@ -169,7 +169,3 @@ cwFiniRender (ScreenPtr pScreen);
void
miInitializeCompositeWrapper(ScreenPtr pScreen);
-
-/* Must be called before miInitializeCompositeWrapper */
-void
-miDisableCompositeWrapper(ScreenPtr pScreen);
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index cd66b5473..d93074758 100755
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -72,6 +72,12 @@
#define pixmapDamage(pPixmap) damagePixPriv(pPixmap)
+static int damageScrPrivateIndex;
+static int damagePixPrivateIndex;
+static int damageGCPrivateIndex;
+static int damageWinPrivateIndex;
+static int damageGeneration;
+
static DamagePtr *
getDrawableDamageRef (DrawablePtr pDrawable)
{
@@ -368,12 +374,12 @@ static void damageChangeClip(GCPtr, int, pointer, int);
static void damageDestroyClip(GCPtr);
static void damageCopyClip(GCPtr, GCPtr);
-GCFuncs damageGCFuncs = {
+static GCFuncs damageGCFuncs = {
damageValidateGC, damageChangeGC, damageCopyGC, damageDestroyGC,
damageChangeClip, damageDestroyClip, damageCopyClip
};
-extern GCOps damageGCOps;
+static GCOps damageGCOps;
static Bool
damageCreateGC(GCPtr pGC)
@@ -1686,7 +1692,7 @@ damageCopyWindow(WindowPtr pWindow,
wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow);
}
-GCOps damageGCOps = {
+static GCOps damageGCOps = {
damageFillSpans, damageSetSpans,
damagePutImage, damageCopyArea,
damageCopyPlane, damagePolyPoint,
@@ -1787,12 +1793,6 @@ damageCloseScreen (int i, ScreenPtr pScreen)
return (*pScreen->CloseScreen) (i, pScreen);
}
-int damageScrPrivateIndex;
-int damagePixPrivateIndex;
-int damageGCPrivateIndex;
-int damageWinPrivateIndex;
-int damageGeneration;
-
Bool
DamageSetup (ScreenPtr pScreen)
{
@@ -1831,16 +1831,6 @@ DamageSetup (ScreenPtr pScreen)
if (!pScrPriv)
return FALSE;
-#ifdef COMPOSITE
- /* This is a kludge to ensure wrapping order with the composite wrapper.
- * If it's done from compinit.c, then DamageSetup may be called before the
- * extension init phase, so that cw will be higher in the wrapping chain and
- * rewrite drawables before damage gets to it, causing confusion.
- */
- if (!noCompositeExtension)
- miInitializeCompositeWrapper (pScreen);
-#endif
-
pScrPriv->internalLevel = 0;
pScrPriv->pScreenDamage = 0;
diff --git a/miext/damage/damagestr.h b/miext/damage/damagestr.h
index 93e213fd1..83a202ba8 100755
--- a/miext/damage/damagestr.h
+++ b/miext/damage/damagestr.h
@@ -82,11 +82,7 @@ typedef struct _damageGCPriv {
GCFuncs *funcs;
} DamageGCPrivRec, *DamageGCPrivPtr;
-extern int damageScrPrivateIndex;
-extern int damagePixPrivateIndex;
-extern int damageGCPrivateIndex;
-extern int damageWinPrivateIndex;
-
+/* XXX should move these into damage.c, damageScrPrivateIndex is static */
#define damageGetScrPriv(pScr) \
((DamageScrPrivPtr) (pScr)->devPrivates[damageScrPrivateIndex].ptr)
diff --git a/miext/rootless/Makefile.am b/miext/rootless/Makefile.am
index ecf762a64..8dae6d237 100644
--- a/miext/rootless/Makefile.am
+++ b/miext/rootless/Makefile.am
@@ -1,14 +1,13 @@
-EXTRA_DIST = \
- accel/rlAccel.c \
- accel/rlAccel.h \
- accel/rlBlt.c \
- accel/rlCopy.c \
- accel/rlFill.c \
- accel/rlFillRect.c \
- accel/rlFillSpans.c \
- accel/rlGlyph.c \
- accel/rlSolid.c \
- README.txt \
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ $(XORG_CFLAGS)
+
+INCLUDES = -I$(top_srcdir)/hw/xfree86/os-support
+
+SUBDIRS = safeAlpha accel
+
+noinst_LTLIBRARIES = librootless.la
+librootless_la_SOURCES = \
rootlessCommon.c \
rootlessCommon.h \
rootlessConfig.h \
@@ -17,7 +16,7 @@ EXTRA_DIST = \
rootlessScreen.c \
rootlessValTree.c \
rootlessWindow.c \
- rootlessWindow.h \
- safeAlpha/safeAlpha.h \
- safeAlpha/safeAlphaPicture.c \
- safeAlpha/safeAlphaWindow.c
+ rootlessWindow.h
+
+EXTRA_DIST = \
+ README.txt
diff --git a/miext/rootless/accel/Makefile.am b/miext/rootless/accel/Makefile.am
new file mode 100644
index 000000000..c49d5fb47
--- /dev/null
+++ b/miext/rootless/accel/Makefile.am
@@ -0,0 +1,18 @@
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ $(XORG_CFLAGS)
+
+INCLUDES = -I$(srcdir)/.. -I$(top_srcdir)/hw/xfree86/os-support
+
+
+noinst_LTLIBRARIES = librlAccel.la
+librlAccel_la_SOURCES = rlAccel.c \
+ rlBlt.c \
+ rlCopy.c \
+ rlFill.c \
+ rlFillRect.c \
+ rlFillSpans.c \
+ rlGlyph.c \
+ rlSolid.c
+
+EXTRA_DIST = rlAccel.h
diff --git a/miext/rootless/accel/rlBlt.c b/miext/rootless/accel/rlBlt.c
index d1e765836..2cf72eb22 100644
--- a/miext/rootless/accel/rlBlt.c
+++ b/miext/rootless/accel/rlBlt.c
@@ -31,6 +31,7 @@
#include <dix-config.h>
#endif
+#include <stddef.h> /* For NULL */
#include "fb.h"
#include "rootlessCommon.h"
#include "rlAccel.h"
diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c
index 8fd922d4a..9cbb7fa1b 100644
--- a/miext/rootless/rootlessCommon.c
+++ b/miext/rootless/rootlessCommon.c
@@ -33,6 +33,9 @@
#include <dix-config.h>
#endif
+#include <stddef.h> /* For NULL */
+#include <limits.h> /* For CHAR_BIT */
+
#include "rootlessCommon.h"
unsigned int rootless_CopyBytes_threshold = 0;
diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c
index 5341267fb..b26f52c54 100644
--- a/miext/rootless/rootlessGC.c
+++ b/miext/rootless/rootlessGC.c
@@ -33,6 +33,7 @@
#include <dix-config.h>
#endif
+#include <stddef.h> /* For NULL */
#include "mi.h"
#include "scrnintstr.h"
#include "gcstruct.h"
diff --git a/miext/rootless/rootlessValTree.c b/miext/rootless/rootlessValTree.c
index 97348f58e..4f16530cc 100644
--- a/miext/rootless/rootlessValTree.c
+++ b/miext/rootless/rootlessValTree.c
@@ -93,6 +93,7 @@ Equipment Corporation.
#include <dix-config.h>
#endif
+#include <stddef.h> /* For NULL */
#include <X11/X.h>
#include "scrnintstr.h"
#include "validate.h"
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index e89ebf897..30b7daaab 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -33,6 +33,10 @@
#include <dix-config.h>
#endif
+#include <stddef.h> /* For NULL */
+#include <limits.h> /* For CHAR_BIT */
+#include <assert.h>
+
#include "rootlessCommon.h"
#include "rootlessWindow.h"
@@ -325,8 +329,8 @@ RootlessEnsureFrame(WindowPtr pWin)
RootlessWindowRec *winRec;
#ifdef SHAPE
RegionRec shape;
- RegionPtr pShape = NULL;
#endif
+ RegionPtr pShape = NULL;
if (WINREC(pWin) != NULL)
return WINREC(pWin);
diff --git a/miext/rootless/safeAlpha/Makefile.am b/miext/rootless/safeAlpha/Makefile.am
new file mode 100644
index 000000000..7592c1840
--- /dev/null
+++ b/miext/rootless/safeAlpha/Makefile.am
@@ -0,0 +1,12 @@
+AM_CFLAGS = \
+ $(DIX_CFLAGS) \
+ $(XORG_CFLAGS)
+
+INCLUDES = -I$(srcdir)/.. -I$(top_srcdir)/hw/xfree86/os-support
+
+
+noinst_LTLIBRARIES = libsafeAlpha.la
+libsafeAlpha_la_SOURCES = safeAlphaPicture.c \
+ safeAlphaWindow.c
+
+EXTRA_DIST = safeAlpha.h
diff --git a/miext/rootless/safeAlpha/safeAlphaPicture.c b/miext/rootless/safeAlpha/safeAlphaPicture.c
index 8550cc01f..6ccc05a27 100644
--- a/miext/rootless/safeAlpha/safeAlphaPicture.c
+++ b/miext/rootless/safeAlpha/safeAlphaPicture.c
@@ -33,15 +33,19 @@
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
#ifdef RENDER
+#include <stddef.h> /* For NULL */
#include "fb.h"
#include "picturestr.h"
#include "mipict.h"
#include "fbpict.h"
#include "safeAlpha.h"
#include "rootlessCommon.h"
-
# define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
diff --git a/miext/rootless/safeAlpha/safeAlphaWindow.c b/miext/rootless/safeAlpha/safeAlphaWindow.c
index 8884c107e..5226782fe 100644
--- a/miext/rootless/safeAlpha/safeAlphaWindow.c
+++ b/miext/rootless/safeAlpha/safeAlphaWindow.c
@@ -32,6 +32,10 @@
* Copyright © 1998 Keith Packard
*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
#include "fb.h"
#include "safeAlpha.h"
#include "rootlessCommon.h"
diff --git a/os/access.c b/os/access.c
index db5ca3135..221b8cbcd 100644
--- a/os/access.c
+++ b/os/access.c
@@ -234,8 +234,8 @@ static Bool NewHost(int /*family*/,
int /*len*/,
int /* addingLocalHosts */);
-int LocalClientCredAndGroups(ClientPtr client, int *pUid, int *pGid,
- int **pSuppGids, int *nSuppGids);
+static int LocalClientCredAndGroups(ClientPtr client, int *pUid, int *pGid,
+ int **pSuppGids, int *nSuppGids);
/* XFree86 bug #156: To keep track of which hosts were explicitly requested in
@@ -1431,7 +1431,7 @@ LocalClientCred(ClientPtr client, int *pUid, int *pGid)
*
* Used by localuser & localgroup ServerInterpreted access control forms below
*/
-int
+static int
LocalClientCredAndGroups(ClientPtr client, int *pUid, int *pGid,
int **pSuppGids, int *nSuppGids)
{
diff --git a/os/auth.c b/os/auth.c
index bf33b7ef1..b06333e6b 100644
--- a/os/auth.c
+++ b/os/auth.c
@@ -255,26 +255,6 @@ ResetAuthorization (void)
ShouldLoadAuth = TRUE;
}
-XID
-AuthorizationToID (
- unsigned short name_length,
- char *name,
- unsigned short data_length,
- char *data)
-{
- int i;
-
- for (i = 0; i < NUM_AUTHORIZATION; i++) {
- if (protocols[i].name_length == name_length &&
- memcmp (protocols[i].name, name, (int) name_length) == 0 &&
- protocols[i].ToID)
- {
- return (*protocols[i].ToID) (data_length, data);
- }
- }
- return (XID) ~0L;
-}
-
int
AuthorizationFromID (
XID id,
diff --git a/os/connection.c b/os/connection.c
index ffe911e45..cb3443c5b 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -175,7 +175,7 @@ typedef const char *string;
# include <ucred.h>
#endif
-int lastfdesc; /* maximum file descriptor */
+static int lastfdesc; /* maximum file descriptor */
fd_set WellKnownConnections; /* Listener mask */
fd_set EnabledDevices; /* mask for input devices that are on */
@@ -189,7 +189,7 @@ int MaxClients = 0;
Bool NewOutputPending; /* not yet attempted to write some new output */
Bool AnyClientsWriteBlocked; /* true if some client blocked on write */
-Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
+static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */
Bool PartialNetwork; /* continue even if unable to bind all addrs */
static Pid_t ParentProcess;
#ifdef __UNIXOS2__
@@ -298,9 +298,9 @@ void ClearConnectionTranslation(void)
}
#endif
-XtransConnInfo *ListenTransConns = NULL;
-int *ListenTransFds = NULL;
-int ListenTransCount;
+static XtransConnInfo *ListenTransConns = NULL;
+static int *ListenTransFds = NULL;
+static int ListenTransCount;
static void ErrorConnMax(XtransConnInfo /* trans_conn */);
@@ -1066,6 +1066,8 @@ CloseDownConnection(ClientPtr client)
XdmcpCloseDisplay(oc->fd);
#endif
CloseDownFileDescriptor(oc);
+ FreeOsBuffers(oc);
+ xfree(client->osPrivate);
client->osPrivate = (pointer)NULL;
if (auditTrailLevel > 1)
AuditF("client %d disconnected\n", client->index);
diff --git a/os/io.c b/os/io.c
index f6c666c0f..4e83e682b 100644
--- a/os/io.c
+++ b/os/io.c
@@ -90,6 +90,11 @@ SOFTWARE.
_X_EXPORT CallbackListPtr ReplyCallback;
_X_EXPORT CallbackListPtr FlushCallback;
+static ConnectionInputPtr AllocateInputBuffer(void);
+static ConnectionOutputPtr AllocateOutputBuffer(void);
+static xReqPtr PeekNextRequest(xReqPtr req, ClientPtr client, Bool readmore);
+static void SkipRequests(xReqPtr req, ClientPtr client, int numskipped);
+
/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
* systems are broken and return EWOULDBLOCK when they should return EAGAIN
*/
@@ -111,11 +116,11 @@ _X_EXPORT CallbackListPtr FlushCallback;
#define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK || err == ENOSPC)
#endif
-Bool CriticalOutputPending;
-int timesThisConnection = 0;
-ConnectionInputPtr FreeInputs = (ConnectionInputPtr)NULL;
-ConnectionOutputPtr FreeOutputs = (ConnectionOutputPtr)NULL;
-OsCommPtr AvailableInput = (OsCommPtr)NULL;
+static Bool CriticalOutputPending;
+static int timesThisConnection = 0;
+static ConnectionInputPtr FreeInputs = (ConnectionInputPtr)NULL;
+static ConnectionOutputPtr FreeOutputs = (ConnectionOutputPtr)NULL;
+static OsCommPtr AvailableInput = (OsCommPtr)NULL;
#define get_req_len(req,cli) ((cli)->swapped ? \
lswaps((req)->length) : (req)->length)
@@ -635,7 +640,7 @@ ResetCurrentRequest(ClientPtr client)
*
**********************/
-xReqPtr
+static xReqPtr
PeekNextRequest(
xReqPtr req, /* request we're starting from */
ClientPtr client, /* client whose requests we're skipping */
@@ -697,7 +702,7 @@ PeekNextRequest(
_X_EXPORT CallbackListPtr SkippedRequestsCallback = NULL;
-void
+static void
SkipRequests(
xReqPtr req, /* last request being skipped */
ClientPtr client, /* client whose requests we're skipping */
@@ -1165,7 +1170,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, char *extraBuf, int extraCount)
return extraCount; /* return only the amount explicitly requested */
}
-ConnectionInputPtr
+static ConnectionInputPtr
AllocateInputBuffer(void)
{
ConnectionInputPtr oci;
@@ -1186,7 +1191,7 @@ AllocateInputBuffer(void)
return oci;
}
-ConnectionOutputPtr
+static ConnectionOutputPtr
AllocateOutputBuffer(void)
{
ConnectionOutputPtr oco;
diff --git a/os/osdep.h b/os/osdep.h
index 5fa1e3918..0984d51e8 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -210,10 +210,6 @@ extern void FreeOsBuffers(
#include "dix.h"
-extern ConnectionInputPtr AllocateInputBuffer(void);
-
-extern ConnectionOutputPtr AllocateOutputBuffer(void);
-
extern fd_set AllSockets;
extern fd_set AllClients;
extern fd_set LastSelectMask;
@@ -234,12 +230,6 @@ extern void ClearConnectionTranslation();
extern Bool NewOutputPending;
extern Bool AnyClientsWriteBlocked;
-extern Bool CriticalOutputPending;
-
-extern int timesThisConnection;
-extern ConnectionInputPtr FreeInputs;
-extern ConnectionOutputPtr FreeOutputs;
-extern OsCommPtr AvailableInput;
extern WorkQueuePtr workQueue;
@@ -299,14 +289,12 @@ extern XID AuthSecurityCheck (AuthCheckArgs);
/* in xdmcp.c */
extern void XdmcpUseMsg (void);
extern int XdmcpOptions(int argc, char **argv, int i);
-extern void XdmcpSetAuthentication (ARRAY8Ptr name);
extern void XdmcpRegisterConnection (
int type,
char *address,
int addrlen);
extern void XdmcpRegisterAuthorizations (void);
extern void XdmcpRegisterAuthorization (char *name, int namelen);
-extern void XdmcpRegisterDisplayClass (char *name, int length);
extern void XdmcpInit (void);
extern void XdmcpReset (void);
extern void XdmcpOpenDisplay(int sock);
@@ -319,8 +307,6 @@ extern void XdmcpRegisterAuthentication (
ValidatorFunc Validator,
GeneratorFunc Generator,
AddAuthorFunc AddAuth);
-extern int XdmcpCheckAuthentication (ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type);
-extern int XdmcpAddAuthorization (ARRAY8Ptr name, ARRAY8Ptr data);
struct sockaddr_in;
extern void XdmcpRegisterBroadcastAddress (struct sockaddr_in *addr);
diff --git a/os/utils.c b/os/utils.c
index 7c725e38d..e605a6c7a 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -117,7 +117,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
#endif
#ifdef XKB
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#endif
#ifdef XCSECURITY
#include "securitysrv.h"
@@ -136,10 +136,7 @@ _X_EXPORT Bool noTestExtensions;
_X_EXPORT Bool noBigReqExtension = FALSE;
#endif
#ifdef COMPOSITE
- /* COMPOSITE is disabled by default for now until the
- * interface is stable */
- #define COMPOSITE_DEFAULT FALSE
-_X_EXPORT Bool noCompositeExtension = !COMPOSITE_DEFAULT;
+_X_EXPORT Bool noCompositeExtension = FALSE;
#endif
#ifdef DAMAGE
@@ -245,10 +242,6 @@ _X_EXPORT Bool noXvExtension = FALSE;
Bool CoreDump;
#ifdef PANORAMIX
-Bool PanoramiXVisibilityNotifySent = FALSE;
-Bool PanoramiXMapped = FALSE;
-Bool PanoramiXWindowExposureSent = FALSE;
-Bool PanoramiXOneExposeRequest = FALSE;
Bool PanoramiXExtensionDisabledHack = FALSE;
#endif
@@ -271,7 +264,7 @@ long Memory_fail = 0;
#include <stdlib.h> /* for random() */
#endif
-char *dev_tty_from_init = NULL; /* since we need to parse it anyway */
+static char *dev_tty_from_init = NULL; /* since we need to parse it anyway */
OsSigHandlerPtr
OsSignal(sig, handler)
@@ -1871,7 +1864,7 @@ Fopen(char *file, char *type)
pidlist = cur;
#ifdef DEBUG
- ErrorF("Popen: `%s', fp = %p\n", command, iop);
+ ErrorF("Fopen(%s), fp = %p\n", file, iop);
#endif
return iop;
diff --git a/os/xdmcp.c b/os/xdmcp.c
index fd4be5e81..310f33bc0 100644
--- a/os/xdmcp.c
+++ b/os/xdmcp.c
@@ -197,8 +197,6 @@ static void receive_packet(int /*socketfd*/);
static void send_packet(void);
-extern void XdmcpDeadSession(char * /*reason*/);
-
static void timeout(void);
static void restart(void);
@@ -213,10 +211,23 @@ static void XdmcpWakeupHandler(
int /*i*/,
pointer /*LastSelectMask*/);
-void XdmcpRegisterManufacturerDisplayID(
- char * /*name*/,
- int /*length*/);
+/*
+ * Register the Manufacturer display ID
+ */
+static ARRAY8 ManufacturerDisplayID;
+
+static void
+XdmcpRegisterManufacturerDisplayID (char *name, int length)
+{
+ int i;
+
+ XdmcpDisposeARRAY8 (&ManufacturerDisplayID);
+ if (!XdmcpAllocARRAY8 (&ManufacturerDisplayID, length))
+ return;
+ for (i = 0; i < length; i++)
+ ManufacturerDisplayID.data[i] = (CARD8) name[i];
+}
static unsigned short xdm_udp_port = XDM_UDP_PORT;
static Bool OneSession = FALSE;
@@ -411,13 +422,13 @@ XdmcpRegisterAuthentication (
* set by the manager of the host to be connected to.
*/
-ARRAY8 noAuthenticationName = {(CARD16) 0, (CARD8Ptr) 0};
-ARRAY8 noAuthenticationData = {(CARD16) 0, (CARD8Ptr) 0};
-ARRAY8Ptr AuthenticationName = &noAuthenticationName;
-ARRAY8Ptr AuthenticationData = &noAuthenticationData;
-AuthenticationFuncsPtr AuthenticationFuncs;
+static ARRAY8 noAuthenticationName = {(CARD16) 0, (CARD8Ptr) 0};
+static ARRAY8 noAuthenticationData = {(CARD16) 0, (CARD8Ptr) 0};
+static ARRAY8Ptr AuthenticationName = &noAuthenticationName;
+static ARRAY8Ptr AuthenticationData = &noAuthenticationData;
+static AuthenticationFuncsPtr AuthenticationFuncs;
-void
+static void
XdmcpSetAuthentication (ARRAY8Ptr name)
{
int i;
@@ -547,9 +558,9 @@ XdmcpRegisterAuthorization (char *name, int namelen)
* Register the DisplayClass string
*/
-ARRAY8 DisplayClass;
+static ARRAY8 DisplayClass;
-void
+static void
XdmcpRegisterDisplayClass (char *name, int length)
{
int i;
@@ -561,24 +572,6 @@ XdmcpRegisterDisplayClass (char *name, int length)
DisplayClass.data[i] = (CARD8) name[i];
}
-/*
- * Register the Manufacturer display ID
- */
-
-ARRAY8 ManufacturerDisplayID;
-
-void
-XdmcpRegisterManufacturerDisplayID (char *name, int length)
-{
- int i;
-
- XdmcpDisposeARRAY8 (&ManufacturerDisplayID);
- if (!XdmcpAllocARRAY8 (&ManufacturerDisplayID, length))
- return;
- for (i = 0; i < length; i++)
- ManufacturerDisplayID.data[i] = (CARD8) name[i];
-}
-
/*
* initialize XDMCP; create the socket, compute the display
* number, set up the state machine
@@ -776,7 +769,7 @@ XdmcpAddHost(
* do the appropriate thing
*/
-ARRAY8 UnwillingMessage = { (CARD8) 14, (CARD8 *) "Host unwilling" };
+static ARRAY8 UnwillingMessage = { (CARD8) 14, (CARD8 *) "Host unwilling" };
static void
receive_packet(int socketfd)
@@ -867,7 +860,7 @@ send_packet(void)
* timeouts, or Keepalive failure.
*/
-void
+static void
XdmcpDeadSession (char *reason)
{
ErrorF ("XDM: %s, declaring session dead\n", reason);
@@ -960,21 +953,16 @@ restart(void)
send_packet();
}
-int
-XdmcpCheckAuthentication (
- ARRAY8Ptr Name,
- ARRAY8Ptr Data,
- int packet_type)
+static int
+XdmcpCheckAuthentication (ARRAY8Ptr Name, ARRAY8Ptr Data, int packet_type)
{
return (XdmcpARRAY8Equal (Name, AuthenticationName) &&
(AuthenticationName->length == 0 ||
(*AuthenticationFuncs->Validator) (AuthenticationData, Data, packet_type)));
}
-int
-XdmcpAddAuthorization (
- ARRAY8Ptr name,
- ARRAY8Ptr data)
+static int
+XdmcpAddAuthorization (ARRAY8Ptr name, ARRAY8Ptr data)
{
AddAuthorFunc AddAuth;
diff --git a/randr/mirandr.c b/randr/mirandr.c
index 0b763e111..3c4991e5a 100644
--- a/randr/mirandr.c
+++ b/randr/mirandr.c
@@ -73,6 +73,20 @@ miRROutputSetProperty (ScreenPtr pScreen,
return TRUE;
}
+Bool
+miRROutputValidateMode (ScreenPtr pScreen,
+ RROutputPtr output,
+ RRModePtr mode)
+{
+ return FALSE;
+}
+
+void
+miRRModeDestroy (ScreenPtr pScreen,
+ RRModePtr mode)
+{
+}
+
/*
* This function assumes that only a single depth can be
* displayed at a time, but that all visuals of that depth
@@ -102,7 +116,8 @@ miRandRInit (ScreenPtr pScreen)
pScrPriv->rrCrtcSet = miRRCrtcSet;
pScrPriv->rrCrtcSetGamma = miRRCrtcSetGamma;
pScrPriv->rrOutputSetProperty = miRROutputSetProperty;
-
+ pScrPriv->rrOutputValidateMode = miRROutputValidateMode;
+ pScrPriv->rrModeDestroy = miRRModeDestroy;
RRScreenSetSizeRange (pScreen,
pScreen->width, pScreen->height,
@@ -118,20 +133,13 @@ miRandRInit (ScreenPtr pScreen)
if (!mode)
return FALSE;
- crtc = RRCrtcCreate (NULL);
+ crtc = RRCrtcCreate (pScreen, NULL);
if (!crtc)
return FALSE;
- if (!RRCrtcAttachScreen (crtc, pScreen))
- {
- RRCrtcDestroy (crtc);
- return FALSE;
- }
- output = RROutputCreate ("screen", 6, NULL);
+ output = RROutputCreate (pScreen, "screen", 6, NULL);
if (!output)
return FALSE;
- if (!RROutputAttachScreen (output, pScreen))
- return FALSE;
if (!RROutputSetClones (output, NULL, 0))
return FALSE;
if (!RROutputSetModes (output, &mode, 1, 0))
diff --git a/randr/randr.c b/randr/randr.c
index 5fa9baf84..4dd0ee5b4 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -230,7 +230,7 @@ Bool RRScreenInit(ScreenPtr pScreen)
RRScreenGeneration = serverGeneration;
}
- pScrPriv = (rrScrPrivPtr) xalloc (sizeof (rrScrPrivRec));
+ pScrPriv = (rrScrPrivPtr) xcalloc (1, sizeof (rrScrPrivRec));
if (!pScrPriv)
return FALSE;
diff --git a/randr/randrstr.h b/randr/randrstr.h
index 505821269..4cc3a469e 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -79,8 +79,7 @@ struct _rrMode {
int refcnt;
xRRModeInfo mode;
char *name;
- void *devPrivate;
- Bool userDefined;
+ ScreenPtr userScreen;
};
struct _rrPropertyValue {
@@ -135,8 +134,11 @@ struct _rrOutput {
int numModes;
int numPreferred;
RRModePtr *modes;
+ int numUserModes;
+ RRModePtr *userModes;
Bool changed;
RRPropertyPtr properties;
+ Bool pendingProperties;
void *devPrivate;
};
@@ -164,6 +166,13 @@ typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen,
Atom property,
RRPropertyValuePtr value);
+typedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen,
+ RROutputPtr output,
+ RRModePtr mode);
+
+typedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen,
+ RRModePtr mode);
+
#endif
typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations);
@@ -208,6 +217,8 @@ typedef struct _rrScrPriv {
RRCrtcSetProcPtr rrCrtcSet;
RRCrtcSetGammaProcPtr rrCrtcSetGamma;
RROutputSetPropertyProcPtr rrOutputSetProperty;
+ RROutputValidateModeProcPtr rrOutputValidateMode;
+ RRModeDestroyProcPtr rrModeDestroy;
#endif
/*
@@ -394,6 +405,15 @@ miRROutputSetProperty (ScreenPtr pScreen,
Atom property,
RRPropertyValuePtr value);
+Bool
+miRROutputValidateMode (ScreenPtr pScreen,
+ RROutputPtr output,
+ RRModePtr mode);
+
+void
+miRRModeDestroy (ScreenPtr pScreen,
+ RRModePtr mode);
+
/* randr.c */
/*
* Send all pending events
@@ -477,16 +497,14 @@ RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged);
* Create a CRTC
*/
RRCrtcPtr
-RRCrtcCreate (void *devPrivate);
+RRCrtcCreate (ScreenPtr pScreen, void *devPrivate);
/*
- * Attach a CRTC to a screen. Once done, this cannot be
- * undone without destroying the CRTC; it is separate from Create
- * only to allow an xf86-based driver to create objects in preinit
+ * Set the allowed rotations on a CRTC
*/
-Bool
-RRCrtcAttachScreen (RRCrtcPtr crtc, ScreenPtr pScreen);
-
+void
+RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations);
+
/*
* Notify the extension that the Crtc has been reconfigured,
* the driver calls this whenever it has updated the mode
@@ -543,11 +561,9 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc,
int size);
/*
- * Set the allowable rotations of the CRTC.
+ * Return the area of the frame buffer scanned out by the crtc,
+ * taking into account the current mode and rotation
*/
-Bool
-RRCrtcSetRotations (RRCrtcPtr crtc,
- Rotation rotations);
void
RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
@@ -646,19 +662,12 @@ RROutputChanged (RROutputPtr output, Bool configChanged);
*/
RROutputPtr
-RROutputCreate (const char *name,
+RROutputCreate (ScreenPtr pScreen,
+ const char *name,
int nameLength,
void *devPrivate);
/*
- * Attach an output to a screen, again split from creation so
- * xf86 DDXen can create randr resources before the ScreenRec
- * exists
- */
-Bool
-RROutputAttachScreen (RROutputPtr output, ScreenPtr pScreen);
-
-/*
* Notify extension that output parameters have been changed
*/
Bool
@@ -672,6 +681,14 @@ RROutputSetModes (RROutputPtr output,
int numModes,
int numPreferred);
+int
+RROutputAddUserMode (RROutputPtr output,
+ RRModePtr mode);
+
+int
+RROutputDeleteUserMode (RROutputPtr output,
+ RRModePtr mode);
+
Bool
RROutputSetCrtcs (RROutputPtr output,
RRCrtcPtr *crtcs,
@@ -729,10 +746,13 @@ RRQueryOutputProperty (RROutputPtr output, Atom property);
void
RRDeleteOutputProperty (RROutputPtr output, Atom property);
+Bool
+RRPostPendingProperties (RROutputPtr output);
+
int
RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
int format, int mode, unsigned long len,
- pointer value, Bool sendevent);
+ pointer value, Bool sendevent, Bool pending);
int
RRConfigureOutputProperty (RROutputPtr output, Atom property,
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index fdd1d429d..1dfc3bbb0 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -51,17 +51,32 @@ RRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged)
* Create a CRTC
*/
RRCrtcPtr
-RRCrtcCreate (void *devPrivate)
+RRCrtcCreate (ScreenPtr pScreen, void *devPrivate)
{
- RRCrtcPtr crtc;
-
+ RRCrtcPtr crtc;
+ RRCrtcPtr *crtcs;
+ rrScrPrivPtr pScrPriv;
+
if (!RRInit())
return NULL;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+
+ /* make space for the crtc pointer */
+ if (pScrPriv->numCrtcs)
+ crtcs = xrealloc (pScrPriv->crtcs,
+ (pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr));
+ else
+ crtcs = xalloc (sizeof (RRCrtcPtr));
+ if (!crtcs)
+ return FALSE;
+ pScrPriv->crtcs = crtcs;
+
crtc = xalloc (sizeof (RRCrtcRec));
if (!crtc)
return NULL;
crtc->id = FakeClientID (0);
- crtc->pScreen = NULL;
+ crtc->pScreen = pScreen;
crtc->mode = NULL;
crtc->x = 0;
crtc->y = 0;
@@ -77,37 +92,20 @@ RRCrtcCreate (void *devPrivate)
if (!AddResource (crtc->id, RRCrtcType, (pointer) crtc))
return NULL;
+ /* attach the screen and crtc together */
+ crtc->pScreen = pScreen;
+ pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc;
+
return crtc;
}
/*
- * Attach a Crtc to a screen. This is done as a separate step
- * so that an xf86-based driver can create CRTCs in PreInit
- * before the Screen has been created
+ * Set the allowed rotations on a CRTC
*/
-
-Bool
-RRCrtcAttachScreen (RRCrtcPtr crtc, ScreenPtr pScreen)
+void
+RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations)
{
- rrScrPriv (pScreen);
- RRCrtcPtr *crtcs;
-
- /* make space for the crtc pointer */
- if (pScrPriv->numCrtcs)
- crtcs = xrealloc (pScrPriv->crtcs,
- (pScrPriv->numCrtcs + 1) * sizeof (RRCrtcPtr));
- else
- crtcs = xalloc (sizeof (RRCrtcPtr));
- if (!crtcs)
- return FALSE;
-
- /* attach the screen and crtc together */
- crtc->pScreen = pScreen;
- pScrPriv->crtcs = crtcs;
- pScrPriv->crtcs[pScrPriv->numCrtcs++] = crtc;
-
- RRCrtcChanged (crtc, TRUE);
- return TRUE;
+ crtc->rotations = rotations;
}
/*
@@ -249,6 +247,22 @@ RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc)
WriteEventsToClient (client, 1, (xEvent *) &ce);
}
+static Bool
+RRCrtcPendingProperties (RRCrtcPtr crtc)
+{
+ ScreenPtr pScreen = crtc->pScreen;
+ rrScrPriv(pScreen);
+ int o;
+
+ for (o = 0; o < pScrPriv->numOutputs; o++)
+ {
+ RROutputPtr output = pScrPriv->outputs[o];
+ if (output->crtc == crtc && output->pendingProperties)
+ return TRUE;
+ }
+ return FALSE;
+}
+
/*
* Request that the Crtc be reconfigured
*/
@@ -262,6 +276,8 @@ RRCrtcSet (RRCrtcPtr crtc,
RROutputPtr *outputs)
{
ScreenPtr pScreen = crtc->pScreen;
+ Bool ret = FALSE;
+ rrScrPriv(pScreen);
/* See if nothing changed */
if (crtc->mode == mode &&
@@ -269,54 +285,73 @@ RRCrtcSet (RRCrtcPtr crtc,
crtc->y == y &&
crtc->rotation == rotation &&
crtc->numOutputs == numOutputs &&
- !memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr)))
+ !memcmp (crtc->outputs, outputs, numOutputs * sizeof (RROutputPtr)) &&
+ !RRCrtcPendingProperties (crtc))
{
- return TRUE;
+ ret = TRUE;
}
- if (pScreen)
+ else
{
#if RANDR_12_INTERFACE
- rrScrPriv(pScreen);
if (pScrPriv->rrCrtcSet)
{
- return (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y,
- rotation, numOutputs, outputs);
+ ret = (*pScrPriv->rrCrtcSet) (pScreen, crtc, mode, x, y,
+ rotation, numOutputs, outputs);
}
+ else
#endif
-#if RANDR_10_INTERFACE
- if (pScrPriv->rrSetConfig)
{
- RRScreenSize size;
- RRScreenRate rate;
- Bool ret;
-
- size.width = mode->mode.width;
- size.height = mode->mode.height;
- if (outputs[0]->mmWidth && outputs[0]->mmHeight)
- {
- size.mmWidth = outputs[0]->mmWidth;
- size.mmHeight = outputs[0]->mmHeight;
- }
- else
+#if RANDR_10_INTERFACE
+ if (pScrPriv->rrSetConfig)
{
- size.mmWidth = pScreen->mmWidth;
- size.mmHeight = pScreen->mmHeight;
+ RRScreenSize size;
+ RRScreenRate rate;
+
+ if (!mode)
+ {
+ RRCrtcNotify (crtc, NULL, x, y, rotation, 0, NULL);
+ ret = TRUE;
+ }
+ else
+ {
+ size.width = mode->mode.width;
+ size.height = mode->mode.height;
+ if (outputs[0]->mmWidth && outputs[0]->mmHeight)
+ {
+ size.mmWidth = outputs[0]->mmWidth;
+ size.mmHeight = outputs[0]->mmHeight;
+ }
+ else
+ {
+ size.mmWidth = pScreen->mmWidth;
+ size.mmHeight = pScreen->mmHeight;
+ }
+ size.nRates = 1;
+ rate.rate = RRVerticalRefresh (&mode->mode);
+ size.pRates = &rate;
+ ret = (*pScrPriv->rrSetConfig) (pScreen, rotation, rate.rate, &size);
+ /*
+ * Old 1.0 interface tied screen size to mode size
+ */
+ if (ret)
+ {
+ RRCrtcNotify (crtc, mode, x, y, rotation, 1, outputs);
+ RRScreenSizeNotify (pScreen);
+ }
+ }
}
- size.nRates = 1;
- rate.rate = RRVerticalRefresh (&mode->mode);
- size.pRates = &rate;
- ret = (*pScrPriv->rrSetConfig) (pScreen, rotation, rate.rate, &size);
- /*
- * Old 1.0 interface tied screen size to mode size
- */
- if (ret)
- RRCrtcNotify (crtc, mode, x, y, rotation, 1, outputs);
- return ret;
- }
#endif
- RRTellChanged (pScreen);
+ }
+ if (ret)
+ {
+ int o;
+ RRTellChanged (pScreen);
+
+ for (o = 0; o < numOutputs; o++)
+ RRPostPendingProperties (outputs[o]);
+ }
}
- return FALSE;
+ return ret;
}
/*
@@ -352,6 +387,8 @@ RRCrtcDestroyResource (pointer value, XID pid)
}
if (crtc->gammaRed)
xfree (crtc->gammaRed);
+ if (crtc->mode)
+ RRModeDestroy (crtc->mode);
xfree (crtc);
return 1;
}
@@ -453,17 +490,6 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc,
}
/*
- * Set the allowable rotations of the CRTC.
- */
-Bool
-RRCrtcSetRotations (RRCrtcPtr crtc,
- Rotation rotations)
-{
- crtc->rotations = rotations;
- return TRUE;
-}
-
-/*
* Initialize crtc type
*/
Bool
@@ -481,7 +507,7 @@ RRCrtcInit (void)
int
ProcRRGetCrtcInfo (ClientPtr client)
{
- REQUEST(xRRGetCrtcInfoReq);;
+ REQUEST(xRRGetCrtcInfoReq);
xRRGetCrtcInfoReply rep;
RRCrtcPtr crtc;
CARD8 *extra;
@@ -657,16 +683,42 @@ ProcRRSetCrtcConfig (ClientPtr client)
return BadMatch;
}
/* validate mode for this output */
- for (j = 0; j < outputs[i]->numModes; j++)
- if (outputs[i]->modes[j] == mode)
+ for (j = 0; j < outputs[i]->numModes + outputs[i]->numUserModes; j++)
+ {
+ RRModePtr m = (j < outputs[i]->numModes ?
+ outputs[i]->modes[j] :
+ outputs[i]->userModes[j - outputs[i]->numModes]);
+ if (m == mode)
break;
- if (j == outputs[i]->numModes)
+ }
+ if (j == outputs[i]->numModes + outputs[i]->numUserModes)
{
if (outputs)
xfree (outputs);
return BadMatch;
}
}
+ /* validate clones */
+ for (i = 0; i < numOutputs; i++)
+ {
+ for (j = 0; j < numOutputs; j++)
+ {
+ int k;
+ if (i == j)
+ continue;
+ for (k = 0; k < outputs[i]->numClones; k++)
+ {
+ if (outputs[i]->clones[k] == outputs[j])
+ break;
+ }
+ if (k == outputs[i]->numClones)
+ {
+ if (outputs)
+ xfree (outputs);
+ return BadMatch;
+ }
+ }
+ }
pScreen = crtc->pScreen;
pScrPriv = rrGetScrPriv(pScreen);
@@ -681,6 +733,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
goto sendReply;
}
+#if 0
/*
* if the client's config timestamp is not the same as the last config
* timestamp, then the config information isn't up-to-date and
@@ -691,6 +744,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
rep.status = RRSetConfigInvalidConfigTime;
goto sendReply;
}
+#endif
/*
* Validate requested rotation
diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
index 7f98965a4..5525427f6 100644
--- a/randr/rrdispatch.c
+++ b/randr/rrdispatch.c
@@ -22,6 +22,9 @@
#include "randrstr.h"
+#define SERVER_RANDR_MAJOR 1
+#define SERVER_RANDR_MINOR 2
+
Bool
RRClientKnowsRates (ClientPtr pClient)
{
@@ -49,8 +52,8 @@ ProcRRQueryVersion (ClientPtr client)
* Report the current version; the current
* spec says they're all compatible after 1.0
*/
- rep.majorVersion = RANDR_MAJOR;
- rep.minorVersion = RANDR_MINOR;
+ rep.majorVersion = SERVER_RANDR_MAJOR;
+ rep.minorVersion = SERVER_RANDR_MINOR;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
diff --git a/randr/rrinfo.c b/randr/rrinfo.c
index 797cdb1b4..5ef1a6b83 100644
--- a/randr/rrinfo.c
+++ b/randr/rrinfo.c
@@ -91,19 +91,12 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
if (pScrPriv->numOutputs == 0 &&
pScrPriv->numCrtcs == 0)
{
- crtc = RRCrtcCreate (NULL);
+ crtc = RRCrtcCreate (pScreen, NULL);
if (!crtc)
return;
- if (!RRCrtcAttachScreen (crtc, pScreen))
- {
- RRCrtcDestroy (crtc);
- return;
- }
- output = RROutputCreate ("default", 7, NULL);
+ output = RROutputCreate (pScreen, "default", 7, NULL);
if (!output)
return;
- if (!RROutputAttachScreen (output, pScreen))
- return;
RROutputSetCrtcs (output, &crtc, 1);
RROutputSetCrtc (output, crtc);
RROutputSetConnection (output, RR_Connected);
@@ -157,9 +150,11 @@ RRScanOldConfig (ScreenPtr pScreen, Rotation rotations)
pScrPriv->nSizes = 0;
/* find size bounds */
- for (i = 0; i < output->numModes; i++)
+ for (i = 0; i < output->numModes + output->numUserModes; i++)
{
- RRModePtr mode = output->modes[i];
+ RRModePtr mode = (i < output->numModes ?
+ output->modes[i] :
+ output->userModes[i-output->numModes]);
CARD16 width = mode->mode.width;
CARD16 height = mode->mode.height;
diff --git a/randr/rrmode.c b/randr/rrmode.c
index 261e1b75f..11175810c 100644
--- a/randr/rrmode.c
+++ b/randr/rrmode.c
@@ -48,25 +48,13 @@ RRModeEqual (xRRModeInfo *a, xRRModeInfo *b)
static int num_modes;
static RRModePtr *modes;
-RRModePtr
-RRModeGet (xRRModeInfo *modeInfo,
- const char *name)
+static RRModePtr
+RRModeCreate (xRRModeInfo *modeInfo,
+ const char *name,
+ ScreenPtr userScreen)
{
- int i;
- RRModePtr mode;
- RRModePtr *newModes;
-
- for (i = 0; i < num_modes; i++)
- {
- mode = modes[i];
- if (RRModeEqual (&mode->mode, modeInfo) &&
- !memcmp (name, mode->name, modeInfo->nameLength))
- {
- ++mode->refcnt;
- return mode;
- }
- }
-
+ RRModePtr mode, *newModes;
+
if (!RRInit ())
return NULL;
@@ -78,7 +66,7 @@ RRModeGet (xRRModeInfo *modeInfo,
mode->name = (char *) (mode + 1);
memcpy (mode->name, name, modeInfo->nameLength);
mode->name[modeInfo->nameLength] = '\0';
- mode->userDefined = FALSE;
+ mode->userScreen = userScreen;
if (num_modes)
newModes = xrealloc (modes, (num_modes + 1) * sizeof (RRModePtr));
@@ -104,11 +92,75 @@ RRModeGet (xRRModeInfo *modeInfo,
return mode;
}
+static RRModePtr
+RRModeFindByName (const char *name,
+ CARD16 nameLength)
+{
+ int i;
+ RRModePtr mode;
+
+ for (i = 0; i < num_modes; i++)
+ {
+ mode = modes[i];
+ if (mode->mode.nameLength == nameLength &&
+ !memcmp (name, mode->name, nameLength))
+ {
+ return mode;
+ }
+ }
+ return NULL;
+}
+
+RRModePtr
+RRModeGet (xRRModeInfo *modeInfo,
+ const char *name)
+{
+ int i;
+
+ for (i = 0; i < num_modes; i++)
+ {
+ RRModePtr mode = modes[i];
+ if (RRModeEqual (&mode->mode, modeInfo) &&
+ !memcmp (name, mode->name, modeInfo->nameLength))
+ {
+ ++mode->refcnt;
+ return mode;
+ }
+ }
+
+ return RRModeCreate (modeInfo, name, NULL);
+}
+
+static RRModePtr
+RRModeCreateUser (ScreenPtr pScreen,
+ xRRModeInfo *modeInfo,
+ const char *name,
+ int *error)
+{
+ RRModePtr mode;
+
+ mode = RRModeFindByName (name, modeInfo->nameLength);
+ if (mode)
+ {
+ *error = BadName;
+ return NULL;
+ }
+
+ mode = RRModeCreate (modeInfo, name, pScreen);
+ if (!mode)
+ {
+ *error = BadAlloc;
+ return NULL;
+ }
+ *error = Success;
+ return mode;
+}
+
RRModePtr *
RRModesForScreen (ScreenPtr pScreen, int *num_ret)
{
rrScrPriv(pScreen);
- int o, c;
+ int o, c, m;
RRModePtr *screen_modes;
int num_screen_modes = 0;
@@ -122,9 +174,11 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret)
RROutputPtr output = pScrPriv->outputs[o];
int m, n;
- for (m = 0; m < output->numModes; m++)
+ for (m = 0; m < output->numModes + output->numUserModes; m++)
{
- RRModePtr mode = output->modes[m];
+ RRModePtr mode = (m < output->numModes ?
+ output->modes[m] :
+ output->userModes[m-output->numModes]);
for (n = 0; n < num_screen_modes; n++)
if (screen_modes[n] == mode)
break;
@@ -150,6 +204,23 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret)
if (n == num_screen_modes)
screen_modes[num_screen_modes++] = mode;
}
+ /*
+ * Add all user modes for this screen
+ */
+ for (m = 0; m < num_modes; m++)
+ {
+ RRModePtr mode = modes[m];
+ int n;
+
+ if (mode->userScreen != pScreen)
+ continue;
+ for (n = 0; n < num_screen_modes; n++)
+ if (screen_modes[n] == mode)
+ break;
+ if (n == num_screen_modes)
+ screen_modes[num_screen_modes++] = mode;
+ }
+
*num_ret = num_screen_modes;
return screen_modes;
}
@@ -205,38 +276,122 @@ int
ProcRRCreateMode (ClientPtr client)
{
REQUEST(xRRCreateModeReq);
+ xRRCreateModeReply rep;
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+ rrScrPrivPtr pScrPriv;
+ xRRModeInfo *modeInfo;
+ long units_after;
+ char *name;
+ int error, rc;
+ RRModePtr mode;
+
+ REQUEST_AT_LEAST_SIZE (xRRCreateModeReq);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
+
+ pScreen = pWin->drawable.pScreen;
+ pScrPriv = rrGetScrPriv(pScreen);
- REQUEST_SIZE_MATCH(xRRCreateModeReq);
- (void) stuff;
- return BadImplementation;
+ modeInfo = &stuff->modeInfo;
+ name = (char *) (stuff + 1);
+ units_after = (stuff->length - (sizeof (xRRCreateModeReq) >> 2));
+
+ /* check to make sure requested name fits within the data provided */
+ if ((int) (modeInfo->nameLength + 3) >> 2 > units_after)
+ return BadLength;
+
+ mode = RRModeCreateUser (pScreen, modeInfo, name, &error);
+ if (!mode)
+ return error;
+
+ rep.type = X_Reply;
+ rep.pad0 = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+ rep.mode = mode->mode.id;
+ if (client->swapped)
+ {
+ int n;
+ swaps(&rep.sequenceNumber, n);
+ swapl(&rep.length, n);
+ swapl(&rep.mode, n);
+ }
+ WriteToClient(client, sizeof(xRRCreateModeReply), (char *)&rep);
+
+ return client->noClientException;
}
int
ProcRRDestroyMode (ClientPtr client)
{
REQUEST(xRRDestroyModeReq);
+ RRModePtr mode;
REQUEST_SIZE_MATCH(xRRDestroyModeReq);
- (void) stuff;
- return BadImplementation;
+ mode = LookupIDByType (stuff->mode, RRModeType);
+ if (!mode)
+ {
+ client->errorValue = stuff->mode;
+ return RRErrorBase + BadRRMode;
+ }
+ if (!mode->userScreen)
+ return BadMatch;
+ if (mode->refcnt > 1)
+ return BadAccess;
+ FreeResource (stuff->mode, 0);
+ return Success;
}
int
ProcRRAddOutputMode (ClientPtr client)
{
REQUEST(xRRAddOutputModeReq);
+ RRModePtr mode;
+ RROutputPtr output;
REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
- (void) stuff;
- return BadImplementation;
+ output = LookupOutput(client, stuff->output, DixReadAccess);
+
+ if (!output)
+ {
+ client->errorValue = stuff->output;
+ return RRErrorBase + BadRROutput;
+ }
+
+ mode = LookupIDByType (stuff->mode, RRModeType);
+ if (!mode)
+ {
+ client->errorValue = stuff->mode;
+ return RRErrorBase + BadRRMode;
+ }
+
+ return RROutputAddUserMode (output, mode);
}
int
ProcRRDeleteOutputMode (ClientPtr client)
{
REQUEST(xRRDeleteOutputModeReq);
+ RRModePtr mode;
+ RROutputPtr output;
REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
- (void) stuff;
- return BadImplementation;
+ output = LookupOutput(client, stuff->output, DixReadAccess);
+
+ if (!output)
+ {
+ client->errorValue = stuff->output;
+ return RRErrorBase + BadRROutput;
+ }
+
+ mode = LookupIDByType (stuff->mode, RRModeType);
+ if (!mode)
+ {
+ client->errorValue = stuff->mode;
+ return RRErrorBase + BadRRMode;
+ }
+
+ return RROutputDeleteUserMode (output, mode);
}
diff --git a/randr/rroutput.c b/randr/rroutput.c
index a66433015..e00116283 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -47,19 +47,35 @@ RROutputChanged (RROutputPtr output, Bool configChanged)
*/
RROutputPtr
-RROutputCreate (const char *name,
+RROutputCreate (ScreenPtr pScreen,
+ const char *name,
int nameLength,
void *devPrivate)
{
- RROutputPtr output;
+ RROutputPtr output;
+ RROutputPtr *outputs;
+ rrScrPrivPtr pScrPriv;
if (!RRInit())
return NULL;
+
+ pScrPriv = rrGetScrPriv(pScreen);
+
+ if (pScrPriv->numOutputs)
+ outputs = xrealloc (pScrPriv->outputs,
+ (pScrPriv->numOutputs + 1) * sizeof (RROutputPtr));
+ else
+ outputs = xalloc (sizeof (RROutputPtr));
+ if (!outputs)
+ return FALSE;
+
+ pScrPriv->outputs = outputs;
+
output = xalloc (sizeof (RROutputRec) + nameLength + 1);
if (!output)
return NULL;
output->id = FakeClientID (0);
- output->pScreen = NULL;
+ output->pScreen = pScreen;
output->name = (char *) (output + 1);
output->nameLength = nameLength;
memcpy (output->name, name, nameLength);
@@ -76,6 +92,8 @@ RROutputCreate (const char *name,
output->numModes = 0;
output->numPreferred = 0;
output->modes = NULL;
+ output->numUserModes = 0;
+ output->userModes = NULL;
output->properties = NULL;
output->changed = FALSE;
output->devPrivate = devPrivate;
@@ -83,36 +101,11 @@ RROutputCreate (const char *name,
if (!AddResource (output->id, RROutputType, (pointer) output))
return NULL;
+ pScrPriv->outputs[pScrPriv->numOutputs++] = output;
return output;
}
/*
- * Attach an Output to a screen. This is done as a separate step
- * so that an xf86-based driver can create Outputs in PreInit
- * before the Screen has been created
- */
-
-Bool
-RROutputAttachScreen (RROutputPtr output, ScreenPtr pScreen)
-{
- rrScrPriv (pScreen);
- RROutputPtr *outputs;
-
- if (pScrPriv->numOutputs)
- outputs = xrealloc (pScrPriv->outputs,
- (pScrPriv->numOutputs + 1) * sizeof (RROutputPtr));
- else
- outputs = xalloc (sizeof (RROutputPtr));
- if (!outputs)
- return FALSE;
- output->pScreen = pScreen;
- pScrPriv->outputs = outputs;
- pScrPriv->outputs[pScrPriv->numOutputs++] = output;
- RROutputChanged (output, FALSE);
- return TRUE;
-}
-
-/*
* Notify extension that output parameters have been changed
*/
Bool
@@ -192,6 +185,74 @@ RROutputSetModes (RROutputPtr output,
return TRUE;
}
+int
+RROutputAddUserMode (RROutputPtr output,
+ RRModePtr mode)
+{
+ int m;
+ ScreenPtr pScreen = output->pScreen;
+ rrScrPriv(pScreen);
+ RRModePtr *newModes;
+
+ /* Check to see if this mode is already listed for this output */
+ for (m = 0; m < output->numModes + output->numUserModes; m++)
+ {
+ RRModePtr e = (m < output->numModes ?
+ output->modes[m] :
+ output->userModes[m - output->numModes]);
+ if (mode == e)
+ return Success;
+ }
+
+ /* Check with the DDX to see if this mode is OK */
+ if (pScrPriv->rrOutputValidateMode)
+ if (!pScrPriv->rrOutputValidateMode (pScreen, output, mode))
+ return BadMatch;
+
+ if (output->userModes)
+ newModes = xrealloc (output->userModes,
+ (output->numUserModes + 1) * sizeof (RRModePtr));
+ else
+ newModes = xalloc (sizeof (RRModePtr));
+ if (!newModes)
+ return BadAlloc;
+
+ output->userModes = newModes;
+ output->userModes[output->numUserModes++] = mode;
+ ++mode->refcnt;
+ RROutputChanged (output, TRUE);
+ RRTellChanged (pScreen);
+ return Success;
+}
+
+int
+RROutputDeleteUserMode (RROutputPtr output,
+ RRModePtr mode)
+{
+ int m;
+
+ /* Find this mode in the user mode list */
+ for (m = 0; m < output->numUserModes; m++)
+ {
+ RRModePtr e = output->userModes[m];
+
+ if (mode == e)
+ break;
+ }
+ /* Not there, access error */
+ if (m == output->numUserModes)
+ return BadAccess;
+
+ /* make sure the mode isn't active for this output */
+ if (output->crtc && output->crtc->mode == mode)
+ return BadMatch;
+
+ memmove (output->userModes + m, output->userModes + m + 1,
+ (output->numUserModes - m - 1) * sizeof (RRModePtr));
+ RRModeDestroy (mode);
+ return Success;
+}
+
Bool
RROutputSetCrtcs (RROutputPtr output,
RRCrtcPtr *crtcs,
@@ -308,9 +369,9 @@ RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
* Destroy a Output at shutdown
*/
void
-RROutputDestroy (RROutputPtr crtc)
+RROutputDestroy (RROutputPtr output)
{
- FreeResource (crtc->id, 0);
+ FreeResource (output->id, 0);
}
static int
@@ -318,6 +379,7 @@ RROutputDestroyResource (pointer value, XID pid)
{
RROutputPtr output = (RROutputPtr) value;
ScreenPtr pScreen = output->pScreen;
+ int m;
if (pScreen)
{
@@ -336,7 +398,17 @@ RROutputDestroyResource (pointer value, XID pid)
}
}
if (output->modes)
+ {
+ for (m = 0; m < output->numModes; m++)
+ RRModeDestroy (output->modes[m]);
xfree (output->modes);
+ }
+
+ for (m = 0; m < output->numUserModes; m++)
+ RRModeDestroy (output->userModes[m]);
+ if (output->userModes)
+ xfree (output->userModes);
+
if (output->crtcs)
xfree (output->crtcs);
if (output->clones)
@@ -366,7 +438,7 @@ RROutputInit (void)
int
ProcRRGetOutputInfo (ClientPtr client)
{
- REQUEST(xRRGetOutputInfoReq);;
+ REQUEST(xRRGetOutputInfoReq);
xRRGetOutputInfoReply rep;
RROutputPtr output;
CARD8 *extra;
@@ -383,7 +455,10 @@ ProcRRGetOutputInfo (ClientPtr client)
output = LookupOutput(client, stuff->output, DixReadAccess);
if (!output)
+ {
+ client->errorValue = stuff->output;
return RRErrorBase + BadRROutput;
+ }
pScreen = output->pScreen;
pScrPriv = rrGetScrPriv(pScreen);
@@ -398,13 +473,13 @@ ProcRRGetOutputInfo (ClientPtr client)
rep.connection = output->connection;
rep.subpixelOrder = output->subpixelOrder;
rep.nCrtcs = output->numCrtcs;
- rep.nModes = output->numModes;
+ rep.nModes = output->numModes + output->numUserModes;
rep.nPreferred = output->numPreferred;
rep.nClones = output->numClones;
rep.nameLength = output->nameLength;
extraLen = ((output->numCrtcs +
- output->numModes +
+ output->numModes + output->numUserModes +
output->numClones +
((rep.nameLength + 3) >> 2)) << 2);
@@ -420,7 +495,7 @@ ProcRRGetOutputInfo (ClientPtr client)
crtcs = (RRCrtc *) extra;
modes = (RRMode *) (crtcs + output->numCrtcs);
- clones = (RROutput *) (modes + output->numModes);
+ clones = (RROutput *) (modes + output->numModes + output->numUserModes);
name = (char *) (clones + output->numClones);
for (i = 0; i < output->numCrtcs; i++)
@@ -429,9 +504,12 @@ ProcRRGetOutputInfo (ClientPtr client)
if (client->swapped)
swapl (&crtcs[i], n);
}
- for (i = 0; i < output->numModes; i++)
+ for (i = 0; i < output->numModes + output->numUserModes; i++)
{
- modes[i] = output->modes[i]->mode.id;
+ if (i < output->numModes)
+ modes[i] = output->modes[i]->mode.id;
+ else
+ modes[i] = output->userModes[i - output->numModes]->mode.id;
if (client->swapped)
swapl (&modes[i], n);
}
diff --git a/randr/rrpointer.c b/randr/rrpointer.c
index 802dcb2c4..c88a0f83e 100644
--- a/randr/rrpointer.c
+++ b/randr/rrpointer.c
@@ -103,7 +103,7 @@ void
RRPointerMoved (ScreenPtr pScreen, int x, int y)
{
rrScrPriv (pScreen);
- RRCrtcPtr pointerCrtc = pScrPriv->pointerCrtc;;
+ RRCrtcPtr pointerCrtc = pScrPriv->pointerCrtc;
int c;
/* Check last known CRTC */
diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 916caf030..5ac073f81 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -27,7 +27,7 @@
static void
RRDeliverEvent (ScreenPtr pScreen, xEvent *event, CARD32 mask)
{
-
+
}
void
@@ -50,7 +50,7 @@ RRDeleteAllOutputProperties (RROutputPtr output)
xfree(prop->current.data);
if (prop->pending.data)
xfree(prop->pending.data);
- xfree(prop);
+ xfree(prop);
}
}
@@ -67,7 +67,7 @@ static RRPropertyPtr
RRCreateOutputProperty (Atom property)
{
RRPropertyPtr prop;
-
+
prop = (RRPropertyPtr)xalloc(sizeof(RRPropertyRec));
if (!prop)
return NULL;
@@ -121,105 +121,114 @@ RRDeleteOutputProperty (RROutputPtr output, Atom property)
int
RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
int format, int mode, unsigned long len,
- pointer value, Bool sendevent)
+ pointer value, Bool sendevent, Bool pending)
{
RRPropertyPtr prop;
xRROutputPropertyNotifyEvent event;
rrScrPrivPtr pScrPriv = rrGetScrPriv(output->pScreen);
- int sizeInBytes;
- int totalSize;
- pointer data;
+ int size_in_bytes;
+ int total_size;
+ unsigned long total_len;
RRPropertyValuePtr prop_value;
+ RRPropertyValueRec new_value;
Bool add = FALSE;
- sizeInBytes = format >> 3;
- totalSize = len * sizeInBytes;
+ size_in_bytes = format >> 3;
/* first see if property already exists */
prop = RRQueryOutputProperty (output, property);
if (!prop) /* just add to list */
{
- prop = RRCreateOutputProperty (property);
+ prop = RRCreateOutputProperty (property);
if (!prop)
return(BadAlloc);
add = TRUE;
mode = PropModeReplace;
}
- if (prop->is_pending)
+ if (pending && prop->is_pending)
prop_value = &prop->pending;
else
prop_value = &prop->current;
-
+
/* To append or prepend to a property the request format and type
- must match those of the already defined property. The
- existing format and type are irrelevant when using the mode
- "PropModeReplace" since they will be written over. */
+ must match those of the already defined property. The
+ existing format and type are irrelevant when using the mode
+ "PropModeReplace" since they will be written over. */
if ((format != prop_value->format) && (mode != PropModeReplace))
return(BadMatch);
if ((prop_value->type != type) && (mode != PropModeReplace))
return(BadMatch);
+ new_value = *prop_value;
if (mode == PropModeReplace)
+ total_len = len;
+ else
+ total_len = prop_value->size + len;
+
+ if (mode == PropModeReplace || len > 0)
{
- if (totalSize != prop_value->size * (prop_value->format >> 3))
+ pointer new_data = NULL, old_data = NULL;
+
+ total_size = total_len * size_in_bytes;
+ new_value.data = (pointer)xalloc (total_size);
+ if (!new_value.data && total_size)
{
- if (prop_value->data)
- data = (pointer)xrealloc(prop_value->data, totalSize);
- else
- data = (pointer)xalloc (totalSize);
- if (!data && len)
- {
- if (add)
- RRDestroyOutputProperty (prop);
- return(BadAlloc);
- }
- prop_value->data = data;
+ if (add)
+ RRDestroyOutputProperty (prop);
+ return BadAlloc;
}
- if (len)
- memmove((char *)prop_value->data, (char *)value, totalSize);
- prop_value->size = len;
- prop_value->type = type;
- prop_value->format = format;
+ new_value.size = len;
+ new_value.type = type;
+ new_value.format = format;
+
+ switch (mode) {
+ case PropModeReplace:
+ new_data = new_value.data;
+ old_data = NULL;
+ break;
+ case PropModeAppend:
+ new_data = (pointer) (((char *) new_value.data) +
+ (prop_value->size * size_in_bytes));
+ old_data = new_value.data;
+ break;
+ case PropModePrepend:
+ new_data = new_value.data;
+ old_data = (pointer) (((char *) new_value.data) +
+ (prop_value->size * size_in_bytes));
+ break;
+ }
+ if (new_data)
+ memcpy ((char *) new_data, (char *) value, len * size_in_bytes);
+ if (old_data)
+ memcpy ((char *) old_data, (char *) prop_value->data,
+ prop_value->size * size_in_bytes);
+
+ if (pending && pScrPriv->rrOutputSetProperty &&
+ !pScrPriv->rrOutputSetProperty(output->pScreen, output,
+ prop->propertyName, &new_value))
+ {
+ if (new_value.data)
+ xfree (new_value.data);
+ return (BadValue);
+ }
+ if (prop_value->data)
+ xfree (prop_value->data);
+ *prop_value = new_value;
}
+
else if (len == 0)
{
/* do nothing */
}
- else if (mode == PropModeAppend)
- {
- data = (pointer)xrealloc(prop_value->data,
- sizeInBytes * (len + prop_value->size));
- if (!data)
- return(BadAlloc);
- prop_value->data = data;
- memmove(&((char *)data)[prop_value->size * sizeInBytes],
- (char *)value,
- totalSize);
- prop_value->size += len;
- }
- else if (mode == PropModePrepend)
- {
- data = (pointer)xalloc(sizeInBytes * (len + prop_value->size));
- if (!data)
- return(BadAlloc);
- memmove(&((char *)data)[totalSize], (char *)prop_value->data,
- (int)(prop_value->size * sizeInBytes));
- memmove((char *)data, (char *)value, totalSize);
- xfree(prop_value->data);
- prop_value->data = data;
- prop_value->size += len;
- }
+
if (add)
{
prop->next = output->properties;
output->properties = prop;
}
- if (!prop->is_pending) {
- /* What should we do in case of failure? */
- pScrPriv->rrOutputSetProperty(output->pScreen, output,
- prop->propertyName, prop_value);
- }
+ if (pending && prop->is_pending)
+ output->pendingProperties = TRUE;
if (sendevent)
{
@@ -234,6 +243,48 @@ RRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
return(Success);
}
+Bool
+RRPostPendingProperties (RROutputPtr output)
+{
+ RRPropertyValuePtr pending_value;
+ RRPropertyValuePtr current_value;
+ RRPropertyPtr property;
+ Bool ret = TRUE;
+
+ if (!output->pendingProperties)
+ return TRUE;
+
+ output->pendingProperties = FALSE;
+ for (property = output->properties; property; property = property->next)
+ {
+ /* Skip non-pending properties */
+ if (!property->is_pending)
+ continue;
+
+ pending_value = &property->pending;
+ current_value = &property->current;
+
+ /*
+ * If the pending and current values are equal, don't mark it
+ * as changed (which would deliver an event)
+ */
+ if (pending_value->type == current_value->type &&
+ pending_value->format == current_value->format &&
+ pending_value->size == current_value->size &&
+ !memcmp (pending_value->data, current_value->data,
+ pending_value->size))
+ continue;
+
+ if (RRChangeOutputProperty (output, property->propertyName,
+ pending_value->type, pending_value->format,
+ PropModeReplace, pending_value->size,
+ pending_value->data, TRUE,
+ FALSE) != Success)
+ ret = FALSE;
+ }
+ return ret;
+}
+
RRPropertyPtr
RRQueryOutputProperty (RROutputPtr output, Atom property)
{
@@ -410,7 +461,7 @@ ProcRRConfigureOutputProperty (ClientPtr client)
RROutputPtr output;
int num_valid;
- REQUEST_SIZE_MATCH(xRRConfigureOutputPropertyReq);
+ REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq);
output = LookupOutput (client, stuff->output, DixReadAccess);
@@ -474,7 +525,7 @@ ProcRRChangeOutputProperty (ClientPtr client)
err = RRChangeOutputProperty(output, stuff->property,
stuff->type, (int)format,
- (int)mode, len, (pointer)&stuff[1], TRUE);
+ (int)mode, len, (pointer)&stuff[1], TRUE, TRUE);
if (err != Success)
return err;
else
@@ -508,8 +559,8 @@ int
ProcRRGetOutputProperty (ClientPtr client)
{
REQUEST(xRRGetOutputPropertyReq);
- RRPropertyPtr prop, *prev;
- RRPropertyValuePtr prop_value;
+ RRPropertyPtr prop, *prev;
+ RRPropertyValuePtr prop_value;
unsigned long n, len, ind;
RROutputPtr output;
xRRGetOutputPropertyReply reply;
@@ -600,7 +651,10 @@ ProcRRGetOutputProperty (ClientPtr client)
reply.bytesAfter = n - (ind + len);
reply.format = prop_value->format;
reply.length = (len + 3) >> 2;
- reply.nItems = len / (prop_value->format / 8 );
+ if (prop_value->format)
+ reply.nItems = len / (prop_value->format / 8);
+ else
+ reply.nItems = 0;
reply.propertyType = prop_value->type;
if (stuff->delete && (reply.bytesAfter == 0))
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index e10aa0362..ad74ac3af 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -26,6 +26,9 @@ extern char *ConnectionInfo;
static int padlength[4] = {0, 3, 2, 1};
+static CARD16
+RR10CurrentSizeID (ScreenPtr pScreen);
+
/*
* Edit connection information block so that new clients
* see the current screen size on connect
@@ -96,10 +99,7 @@ RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen)
rrScrPriv (pScreen);
xRRScreenChangeNotifyEvent se;
RRCrtcPtr crtc = pScrPriv->numCrtcs ? pScrPriv->crtcs[0] : NULL;
- RROutputPtr output = pScrPriv->numOutputs ? pScrPriv->outputs[0] : NULL;
- RRModePtr mode = crtc ? crtc->mode : NULL;
WindowPtr pRoot = WindowTable[pScreen->myNum];
- int i;
se.type = RRScreenChangeNotify + RREventBase;
se.rotation = (CARD8) (crtc ? crtc->rotation : RR_Rotate_0);
@@ -115,32 +115,12 @@ RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen)
#endif
se.sequenceNumber = client->sequence;
- if (mode)
- {
- se.sizeID = -1;
- for (i = 0; i < output->numModes; i++)
- if (mode == output->modes[i])
- {
- se.sizeID = i;
- break;
- }
- se.widthInPixels = mode->mode.width;
- se.heightInPixels = mode->mode.height;
- se.widthInMillimeters = pScreen->mmWidth;
- se.heightInMillimeters = pScreen->mmHeight;
- }
- else
- {
- /*
- * This "shouldn't happen", but a broken DDX can
- * forget to set the current configuration on GetInfo
- */
- se.sizeID = 0xffff;
- se.widthInPixels = 0;
- se.heightInPixels = 0;
- se.widthInMillimeters = 0;
- se.heightInMillimeters = 0;
- }
+ se.sizeID = RR10CurrentSizeID (pScreen);
+
+ se.widthInPixels = pScreen->width;
+ se.heightInPixels = pScreen->height;
+ se.widthInMillimeters = pScreen->mmWidth;
+ se.heightInMillimeters = pScreen->mmHeight;
WriteEventsToClient (client, 1, (xEvent *) &se);
}
@@ -493,7 +473,7 @@ RR10GetData (ScreenPtr pScreen, RROutputPtr output)
{
RR10DataPtr data;
RRScreenSizePtr size;
- int nmode = output->numModes;
+ int nmode = output->numModes + output->numUserModes;
int o, os, l, r;
RRScreenRatePtr refresh;
CARD16 vRefresh;
@@ -520,11 +500,14 @@ RR10GetData (ScreenPtr pScreen, RROutputPtr output)
/*
* find modes not yet listed
*/
- for (o = 0; o < output->numModes; o++)
+ for (o = 0; o < output->numModes + output->numUserModes; o++)
{
if (used[o]) continue;
- mode = output->modes[o];
+ if (o < output->numModes)
+ mode = output->modes[o];
+ else
+ mode = output->userModes[o - output->numModes];
l = data->nsize;
size[l].id = data->nsize;
@@ -544,9 +527,12 @@ RR10GetData (ScreenPtr pScreen, RROutputPtr output)
/*
* Find all modes with matching size
*/
- for (os = o; os < output->numModes; os++)
+ for (os = o; os < output->numModes + output->numUserModes; os++)
{
- mode = output->modes[os];
+ if (os < output->numModes)
+ mode = output->modes[os];
+ else
+ mode = output->userModes[os - output->numModes];
if (mode->mode.width == size[l].width &&
mode->mode.height == size[l].height)
{
@@ -949,3 +935,27 @@ sendReply:
return (client->noClientException);
}
+static CARD16
+RR10CurrentSizeID (ScreenPtr pScreen)
+{
+ CARD16 sizeID = 0xffff;
+ RROutputPtr output = RRFirstOutput (pScreen);
+
+ if (output)
+ {
+ RR10DataPtr data = RR10GetData (pScreen, output);
+ if (data)
+ {
+ int i;
+ for (i = 0; i < data->nsize; i++)
+ if (data->sizes[i].width == pScreen->width &&
+ data->sizes[i].height == pScreen->height)
+ {
+ sizeID = (CARD16) i;
+ break;
+ }
+ xfree (data);
+ }
+ }
+ return sizeID;
+}
diff --git a/record/set.c b/record/set.c
index 0ebb0884d..07a3a63a3 100644
--- a/record/set.c
+++ b/record/set.c
@@ -164,10 +164,10 @@ BitVectorIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter,
return (RecordSetIteratePtr)(long)(pInterval->last + 1);
}
-RecordSetOperations BitVectorSetOperations = {
+static RecordSetOperations BitVectorSetOperations = {
BitVectorDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet };
-RecordSetOperations BitVectorNoFreeOperations = {
+static RecordSetOperations BitVectorNoFreeOperations = {
NoopDestroySet, BitVectorIsMemberOfSet, BitVectorIterateSet };
static int
@@ -277,10 +277,10 @@ IntervalListIterateSet(RecordSetPtr pSet, RecordSetIteratePtr pIter,
return (RecordSetIteratePtr)NULL;
}
-RecordSetOperations IntervalListSetOperations = {
+static RecordSetOperations IntervalListSetOperations = {
IntervalListDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet };
-RecordSetOperations IntervalListNoFreeOperations = {
+static RecordSetOperations IntervalListNoFreeOperations = {
NoopDestroySet, IntervalListIsMemberOfSet, IntervalListIterateSet };
static int
diff --git a/render/animcur.c b/render/animcur.c
index 8e4f59d1b..1f25e79d0 100644
--- a/render/animcur.c
+++ b/render/animcur.c
@@ -87,8 +87,8 @@ static CursorBits animCursorBits = {
empty, empty, 2, 1, 1, 0, 0, 1
};
-int AnimCurScreenPrivateIndex = -1;
-int AnimCurGeneration;
+static int AnimCurScreenPrivateIndex = -1;
+static int AnimCurGeneration;
#define IsAnimCur(c) ((c)->bits == &animCursorBits)
#define GetAnimCur(c) ((AnimCurPtr) ((c) + 1))
diff --git a/render/glyph.c b/render/glyph.c
index 6d09a0e52..5987cbc70 100644
--- a/render/glyph.c
+++ b/render/glyph.c
@@ -77,11 +77,11 @@ static GlyphHashSetRec glyphHashSets[] = {
#define NGLYPHHASHSETS (sizeof(glyphHashSets)/sizeof(glyphHashSets[0]))
-const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 };
+static const CARD8 glyphDepths[GlyphFormatNum] = { 1, 4, 8, 16, 32 };
-GlyphHashRec globalGlyphs[GlyphFormatNum];
+static GlyphHashRec globalGlyphs[GlyphFormatNum];
-int globalTotalGlyphPrivateSize = 0;
+static int globalTotalGlyphPrivateSize = 0;
static int glyphPrivateCount = 0;
diff --git a/render/glyphstr.h b/render/glyphstr.h
index 64cedfa16..22150deee 100644
--- a/render/glyphstr.h
+++ b/render/glyphstr.h
@@ -91,8 +91,6 @@ typedef struct _GlyphList {
PictFormatPtr format;
} GlyphListRec, *GlyphListPtr;
-extern GlyphHashRec globalGlyphs[GlyphFormatNum];
-
GlyphHashSetPtr
FindGlyphHashSet (CARD32 filled);
diff --git a/render/picture.c b/render/picture.c
index e7901e873..c30649c6b 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -43,7 +43,7 @@
_X_EXPORT int PictureScreenPrivateIndex = -1;
int PictureWindowPrivateIndex;
-int PictureGeneration;
+static int PictureGeneration;
RESTYPE PictureType;
RESTYPE PictFormatType;
RESTYPE GlyphSetType;
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 86a512c25..3cdacc0e4 100755
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -143,7 +143,8 @@ CursorDisplayCursor (ScreenPtr pScreen,
CursorCurrent = pCursor;
for (e = cursorEvents; e; e = e->next)
{
- if (e->eventMask & XFixesDisplayCursorNotifyMask)
+ if ((e->eventMask & XFixesDisplayCursorNotifyMask) &&
+ !e->pClient->clientGone)
{
xXFixesCursorNotifyEvent ev;
ev.type = XFixesEventBase + XFixesCursorNotify;
diff --git a/xfixes/select.c b/xfixes/select.c
index d1c22c552..f0a9f2f4f 100755
--- a/xfixes/select.c
+++ b/xfixes/select.c
@@ -78,7 +78,9 @@ XFixesSelectionCallback (CallbackListPtr *callbacks, pointer data, pointer args)
}
for (e = selectionEvents; e; e = e->next)
{
- if (e->selection == selection->selection && (e->eventMask & eventMask))
+ if (e->selection == selection->selection &&
+ (e->eventMask & eventMask) &&
+ !e->pClient->clientGone)
{
xXFixesSelectionNotifyEvent ev;
diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c
index cee9e096d..32dee8a18 100755
--- a/xfixes/xfixes.c
+++ b/xfixes/xfixes.c
@@ -1,6 +1,4 @@
/*
- * $Id$
- *
* Copyright © 2006 Sun Microsystems
*
* Permission to use, copy, modify, distribute, and sell this software and its
@@ -55,10 +53,10 @@
#define SERVER_XFIXES_MAJOR 4
#define SERVER_XFIXES_MINOR 0
-unsigned char XFixesReqCode;
+static unsigned char XFixesReqCode;
int XFixesEventBase;
int XFixesErrorBase;
-int XFixesClientPrivateIndex;
+static int XFixesClientPrivateIndex;
static int
ProcXFixesQueryVersion(ClientPtr client)
@@ -169,7 +167,7 @@ SProcXFixesQueryVersion(ClientPtr client)
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
-int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
+static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
/*************** Version 1 ******************/
SProcXFixesQueryVersion,
SProcXFixesChangeSaveSet,
diff --git a/xfixes/xfixesint.h b/xfixes/xfixesint.h
index 5f08807f9..7f3b119b7 100755
--- a/xfixes/xfixesint.h
+++ b/xfixes/xfixesint.h
@@ -61,9 +61,7 @@
#include "selection.h"
#include "xfixes.h"
-extern unsigned char XFixesReqCode;
extern int XFixesEventBase;
-extern int XFixesClientPrivateIndex;
typedef struct _XFixesClient {
CARD32 major_version;
@@ -73,7 +71,6 @@ typedef struct _XFixesClient {
#define GetXFixesClient(pClient) ((XFixesClientPtr) (pClient)->devPrivates[XFixesClientPrivateIndex].ptr)
extern int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr);
-extern int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr);
/* Initialize extension at server startup time */
diff --git a/xkb/Makefile.am b/xkb/Makefile.am
index 996d52761..78cdf7196 100644
--- a/xkb/Makefile.am
+++ b/xkb/Makefile.am
@@ -41,7 +41,8 @@ X11_SRCS = \
XKBGAlloc.c \
XKBMAlloc.c
-XI_SRCS = xkbPrOtherEv.c
+# ends up unused...
+# XI_SRCS = xkbPrOtherEv.c
libxkb_la_SOURCES = $(DDX_SRCS) $(DIX_SRCS) $(XI_SRCS) $(XKBFILE_SRCS) \
$(X11_SRCS)
diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c
index c474733d0..f0a1f890e 100644
--- a/xkb/XKBAlloc.c
+++ b/xkb/XKBAlloc.c
@@ -35,7 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xproto.h>
#include "misc.h"
#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XKBgeom.h>
/***===================================================================***/
@@ -259,7 +259,7 @@ XkbAllocControls(XkbDescPtr xkb,unsigned which)
}
/*ARGSUSED*/
-void
+static void
XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap)
{
if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) {
@@ -284,7 +284,7 @@ XkbAllocIndicatorMaps(XkbDescPtr xkb)
return Success;
}
-void
+static void
XkbFreeIndicatorMaps(XkbDescPtr xkb)
{
if ((xkb!=NULL)&&(xkb->indicators!=NULL)) {
@@ -335,154 +335,3 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll)
_XkbFree(xkb);
return;
}
-
-/***====================================================================***/
-
-XkbDeviceLedInfoPtr
-XkbAddDeviceLedInfo(XkbDeviceInfoPtr devi,unsigned ledClass,unsigned ledId)
-{
-XkbDeviceLedInfoPtr devli;
-register int i;
-
- if ((!devi)||(!XkbSingleXIClass(ledClass))||(!XkbSingleXIId(ledId)))
- return NULL;
- for (i=0,devli=devi->leds;i<devi->num_leds;i++,devli++) {
- if ((devli->led_class==ledClass)&&(devli->led_id==ledId))
- return devli;
- }
- if (devi->num_leds>=devi->sz_leds) {
- XkbDeviceLedInfoRec *prev_leds = devi->leds;
-
- if (devi->sz_leds>0) devi->sz_leds*= 2;
- else devi->sz_leds= 1;
- devi->leds= _XkbTypedRealloc(devi->leds,devi->sz_leds,
- XkbDeviceLedInfoRec);
- if (!devi->leds) {
- _XkbFree(prev_leds);
- devi->sz_leds= devi->num_leds= 0;
- return NULL;
- }
- i= devi->num_leds;
- for (devli=&devi->leds[i];i<devi->sz_leds;i++,devli++) {
- bzero(devli,sizeof(XkbDeviceLedInfoRec));
- devli->led_class= XkbXINone;
- devli->led_id= XkbXINone;
- }
- }
- devli= &devi->leds[devi->num_leds++];
- bzero(devli,sizeof(XkbDeviceLedInfoRec));
- devli->led_class= ledClass;
- devli->led_id= ledId;
- return devli;
-}
-
-Status
-XkbResizeDeviceButtonActions(XkbDeviceInfoPtr devi,unsigned newTotal)
-{
- XkbAction *prev_btn_acts;
-
- if ((!devi)||(newTotal>255))
- return BadValue;
- if ((devi->btn_acts!=NULL)&&(newTotal==devi->num_btns))
- return Success;
- if (newTotal==0) {
- if (devi->btn_acts!=NULL) {
- _XkbFree(devi->btn_acts);
- devi->btn_acts= NULL;
- }
- devi->num_btns= 0;
- return Success;
- }
- prev_btn_acts = devi->btn_acts;
- devi->btn_acts= _XkbTypedRealloc(devi->btn_acts,newTotal,XkbAction);
- if (devi->btn_acts==NULL) {
- _XkbFree(prev_btn_acts);
- devi->num_btns= 0;
- return BadAlloc;
- }
- if (newTotal>devi->num_btns) {
- XkbAction *act;
- act= &devi->btn_acts[devi->num_btns];
- bzero((char *)act,(newTotal-devi->num_btns)*sizeof(XkbAction));
- }
- devi->num_btns= newTotal;
- return Success;
-}
-
-/*ARGSUSED*/
-XkbDeviceInfoPtr
-XkbAllocDeviceInfo(unsigned deviceSpec,unsigned nButtons,unsigned szLeds)
-{
-XkbDeviceInfoPtr devi;
-
- devi= _XkbTypedCalloc(1,XkbDeviceInfoRec);
- if (devi!=NULL) {
- devi->device_spec= deviceSpec;
- devi->has_own_state= False;
- devi->num_btns= 0;
- devi->btn_acts= NULL;
- if (nButtons>0) {
- devi->num_btns= nButtons;
- devi->btn_acts= _XkbTypedCalloc(nButtons,XkbAction);
- if (!devi->btn_acts) {
- _XkbFree(devi);
- return NULL;
- }
- }
- devi->dflt_kbd_fb= XkbXINone;
- devi->dflt_led_fb= XkbXINone;
- devi->num_leds= 0;
- devi->sz_leds= 0;
- devi->leds= NULL;
- if (szLeds>0) {
- devi->sz_leds= szLeds;
- devi->leds= _XkbTypedCalloc(szLeds,XkbDeviceLedInfoRec);
- if (!devi->leds) {
- if (devi->btn_acts)
- _XkbFree(devi->btn_acts);
- _XkbFree(devi);
- return NULL;
- }
- }
- }
- return devi;
-}
-
-
-void
-XkbFreeDeviceInfo(XkbDeviceInfoPtr devi,unsigned which,Bool freeDevI)
-{
- if (devi) {
- if (freeDevI) {
- which= XkbXI_AllDeviceFeaturesMask;
- if (devi->name) {
- _XkbFree(devi->name);
- devi->name= NULL;
- }
- }
- if ((which&XkbXI_ButtonActionsMask)&&(devi->btn_acts)) {
- _XkbFree(devi->btn_acts);
- devi->num_btns= 0;
- devi->btn_acts= NULL;
- }
- if ((which&XkbXI_IndicatorsMask)&&(devi->leds)) {
- register int i;
- if ((which&XkbXI_IndicatorsMask)==XkbXI_IndicatorsMask) {
- _XkbFree(devi->leds);
- devi->sz_leds= devi->num_leds= 0;
- devi->leds= NULL;
- }
- else {
- XkbDeviceLedInfoPtr devli;
- for (i=0,devli=devi->leds;i<devi->num_leds;i++,devli++) {
- if (which&XkbXI_IndicatorMapsMask)
- bzero((char *)&devli->maps[0],sizeof(devli->maps));
- else bzero((char *)&devli->names[0],sizeof(devli->names));
- }
- }
- }
- if (freeDevI)
- _XkbFree(devi);
- }
- return;
-}
diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c
index edaed10f3..815cc95f5 100644
--- a/xkb/XKBGAlloc.c
+++ b/xkb/XKBGAlloc.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xproto.h>
#include "misc.h"
#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XKBgeom.h>
#ifdef X_NOT_POSIX
diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c
index ef4097dad..9feaf8e93 100644
--- a/xkb/XKBMAlloc.c
+++ b/xkb/XKBMAlloc.c
@@ -39,7 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include <X11/keysym.h>
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
/***====================================================================***/
@@ -220,7 +220,7 @@ XkbServerMapPtr map;
/***====================================================================***/
-Status
+static Status
XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into)
{
if ((!from)||(!into))
@@ -275,82 +275,6 @@ register int i,rtrn;
return Success;
}
-XkbKeyTypePtr
-XkbAddKeyType( XkbDescPtr xkb,
- Atom name,
- int map_count,
- Bool want_preserve,
- int num_lvls)
-{
-register int i;
-unsigned tmp;
-XkbKeyTypePtr type;
-XkbClientMapPtr map;
-
- if ((!xkb)||(num_lvls<1))
- return NULL;
- map= xkb->map;
- if ((map)&&(map->types)) {
- for (i=0;i<map->num_types;i++) {
- if (map->types[i].name==name) {
- Status status;
- status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls);
- return (status==Success?&map->types[i]:NULL);
- }
- }
- }
- if ((!map)||(!map->types)||(!map->num_types<XkbNumRequiredTypes)) {
- tmp= XkbNumRequiredTypes+1;
- if (XkbAllocClientMap(xkb,XkbKeyTypesMask,tmp)!=Success)
- return NULL;
- map = xkb->map;
- tmp= 0;
- if (map->num_types<=XkbKeypadIndex)
- tmp|= XkbKeypadMask;
- if (map->num_types<=XkbAlphabeticIndex)
- tmp|= XkbAlphabeticMask;
- if (map->num_types<=XkbTwoLevelIndex)
- tmp|= XkbTwoLevelMask;
- if (map->num_types<=XkbOneLevelIndex)
- tmp|= XkbOneLevelMask;
- if (XkbInitCanonicalKeyTypes(xkb,tmp,XkbNoModifier)==Success) {
- for (i=0;i<map->num_types;i++) {
- Status status;
- if (map->types[i].name!=name)
- continue;
- status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls);
- return (status==Success?&map->types[i]:NULL);
- }
- }
- }
- if ((map->num_types<=map->size_types)&&
- (XkbAllocClientMap(xkb,XkbKeyTypesMask,map->num_types+1)!=Success)) {
- return NULL;
- }
- type= &map->types[map->num_types];
- map->num_types++;
- bzero((char *)type,sizeof(XkbKeyTypeRec));
- type->num_levels= num_lvls;
- type->map_count= map_count;
- type->name= name;
- if (map_count>0) {
- type->map= _XkbTypedCalloc(map_count,XkbKTMapEntryRec);
- if (!type->map) {
- map->num_types--;
- return NULL;
- }
- if (want_preserve) {
- type->preserve= _XkbTypedCalloc(map_count,XkbModsRec);
- if (!type->preserve) {
- _XkbFree(type->map);
- map->num_types--;
- return NULL;
- }
- }
- }
- return type;
-}
-
Status
XkbResizeKeyType( XkbDescPtr xkb,
int type_ndx,
@@ -475,7 +399,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
}
if (nResize>0) {
int nextMatch;
- xkb->map->size_syms= (nTotal*12)/10;
+ xkb->map->size_syms= (nTotal*15)/10;
newSyms = _XkbTypedCalloc(xkb->map->size_syms,KeySym);
if (newSyms==NULL)
return BadAlloc;
diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index 7ed47697e..0404108a2 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -39,102 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include <X11/keysym.h>
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
-
-/***====================================================================***/
-
-#define mapSize(m) (sizeof(m)/sizeof(XkbKTMapEntryRec))
-static XkbKTMapEntryRec map2Level[]= {
- { True, ShiftMask, {1, ShiftMask, 0} }
-};
-
-static XkbKTMapEntryRec mapAlpha[]= {
- { True, ShiftMask, { 1, ShiftMask, 0 } },
- { True, LockMask, { 0, LockMask, 0 } }
-};
-
-static XkbModsRec preAlpha[]= {
- { 0, 0, 0 },
- { LockMask, LockMask, 0 }
-};
-
-#define NL_VMOD_MASK 0
-static XkbKTMapEntryRec mapKeypad[]= {
- { True, ShiftMask, { 1, ShiftMask, 0 } },
- { False, 0, { 1, 0, NL_VMOD_MASK } }
-};
-
-static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = {
- { { 0, 0, 0 },
- 1, /* num_levels */
- 0, /* map_count */
- NULL, NULL,
- None, NULL
- },
- { { ShiftMask, ShiftMask, 0 },
- 2, /* num_levels */
- mapSize(map2Level), /* map_count */
- map2Level, NULL,
- None, NULL
- },
- { { ShiftMask|LockMask, ShiftMask|LockMask, 0 },
- 2, /* num_levels */
- mapSize(mapAlpha), /* map_count */
- mapAlpha, preAlpha,
- None, NULL
- },
- { { ShiftMask, ShiftMask, NL_VMOD_MASK },
- 2, /* num_levels */
- mapSize(mapKeypad), /* map_count */
- mapKeypad, NULL,
- None, NULL
- }
-};
-
-Status
-XkbInitCanonicalKeyTypes(XkbDescPtr xkb,unsigned which,int keypadVMod)
-{
-XkbClientMapPtr map;
-XkbKeyTypePtr from,to;
-Status rtrn;
-
- if (!xkb)
- return BadMatch;
- rtrn= XkbAllocClientMap(xkb,XkbKeyTypesMask,XkbNumRequiredTypes);
- if (rtrn!=Success)
- return rtrn;
- map= xkb->map;
- if ((which&XkbAllRequiredTypes)==0)
- return Success;
- rtrn= Success;
- from= canonicalTypes;
- to= map->types;
- if (which&XkbOneLevelMask)
- rtrn= XkbCopyKeyType(&from[XkbOneLevelIndex],&to[XkbOneLevelIndex]);
- if ((which&XkbTwoLevelMask)&&(rtrn==Success))
- rtrn= XkbCopyKeyType(&from[XkbTwoLevelIndex],&to[XkbTwoLevelIndex]);
- if ((which&XkbAlphabeticMask)&&(rtrn==Success))
- rtrn= XkbCopyKeyType(&from[XkbAlphabeticIndex],&to[XkbAlphabeticIndex]);
- if ((which&XkbKeypadMask)&&(rtrn==Success)) {
- XkbKeyTypePtr type;
- rtrn= XkbCopyKeyType(&from[XkbKeypadIndex],&to[XkbKeypadIndex]);
- type= &to[XkbKeypadIndex];
- if ((keypadVMod>=0)&&(keypadVMod<XkbNumVirtualMods)&&(rtrn==Success)) {
- type->mods.vmods= (1<<keypadVMod);
- type->map[0].active= True;
- type->map[0].mods.mask= ShiftMask;
- type->map[0].mods.real_mods= ShiftMask;
- type->map[0].mods.vmods= 0;
- type->map[0].level= 1;
- type->map[1].active= False;
- type->map[1].mods.mask= 0;
- type->map[1].mods.real_mods= 0;
- type->map[1].mods.vmods= (1<<keypadVMod);
- type->map[1].level= 1;
- }
- }
- return Success;
-}
+#include <xkbsrv.h>
/***====================================================================***/
@@ -558,88 +463,6 @@ unsigned changed,tmp;
return True;
}
-Bool
-XkbUpdateMapFromCore( XkbDescPtr xkb,
- KeyCode first_key,
- int num_keys,
- int map_width,
- KeySym * core_keysyms,
- XkbChangesPtr changes)
-{
-register int key,last_key;
-KeySym * syms;
-
- syms= &core_keysyms[(first_key-xkb->min_key_code)*map_width];
- if (changes) {
- if (changes->map.changed&XkbKeySymsMask) {
- _XkbAddKeyChange(&changes->map.first_key_sym,
- &changes->map.num_key_syms,first_key);
- if (num_keys>1) {
- _XkbAddKeyChange(&changes->map.first_key_sym,
- &changes->map.num_key_syms,
- first_key+num_keys-1);
- }
- }
- else {
- changes->map.changed|= XkbKeySymsMask;
- changes->map.first_key_sym= first_key;
- changes->map.num_key_syms= num_keys;
- }
- }
- last_key= first_key+num_keys-1;
- for (key=first_key;key<=last_key;key++,syms+= map_width) {
- XkbMapChangesPtr mc;
- unsigned explicit;
- KeySym tsyms[XkbMaxSymsPerKey];
- int types[XkbNumKbdGroups];
- int nG;
-
- explicit= xkb->server->explicit[key]&XkbExplicitKeyTypesMask;
- types[XkbGroup1Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index);
- types[XkbGroup2Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup2Index);
- types[XkbGroup3Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup3Index);
- types[XkbGroup4Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup4Index);
- nG= XkbKeyTypesForCoreSymbols(xkb,map_width,syms,explicit,types,tsyms);
- if (changes)
- mc= &changes->map;
- else mc= NULL;
- XkbChangeTypesOfKey(xkb,key,nG,XkbAllGroupsMask,types,mc);
- memcpy((char *)XkbKeySymsPtr(xkb,key),(char *)tsyms,
- XkbKeyNumSyms(xkb,key)*sizeof(KeySym));
- XkbApplyCompatMapToKey(xkb,key,changes);
- }
-
- if ((xkb->server->vmods!=NULL)&&(xkb->map->modmap!=NULL)&&(changes)&&
- (changes->map.changed&(XkbVirtualModMapMask|XkbModifierMapMask))) {
- unsigned char newVMods[XkbNumVirtualMods];
- register unsigned bit,i;
- unsigned present;
-
- bzero(newVMods,XkbNumVirtualMods);
- present= 0;
- for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) {
- if (xkb->server->vmodmap[key]==0)
- continue;
- for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if (bit&xkb->server->vmodmap[key]) {
- present|= bit;
- newVMods[i]|= xkb->map->modmap[key];
- }
- }
- }
- for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if ((bit&present)&&(newVMods[i]!=xkb->server->vmods[i])) {
- changes->map.changed|= XkbVirtualModsMask;
- changes->map.vmods|= bit;
- xkb->server->vmods[i]= newVMods[i];
- }
- }
- }
- if (changes && (changes->map.changed&XkbVirtualModsMask))
- XkbApplyVirtualModChanges(xkb,changes->map.vmods,changes);
- return True;
-}
-
Status
XkbChangeTypesOfKey( XkbDescPtr xkb,
int key,
@@ -788,7 +611,7 @@ register unsigned mask;
/***====================================================================***/
-Bool
+static Bool
XkbUpdateActionVirtualMods(XkbDescPtr xkb,XkbAction *act,unsigned changed)
{
unsigned int tmp;
@@ -814,7 +637,7 @@ unsigned int tmp;
return False;
}
-void
+static void
XkbUpdateKeyTypeVirtualMods( XkbDescPtr xkb,
XkbKeyTypePtr type,
unsigned int changed,
diff --git a/xkb/ddxBeep.c b/xkb/ddxBeep.c
index 53f3a6f9c..331357ded 100644
--- a/xkb/ddxBeep.c
+++ b/xkb/ddxBeep.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
/*#define FALLING_TONE 1*/
diff --git a/xkb/ddxCtrls.c b/xkb/ddxCtrls.c
index 5a9ad4018..0f7f9187f 100644
--- a/xkb/ddxCtrls.c
+++ b/xkb/ddxCtrls.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
void
diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c
index 3de8f8721..7e27c5189 100644
--- a/xkb/ddxDevBtn.c
+++ b/xkb/ddxDevBtn.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
diff --git a/xkb/ddxFakeBtn.c b/xkb/ddxFakeBtn.c
index f7b746b05..77222236f 100644
--- a/xkb/ddxFakeBtn.c
+++ b/xkb/ddxFakeBtn.c
@@ -37,7 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
void
diff --git a/xkb/ddxFakeMtn.c b/xkb/ddxFakeMtn.c
index a19819fd7..1060afe99 100644
--- a/xkb/ddxFakeMtn.c
+++ b/xkb/ddxFakeMtn.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
#ifdef PANORAMIX
diff --git a/xkb/ddxInit.c b/xkb/ddxInit.c
index 88c488c22..3bcf9d604 100644
--- a/xkb/ddxInit.c
+++ b/xkb/ddxInit.c
@@ -37,7 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
int
diff --git a/xkb/ddxKeyClick.c b/xkb/ddxKeyClick.c
index 528b20207..685ae1b42 100644
--- a/xkb/ddxKeyClick.c
+++ b/xkb/ddxKeyClick.c
@@ -37,7 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
void
diff --git a/xkb/ddxKillSrv.c b/xkb/ddxKillSrv.c
index 95d75897b..a573ecbd8 100644
--- a/xkb/ddxKillSrv.c
+++ b/xkb/ddxKillSrv.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
int
XkbDDXTerminateServer(DeviceIntPtr dev,KeyCode key,XkbAction *act)
diff --git a/xkb/ddxLEDs.c b/xkb/ddxLEDs.c
index fd0195882..22899d766 100644
--- a/xkb/ddxLEDs.c
+++ b/xkb/ddxLEDs.c
@@ -37,10 +37,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
-void
+static void
XkbDDXUpdateIndicators(DeviceIntPtr dev,CARD32 new)
{
dev->kbdfeed->ctrl.leds= new;
diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index 034f694ed..a91a9badf 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -40,7 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "scrnintstr.h"
#include "windowstr.h"
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
#ifndef PATH_MAX
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 6e8f8921c..c24c56c1c 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -44,7 +44,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "scrnintstr.h"
#include "windowstr.h"
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XI.h>
#include "xkb.h"
@@ -211,7 +211,7 @@ OutputDirectory(
}
}
-Bool
+static Bool
XkbDDXCompileNamedKeymap( XkbDescPtr xkb,
XkbComponentNamesPtr names,
char * nameRtrn,
@@ -298,7 +298,7 @@ char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile;
return False;
}
-Bool
+static Bool
XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
XkbComponentNamesPtr names,
unsigned want,
@@ -432,7 +432,7 @@ char tmpname[PATH_MAX];
return False;
}
-FILE *
+static FILE *
XkbDDXOpenConfigFile(char *mapName,char *fileNameRtrn,int fileNameRtrnLen)
{
char buf[PATH_MAX],xkm_output_dir[PATH_MAX];
diff --git a/xkb/ddxPrivate.c b/xkb/ddxPrivate.c
index 7450b47ba..f67e20c27 100644
--- a/xkb/ddxPrivate.c
+++ b/xkb/ddxPrivate.c
@@ -6,7 +6,7 @@
#define NEED_EVENTS
#include <X11/X.h>
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
int
XkbDDXPrivate(DeviceIntPtr dev,KeyCode key,XkbAction *act)
diff --git a/xkb/ddxVT.c b/xkb/ddxVT.c
index f56f0796d..55c82a865 100644
--- a/xkb/ddxVT.c
+++ b/xkb/ddxVT.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
int
XkbDDXSwitchScreen(DeviceIntPtr dev,KeyCode key,XkbAction *act)
diff --git a/xkb/maprules.c b/xkb/maprules.c
index b0a2225e2..0fa356ee5 100644
--- a/xkb/maprules.c
+++ b/xkb/maprules.c
@@ -48,7 +48,7 @@
#include "dix.h"
#include <X11/extensions/XKBstr.h>
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#ifdef DEBUG
#define PR_DEBUG(s) fprintf(stderr,s)
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 2c97e05db..cf4243070 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -36,23 +36,20 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "misc.h"
#include "inputstr.h"
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include "extnsionst.h"
#include "xkb.h"
#include <X11/extensions/XI.h>
int XkbEventBase;
- int XkbErrorBase;
+static int XkbErrorBase;
int XkbReqCode;
- int XkbKeyboardErrorCode;
-Atom xkbONE_LEVEL;
-Atom xkbTWO_LEVEL;
-Atom xkbKEYPAD;
+static int XkbKeyboardErrorCode;
CARD32 xkbDebugFlags = 0;
-CARD32 xkbDebugCtrls = 0;
+static CARD32 xkbDebugCtrls = 0;
-RESTYPE RT_XKBCLIENT;
+static RESTYPE RT_XKBCLIENT;
/***====================================================================***/
@@ -895,52 +892,6 @@ ProcXkbSetControls(ClientPtr client)
return client->noClientException;
}
-/* FIXME: Needs to set rate on all core-sending devices. */
-int
-XkbSetRepeatRate(DeviceIntPtr dev,int timeout,int interval,int major,int minor)
-{
-int changed= 0;
-XkbControlsRec old,*xkb;
-
- if ((!dev)||(!dev->key)||(!dev->key->xkbInfo))
- return 0;
- xkb= dev->key->xkbInfo->desc->ctrls;
- old= *xkb;
- if ((timeout!=0) && (xkb->repeat_delay!=timeout)) {
- xkb->repeat_delay= timeout;
- changed++;
- }
- if ((interval!=0) && (xkb->repeat_interval!=interval)) {
- xkb->repeat_interval= interval;
- changed++;
- }
- if (changed) {
- xkbControlsNotify cn;
- XkbDDXChangeControls(dev,&old,xkb);
- if (XkbComputeControlsNotify(dev,&old,xkb,&cn,False)) {
- cn.keycode= 0;
- cn.eventType = 0;
- cn.requestMajor = major;
- cn.requestMinor = minor;
- XkbSendControlsNotify(dev,&cn);
- }
- }
- return 1;
-}
-
-int
-XkbGetRepeatRate(DeviceIntPtr dev,int *timeout,int *interval)
-{
-XkbControlsPtr xkb;
-
- if ((!dev)||(!dev->key)||(!dev->key->xkbInfo))
- return 0;
- xkb= dev->key->xkbInfo->desc->ctrls;
- if (timeout) *timeout= xkb->repeat_delay;
- if (interval) *interval= xkb->repeat_interval;
- return 1;
-}
-
/***====================================================================***/
static int
@@ -2820,7 +2771,7 @@ ProcXkbGetIndicatorState(ClientPtr client)
/***====================================================================***/
-Status
+static Status
XkbComputeGetIndicatorMapReplySize(
XkbIndicatorPtr indicators,
xkbGetIndicatorMapReply *rep)
@@ -2837,7 +2788,7 @@ int nIndicators;
return Success;
}
-int
+static int
XkbSendIndicatorMap( ClientPtr client,
XkbIndicatorPtr indicators,
xkbGetIndicatorMapReply * rep)
diff --git a/xkb/xkb.h b/xkb/xkb.h
index 2be42582d..99b60bf5e 100644
--- a/xkb/xkb.h
+++ b/xkb/xkb.h
@@ -1,5 +1,3 @@
-/* $XFree86$ */
-
/* #include "XKBfile.h" */
extern int ProcXkbUseExtension(ClientPtr client);
@@ -29,50 +27,10 @@ extern int ProcXkbGetDeviceInfo(ClientPtr client);
extern int ProcXkbSetDeviceInfo(ClientPtr client);
extern int ProcXkbSetDebuggingFlags(ClientPtr client);
-extern int XkbSetRepeatRate(DeviceIntPtr dev, int timeout, int interval, int major, int minor);
-extern int XkbGetRepeatRate(DeviceIntPtr dev, int *timeout, int *interval);
-
extern void XkbExtensionInit(void);
-extern Status XkbComputeGetIndicatorMapReplySize(
- XkbIndicatorPtr indicators,
- xkbGetIndicatorMapReply *rep);
-extern int XkbSendIndicatorMap(
- ClientPtr client,
- XkbIndicatorPtr indicators,
- xkbGetIndicatorMapReply *rep);
-
-extern void XkbComputeCompatState(XkbSrvInfoPtr xkbi);
-extern void XkbSetPhysicalLockingKey(DeviceIntPtr dev, unsigned key);
-
extern Bool XkbFilterEvents(ClientPtr pClient, int nEvents, xEvent *xE);
-extern Bool XkbApplyLEDChangeToKeyboard(
- XkbSrvInfoPtr xkbi,
- XkbIndicatorMapPtr map,
- Bool on,
- XkbChangesPtr change);
-
-extern Bool XkbWriteRulesProp(ClientPtr client, pointer closure);
-
-extern XkbAction XkbGetButtonAction(DeviceIntPtr kbd, DeviceIntPtr dev, int button);
-
-/* extern Status XkbMergeFile(XkbDescPtr xkb, XkbFileInfo finfo); */
-
-extern Bool XkbDDXCompileNamedKeymap(
- XkbDescPtr xkb,
- XkbComponentNamesPtr names,
- char * nameRtrn,
- int nameRtrnLen);
-
-extern Bool XkbDDXCompileKeymapByNames(
- XkbDescPtr xkb,
- XkbComponentNamesPtr names,
- unsigned want,
- unsigned need,
- char * nameRtrn,
- int nameRtrnLen);
-
extern Bool XkbCopyKeymap(
XkbDescPtr src,
XkbDescPtr dst,
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 0ab3dadf6..2954a0c0e 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -38,7 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xproto.h>
#include <X11/keysym.h>
#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#if !defined(WIN32) && !defined(Lynx)
#include <sys/time.h>
#endif
@@ -52,9 +52,9 @@ pointer XkbLastRepeatEvent= NULL;
unsigned short XkbDfltAccessXTimeout= 120;
unsigned int XkbDfltAccessXTimeoutMask= DFLT_TIMEOUT_CTRLS;
-unsigned int XkbDfltAccessXTimeoutValues= 0;
-unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS;
-unsigned int XkbDfltAccessXTimeoutOptionsValues= 0;
+static unsigned int XkbDfltAccessXTimeoutValues= 0;
+static unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS;
+static unsigned int XkbDfltAccessXTimeoutOptionsValues= 0;
unsigned int XkbDfltAccessXFeedback= XkbAccessXFeedbackMask;
unsigned short XkbDfltAccessXOptions= XkbAX_AllOptionsMask & ~(XkbAX_IndicatorFBMask|XkbAX_SKReleaseFBMask|XkbAX_SKRejectFBMask);
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index e0bf89c7b..2e0c89fc2 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -36,14 +36,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/keysym.h>
#include "misc.h"
#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include "xkb.h"
#include <ctype.h>
static unsigned int _xkbServerGeneration;
-int xkbDevicePrivateIndex = -1;
+static int xkbDevicePrivateIndex = -1;
-void
+static void
xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc,
pointer data)
{
@@ -216,7 +216,7 @@ static XkbAction fake;
return fake;
}
-XkbAction
+static XkbAction
XkbGetButtonAction(DeviceIntPtr kbd,DeviceIntPtr dev,int button)
{
XkbAction fake;
diff --git a/xkb/xkbDflts.h b/xkb/xkbDflts.h
index e31568abb..5d8690650 100644
--- a/xkb/xkbDflts.h
+++ b/xkb/xkbDflts.h
@@ -456,43 +456,6 @@ static XkbCompatMapRec compatMap= {
num_dfltSI, num_dfltSI
};
-static XkbIndicatorRec indicators= {
- 0x0,
- {
- { 0x80, 0, 0x00, XkbIM_UseEffective, { LockMask, LockMask, 0 }, 0 },
- { 0x80, 0, 0x00, XkbIM_UseEffective, { 0, 0, vmod_NumLockMask }, 0 },
- { 0x80, 0, 0x00, XkbIM_UseLocked, { ShiftMask, ShiftMask, 0 }, 0 },
- { 0x80, 0, 0x00, 0, { 0, 0, 0 }, XkbMouseKeysMask },
- { 0x80, 0, 0x00, XkbIM_UseLocked, { 0, 0, vmod_ScrollLockMask }, 0 },
- { 0x80, XkbIM_UseEffective, 0xfe, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 },
- { 0x00, 0, 0x00, 0, { 0, 0, 0 }, 0 }
- }
-};
static void
initIndicatorNames(DPYTYPE dpy,XkbDescPtr xkb)
{
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index 139221f3f..11dc17ad3 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XI.h>
#include "inputstr.h"
#include "windowstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include "xkb.h"
/***====================================================================***/
@@ -331,7 +331,7 @@ Time time = 0;
return;
}
-void
+static void
XkbSendIndicatorNotify(DeviceIntPtr kbd,int xkbType,xkbIndicatorNotify *pEv)
{
int initialized;
@@ -972,48 +972,6 @@ XkbInterestPtr interest;
}
int
-XkbRemoveClient(DevicePtr inDev,ClientPtr client)
-{
-XkbSrvInfoPtr xkbi;
-DeviceIntPtr dev = (DeviceIntPtr)inDev;
-XkbInterestPtr interest;
-unsigned long autoCtrls,autoValues;
-Bool found;
-
- found= False;
- autoCtrls= autoValues= 0;
- if ( dev->xkb_interest ) {
- interest = dev->xkb_interest;
- if (interest && (interest->client==client)){
- dev->xkb_interest = interest->next;
- autoCtrls= interest->autoCtrls;
- autoValues= interest->autoCtrlValues;
- _XkbFree(interest);
- found= True;
- }
- while ((!found)&&(interest->next)) {
- if (interest->next->client==client) {
- XkbInterestPtr victim = interest->next;
- interest->next = victim->next;
- autoCtrls= victim->autoCtrls;
- autoValues= victim->autoCtrlValues;
- _XkbFree(victim);
- found= True;
- }
- interest = interest->next;
- }
- }
- if (found && autoCtrls && dev->key && dev->key->xkbInfo ) {
- XkbEventCauseRec cause;
-
- xkbi= dev->key->xkbInfo;
- XkbSetCauseXkbReq(&cause,X_kbPerClientFlags,client);
- XkbEnableDisableControls(xkbi,autoCtrls,autoValues,NULL,&cause);
- }
- return found;
-}
-
-int
XkbRemoveResourceClient(DevicePtr inDev,XID id)
{
XkbSrvInfoPtr xkbi;
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 5aa121da2..716bc26a5 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -47,7 +47,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "opaque.h"
#include "property.h"
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XKBgeom.h>
#include <X11/extensions/XKMformat.h>
#include <X11/extensions/XKBfile.h>
@@ -124,7 +124,7 @@ typedef struct _SrvXkmInfo {
char * XkbBaseDirectory= XKB_BASE_DIRECTORY;
char * XkbBinDirectory= XKB_BIN_DIRECTORY;
-int XkbWantAccessX= 0;
+static int XkbWantAccessX= 0;
static XkbFileInfo * _XkbInitFileInfo= NULL;
static Bool rulesDefined= False;
@@ -134,20 +134,17 @@ static char * XkbLayoutDflt= NULL;
static char * XkbVariantDflt= NULL;
static char * XkbOptionsDflt= NULL;
-char * XkbModelUsed= NULL;
-char * XkbLayoutUsed= NULL;
-char * XkbVariantUsed= NULL;
-char * XkbOptionsUsed= NULL;
-
-int _XkbClientMajor= XkbMajorVersion;
-int _XkbClientMinor= XkbMinorVersion;
+static char * XkbModelUsed= NULL;
+static char * XkbLayoutUsed= NULL;
+static char * XkbVariantUsed= NULL;
+static char * XkbOptionsUsed= NULL;
_X_EXPORT Bool noXkbExtension= XKB_DFLT_DISABLED;
-Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP;
+static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP;
/***====================================================================***/
-char *
+static char *
XkbGetRulesDflts(XkbRF_VarDefsPtr defs)
{
if (XkbModelDflt) defs->model= XkbModelDflt;
@@ -161,7 +158,7 @@ XkbGetRulesDflts(XkbRF_VarDefsPtr defs)
return (rulesDefined?XkbRulesFile:XKB_DFLT_RULES_FILE);
}
-Bool
+static Bool
XkbWriteRulesProp(ClientPtr client, pointer closure)
{
int len,out;
@@ -230,7 +227,7 @@ char * pval;
return True;
}
-void
+static void
XkbSetRulesUsed(XkbRF_VarDefsPtr defs)
{
if (XkbModelUsed)
@@ -289,9 +286,6 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout,
#include "xkbDflts.h"
-/* A dummy to keep the compiler quiet */
-pointer xkbBogus = &indicators;
-
static Bool
XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file)
{
diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index e94e0bff4..d607d9066 100644
--- a/xkb/xkbLEDs.c
+++ b/xkb/xkbLEDs.c
@@ -38,7 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include <X11/extensions/XI.h>
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include "xkb.h"
/***====================================================================***/
@@ -82,7 +82,7 @@ XkbSrvLedInfoPtr sli;
/*
* Bool
- * XkbApplyLEDChangeToKeyboard(xkbi,map,on,change)
+ *XkbApplyLEDChangeToKeyboard(xkbi,map,on,change)
*
* Some indicators "drive" the keyboard when their state is explicitly
* changed, as described in section 9.2.1 of the XKB protocol spec.
@@ -91,7 +91,7 @@ XkbSrvLedInfoPtr sli;
* when the indicator described by 'map' is turned on or off. The
* extent of the changes is reported in change, which must be defined.
*/
-Bool
+static Bool
XkbApplyLEDChangeToKeyboard( XkbSrvInfoPtr xkbi,
XkbIndicatorMapPtr map,
Bool on,
@@ -166,6 +166,164 @@ XkbStatePtr state;
}
return (stateChange || ctrlChange);
}
+
+ /*
+ * Bool
+ * ComputeAutoState(map,state,ctrls)
+ *
+ * This function reports the effect of applying the specified
+ * indicator map given the specified state and controls, as
+ * described in section 9.2 of the XKB protocol specification.
+ */
+
+static Bool
+ComputeAutoState( XkbIndicatorMapPtr map,
+ XkbStatePtr state,
+ XkbControlsPtr ctrls)
+{
+Bool on;
+CARD8 mods,group;
+
+ on= False;
+ mods= group= 0;
+ if (map->which_mods&XkbIM_UseAnyMods) {
+ if (map->which_mods&XkbIM_UseBase)
+ mods|= state->base_mods;
+ if (map->which_mods&XkbIM_UseLatched)
+ mods|= state->latched_mods;
+ if (map->which_mods&XkbIM_UseLocked)
+ mods|= state->locked_mods;
+ if (map->which_mods&XkbIM_UseEffective)
+ mods|= state->mods;
+ if (map->which_mods&XkbIM_UseCompat)
+ mods|= state->compat_state;
+ on = ((map->mods.mask&mods)!=0);
+ on = on||((mods==0)&&(map->mods.mask==0)&&(map->mods.vmods==0));
+ }
+ if (map->which_groups&XkbIM_UseAnyGroup) {
+ if (map->which_groups&XkbIM_UseBase)
+ group|= (1L << state->base_group);
+ if (map->which_groups&XkbIM_UseLatched)
+ group|= (1L << state->latched_group);
+ if (map->which_groups&XkbIM_UseLocked)
+ group|= (1L << state->locked_group);
+ if (map->which_groups&XkbIM_UseEffective)
+ group|= (1L << state->group);
+ on = on||(((map->groups&group)!=0)||(map->groups==0));
+ }
+ if (map->ctrls)
+ on = on||(ctrls->enabled_ctrls&map->ctrls);
+ return on;
+}
+
+
+static void
+XkbUpdateLedAutoState( DeviceIntPtr dev,
+ XkbSrvLedInfoPtr sli,
+ unsigned maps_to_check,
+ xkbExtensionDeviceNotify * ed,
+ XkbChangesPtr changes,
+ XkbEventCausePtr cause)
+{
+DeviceIntPtr kbd;
+XkbStatePtr state;
+XkbControlsPtr ctrls;
+XkbChangesRec my_changes;
+xkbExtensionDeviceNotify my_ed;
+register unsigned i,bit,affected;
+register XkbIndicatorMapPtr map;
+unsigned oldState;
+
+ if ((maps_to_check==0)||(sli->maps==NULL)||(sli->mapsPresent==0))
+ return;
+
+ if (dev->key && dev->key->xkbInfo)
+ kbd= dev;
+ else kbd= (DeviceIntPtr)LookupKeyboardDevice();
+
+ state= &kbd->key->xkbInfo->state;
+ ctrls= kbd->key->xkbInfo->desc->ctrls;
+ affected= maps_to_check;
+ oldState= sli->effectiveState;
+ sli->autoState&= ~affected;
+ for (i=0,bit=1;(i<XkbNumIndicators)&&(affected);i++,bit<<=1) {
+ if ((affected&bit)==0)
+ continue;
+ affected&= ~bit;
+ map= &sli->maps[i];
+ if((!(map->flags&XkbIM_NoAutomatic))&&ComputeAutoState(map,state,ctrls))
+ sli->autoState|= bit;
+ }
+ sli->effectiveState= (sli->autoState|sli->explicitState);
+ affected= sli->effectiveState^oldState;
+ if (affected==0)
+ return;
+
+ if (ed==NULL) {
+ ed= &my_ed;
+ bzero((char *)ed,sizeof(xkbExtensionDeviceNotify));
+ }
+ else if ((ed->reason&XkbXI_IndicatorsMask)&&
+ ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) {
+ XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause);
+ }
+
+ if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) {
+ if (changes==NULL) {
+ changes= &my_changes;
+ bzero((char *)changes,sizeof(XkbChangesRec));
+ }
+ changes->indicators.state_changes|= affected;
+ }
+
+ ed->reason|= XkbXI_IndicatorStateMask;
+ ed->ledClass= sli->class;
+ ed->ledID= sli->id;
+ ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
+ ed->ledState= sli->effectiveState;
+ ed->unsupported|= XkbXI_IndicatorStateMask;
+ ed->supported= XkbXI_AllFeaturesMask;
+
+ if (changes!=&my_changes) changes= NULL;
+ if (ed!=&my_ed) ed= NULL;
+ if (changes || ed)
+ XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause);
+ return;
+}
+
+static void
+XkbUpdateAllDeviceIndicators(XkbChangesPtr changes,XkbEventCausePtr cause)
+{
+DeviceIntPtr edev;
+XkbSrvLedInfoPtr sli;
+
+ for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) {
+ if (edev->kbdfeed) {
+ KbdFeedbackPtr kf;
+ for (kf=edev->kbdfeed;kf!=NULL;kf=kf->next) {
+ if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL))
+ continue;
+ sli= kf->xkb_sli;
+ XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL,
+ changes,cause);
+
+ }
+ }
+ if (edev->leds) {
+ LedFeedbackPtr lf;
+ for (lf=edev->leds;lf!=NULL;lf=lf->next) {
+ if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL))
+ continue;
+ sli= lf->xkb_sli;
+ XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL,
+ changes,cause);
+
+ }
+ }
+ }
+ return;
+}
+
/***====================================================================***/
@@ -228,55 +386,6 @@ unsigned side_affected;
/***====================================================================***/
- /*
- * Bool
- * ComputeAutoState(map,state,ctrls)
- *
- * This function reports the effect of applying the specified
- * indicator map given the specified state and controls, as
- * described in section 9.2 of the XKB protocol specification.
- */
-
-static Bool
-ComputeAutoState( XkbIndicatorMapPtr map,
- XkbStatePtr state,
- XkbControlsPtr ctrls)
-{
-Bool on;
-CARD8 mods,group;
-
- on= False;
- mods= group= 0;
- if (map->which_mods&XkbIM_UseAnyMods) {
- if (map->which_mods&XkbIM_UseBase)
- mods|= state->base_mods;
- if (map->which_mods&XkbIM_UseLatched)
- mods|= state->latched_mods;
- if (map->which_mods&XkbIM_UseLocked)
- mods|= state->locked_mods;
- if (map->which_mods&XkbIM_UseEffective)
- mods|= state->mods;
- if (map->which_mods&XkbIM_UseCompat)
- mods|= state->compat_state;
- on = ((map->mods.mask&mods)!=0);
- on = on||((mods==0)&&(map->mods.mask==0)&&(map->mods.vmods==0));
- }
- if (map->which_groups&XkbIM_UseAnyGroup) {
- if (map->which_groups&XkbIM_UseBase)
- group|= (1L << state->base_group);
- if (map->which_groups&XkbIM_UseLatched)
- group|= (1L << state->latched_group);
- if (map->which_groups&XkbIM_UseLocked)
- group|= (1L << state->locked_group);
- if (map->which_groups&XkbIM_UseEffective)
- group|= (1L << state->group);
- on = on||(((map->groups&group)!=0)||(map->groups==0));
- }
- if (map->ctrls)
- on = on||(ctrls->enabled_ctrls&map->ctrls);
- return on;
-}
-
/***====================================================================***/
/*
@@ -314,39 +423,6 @@ XkbSrvLedInfoPtr sli;
/***====================================================================***/
-void
-XkbUpdateAllDeviceIndicators(XkbChangesPtr changes,XkbEventCausePtr cause)
-{
-DeviceIntPtr edev;
-XkbSrvLedInfoPtr sli;
-
- for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) {
- if (edev->kbdfeed) {
- KbdFeedbackPtr kf;
- for (kf=edev->kbdfeed;kf!=NULL;kf=kf->next) {
- if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL))
- continue;
- sli= kf->xkb_sli;
- XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL,
- changes,cause);
-
- }
- }
- if (edev->leds) {
- LedFeedbackPtr lf;
- for (lf=edev->leds;lf!=NULL;lf=lf->next) {
- if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL))
- continue;
- sli= lf->xkb_sli;
- XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL,
- changes,cause);
-
- }
- }
- }
- return;
-}
-
/***====================================================================***/
/*
@@ -856,210 +932,3 @@ Bool kb_changed;
XkbUpdateAllDeviceIndicators(NULL,cause);
return;
}
-
-/***====================================================================***/
-
-void
-XkbUpdateLedAutoState( DeviceIntPtr dev,
- XkbSrvLedInfoPtr sli,
- unsigned maps_to_check,
- xkbExtensionDeviceNotify * ed,
- XkbChangesPtr changes,
- XkbEventCausePtr cause)
-{
-DeviceIntPtr kbd;
-XkbStatePtr state;
-XkbControlsPtr ctrls;
-XkbChangesRec my_changes;
-xkbExtensionDeviceNotify my_ed;
-register unsigned i,bit,affected;
-register XkbIndicatorMapPtr map;
-unsigned oldState;
-
- if ((maps_to_check==0)||(sli->maps==NULL)||(sli->mapsPresent==0))
- return;
-
- if (dev->key && dev->key->xkbInfo)
- kbd= dev;
- else kbd= (DeviceIntPtr)LookupKeyboardDevice();
-
- state= &kbd->key->xkbInfo->state;
- ctrls= kbd->key->xkbInfo->desc->ctrls;
- affected= maps_to_check;
- oldState= sli->effectiveState;
- sli->autoState&= ~affected;
- for (i=0,bit=1;(i<XkbNumIndicators)&&(affected);i++,bit<<=1) {
- if ((affected&bit)==0)
- continue;
- affected&= ~bit;
- map= &sli->maps[i];
- if((!(map->flags&XkbIM_NoAutomatic))&&ComputeAutoState(map,state,ctrls))
- sli->autoState|= bit;
- }
- sli->effectiveState= (sli->autoState|sli->explicitState);
- affected= sli->effectiveState^oldState;
- if (affected==0)
- return;
-
- if (ed==NULL) {
- ed= &my_ed;
- bzero((char *)ed,sizeof(xkbExtensionDeviceNotify));
- }
- else if ((ed->reason&XkbXI_IndicatorsMask)&&
- ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) {
- XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause);
- }
-
- if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) {
- if (changes==NULL) {
- changes= &my_changes;
- bzero((char *)changes,sizeof(XkbChangesRec));
- }
- changes->indicators.state_changes|= affected;
- }
-
- ed->reason|= XkbXI_IndicatorStateMask;
- ed->ledClass= sli->class;
- ed->ledID= sli->id;
- ed->ledsDefined= sli->namesPresent|sli->mapsPresent;
- ed->ledState= sli->effectiveState;
- ed->unsupported|= XkbXI_IndicatorStateMask;
- ed->supported= XkbXI_AllFeaturesMask;
-
- if (changes!=&my_changes) changes= NULL;
- if (ed!=&my_ed) ed= NULL;
- if (changes || ed)
- XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause);
- return;
-}
-
-/***====================================================================***/
-
-static void
-_UpdateButtonVMods( XkbDescPtr xkb,
- unsigned num_btns,
- XkbAction * acts,
- unsigned changed,
- xkbExtensionDeviceNotify * ed_inout)
-{
-register int i;
-
- for (i=0;i<num_btns;i++,acts++) {
- if ((acts->any.type!=XkbSA_NoAction)&&
- XkbUpdateActionVirtualMods(xkb,acts,changed)) {
- if ((ed_inout->reason&XkbXI_ButtonActionsMask)==0) {
- ed_inout->reason|= XkbXI_ButtonActionsMask;
- ed_inout->firstBtn= i;
- ed_inout->nBtns= 1;
- }
- else {
- ed_inout->nBtns= (i-ed_inout->firstBtn)+1;
- }
- }
- }
- return;
-}
-
-static void
-_UpdateMapVMods( XkbDescPtr xkb,
- register XkbIndicatorMapPtr map,
- unsigned changed_vmods,
- unsigned * changed_maps_rtrn)
-{
-register int i;
-
- *changed_maps_rtrn= 0;
- for (i=0;i<XkbNumIndicators;i++,map++) {
- if (map->mods.vmods&changed_vmods) {
- map->mods.mask= map->mods.real_mods;
- map->mods.mask|= XkbMaskForVMask(xkb,map->mods.vmods);
- *changed_maps_rtrn|= (1L<<i);
- }
- }
- return;
-}
-
-static void
-_UpdateDeviceVMods( DeviceIntPtr dev,
- XkbDescPtr xkb,
- unsigned changed,
- XkbEventCausePtr cause)
-{
-xkbExtensionDeviceNotify ed;
-XkbSrvLedInfoPtr sli;
-unsigned changed_maps;
-
- bzero((char *)&ed,sizeof(xkbExtensionDeviceNotify));
- ed.deviceID= dev->id;
- if ((dev->button)&&(dev->button->xkb_acts)) {
- _UpdateButtonVMods(xkb,dev->button->numButtons,
- dev->button->xkb_acts,changed,&ed);
- }
- if (dev->kbdfeed) {
- KbdFeedbackPtr kf;
- for (kf=dev->kbdfeed;kf!=NULL;kf=kf->next) {
- if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL))
- continue;
- sli= kf->xkb_sli;
- _UpdateMapVMods(xkb,sli->maps,changed,&changed_maps);
- if (changed_maps) {
- if (ed.reason&XkbXI_IndicatorsMask) {
- XkbSendExtensionDeviceNotify(dev,NULL,&ed);
- ed.reason= 0;
- ed.firstBtn= ed.nBtns;
- }
- ed.ledClass= sli->class;
- ed.ledID= sli->id;
- ed.ledsDefined= sli->namesPresent|sli->mapsPresent;
- ed.reason|= XkbXI_IndicatorMapsMask;
- XkbUpdateLedAutoState(dev,sli,changed_maps,&ed,NULL,cause);
- }
- }
- }
- if (dev->leds) {
- LedFeedbackPtr lf;
- for (lf=dev->leds;lf!=NULL;lf=lf->next) {
- if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL))
- continue;
- sli= lf->xkb_sli;
- _UpdateMapVMods(xkb,sli->maps,changed,&changed_maps);
- if (changed_maps) {
- if (ed.reason&XkbXI_IndicatorsMask) {
- XkbSendExtensionDeviceNotify(dev,NULL,&ed);
- ed.reason= 0;
- ed.firstBtn= ed.nBtns;
- }
- ed.ledClass= sli->class;
- ed.ledID= sli->id;
- ed.ledsDefined= sli->namesPresent|sli->mapsPresent;
- ed.reason|= XkbXI_IndicatorMapsMask;
- XkbUpdateLedAutoState(dev,sli,changed_maps,&ed,NULL,cause);
- }
- }
- }
- if (ed.reason!=0)
- XkbSendExtensionDeviceNotify(dev,NULL,&ed);
- return;
-}
-
-void
-XkbApplyVModChangesToAllDevices( DeviceIntPtr dev,
- XkbDescPtr xkb,
- unsigned changed,
- XkbEventCausePtr cause)
-{
-DeviceIntPtr edev;
- if (dev!=(DeviceIntPtr)LookupKeyboardDevice())
- return;
- for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) {
- if (edev->key)
- continue;
- _UpdateDeviceVMods(edev,xkb,changed,cause);
- }
- for (edev=inputInfo.off_devices;edev!=NULL;edev=edev->next) {
- if (edev->key)
- continue;
- _UpdateDeviceVMods(edev,xkb,changed,cause);
- }
- return;
-}
diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c
index 9944c8886..81124bcfb 100644
--- a/xkb/xkbPrKeyEv.c
+++ b/xkb/xkbPrKeyEv.c
@@ -36,7 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/keysym.h>
#include "misc.h"
#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <ctype.h>
diff --git a/xkb/xkbSwap.c b/xkb/xkbSwap.c
index 9a04b77d5..da4c9053b 100644
--- a/xkb/xkbSwap.c
+++ b/xkb/xkbSwap.c
@@ -35,7 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xproto.h>
#include "misc.h"
#include "inputstr.h"
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XKBstr.h>
#include "extnsionst.h"
#include "xkb.h"
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 062159ec6..bb6d8a0ae 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -41,7 +41,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XKBgeom.h>
#include "xkb.h"
@@ -172,44 +172,6 @@ register unsigned mask;
return mask;
}
-
-Bool
-XkbApplyVModChanges( XkbSrvInfoPtr xkbi,
- unsigned changed,
- XkbChangesPtr changes,
- unsigned * needChecksRtrn,
- XkbEventCausePtr cause)
-{
-XkbDescPtr xkb;
-Bool check;
-
- xkb= xkbi->desc;
-#ifdef DEBUG
-{
-register unsigned i,bit;
- for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) {
- if ((changed&bit)==0)
- continue;
- if (xkbDebugFlags)
- ErrorF("Should be applying: change vmod %d to 0x%x\n",i,
- xkb->server->vmods[i]);
- }
-}
-#endif
- check= XkbApplyVirtualModChanges(xkb,changed,changes);
- XkbApplyVModChangesToAllDevices(xkbi->device,xkb,changed,cause);
-
- if (needChecksRtrn!=NULL) {
- if (check)
- *needChecksRtrn= XkbStateNotifyMask|XkbIndicatorStateNotifyMask;
- else *needChecksRtrn= 0;
- }
- else if (check) {
- /* 7/12/95 (ef) -- XXX check compatibility and/or indicator state */
- }
- return 1;
-}
-
/***====================================================================***/
void
@@ -658,7 +620,7 @@ int changed;
return changed;
}
-void
+static void
XkbComputeCompatState(XkbSrvInfoPtr xkbi)
{
CARD16 grp_mask;
@@ -772,21 +734,6 @@ XkbCheckSecondaryEffects( XkbSrvInfoPtr xkbi,
/***====================================================================***/
-void
-XkbSetPhysicalLockingKey(DeviceIntPtr dev,unsigned key)
-{
-XkbDescPtr xkb;
-
- xkb= dev->key->xkbInfo->desc;
- if ((key>=xkb->min_key_code) && (key<=xkb->max_key_code)) {
- xkb->server->behaviors[key].type= XkbKB_Lock|XkbKB_Permanent;
- }
- else ErrorF("Internal Error! Bad XKB info in SetPhysicalLockingKey\n");
- return;
-}
-
-/***====================================================================***/
-
Bool
XkbEnableDisableControls( XkbSrvInfoPtr xkbi,
unsigned long change,
@@ -1193,6 +1140,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
dtype->preserve = NULL;
}
}
+
+ dst->map->size_types = src->map->num_types;
+ dst->map->num_types = src->map->num_types;
}
else {
if (dst->map->types) {
@@ -1208,9 +1158,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
xfree(dst->map->types);
dst->map->types = NULL;
}
+ dst->map->num_types = 0;
+ dst->map->size_types = 0;
}
- dst->map->size_types = src->map->num_types;
- dst->map->num_types = src->map->num_types;
if (src->map->modmap) {
if (src->max_key_code != dst->max_key_code) {
diff --git a/xkb/xkberrs.c b/xkb/xkberrs.c
index 095d573ea..3534356c6 100644
--- a/xkb/xkberrs.c
+++ b/xkb/xkberrs.c
@@ -32,37 +32,6 @@
#include <ctype.h>
#include <stdlib.h>
-char * _XkbErrMessages[] = {
- "success", /* _XkbSuccess */
- "key names not defined", /* _XkbErrMissingNames */
- "key types not defined", /* _XkbErrMissingTypes */
- "required key types not present", /* _XkbErrMissingReqTypes */
- "symbols not defined", /* _XkbErrMissingSymbols */
- "virtual modifier bindings not defined",/* _XkbErrMissingVMods */
- "indicators not defined", /* _XkbErrMissingIndicators */
- "compatibility map not defined", /* _XkbErrMissingCompatMap */
- "symbol interpretations not defined", /* _XkbErrMissingSymInterps */
- "geometry not defined", /* _XkbErrMissingGeometry */
- "illegal doodad type", /* _XkbErrIllegalDoodad */
- "illegal TOC type", /* _XkbErrIllegalTOCType */
- "illegal contents", /* _XkbErrIllegalContents */
- "empty file", /* _XkbErrEmptyFile */
- "file not found", /* _XkbErrFileNotFound */
- "cannot open", /* _XkbErrFileCannotOpen */
- "bad value", /* _XkbErrBadValue */
- "bad match", /* _XkbErrBadMatch */
- "illegal name for type", /* _XkbErrBadTypeName */
- "illegal width for type", /* _XkbErrBadTypeWidth */
- "bad file type", /* _XkbErrBadFileType */
- "bad file version", /* _XkbErrBadFileVersion */
- "error in Xkm file", /* _XkbErrBadFileFormat */
- "allocation failed", /* _XkbErrBadAlloc */
- "bad length", /* _XkbErrBadLength */
- "X request failed", /* _XkbErrXReqFailure */
- "not implemented" /* _XkbErrBadImplementation */
-};
-
unsigned _XkbErrCode;
char * _XkbErrLocation= NULL;
unsigned _XkbErrData;
-
diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c
index 4130bd998..05344b475 100644
--- a/xkb/xkbfmisc.c
+++ b/xkb/xkbfmisc.c
@@ -44,7 +44,7 @@
#include "dix.h"
#include <X11/extensions/XKBstr.h>
#define XKBSRV_NEED_FILE_FUNCS 1
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XKBgeom.h>
#include "xkb.h"
@@ -133,76 +133,6 @@ unsigned set,rtrn;
/***===================================================================***/
-Bool
-XkbLookupGroupAndLevel( XkbDescPtr xkb,
- int key,
- int * mods_inout,
- int * grp_inout,
- int * lvl_rtrn)
-{
-int nG,eG;
-
- if ((!xkb)||(!XkbKeycodeInRange(xkb,key))||(!grp_inout))
- return False;
-
- nG= XkbKeyNumGroups(xkb,key);
- eG= *grp_inout;
-
- if ( nG==0 ) {
- *grp_inout= 0;
- if (lvl_rtrn!=NULL)
- *lvl_rtrn= 0;
- return False;
- }
- else if ( nG==1 ) {
- eG= 0;
- }
- else if ( eG>=nG ) {
- unsigned gI= XkbKeyGroupInfo(xkb,key);
- switch (XkbOutOfRangeGroupAction(gI)) {
- default:
- eG %= nG;
- break;
- case XkbClampIntoRange:
- eG = nG-1;
- break;
- case XkbRedirectIntoRange:
- eG = XkbOutOfRangeGroupNumber(gI);
- if (eG>=nG)
- eG= 0;
- break;
- }
- }
- *grp_inout= eG;
- if (mods_inout!=NULL) {
- XkbKeyTypePtr type;
- int preserve;
-
- type = XkbKeyKeyType(xkb,key,eG);
- if (lvl_rtrn!=NULL)
- *lvl_rtrn= 0;
- preserve= 0;
- if (type->map) { /* find the shift level */
- register int i;
- register XkbKTMapEntryPtr entry;
- for (i=0,entry=type->map;i<type->map_count;i++,entry++) {
- if ((entry->active)&&
- (((*mods_inout)&type->mods.mask)==entry->mods.mask)){
- if (lvl_rtrn!=NULL)
- *lvl_rtrn= entry->level;
- if (type->preserve)
- preserve= type->preserve[i].mask;
- break;
- }
- }
- }
- (*mods_inout)&= ~(type->mods.mask&(~preserve));
- }
- return True;
-}
-
-/***===================================================================***/
-
static Bool
XkbWriteSectionFromName(FILE *file,char *sectionName,char *name)
{
@@ -416,15 +346,6 @@ XkbFileInfo finfo;
/***====================================================================***/
-/*ARGSUSED*/
-Status
-XkbMergeFile(XkbDescPtr xkb,XkbFileInfo finfo)
-{
- return BadImplementation;
-}
-
-/***====================================================================***/
-
int
XkbFindKeycodeByName(XkbDescPtr xkb,char *name,Bool use_aliases)
{
@@ -484,34 +405,6 @@ unsigned rtrn;
return rtrn;
}
-unsigned
-XkbConvertXkbComponents(Bool toXkm,unsigned orig)
-{
-unsigned rtrn;
-
- rtrn= 0;
- if (toXkm) {
- if (orig&XkbClientMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask;
- if (orig&XkbServerMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask;
- if (orig&XkbCompatMapMask) rtrn|= XkmCompatMapMask;
- if (orig&XkbIndicatorMapMask) rtrn|= XkmIndicatorsMask;
- if (orig&XkbNamesMask) rtrn|= XkmKeyNamesMask;
- if (orig&XkbGeometryMask) rtrn|= XkmGeometryMask;
- }
- else {
- if (orig!=0) rtrn|= XkbNamesMask;
- if (orig&XkmTypesMask) rtrn|= XkbClientMapMask;
- if (orig&XkmCompatMapMask)
- rtrn|= XkbCompatMapMask|XkbIndicatorMapMask;
- if (orig&XkmSymbolsMask) rtrn|=XkbClientMapMask|XkbServerMapMask;
- if (orig&XkmIndicatorsMask) rtrn|= XkbIndicatorMapMask;
- if (orig&XkmKeyNamesMask)
- rtrn|= XkbNamesMask|XkbIndicatorMapMask;
- if (orig&XkmGeometryMask) rtrn|= XkbGeometryMask;
- }
- return rtrn;
-}
-
Bool
XkbDetermineFileType(XkbFileInfoPtr finfo,int format,int *opts_missing)
{
diff --git a/xkb/xkbout.c b/xkb/xkbout.c
index 31cd4fae4..bdec8e7d3 100644
--- a/xkb/xkbout.c
+++ b/xkb/xkbout.c
@@ -44,7 +44,7 @@
#include "dix.h"
#include <X11/extensions/XKBstr.h>
#define XKBSRV_NEED_FILE_FUNCS 1
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XKBgeom.h>
#include <X11/extensions/XKBfile.h>
@@ -925,127 +925,3 @@ XkbGeometryPtr geom;
fprintf(file,"};\n\n");
return True;
}
-
-/*ARGSUSED*/
-Bool
-XkbWriteXKBSemantics( FILE * file,
- XkbFileInfo * result,
- Bool topLevel,
- Bool showImplicit,
- XkbFileAddOnFunc addOn,
- void * priv)
-{
-Bool ok;
-
- fprintf(file,"xkb_semantics {\n");
- ok= XkbWriteXKBKeyTypes(file,result,False,False,addOn,priv);
- ok= ok&&XkbWriteXKBCompatMap(file,result,False,False,addOn,priv);
- fprintf(file,"};\n");
- return ok;
-}
-
-/*ARGSUSED*/
-Bool
-XkbWriteXKBLayout( FILE * file,
- XkbFileInfo * result,
- Bool topLevel,
- Bool showImplicit,
- XkbFileAddOnFunc addOn,
- void * priv)
-{
-Bool ok;
-XkbDescPtr xkb;
-
- xkb= result->xkb;
- fprintf(file,"xkb_layout {\n");
- ok= XkbWriteXKBKeycodes(file,result,False,showImplicit,addOn,priv);
- ok= ok&&XkbWriteXKBKeyTypes(file,result,False,showImplicit,addOn,priv);
- ok= ok&&XkbWriteXKBSymbols(file,result,False,showImplicit,addOn,priv);
- if (xkb->geom)
- ok= ok&&XkbWriteXKBGeometry(file,result,False,showImplicit,addOn,priv);
- fprintf(file,"};\n");
- return ok;
-}
-
-/*ARGSUSED*/
-Bool
-XkbWriteXKBKeymap( FILE * file,
- XkbFileInfo * result,
- Bool topLevel,
- Bool showImplicit,
- XkbFileAddOnFunc addOn,
- void * priv)
-{
-Bool ok;
-XkbDescPtr xkb;
-
- xkb= result->xkb;
- fprintf(file,"xkb_keymap {\n");
- ok= XkbWriteXKBKeycodes(file,result,False,showImplicit,addOn,priv);
- ok= ok&&XkbWriteXKBKeyTypes(file,result,False,showImplicit,addOn,priv);
- ok= ok&&XkbWriteXKBCompatMap(file,result,False,showImplicit,addOn,priv);
- ok= ok&&XkbWriteXKBSymbols(file,result,False,showImplicit,addOn,priv);
- if (xkb->geom)
- ok= ok&&XkbWriteXKBGeometry(file,result,False,showImplicit,addOn,priv);
- fprintf(file,"};\n");
- return ok;
-}
-
-Bool
-XkbWriteXKBFile( FILE * out,
- XkbFileInfo * result,
- Bool showImplicit,
- XkbFileAddOnFunc addOn,
- void * priv)
-{
-Bool ok = False;
-Bool (*func)(
- FILE * /* file */,
- XkbFileInfo * /* result */,
- Bool /* topLevel */,
- Bool /* showImplicit */,
- XkbFileAddOnFunc /* addOn */,
- void * /* priv */
-) = NULL;
-
- switch (result->type) {
- case XkmSemanticsFile:
- func= XkbWriteXKBSemantics;
- break;
- case XkmLayoutFile:
- func= XkbWriteXKBLayout;
- break;
- case XkmKeymapFile:
- func= XkbWriteXKBKeymap;
- break;
- case XkmTypesIndex:
- func= XkbWriteXKBKeyTypes;
- break;
- case XkmCompatMapIndex:
- func= XkbWriteXKBCompatMap;
- break;
- case XkmSymbolsIndex:
- func= XkbWriteXKBSymbols;
- break;
- case XkmKeyNamesIndex:
- func= XkbWriteXKBKeycodes;
- break;
- case XkmGeometryFile:
- case XkmGeometryIndex:
- func= XkbWriteXKBGeometry;
- break;
- case XkmVirtualModsIndex:
- case XkmIndicatorsIndex:
- _XkbLibError(_XkbErrBadImplementation,
- XkbConfigText(result->type,XkbMessage),0);
- return False;
- }
- if (out==NULL) {
- _XkbLibError(_XkbErrFileCannotOpen,"XkbWriteXkbFile",0);
- ok= False;
- }
- else if (func) {
- ok= (*func)(out,result,True,showImplicit,addOn,priv);
- }
- return ok;
-}
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index defd45a64..3a5037150 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -44,7 +44,7 @@
#include "dix.h"
#include <X11/extensions/XKBstr.h>
#define XKBSRV_NEED_FILE_FUNCS 1
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XKBgeom.h>
/***====================================================================***/
@@ -448,100 +448,6 @@ char * buf;
return buf;
}
-char *
-XkbAccessXDetailText(unsigned state,unsigned format)
-{
-char *buf,*prefix;
-
- buf= tbGetBuffer(32);
- if (format==XkbMessage) prefix= "";
- else prefix= "XkbAXN_";
- switch (state){
- case XkbAXN_SKPress: sprintf(buf,"%sSKPress",prefix); break;
- case XkbAXN_SKAccept: sprintf(buf,"%sSKAccept",prefix); break;
- case XkbAXN_SKRelease: sprintf(buf,"%sSKRelease",prefix); break;
- case XkbAXN_SKReject: sprintf(buf,"%sSKReject",prefix); break;
- case XkbAXN_BKAccept: sprintf(buf,"%sBKAccept",prefix); break;
- case XkbAXN_BKReject: sprintf(buf,"%sBKReject",prefix); break;
- case XkbAXN_AXKWarning: sprintf(buf,"%sAXKWarning",prefix); break;
- default: sprintf(buf,"ILLEGAL"); break;
- }
- return buf;
-}
-
-static char *nknNames[] = {
- "keycodes", "geometry", "deviceID"
-};
-#define NUM_NKN (sizeof(nknNames)/sizeof(char *))
-
-char *
-XkbNKNDetailMaskText(unsigned detail,unsigned format)
-{
-char *buf,*prefix,*suffix;
-register int i;
-register unsigned bit;
-int len,plen,slen;
-
-
- if ((detail&XkbAllNewKeyboardEventsMask)==0) {
- char *tmp = "";
- if (format==XkbCFile) tmp= "0";
- else if (format==XkbMessage) tmp= "none";
- buf= tbGetBuffer(strlen(tmp)+1);
- strcpy(buf,tmp);
- return buf;
- }
- else if ((detail&XkbAllNewKeyboardEventsMask)==XkbAllNewKeyboardEventsMask){
- char * tmp;
- if (format==XkbCFile) tmp= "XkbAllNewKeyboardEventsMask";
- else tmp= "all";
- buf= tbGetBuffer(strlen(tmp)+1);
- strcpy(buf,tmp);
- return buf;
- }
- if (format==XkbMessage) {
- prefix= "";
- suffix= "";
- slen= plen= 0;
- }
- else {
- prefix= "XkbNKN_";
- plen= 7;
- if (format==XkbCFile)
- suffix= "Mask";
- else suffix= "";
- slen= strlen(suffix);
- }
- for (len=0,i=0,bit=1;i<NUM_NKN;i++,bit<<=1) {
- if (detail&bit) {
- if (len!=0) len+= 1; /* room for '+' or '|' */
- len+= plen+slen+strlen(nknNames[i]);
- }
- }
- buf= tbGetBuffer(len+1);
- buf[0]= '\0';
- for (len=0,i=0,bit=1;i<NUM_NKN;i++,bit<<=1) {
- if (detail&bit) {
- if (len!=0) {
- if (format==XkbCFile) buf[len++]= '|';
- else buf[len++]= '+';
- }
- if (plen) {
- strcpy(&buf[len],prefix);
- len+= plen;
- }
- strcpy(&buf[len],nknNames[i]);
- len+= strlen(nknNames[i]);
- if (slen) {
- strcpy(&buf[len],suffix);
- len+= slen;
- }
- }
- }
- buf[len++]= '\0';
- return buf;
-}
-
static char *ctrlNames[] = {
"repeatKeys",
"slowKeys",
diff --git a/xkb/xkmread.c b/xkb/xkmread.c
index fec86874f..c6c18422d 100644
--- a/xkb/xkmread.c
+++ b/xkb/xkmread.c
@@ -41,7 +41,7 @@
#include "inputstr.h"
#include <X11/extensions/XKBstr.h>
#define XKBSRV_NEED_FILE_FUNCS
-#include <X11/extensions/XKBsrv.h>
+#include <xkbsrv.h>
#include <X11/extensions/XKBgeom.h>
Atom
@@ -1098,18 +1098,6 @@ unsigned i,size_toc;
return 1;
}
-xkmSectionInfo *
-XkmFindTOCEntry(xkmFileInfo *finfo,xkmSectionInfo *toc,unsigned type)
-{
-register int i;
-
- for (i=0;i<finfo->num_toc;i++) {
- if (toc[i].type==type)
- return &toc[i];
- }
- return NULL;
-}
-
Bool
XkmReadFileSection( FILE * file,
xkmSectionInfo * toc,