summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xext/EVI.c10
-rw-r--r--Xext/appgroup.c18
-rw-r--r--Xext/bigreq.c18
-rw-r--r--Xext/cup.c17
-rw-r--r--Xext/dpms.c88
-rw-r--r--Xext/dpmsstubs.c8
-rw-r--r--Xext/mbuf.c558
-rw-r--r--Xext/mbufbf.c1
-rw-r--r--Xext/mbufpx.c1
-rw-r--r--Xext/mitmisc.c24
-rw-r--r--Xext/panoramiX.c1301
-rw-r--r--Xext/panoramiXSwap.c89
-rw-r--r--Xext/panoramiXprocs.c3996
-rw-r--r--Xext/security.c25
-rw-r--r--Xext/shape.c370
-rw-r--r--Xext/shm.c719
-rw-r--r--Xext/sleepuntil.c48
-rw-r--r--Xext/sync.c298
-rw-r--r--Xext/xcmisc.c32
-rw-r--r--Xext/xprint.c578
-rw-r--r--Xext/xtest.c52
-rw-r--r--Xext/xtest1dd.c127
-rw-r--r--Xext/xtest1di.c87
-rw-r--r--Xi/allowev.c12
-rw-r--r--Xi/chgdctl.c18
-rw-r--r--Xi/chgfctl.c48
-rw-r--r--Xi/chgkbd.c24
-rw-r--r--Xi/chgkmap.c13
-rw-r--r--Xi/chgprop.c13
-rw-r--r--Xi/chgptr.c30
-rw-r--r--Xi/closedev.c16
-rw-r--r--Xi/devbell.c12
-rw-r--r--Xi/exevents.c253
-rw-r--r--Xi/extinit.c189
-rw-r--r--Xi/getbmap.c11
-rw-r--r--Xi/getdctl.c16
-rw-r--r--Xi/getfctl.c21
-rw-r--r--Xi/getfocus.c10
-rw-r--r--Xi/getkmap.c15
-rw-r--r--Xi/getmmap.c11
-rw-r--r--Xi/getprop.c26
-rw-r--r--Xi/getselev.c23
-rw-r--r--Xi/getvers.c11
-rw-r--r--Xi/grabdev.c15
-rw-r--r--Xi/grabdevb.c13
-rw-r--r--Xi/grabdevk.c13
-rw-r--r--Xi/gtmotion.c15
-rw-r--r--Xi/listdev.c28
-rw-r--r--Xi/opendev.c16
-rw-r--r--Xi/queryst.c15
-rw-r--r--Xi/selectev.c13
-rw-r--r--Xi/sendexev.c20
-rw-r--r--Xi/setbmap.c15
-rw-r--r--Xi/setdval.c13
-rw-r--r--Xi/setfocus.c13
-rw-r--r--Xi/setmmap.c15
-rw-r--r--Xi/setmode.c13
-rw-r--r--Xi/stubs.c18
-rw-r--r--Xi/ungrdev.c9
-rw-r--r--Xi/ungrdevb.c12
-rw-r--r--Xi/ungrdevk.c12
-rw-r--r--XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias1
-rw-r--r--XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias1
-rw-r--r--Xprint/AttrValid.c12
-rw-r--r--Xprint/AttrValid.h15
-rw-r--r--Xprint/DiPrint.h21
-rw-r--r--Xprint/Init.c259
-rw-r--r--Xprint/Oid.c26
-rw-r--r--Xprint/Oid.h3
-rw-r--r--Xprint/OidStrs.h260
-rw-r--r--Xprint/Util.c84
-rw-r--r--Xprint/attributes.c238
-rw-r--r--Xprint/attributes.h54
-rw-r--r--Xprint/ddxInit.c177
-rw-r--r--Xprint/mediaSizes.c28
-rw-r--r--Xprint/pcl/Pcl.h115
-rw-r--r--Xprint/pcl/PclArc.c56
-rw-r--r--Xprint/pcl/PclArea.c129
-rw-r--r--Xprint/pcl/PclColor.c36
-rw-r--r--Xprint/pcl/PclCursor.c53
-rw-r--r--Xprint/pcl/PclGC.c146
-rw-r--r--Xprint/pcl/PclInit.c111
-rw-r--r--Xprint/pcl/PclLine.c96
-rw-r--r--Xprint/pcl/PclMisc.c11
-rw-r--r--Xprint/pcl/PclPixel.c7
-rw-r--r--Xprint/pcl/PclPixmap.c11
-rw-r--r--Xprint/pcl/PclPolygon.c141
-rw-r--r--Xprint/pcl/PclPrint.c80
-rw-r--r--Xprint/pcl/PclSFonts.c12
-rw-r--r--Xprint/pcl/PclSpans.c61
-rw-r--r--Xprint/pcl/PclText.c134
-rw-r--r--Xprint/pcl/PclWindow.c14
-rw-r--r--Xprint/pcl/Pclmap.h214
-rw-r--r--Xprint/ps/Ps.h56
-rw-r--r--Xprint/ps/PsArea.c138
-rw-r--r--Xprint/ps/PsAttVal.c11
-rw-r--r--Xprint/ps/PsAttr.c2
-rw-r--r--Xprint/ps/PsCache.c194
-rw-r--r--Xprint/ps/PsColor.c2
-rw-r--r--Xprint/ps/PsFonts.c9
-rw-r--r--Xprint/ps/PsGC.c6
-rw-r--r--Xprint/ps/PsInit.c61
-rw-r--r--Xprint/ps/PsLine.c1
-rw-r--r--Xprint/ps/PsMisc.c1
-rw-r--r--Xprint/ps/PsPixel.c1
-rw-r--r--Xprint/ps/PsPixmap.c12
-rw-r--r--Xprint/ps/PsPolygon.c3
-rw-r--r--Xprint/ps/PsPrint.c7
-rw-r--r--Xprint/ps/PsSpans.c12
-rw-r--r--Xprint/ps/PsText.c7
-rw-r--r--Xprint/ps/PsWindow.c14
-rw-r--r--Xprint/ps/psout.c43
-rw-r--r--Xprint/ps/psout.h15
-rw-r--r--Xprint/raster/Raster.c103
-rw-r--r--Xprint/raster/Raster.h25
-rw-r--r--Xprint/raster/RasterAttVal.c6
-rw-r--r--cfb/cfb.h443
-rw-r--r--cfb/cfb8bit.c15
-rw-r--r--cfb/cfb8bit.h394
-rw-r--r--cfb/cfb8line.c619
-rw-r--r--cfb/cfballpriv.c16
-rw-r--r--cfb/cfbbitblt.c465
-rw-r--r--cfb/cfbblt.c349
-rw-r--r--cfb/cfbbres.c113
-rw-r--r--cfb/cfbbresd.c152
-rw-r--r--cfb/cfbbstore.c14
-rw-r--r--cfb/cfbcmap.c548
-rw-r--r--cfb/cfbfillarc.c117
-rw-r--r--cfb/cfbfillrct.c31
-rw-r--r--cfb/cfbfillsp.c143
-rw-r--r--cfb/cfbgc.c30
-rw-r--r--cfb/cfbgetsp.c61
-rw-r--r--cfb/cfbglblt8.c87
-rw-r--r--cfb/cfbhrzvert.c387
-rw-r--r--cfb/cfbigblt8.c21
-rw-r--r--cfb/cfbimage.c24
-rw-r--r--cfb/cfbline.c28
-rw-r--r--cfb/cfbmap.h392
-rw-r--r--cfb/cfbmskbits.c188
-rw-r--r--cfb/cfbmskbits.h277
-rw-r--r--cfb/cfbpixmap.c27
-rw-r--r--cfb/cfbply1rct.c70
-rw-r--r--cfb/cfbpntwin.c426
-rw-r--r--cfb/cfbpolypnt.c62
-rw-r--r--cfb/cfbpush8.c18
-rw-r--r--cfb/cfbrctstp8.c79
-rw-r--r--cfb/cfbrrop.c10
-rw-r--r--cfb/cfbrrop.h201
-rw-r--r--cfb/cfbscrinit.c51
-rw-r--r--cfb/cfbsetsp.c36
-rw-r--r--cfb/cfbsolid.c1089
-rw-r--r--cfb/cfbteblt8.c31
-rw-r--r--cfb/cfbtegblt.c37
-rw-r--r--cfb/cfbtile32.c181
-rw-r--r--cfb/cfbtileodd.c255
-rw-r--r--cfb/cfbzerarc.c99
-rw-r--r--cfb/stip68kgnu.h161
-rw-r--r--cfb/stipsparc.s3
-rw-r--r--cfb/stipsprc32.s3
-rw-r--r--dbe/dbe.c28
-rw-r--r--dbe/midbe.c21
-rw-r--r--dix/atom.c7
-rw-r--r--dix/buildatoms7
-rw-r--r--dix/colormap.c41
-rw-r--r--dix/cursor.c70
-rw-r--r--dix/devices.c190
-rw-r--r--dix/dispatch.c496
-rw-r--r--dix/dixfonts.c351
-rw-r--r--dix/dixutils.c69
-rw-r--r--dix/events.c1174
-rw-r--r--dix/extension.c44
-rw-r--r--dix/gc.c54
-rw-r--r--dix/globals.c25
-rw-r--r--dix/grabs.c52
-rw-r--r--dix/initatoms.c5
-rw-r--r--dix/main.c295
-rw-r--r--dix/pixmap.c7
-rw-r--r--dix/privates.c101
-rw-r--r--dix/property.c26
-rw-r--r--dix/resource.c160
-rw-r--r--dix/swaprep.c60
-rw-r--r--dix/swapreq.c10
-rw-r--r--dix/tables.c402
-rw-r--r--dix/window.c339
-rw-r--r--dix/xpstubs.c2
-rw-r--r--doc/Xserver.man.pre271
-rw-r--r--hw/vfb/InitInput.c7
-rw-r--r--hw/vfb/InitOutput.c129
-rw-r--r--hw/vfb/Xvfb.man.pre11
-rw-r--r--hw/xfree86/common/atKeynames.h159
-rw-r--r--hw/xfree86/common/compiler.h2367
-rw-r--r--hw/xfree86/common/xf86.h1080
-rw-r--r--hw/xfree86/common/xf86Config.c5588
-rw-r--r--hw/xfree86/common/xf86Cursor.c750
-rw-r--r--hw/xfree86/common/xf86Events.c1655
-rw-r--r--hw/xfree86/common/xf86Init.c1804
-rw-r--r--hw/xfree86/common/xf86Io.c304
-rw-r--r--hw/xfree86/common/xf86Kbd.c111
-rw-r--r--hw/xfree86/common/xf86KbdBSD.c896
-rw-r--r--hw/xfree86/common/xf86KbdLnx.c142
-rw-r--r--hw/xfree86/common/xf86KbdMach.c9
-rw-r--r--hw/xfree86/common/xf86Keymap.h356
-rw-r--r--hw/xfree86/common/xf86Priv.h321
-rw-r--r--hw/xfree86/common/xf86Version.h38
-rw-r--r--hw/xfree86/common/xf86XKB.c79
-rw-r--r--hw/xfree86/common/xf86Xinput.c1150
-rw-r--r--hw/xfree86/common/xf86Xinput.h379
-rw-r--r--hw/xfree86/dixmods/extmod/xf86vmode.c1952
-rw-r--r--hw/xfree86/os-support/README.OS-lib157
-rw-r--r--hw/xfree86/os-support/assyntax.h6
-rw-r--r--hw/xfree86/os-support/bsd/bsd_VTsw.c20
-rw-r--r--hw/xfree86/os-support/bsd/bsd_init.c354
-rw-r--r--hw/xfree86/os-support/bsd/bsd_io.c204
-rw-r--r--hw/xfree86/os-support/bsd/bsd_jstk.c53
-rw-r--r--hw/xfree86/os-support/linux/lnx_init.c119
-rw-r--r--hw/xfree86/os-support/linux/lnx_io.c225
-rw-r--r--hw/xfree86/os-support/linux/lnx_jstk.c77
-rw-r--r--hw/xfree86/os-support/linux/lnx_video.c1370
-rw-r--r--hw/xfree86/os-support/lynxos/lynx_init.c45
-rw-r--r--hw/xfree86/os-support/lynxos/lynx_io.c78
-rw-r--r--hw/xfree86/os-support/lynxos/lynx_mmap.c25
-rw-r--r--hw/xfree86/os-support/lynxos/lynx_video.c597
-rw-r--r--hw/xfree86/os-support/misc/xf86_IlHack.c5
-rw-r--r--hw/xfree86/os-support/misc/xf86_Util.c64
-rw-r--r--hw/xfree86/os-support/sco/VTsw_sco.c110
-rw-r--r--hw/xfree86/os-support/sco/sco_init.c503
-rw-r--r--hw/xfree86/os-support/sco/sco_io.c328
-rw-r--r--hw/xfree86/os-support/sco/sco_mouse.c384
-rw-r--r--hw/xfree86/os-support/sco/sco_video.c457
-rw-r--r--hw/xfree86/os-support/shared/VTsw_noop.c15
-rw-r--r--hw/xfree86/os-support/shared/VTsw_usl.c23
-rw-r--r--hw/xfree86/os-support/shared/bios_devmem.c96
-rw-r--r--hw/xfree86/os-support/shared/ioperm_noop.c35
-rw-r--r--hw/xfree86/os-support/shared/posix_tty.c820
-rw-r--r--hw/xfree86/os-support/shared/std_kbdEv.c17
-rw-r--r--hw/xfree86/os-support/shared/sysv_kbd.c33
-rw-r--r--hw/xfree86/os-support/sysv/sysv_init.c59
-rw-r--r--hw/xfree86/os-support/sysv/sysv_io.c50
-rw-r--r--hw/xfree86/os-support/sysv/sysv_video.c574
-rw-r--r--hw/xfree86/os-support/sysv/xqueue.c606
-rw-r--r--hw/xfree86/os-support/xf86_OSlib.h526
-rw-r--r--hw/xfree86/os-support/xf86_OSproc.h522
-rw-r--r--hw/xfree86/utils/kbd_mode/bsd-kbd_mode.c5
-rw-r--r--hw/xfree86/utils/kbd_mode/bsd-kbd_mode.man.pre6
-rw-r--r--hw/xfree86/utils/kbd_mode/sun-kbd_mode.c12
-rw-r--r--hw/xfree86/utils/kbd_mode/sun-kbd_mode.man.pre5
-rw-r--r--hw/xfree86/utils/scanpci/scanpci.c2355
-rw-r--r--hw/xfree86/utils/xorgconfig/Cards1439
-rw-r--r--hw/xfree86/utils/xorgconfig/cards.c59
-rw-r--r--hw/xfree86/utils/xorgconfig/cards.h14
-rw-r--r--hw/xnest/Color.c2
-rw-r--r--hw/xnest/Cursor.c4
-rw-r--r--hw/xnest/Display.c9
-rw-r--r--hw/xnest/Display.h3
-rw-r--r--hw/xnest/Drawable.h3
-rw-r--r--hw/xnest/Events.c5
-rw-r--r--hw/xnest/Font.c2
-rw-r--r--hw/xnest/GC.c12
-rw-r--r--hw/xnest/GCOps.c2
-rw-r--r--hw/xnest/Handlers.c3
-rw-r--r--hw/xnest/Init.c40
-rw-r--r--hw/xnest/Keyboard.c135
-rw-r--r--hw/xnest/Pixmap.c16
-rw-r--r--hw/xnest/Screen.c56
-rw-r--r--hw/xnest/TestExt.c9
-rw-r--r--hw/xnest/Window.c14
-rw-r--r--hw/xnest/Xnest.h5
-rw-r--r--hw/xnest/Xnest.man.pre5
-rw-r--r--include/closestr.h29
-rw-r--r--include/colormap.h4
-rw-r--r--include/cursor.h34
-rw-r--r--include/cursorstr.h6
-rw-r--r--include/dix.h141
-rw-r--r--include/dixfont.h356
-rw-r--r--include/dixstruct.h63
-rw-r--r--include/extension.h4
-rw-r--r--include/extnsionst.h35
-rw-r--r--include/gc.h3
-rw-r--r--include/gcstruct.h15
-rw-r--r--include/input.h39
-rw-r--r--include/inputstr.h3
-rw-r--r--include/misc.h69
-rw-r--r--include/miscstruct.h8
-rw-r--r--include/opaque.h38
-rw-r--r--include/os.h216
-rw-r--r--include/property.h5
-rw-r--r--include/propertyst.h4
-rw-r--r--include/regionstr.h31
-rw-r--r--include/resource.h78
-rw-r--r--include/screenint.h8
-rw-r--r--include/scrnintstr.h93
-rw-r--r--include/servermd.h288
-rw-r--r--include/site.h10
-rw-r--r--include/validate.h3
-rw-r--r--include/window.h12
-rw-r--r--include/windowstr.h1
-rw-r--r--lbx/lbxcmap.c152
-rw-r--r--lbx/lbxdix.c124
-rw-r--r--lbx/lbxexts.c63
-rw-r--r--lbx/lbxgfx.c121
-rw-r--r--lbx/lbxmain.c279
-rw-r--r--lbx/lbxopts.c221
-rw-r--r--lbx/lbxprop.c53
-rw-r--r--lbx/lbxserve.h204
-rw-r--r--lbx/lbxsquish.c6
-rw-r--r--lbx/lbxsrvopts.h43
-rw-r--r--lbx/lbxswap.c138
-rw-r--r--lbx/lbxtables.c8
-rw-r--r--lbx/lbxtags.c59
-rw-r--r--lbx/lbxtags.h57
-rw-r--r--lbx/lbxzerorep.c8
-rw-r--r--mfb/fastblt.h26
-rw-r--r--mfb/maskbits.c8868
-rw-r--r--mfb/maskbits.h85
-rw-r--r--mfb/mergerop.h247
-rw-r--r--mfb/mfb.h90
-rw-r--r--mfb/mfbbitblt.c14
-rw-r--r--mfb/mfbblt.c20
-rw-r--r--mfb/mfbbres.c3
-rw-r--r--mfb/mfbbresd.c3
-rw-r--r--mfb/mfbclip.c4
-rw-r--r--mfb/mfbcmap.c52
-rw-r--r--mfb/mfbfillarc.c3
-rw-r--r--mfb/mfbfillrct.c8
-rw-r--r--mfb/mfbfillsp.c66
-rw-r--r--mfb/mfbgc.c43
-rw-r--r--mfb/mfbgetsp.c5
-rw-r--r--mfb/mfbhrzvert.c3
-rw-r--r--mfb/mfbimage.c6
-rw-r--r--mfb/mfbimggblt.c35
-rw-r--r--mfb/mfbline.c11
-rw-r--r--mfb/mfbply1rct.c32
-rw-r--r--mfb/mfbplygblt.c14
-rw-r--r--mfb/mfbpolypnt.c5
-rw-r--r--mfb/mfbpushpxl.c8
-rw-r--r--mfb/mfbscrclse.c3
-rw-r--r--mfb/mfbscrinit.c51
-rw-r--r--mfb/mfbsetsp.c6
-rw-r--r--mfb/mfbtegblt.c95
-rw-r--r--mfb/mfbtile.c3
-rw-r--r--mfb/mfbzerarc.c7
-rw-r--r--mi/cbrt.c17
-rw-r--r--mi/mi.h177
-rw-r--r--mi/miarc.c562
-rw-r--r--mi/mibitblt.c61
-rw-r--r--mi/mibstore.c266
-rw-r--r--mi/mibstore.h42
-rw-r--r--mi/mibstorest.h6
-rw-r--r--mi/miclipn.c21
-rw-r--r--mi/micursor.c2
-rw-r--r--mi/midash.c11
-rw-r--r--mi/midispcur.c262
-rw-r--r--mi/mieq.c7
-rw-r--r--mi/miexpose.c56
-rw-r--r--mi/mifillarc.c57
-rw-r--r--mi/mifillarc.h17
-rw-r--r--mi/mifillrct.c3
-rw-r--r--mi/mifpoly.h11
-rw-r--r--mi/mifpolycon.c25
-rw-r--r--mi/migc.c82
-rw-r--r--mi/migc.h41
-rw-r--r--mi/miglblt.c13
-rw-r--r--mi/miinitext.c385
-rw-r--r--mi/miline.h15
-rw-r--r--mi/mipointer.c77
-rw-r--r--mi/mipointer.h98
-rw-r--r--mi/mipointrst.h6
-rw-r--r--mi/mipoly.h13
-rw-r--r--mi/mipolycon.c41
-rw-r--r--mi/mipolygen.c2
-rw-r--r--mi/mipolypnt.c2
-rw-r--r--mi/mipolyrect.c2
-rw-r--r--mi/mipolyseg.c2
-rw-r--r--mi/mipolytext.c2
-rw-r--r--mi/mipolyutil.c5
-rw-r--r--mi/mipushpxl.c90
-rw-r--r--mi/miregion.c323
-rw-r--r--mi/miscrinit.c149
-rw-r--r--mi/mispans.c31
-rw-r--r--mi/mispans.h17
-rw-r--r--mi/misprite.c415
-rw-r--r--mi/misprite.h17
-rw-r--r--mi/mispritest.h8
-rw-r--r--mi/mivaltree.c124
-rw-r--r--mi/miwideline.c217
-rw-r--r--mi/miwideline.h40
-rw-r--r--mi/miwindow.c88
-rw-r--r--mi/mizerarc.c21
-rw-r--r--mi/mizerarc.h5
-rw-r--r--mi/mizerline.c590
-rw-r--r--os/WaitFor.c182
-rw-r--r--os/access.c569
-rw-r--r--os/auth.c189
-rw-r--r--os/connection.c310
-rw-r--r--os/io.c163
-rw-r--r--os/k5auth.c3
-rw-r--r--os/lbxio.c42
-rw-r--r--os/mitauth.c54
-rw-r--r--os/oscolor.c32
-rw-r--r--os/osdep.h189
-rw-r--r--os/osinit.c42
-rw-r--r--os/rpcauth.c41
-rw-r--r--os/secauth.c30
-rw-r--r--os/utils.c1179
-rw-r--r--os/xdmauth.c9
-rw-r--r--os/xdmcp.c377
-rw-r--r--record/record.c76
-rw-r--r--record/set.c12
-rw-r--r--xkb/XKBAlloc.c1
-rw-r--r--xkb/XKBGAlloc.c1
-rw-r--r--xkb/XKBMAlloc.c1
-rw-r--r--xkb/XKBMisc.c18
-rw-r--r--xkb/ddxBeep.c29
-rw-r--r--xkb/ddxConfig.c10
-rw-r--r--xkb/ddxCtrls.c14
-rw-r--r--xkb/ddxDevBtn.c3
-rw-r--r--xkb/ddxFakeMtn.c92
-rw-r--r--xkb/ddxKillSrv.c9
-rw-r--r--xkb/ddxList.c21
-rw-r--r--xkb/ddxLoad.c107
-rw-r--r--xkb/ddxVT.c21
-rw-r--r--xkb/maprules.c664
-rw-r--r--xkb/xkb.c67
-rw-r--r--xkb/xkbAccessX.c16
-rw-r--r--xkb/xkbActions.c104
-rw-r--r--xkb/xkbDflts.h203
-rw-r--r--xkb/xkbEvents.c75
-rw-r--r--xkb/xkbInit.c181
-rw-r--r--xkb/xkbLEDs.c18
-rw-r--r--xkb/xkbPrKeyEv.c55
-rw-r--r--xkb/xkbSwap.c7
-rw-r--r--xkb/xkbUtils.c19
-rw-r--r--xkb/xkbconfig.c151
-rw-r--r--xkb/xkberrs.c6
-rw-r--r--xkb/xkbfmisc.c78
-rw-r--r--xkb/xkbout.c18
-rw-r--r--xkb/xkbtext.c15
-rw-r--r--xkb/xkmread.c13
438 files changed, 42560 insertions, 37392 deletions
diff --git a/Xext/EVI.c b/Xext/EVI.c
index 8ccc31af2..aa3734b02 100644
--- a/Xext/EVI.c
+++ b/Xext/EVI.c
@@ -21,6 +21,8 @@ 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.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/EVI.c,v 3.9 2001/10/28 03:32:50 tsi Exp $ */
+
#include "X.h"
#include "Xproto.h"
#include "dixstruct.h"
@@ -34,7 +36,7 @@ static EviPrivPtr eviPriv;
static int
ProcEVIQueryVersion(ClientPtr client)
{
- REQUEST(xEVIQueryVersionReq);
+ /* REQUEST(xEVIQueryVersionReq); */
xEVIQueryVersionReply rep;
register int n;
REQUEST_SIZE_MATCH (xEVIQueryVersionReq);
@@ -167,11 +169,11 @@ EVIResetProc(ExtensionEntry *extEntry)
void
EVIExtensionInit(void)
{
- ExtensionEntry *extEntry, *AddExtension();
- if (extEntry = AddExtension(EVINAME, 0, 0,
+ ExtensionEntry *extEntry;
+ if ((extEntry = AddExtension(EVINAME, 0, 0,
ProcEVIDispatch,
SProcEVIDispatch,
- EVIResetProc, StandardMinorOpcode))
+ EVIResetProc, StandardMinorOpcode)))
{
XEVIReqCode = (unsigned char)extEntry->base;
eviPriv = eviDDXInit();
diff --git a/Xext/appgroup.c b/Xext/appgroup.c
index 71e74da38..37e6ee0bc 100644
--- a/Xext/appgroup.c
+++ b/Xext/appgroup.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/appgroup.c,v 1.9 2001/12/17 20:52:25 dawes Exp $ */
/*
Copyright 1996, 1998, 2001 The Open Group
@@ -74,9 +75,9 @@ static int XagCallbackRefCount = 0;
static RESTYPE RT_APPGROUP;
static AppGroupPtr appGrpList = NULL;
-extern WindowPtr* WindowTable;
extern xConnSetupPrefix connSetupPrefix;
extern char* ConnectionInfo;
+extern int connBlockScreenStart;
static
int XagAppGroupFree (what, id)
@@ -121,7 +122,7 @@ void XagClientStateChange (pcbl, nulldata, calldata)
NewClientInfoRec* pci = (NewClientInfoRec*) calldata;
ClientPtr pClient = pci->client;
AppGroupPtr pAppGrp;
- XID authId;
+ XID authId = 0;
if (!pClient->appgroup) {
switch (pClient->clientState) {
@@ -220,13 +221,13 @@ XagExtensionInit ()
{
ExtensionEntry* extEntry;
- if (extEntry = AddExtension (XAGNAME,
+ if ((extEntry = AddExtension (XAGNAME,
0,
XagNumberErrors,
ProcXagDispatch,
SProcXagDispatch,
XagResetProc,
- StandardMinorOpcode)) {
+ StandardMinorOpcode))) {
XagReqCode = (unsigned char)extEntry->base;
XagErrorBase = extEntry->errorBase;
RT_APPGROUP = CreateNewResourceType (XagAppGroupFree);
@@ -247,7 +248,7 @@ static
int ProcXagQueryVersion (client)
register ClientPtr client;
{
- REQUEST (xXagQueryVersionReq);
+ /* REQUEST (xXagQueryVersionReq); */
xXagQueryVersionReply rep;
register int n;
@@ -309,8 +310,6 @@ static
void CreateConnectionInfo (pAppGrp)
AppGroupPtr pAppGrp;
{
- extern int connBlockScreenStart;
- xConnSetup *setup = (xConnSetup*) ConnectionInfo;
xWindowRoot* rootp;
xWindowRoot* roots[MAXSCREENS];
unsigned int rootlens[MAXSCREENS];
@@ -376,7 +375,6 @@ AppGroupPtr CreateAppGroup (client, appgroupId, attrib_mask, attribs)
CARD32* attribs;
{
AppGroupPtr pAppGrp;
- int i;
pAppGrp = (AppGroupPtr) xalloc (sizeof(AppGroupRec));
if (pAppGrp) {
@@ -570,7 +568,7 @@ int ProcXagCreateAssoc (client)
if (stuff->window_type != XagWindowTypeX11)
#endif
return BadMatch;
-#ifdef WIN32 /* and Mac, etc */
+#if defined(WIN32) || defined(__CYGWIN__) /* and Mac, etc */
if (!LocalClient (client))
return BadAccess;
#endif
@@ -584,7 +582,7 @@ static
int ProcXagDestroyAssoc (client)
register ClientPtr client;
{
- REQUEST (xXagDestroyAssocReq);
+ /* REQUEST (xXagDestroyAssocReq); */
REQUEST_SIZE_MATCH (xXagDestroyAssocReq);
/* Macintosh, OS/2, and MS-Windows servers have some work to do here */
diff --git a/Xext/bigreq.c b/Xext/bigreq.c
index 4f4bf5c02..0d2dc5178 100644
--- a/Xext/bigreq.c
+++ b/Xext/bigreq.c
@@ -26,7 +26,9 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/Xext/bigreq.c,v 3.5 2001/12/14 19:58:48 dawes Exp $ */
+#define NEED_EVENTS
#include "X.h"
#include "Xproto.h"
#include "misc.h"
@@ -36,17 +38,23 @@ from The Open Group.
#include "bigreqstr.h"
static unsigned char XBigReqCode;
-static int ProcBigReqDispatch();
-static void BigReqResetProc();
+
+static void BigReqResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+
+static DISPATCH_PROC(ProcBigReqDispatch);
void
BigReqExtensionInit()
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
- if (extEntry = AddExtension(XBigReqExtensionName, 0, 0,
+ if ((extEntry = AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch,
- BigReqResetProc, StandardMinorOpcode))
+ BigReqResetProc, StandardMinorOpcode)) != 0)
XBigReqCode = (unsigned char)extEntry->base;
DeclareExtensionSecurity(XBigReqExtensionName, TRUE);
}
diff --git a/Xext/cup.c b/Xext/cup.c
index 4e8cf66b4..2159417bb 100644
--- a/Xext/cup.c
+++ b/Xext/cup.c
@@ -24,6 +24,7 @@ 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/Xext/cup.c,v 1.10 2001/12/14 19:58:48 dawes Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
@@ -35,11 +36,16 @@ in this Software without prior written authorization from The Open Group.
#include "colormapst.h"
#include "scrnintstr.h"
#include "servermd.h"
+#include "swapreq.h"
#define _XCUP_SERVER_
#include "Xcupstr.h"
#include "Xfuncproto.h"
+#ifndef EXTMODULE
#include "../os/osdep.h"
+#else
+#include "xf86_ansic.h"
+#endif
static int ProcDispatch (), SProcDispatch ();
static void ResetProc ();
@@ -121,13 +127,13 @@ XcupExtensionInit ()
{
ExtensionEntry* extEntry;
- if (extEntry = AddExtension (XCUPNAME,
+ if ((extEntry = AddExtension (XCUPNAME,
0,
XcupNumberErrors,
ProcDispatch,
SProcDispatch,
ResetProc,
- StandardMinorOpcode)) {
+ StandardMinorOpcode))) {
ReqCode = (unsigned char)extEntry->base;
ErrorBase = extEntry->errorBase;
}
@@ -146,7 +152,7 @@ static
int ProcQueryVersion (client)
register ClientPtr client;
{
- REQUEST (xXcupQueryVersionReq);
+ /* REQUEST (xXcupQueryVersionReq); */
xXcupQueryVersionReply rep;
register int n;
@@ -214,7 +220,6 @@ int ProcStoreColors (client)
int ncolors, n;
xXcupStoreColorsReply rep;
xColorItem* cptr;
- Pixel pixel;
if (!(pcmp->class & DynamicClass))
return BadMatch;
@@ -302,7 +307,7 @@ int SProcGetReservedColormapEntries (client)
}
static
-int SProcStoreColors (client)
+int SProcXcupStoreColors (client)
ClientPtr client;
{
register int n;
@@ -331,7 +336,7 @@ int SProcDispatch (client)
case X_XcupGetReservedColormapEntries:
return SProcGetReservedColormapEntries (client);
case X_XcupStoreColors:
- return SProcStoreColors (client);
+ return SProcXcupStoreColors (client);
default:
return BadRequest;
}
diff --git a/Xext/dpms.c b/Xext/dpms.c
index ebc992dc2..23c377fb4 100644
--- a/Xext/dpms.c
+++ b/Xext/dpms.c
@@ -27,43 +27,55 @@ Equipment Corporation.
******************************************************************/
+/*
+ * HISTORY
+ *
+ * @(#)RCSfile: dpms.c,v Revision: 1.1.4.5 (DEC) Date: 1996/03/04 15:27:00
+ */
+
+/* $XFree86: xc/programs/Xserver/Xext/dpms.c,v 3.9 2001/10/28 03:32:50 tsi Exp $ */
+
#include "X.h"
#include "Xproto.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
+#include "opaque.h"
+#define DPMS_SERVER
#include "dpms.h"
#include "dpmsstr.h"
-#include <stdio.h>
+#include "dpmsproc.h"
static unsigned char DPMSCode;
-static int ProcDPMSDispatch(), SProcDPMSDispatch();
-static void DPMSResetProc();
-static int ProcDPMSGetVersion(), SProcDPMSGetVersion();
-static int ProcDPMSGetTimeouts(), SProcDPMSGetTimeouts();
-static int ProcDPMSSetTimeouts(), ProcDPMSSetTimeouts();
-static int ProcDPMSEnable(), ProcDPMSEnable();
-static int ProcDPMSDisable(), ProcDPMSDisable();
-static int ProcDPMSForceLevel(), ProcDPMSForceLevel();
-
-extern void Swap32Write(); /* XXX should be in header file */
-extern CARD32 ScreenSaverTime;
-extern CARD32 DPMSStandbyTime;
-extern CARD32 DPMSSuspendTime;
-extern CARD32 DPMSOffTime;
-extern BOOL DPMSCapableFlag;
-extern BOOL DPMSEnabled;
-extern CARD16 DPMSPowerLevel;
+static DISPATCH_PROC(ProcDPMSDispatch);
+static DISPATCH_PROC(SProcDPMSDispatch);
+static DISPATCH_PROC(ProcDPMSGetVersion);
+static DISPATCH_PROC(SProcDPMSGetVersion);
+static DISPATCH_PROC(ProcDPMSGetTimeouts);
+static DISPATCH_PROC(SProcDPMSGetTimeouts);
+static DISPATCH_PROC(ProcDPMSSetTimeouts);
+static DISPATCH_PROC(SProcDPMSSetTimeouts);
+static DISPATCH_PROC(ProcDPMSEnable);
+static DISPATCH_PROC(SProcDPMSEnable);
+static DISPATCH_PROC(ProcDPMSDisable);
+static DISPATCH_PROC(SProcDPMSDisable);
+static DISPATCH_PROC(ProcDPMSForceLevel);
+static DISPATCH_PROC(SProcDPMSForceLevel);
+static DISPATCH_PROC(ProcDPMSInfo);
+static DISPATCH_PROC(SProcDPMSInfo);
+static DISPATCH_PROC(ProcDPMSCapable);
+static DISPATCH_PROC(SProcDPMSCapable);
+static void DPMSResetProc(ExtensionEntry* extEntry);
void
DPMSExtensionInit()
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
- if (extEntry = AddExtension(DPMSExtensionName, 0, 0,
+ if ((extEntry = AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
- DPMSResetProc, StandardMinorOpcode))
+ DPMSResetProc, StandardMinorOpcode)))
DPMSCode = (unsigned char)extEntry->base;
return;
}
@@ -79,7 +91,7 @@ static int
ProcDPMSGetVersion(client)
register ClientPtr client;
{
- REQUEST(xDPMSGetVersionReq);
+ /* REQUEST(xDPMSGetVersionReq); */
xDPMSGetVersionReply rep;
register int n;
@@ -100,10 +112,9 @@ ProcDPMSGetVersion(client)
}
static int
-ProcDPMSCapable(client)
- register ClientPtr client;
+ProcDPMSCapable(register ClientPtr client)
{
- REQUEST(xDPMSCapableReq);
+ /* REQUEST(xDPMSCapableReq); */
xDPMSCapableReply rep;
register int n;
@@ -114,6 +125,9 @@ ProcDPMSCapable(client)
rep.sequenceNumber = client->sequence;
rep.capable = DPMSCapableFlag;
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber, n);
+ }
WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep);
return(client->noClientException);
}
@@ -122,7 +136,7 @@ static int
ProcDPMSGetTimeouts(client)
register ClientPtr client;
{
- REQUEST(xDPMSGetTimeoutsReq);
+ /* REQUEST(xDPMSGetTimeoutsReq); */
xDPMSGetTimeoutsReply rep;
register int n;
@@ -150,7 +164,6 @@ ProcDPMSSetTimeouts(client)
register ClientPtr client;
{
REQUEST(xDPMSSetTimeoutsReq);
- register int n;
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
@@ -176,7 +189,7 @@ static int
ProcDPMSEnable(client)
register ClientPtr client;
{
- REQUEST(xDPMSEnableReq);
+ /* REQUEST(xDPMSEnableReq); */
REQUEST_SIZE_MATCH(xDPMSEnableReq);
@@ -190,13 +203,11 @@ static int
ProcDPMSDisable(client)
register ClientPtr client;
{
- REQUEST(xDPMSDisableReq);
+ /* REQUEST(xDPMSDisableReq); */
REQUEST_SIZE_MATCH(xDPMSDisableReq);
-#ifdef DPMSExtension
DPMSSet(DPMSModeOn);
-#endif
DPMSEnabled = FALSE;
@@ -217,9 +228,7 @@ ProcDPMSForceLevel(client)
if (stuff->level == DPMSModeOn) {
lastDeviceEventTime.milliseconds =
GetTimeInMillis();
- }
-#if 0
- else if (stuff->level == DPMSModeStandby) {
+ } else if (stuff->level == DPMSModeStandby) {
lastDeviceEventTime.milliseconds =
GetTimeInMillis() - DPMSStandbyTime;
} else if (stuff->level == DPMSModeSuspend) {
@@ -232,20 +241,16 @@ ProcDPMSForceLevel(client)
client->errorValue = stuff->level;
return BadValue;
}
-#endif
-#ifdef DPMSExtension
DPMSSet(stuff->level);
-#endif
return(client->noClientException);
}
static int
-ProcDPMSInfo(client)
- register ClientPtr client;
+ProcDPMSInfo(register ClientPtr client)
{
- REQUEST(xDPMSInfoReq);
+ /* REQUEST(xDPMSInfoReq); */
xDPMSInfoReply rep;
register int n;
@@ -309,8 +314,7 @@ SProcDPMSGetVersion(client)
}
static int
-SProcDPMSCapable(client)
- register ClientPtr client;
+SProcDPMSCapable(register ClientPtr client)
{
REQUEST(xDPMSCapableReq);
register int n;
diff --git a/Xext/dpmsstubs.c b/Xext/dpmsstubs.c
index 6f635f42b..ac1ee352a 100644
--- a/Xext/dpmsstubs.c
+++ b/Xext/dpmsstubs.c
@@ -26,23 +26,23 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/dpmsstubs.c,v 3.4 2001/01/17 22:13:15 dawes Exp $ */
typedef int Bool;
#define FALSE 0
-Bool DPMSSupported()
+Bool DPMSSupported(void)
{
return FALSE;
}
-int DPSMGet(level)
- int *level;
+int DPSMGet(int *level)
{
return -1;
}
-void DPMSSet(level)
+void DPMSSet(int level)
{
}
diff --git a/Xext/mbuf.c b/Xext/mbuf.c
index c65ed3dd2..16a59e58e 100644
--- a/Xext/mbuf.c
+++ b/Xext/mbuf.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/mbuf.c,v 3.14 2001/12/14 19:58:49 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -27,29 +28,29 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: mbuf.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
-#include <stdio.h>
#include "X.h"
#include "Xproto.h"
-#include "misc.h"
+#include "window.h"
#include "os.h"
#include "windowstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
+#include "gcstruct.h"
#include "extnsionst.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
+#include "sleepuntil.h"
#define _MULTIBUF_SERVER_ /* don't want Xlib structures */
#include "multibufst.h"
-#include "regionstr.h"
-#include "gcstruct.h"
-#include "inputstr.h"
-#ifndef WIN32
+
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#else
+#include <stdio.h>
+#if !defined(WIN32) && !defined(Lynx)
#include <sys/time.h>
#endif
-
-#ifdef PANORAMIX
-#include "panoramiX.h"
#endif
/* given an OtherClientPtr obj, get the ClientPtr */
@@ -60,121 +61,99 @@ in this Software without prior written authorization from The Open Group.
#define ValidEventMasks (ExposureMask|MultibufferClobberNotifyMask|MultibufferUpdateNotifyMask)
-#ifdef PANORAMIX
-extern int PanoramiXNumScreens;
-extern Bool noPanoramiXExtension;
-extern PanoramiXWindow *PanoramiXWinRoot;
-extern PanoramiXPmap *PanoramiXPmapRoot;
-extern PanoramiXData *panoramiXdataPtr;
-#endif
-
-/* The _Multibuffer and _Multibuffers structures below refer to each other,
- * so we need this forward declaration
- */
-
-typedef struct _Multibuffers *MultibuffersPtr;
-
-/*
- * per-Multibuffer data
- */
-
-typedef struct _Multibuffer {
- MultibuffersPtr pMultibuffers; /* associated window data */
- Mask eventMask; /* MultibufferClobberNotifyMask|ExposureMask|MultibufferUpdateNotifyMask */
- Mask otherEventMask; /* mask of all other clients event masks */
- OtherClients *otherClients; /* other clients that want events */
- int number; /* index of this buffer into array */
- int side; /* always Mono */
- int clobber; /* Unclobbered, PartiallyClobbered, FullClobbered */
- PixmapPtr pPixmap; /* associated pixmap */
-} MultibufferRec, *MultibufferPtr;
-
-/*
- * per-window data
- */
-
-typedef struct _Multibuffers {
- WindowPtr pWindow; /* associated window */
- int numMultibuffer; /* count of buffers */
- int refcnt; /* ref count for delete */
- int displayedMultibuffer; /* currently active buffer */
- int updateAction; /* Undefined, Background, Untouched, Copied */
- int updateHint; /* Frequent, Intermittent, Static */
- int windowMode; /* always Mono */
-
- TimeStamp lastUpdate; /* time of last update */
-
- unsigned short width, height; /* last known window size */
- short x, y; /* for static gravity */
-
- MultibufferPtr buffers; /* array of numMultibuffer buffers */
-} MultibuffersRec;
-
-/*
- * per-screen data
- */
-typedef struct _MultibufferScreen {
- Bool (*PositionWindow)();
-} MultibufferScreenRec, *MultibufferScreenPtr;
-
-/*
- * per display-image-buffers request data.
- */
-
-typedef struct _DisplayRequest {
- struct _DisplayRequest *next;
- TimeStamp activateTime;
- ClientPtr pClient;
- XID id;
-} DisplayRequestRec, *DisplayRequestPtr;
-
static unsigned char MultibufferReqCode;
static int MultibufferEventBase;
static int MultibufferErrorBase;
int MultibufferScreenIndex = -1;
int MultibufferWindowIndex = -1;
-static void PerformDisplayRequest ();
-static void DisposeDisplayRequest ();
-static Bool QueueDisplayRequest ();
-
-static void BumpTimeStamp ();
+static void PerformDisplayRequest (
+#if NeedFunctionPrototypes
+ MultibuffersPtr * /* ppMultibuffers */,
+ MultibufferPtr * /* pMultibuffer */,
+ int /* nbuf */
+#endif
+ );
+static Bool QueueDisplayRequest (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ TimeStamp /* activateTime */
+#endif
+ );
-void MultibufferExpose ();
-void MultibufferUpdate ();
-static void AliasMultibuffer ();
-int CreateImageBuffers ();
-void DestroyImageBuffers ();
-int DisplayImageBuffers ();
-static void RecalculateMultibufferOtherEvents ();
-static int EventSelectForMultibuffer();
+static void BumpTimeStamp (
+#if NeedFunctionPrototypes
+ TimeStamp * /* ts */,
+ CARD32 /* inc */
+#endif
+ );
+static void AliasMultibuffer (
+#if NeedFunctionPrototypes
+ MultibuffersPtr /* pMultibuffers */,
+ int /* i */
+#endif
+ );
+static void RecalculateMultibufferOtherEvents (
+#if NeedFunctionPrototypes
+ MultibufferPtr /* pMultibuffer */
+#endif
+ );
+static int EventSelectForMultibuffer(
+#if NeedFunctionPrototypes
+ MultibufferPtr /* pMultibuffer */,
+ ClientPtr /* client */,
+ Mask /* mask */
+#endif
+ );
/*
* The Pixmap associated with a buffer can be found as a resource
* with this type
*/
RESTYPE MultibufferDrawableResType;
-static int MultibufferDrawableDelete ();
+static int MultibufferDrawableDelete (
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
/*
* The per-buffer data can be found as a resource with this type.
* the resource id of the per-buffer data is the same as the resource
* id of the pixmap
*/
static RESTYPE MultibufferResType;
-static int MultibufferDelete ();
+static int MultibufferDelete (
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
+
/*
* The per-window data can be found as a resource with this type,
* using the window resource id
*/
static RESTYPE MultibuffersResType;
-static int MultibuffersDelete ();
+static int MultibuffersDelete (
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
+
/*
* Clients other than the buffer creator attach event masks in
* OtherClient structures; each has a resource of this type.
*/
static RESTYPE OtherClientResType;
-static int OtherClientDelete ();
+static int OtherClientDelete (
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
/****************
* MultibufferExtensionInit
@@ -183,10 +162,70 @@ static int OtherClientDelete ();
*
****************/
-static int ProcMultibufferDispatch(), SProcMultibufferDispatch();
-static void MultibufferResetProc();
-static void SClobberNotifyEvent(), SUpdateNotifyEvent();
-static Bool MultibufferPositionWindow();
+extern DISPATCH_PROC(ProcGetBufferAttributes);
+
+static DISPATCH_PROC(ProcClearImageBufferArea);
+static DISPATCH_PROC(ProcCreateImageBuffers);
+static DISPATCH_PROC(ProcDestroyImageBuffers);
+static DISPATCH_PROC(ProcDisplayImageBuffers);
+static DISPATCH_PROC(ProcGetBufferInfo);
+static DISPATCH_PROC(ProcGetBufferVersion);
+static DISPATCH_PROC(ProcGetMBufferAttributes);
+static DISPATCH_PROC(ProcMultibufferDispatch);
+static DISPATCH_PROC(ProcSetBufferAttributes);
+static DISPATCH_PROC(ProcSetMBufferAttributes);
+static DISPATCH_PROC(SProcClearImageBufferArea);
+static DISPATCH_PROC(SProcCreateImageBuffers);
+static DISPATCH_PROC(SProcDestroyImageBuffers);
+static DISPATCH_PROC(SProcDisplayImageBuffers);
+static DISPATCH_PROC(SProcGetBufferAttributes);
+static DISPATCH_PROC(SProcGetBufferInfo);
+static DISPATCH_PROC(SProcGetBufferVersion);
+static DISPATCH_PROC(SProcGetMBufferAttributes);
+static DISPATCH_PROC(SProcMultibufferDispatch);
+static DISPATCH_PROC(SProcSetBufferAttributes);
+static DISPATCH_PROC(SProcSetMBufferAttributes);
+
+static void MultibufferResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+ );
+static void SClobberNotifyEvent(
+#if NeedFunctionPrototypes
+ xMbufClobberNotifyEvent * /* from */,
+ xMbufClobberNotifyEvent * /* to */
+# endif
+ );
+static void SUpdateNotifyEvent(
+#if NeedFunctionPrototypes
+ xMbufUpdateNotifyEvent * /* from */,
+ xMbufUpdateNotifyEvent * /* to */
+#endif
+ );
+static Bool MultibufferPositionWindow(
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */,
+ int /* x */,
+ int /* y */
+#endif
+ );
+
+static void SetupBackgroundPainter (
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */,
+ GCPtr /* pGC */
+#endif
+ );
+
+static int DeliverEventsToMultibuffer (
+#if NeedFunctionPrototypes
+ MultibufferPtr /* pMultibuffer */,
+ xEvent * /* pEvents */,
+ int /* count */,
+ Mask /* filter */
+#endif
+ );
void
MultibufferExtensionInit()
@@ -243,8 +282,8 @@ MultibufferExtensionInit()
MultibufferReqCode = (unsigned char)extEntry->base;
MultibufferEventBase = extEntry->eventBase;
MultibufferErrorBase = extEntry->errorBase;
- EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = SClobberNotifyEvent;
- EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = SUpdateNotifyEvent;
+ EventSwapVector[MultibufferEventBase + MultibufferClobberNotify] = (EventSwapPtr) SClobberNotifyEvent;
+ EventSwapVector[MultibufferEventBase + MultibufferUpdateNotify] = (EventSwapPtr) SUpdateNotifyEvent;
}
}
@@ -275,7 +314,6 @@ static int
ProcGetBufferVersion (client)
register ClientPtr client;
{
- REQUEST(xMbufGetBufferVersionReq);
xMbufGetBufferVersionReply rep;
register int n;
@@ -331,8 +369,8 @@ SetupBackgroundPainter (pWin, pGC)
case BackgroundPixmap:
gcvalues[0] = (pointer) FillTiled;
gcvalues[1] = (pointer) background.pixmap;
- gcvalues[2] = (pointer) ts_x_origin;
- gcvalues[3] = (pointer) ts_y_origin;
+ gcvalues[2] = (pointer)(long) ts_x_origin;
+ gcvalues[3] = (pointer)(long) ts_y_origin;
gcmask = GCFillStyle|GCTile|GCTileStipXOrigin|GCTileStipYOrigin;
break;
@@ -430,80 +468,8 @@ CreateImageBuffers (pWin, nbuf, ids, action, hint)
return Success;
}
-#ifdef PANORAMIX
-static int
-ProcPanoramiXCreateImageBuffers (client)
- register ClientPtr client;
-{
- REQUEST(xMbufCreateImageBuffersReq);
-
- register int result;
- int i, j, k, len;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXWindow *next;
- PanoramiXWindow *pPanoramiXids;
- PanoramiXWindow *pPanoramiXPrev_ids;
- PanoramiXPmap *local;
- PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
- CARD32 *value, *orig_ids;
- XID *ids;
- XID ID;
- DrawablePtr pDrawable;
-
- REQUEST_AT_LEAST_SIZE (xMbufCreateImageBuffersReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->window);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- len = stuff->length - (sizeof(xMbufCreateImageBuffersReq) >> 2);
- ids = (XID *)ALLOCATE_LOCAL(sizeof(XID)*len);
- orig_ids = (XID *)ALLOCATE_LOCAL(sizeof(XID)*len);
- if (!ids)
- return BadAlloc;
- memcpy((char *)orig_ids, (char *) &stuff[1], len * sizeof(XID));
- value = (CARD32 *)&stuff[1];
- /* New resources are pixmaps */
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->window = pPanoramiXWin->info[j].id;
- for (i = 0; i < len; i++) {
- ids[i] = (XID)orig_ids[i];
- /* These will be MultibufferDrawableResType & MultibufferResType */
- pPanoramiXPmap = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXPmap, ids[i]);
- if (!pPanoramiXPmap) {
- local = (PanoramiXWindow *)Xcalloc(sizeof(PanoramiXWindow));
- for (k = 0; k <= PanoramiXNumScreens - 1; k++) {
- ID = k ? FakeClientID(client->index) : ids[i];
- local->info[k].id = ID;
- }
- local->FreeMe = FALSE;
- PANORAMIXFIND_LAST(pPanoramiXPmap, PanoramiXPmapRoot);
- pPanoramiXPmap->next = local;
- value[i] = local->info[j].id;
- }else
- value[i] = pPanoramiXPmap->info[j].id;
- }
- if (!j)
- noPanoramiXExtension = TRUE;
- result = ProcCreateImageBuffers (client);
- noPanoramiXExtension = FALSE;
- BREAK_IF(result != Success);
- }
- if (result != Success) {
- if (ids)
- Xfree(ids);
- if (orig_ids)
- Xfree(orig_ids);
- if (local)
- Xfree(local);
- }
- return (result);
-}
-#endif
-#ifdef PANORAMIX
-int
-#else
static int
-#endif
ProcCreateImageBuffers (client)
register ClientPtr client;
{
@@ -565,10 +531,7 @@ ProcCreateImageBuffers (client)
swapl(&rep.length, n);
swaps(&rep.numberBuffer, n);
}
-#ifdef PANORAMIX
- if (noPanoramiXExtension)
-#endif
- WriteToClient(client, sizeof (xMbufCreateImageBuffersReply), (char*)&rep);
+ WriteToClient(client, sizeof (xMbufCreateImageBuffersReply), (char*)&rep);
return (client->noClientException);
}
@@ -585,16 +548,6 @@ ProcDisplayImageBuffers (client)
CARD32 minDelay;
TimeStamp activateTime, bufferTime;
-#ifdef PANORAMIX
- WindowPtr pWndw;
- PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
- MultibufferPtr *pScrn0Multibuffer;
- MultibuffersPtr *ppScrn0Multibuffers;
- int k;
- int panoramiX_buf = 0;
- Bool FoundScreen;
-
-#endif
REQUEST_AT_LEAST_SIZE (xMbufDisplayImageBuffersReq);
nbuf = stuff->length - (sizeof (xMbufDisplayImageBuffersReq) >> 2);
@@ -602,23 +555,6 @@ ProcDisplayImageBuffers (client)
return Success;
minDelay = stuff->minDelay;
ids = (XID *) &stuff[1];
-#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- {
- int maxbuf = 0;
- maxbuf = nbuf * PanoramiXNumScreens;
- ppScrn0Multibuffers = (MultibuffersPtr *) xalloc(maxbuf * sizeof (MultibuffersPtr));
- pScrn0Multibuffer = (MultibufferPtr *) xalloc (maxbuf * sizeof(MultibufferPtr));
- if (!ppScrn0Multibuffers || !pScrn0Multibuffer)
- {
- if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
- xfree (ppScrn0Multibuffers);
- xfree (pScrn0Multibuffer);
- client->errorValue = 0;
- return BadAlloc;
- }
- }
-#endif
ppMultibuffers = (MultibuffersPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibuffersPtr));
pMultibuffer = (MultibufferPtr *) ALLOCATE_LOCAL(nbuf * sizeof (MultibufferPtr));
if (!ppMultibuffers || !pMultibuffer)
@@ -632,81 +568,6 @@ ProcDisplayImageBuffers (client)
activateTime.milliseconds = 0;
for (i = 0; i < nbuf; i++)
{
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- pPanoramiXPmap = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXPmap, ids[i]);
- if (!pPanoramiXPmap){
- if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
- xfree (ppMultibuffers);
- xfree (pMultibuffer);
- client->errorValue = ids[i];
- return MultibufferErrorBase + MultibufferBadBuffer;
- }
- FoundScreen = FALSE;
- pScrn0Multibuffer[panoramiX_buf] = (MultibufferPtr)
- LookupIDByType (ids[i], MultibufferResType);
- ppScrn0Multibuffers[i] = pScrn0Multibuffer[i]->pMultibuffers;
- pWndw = ppScrn0Multibuffers[i]->pWindow;
- for (k = 0; (k < PanoramiXNumScreens && !FoundScreen); k++) {
- pMultibuffer[panoramiX_buf] = (MultibufferPtr)
- LookupIDByType (pPanoramiXPmap->info[k].id, MultibufferResType);
- if (!pMultibuffer[i])
- {
- if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
- xfree (ppMultibuffers);
- xfree (pMultibuffer);
- client->errorValue = ids[i];
- return MultibufferErrorBase + MultibufferBadBuffer;
- }
- ppMultibuffers[panoramiX_buf] = pMultibuffer[panoramiX_buf]->pMultibuffers;
- /* Figure out where the buffer resides, which screens */
- if ( ((pWndw->drawable.x < 0) &&
- (pWndw->drawable.x + pWndw->drawable.width < 0))
- || ( (pWndw->drawable.x >
- panoramiXdataPtr[k].x + panoramiXdataPtr[k].width) &&
- (pWndw->drawable.x + pWndw->drawable.width >
- panoramiXdataPtr[k].x + panoramiXdataPtr[k].width)))
- /* its not on screen - k -, try next screen */
- continue;
- if ( ((pWndw->drawable.y < 0) &&
- (pWndw->drawable.y + pWndw->drawable.height < 0))
- || ( (pWndw->drawable.y >
- panoramiXdataPtr[k].y + panoramiXdataPtr[k].height) &&
- (pWndw->drawable.y + pWndw->drawable.height >
- panoramiXdataPtr[k].y + panoramiXdataPtr[k].height)))
- /* its not on screen - k -, try next screen */
- continue;
-
- /* The window resides on screen k, which means we need to
- keep the buffer information for this screen */
- panoramiX_buf++;
-
- /* Is it only on this screen, or does it enter onto another
- screen */
- if ( ((pWndw->drawable.x + pWndw->drawable.width) <=
- (panoramiXdataPtr[k].x + panoramiXdataPtr[k].width)) &&
- ((pWndw->drawable.y + pWndw->drawable.height) <=
- (panoramiXdataPtr[k].y +
- panoramiXdataPtr[k].height )) )
- FoundScreen = TRUE;
- } /* for each screen k */
- for (j = 0; j < i; j++)
- {
- if (ppScrn0Multibuffers[i] == ppScrn0Multibuffers[j])
- {
- if ( sizeof (long) != sizeof(CARD32) ) DEALLOCATE_LOCAL(ids);
- DEALLOCATE_LOCAL(ppScrn0Multibuffers);
- DEALLOCATE_LOCAL(pScrn0Multibuffer);
- DEALLOCATE_LOCAL(ppMultibuffers);
- DEALLOCATE_LOCAL(pMultibuffer);
- client->errorValue = ids[i];
- return BadMatch;
- }
- }
- bufferTime = ppScrn0Multibuffers[i]->lastUpdate;
- }else {
-#endif
pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i],
MultibufferResType);
if (!pMultibuffer[i])
@@ -728,9 +589,6 @@ MultibufferResType);
}
}
bufferTime = ppMultibuffers[i]->lastUpdate;
-#ifdef PANORAMIX
- }
-#endif
BumpTimeStamp (&bufferTime, minDelay);
if (CompareTimeStamps (bufferTime, activateTime) == LATER)
activateTime = bufferTime;
@@ -742,54 +600,15 @@ MultibufferResType);
;
}
else
-#ifdef PANORAMIX
- if (!noPanoramiXExtension){
- PerformDisplayRequest (ppMultibuffers, pMultibuffer, panoramiX_buf);
- }else
-#endif
PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf);
-#ifdef PANORAMIX
- if (!noPanoramiXExtension){
- DEALLOCATE_LOCAL(ppScrn0Multibuffers);
- DEALLOCATE_LOCAL(pScrn0Multibuffer);
- }
-#endif
-
DEALLOCATE_LOCAL(ppMultibuffers);
DEALLOCATE_LOCAL(pMultibuffer);
return Success;
}
-#ifdef PANORAMIX
-static int
-ProcPanoramiXDestroyImageBuffers (client)
- ClientPtr client;
-{
- REQUEST (xMbufDestroyImageBuffersReq);
- WindowPtr pWin;
-
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-
- REQUEST_SIZE_MATCH (xMbufDestroyImageBuffersReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->window);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->window = pPanoramiXWin->info[j].id;
- result = ProcDestroyImageBuffers (client);
- BREAK_IF(result != Success);
- }
- return (result);
-}
-#endif
-#ifdef PANORAMIX
-int
-#else
static int
-#endif
ProcDestroyImageBuffers (client)
register ClientPtr client;
{
@@ -803,34 +622,7 @@ ProcDestroyImageBuffers (client)
return Success;
}
-#ifdef PANORAMIX
-static int
-ProcPanoramiXSetMBufferAttributes (client)
- ClientPtr client;
-{
- REQUEST (xMbufSetMBufferAttributesReq);
- WindowPtr pWin;
-
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-
- REQUEST_SIZE_MATCH (xMbufSetMBufferAttributesReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->window);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->window = pPanoramiXWin->info[j].id;
- result = ProcSetMBufferAttributes (client);
- BREAK_IF(result != Success);
- }
- return (result);
-}
-#endif
-#ifdef PANORAMIX
-int
-#else
static int
-#endif
ProcSetMBufferAttributes (client)
register ClientPtr client;
{
@@ -839,7 +631,7 @@ ProcSetMBufferAttributes (client)
MultibuffersPtr pMultibuffers;
int len;
Mask vmask;
- Mask index;
+ Mask index2;
CARD32 updateHint;
XID *vlist;
@@ -857,9 +649,9 @@ ProcSetMBufferAttributes (client)
vlist = (XID *) &stuff[1];
while (vmask)
{
- index = (Mask) lowbit (vmask);
- vmask &= ~index;
- switch (index)
+ index2 = (Mask) lowbit (vmask);
+ vmask &= ~index2;
+ switch (index2)
{
case MultibufferWindowUpdateHint:
updateHint = (CARD32) *vlist;
@@ -936,7 +728,7 @@ ProcSetBufferAttributes (client)
REQUEST(xMbufSetBufferAttributesReq);
MultibufferPtr pMultibuffer;
int len;
- Mask vmask, index;
+ Mask vmask, index2;
XID *vlist;
Mask eventMask;
int result;
@@ -952,9 +744,9 @@ ProcSetBufferAttributes (client)
vlist = (XID *) &stuff[1];
while (vmask)
{
- index = (Mask) lowbit (vmask);
- vmask &= ~index;
- switch (index)
+ index2 = (Mask) lowbit (vmask);
+ vmask &= ~index2;
+ switch (index2)
{
case MultibufferBufferEventMask:
eventMask = (Mask) *vlist;
@@ -971,6 +763,7 @@ ProcSetBufferAttributes (client)
return Success;
}
+int
ProcGetBufferAttributes (client)
register ClientPtr client;
{
@@ -1150,34 +943,13 @@ ProcMultibufferDispatch (client)
case X_MbufGetBufferVersion:
return ProcGetBufferVersion (client);
case X_MbufCreateImageBuffers:
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXCreateImageBuffers (client);
- else
- return ProcCreateImageBuffers (client);
-#else
return ProcCreateImageBuffers (client);
-#endif
case X_MbufDisplayImageBuffers:
return ProcDisplayImageBuffers (client);
case X_MbufDestroyImageBuffers:
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXDestroyImageBuffers (client);
- else
- return ProcDestroyImageBuffers (client);
-#else
return ProcDestroyImageBuffers (client);
-#endif
case X_MbufSetMBufferAttributes:
-#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXSetMBufferAttributes (client);
- else
- return ProcSetMBufferAttributes (client);
-#else
return ProcSetMBufferAttributes (client);
-#endif
case X_MbufGetMBufferAttributes:
return ProcGetMBufferAttributes (client);
case X_MbufSetBufferAttributes:
@@ -1447,8 +1219,6 @@ PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf)
if (pExposed)
{
RegionPtr pWinSize;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- extern RegionPtr CreateUnclippedWinSize();
pWinSize = CreateUnclippedWinSize (pWin);
/* pExposed is window-relative, but at this point
@@ -1456,13 +1226,13 @@ PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf)
* window-relative so that region ops involving
* pExposed and pWinSize behave sensibly.
*/
- REGION_TRANSLATE(pScreen, pWinSize,
- -pWin->drawable.x,
- -pWin->drawable.y);
- REGION_INTERSECT(pScreen, pExposed, pExposed, pWinSize);
- REGION_DESTROY(pScreen, pWinSize);
+ REGION_TRANSLATE(pWin->drawable.pScreen, pWinSize,
+ -pWin->drawable.x, -pWin->drawable.y);
+ REGION_INTERSECT(pWin->drawable.pScreen, pExposed,
+ pExposed, pWinSize);
+ REGION_DESTROY(pWin->drawable.pScreen, pWinSize);
MultibufferExpose (pPrevMultibuffer, pExposed);
- REGION_DESTROY(pScreen, pExposed);
+ REGION_DESTROY(pWin->drawable.pScreen, pExposed);
}
graphicsExpose = FALSE;
DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE);
@@ -1590,8 +1360,8 @@ DeliverEventsToMultibuffer (pMultibuffer, pEvents, count, filter)
return 0;
/* maybe send event to owner */
- if (attempt = TryClientEvents(
- bClient(pMultibuffer), pEvents, count, pMultibuffer->eventMask, filter, (GrabPtr) 0))
+ if ((attempt = TryClientEvents(
+ bClient(pMultibuffer), pEvents, count, pMultibuffer->eventMask, filter, (GrabPtr) 0)) != 0)
{
if (attempt > 0)
deliveries++;
@@ -1602,8 +1372,8 @@ DeliverEventsToMultibuffer (pMultibuffer, pEvents, count, filter)
/* maybe send event to other clients */
for (other = pMultibuffer->otherClients; other; other=other->next)
{
- if (attempt = TryClientEvents(
- rClient(other), pEvents, count, other->mask, filter, (GrabPtr) 0))
+ if ((attempt = TryClientEvents(
+ rClient(other), pEvents, count, other->mask, filter, (GrabPtr) 0)) != 0)
{
if (attempt > 0)
deliveries++;
@@ -1664,15 +1434,15 @@ MultibufferExpose (pMultibuffer, pRegion)
/* send UpdateNotify event */
void
-MultibufferUpdate (pMultibuffer, time)
+MultibufferUpdate (pMultibuffer, time2)
MultibufferPtr pMultibuffer;
- CARD32 time;
+ CARD32 time2;
{
xMbufUpdateNotifyEvent event;
event.type = MultibufferEventBase + MultibufferUpdateNotify;
event.buffer = pMultibuffer->pPixmap->drawable.id;
- event.timeStamp = time;
+ event.timeStamp = time2;
(void) DeliverEventsToMultibuffer (pMultibuffer, (xEvent *)&event,
1, (Mask)MultibufferUpdateNotifyMask);
}
diff --git a/Xext/mbufbf.c b/Xext/mbufbf.c
index 3c873086f..925745712 100644
--- a/Xext/mbufbf.c
+++ b/Xext/mbufbf.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/mbufbf.c,v 3.4 2001/12/14 19:58:49 dawes Exp $ */
/*
Copyright 1989, 1998 The Open Group
diff --git a/Xext/mbufpx.c b/Xext/mbufpx.c
index 9474cc9aa..9c531c292 100644
--- a/Xext/mbufpx.c
+++ b/Xext/mbufpx.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/mbufpx.c,v 3.4 2001/12/14 19:58:49 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
diff --git a/Xext/mitmisc.c b/Xext/mitmisc.c
index 63e496209..b6038edba 100644
--- a/Xext/mitmisc.c
+++ b/Xext/mitmisc.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/mitmisc.c,v 3.4 2001/12/14 19:58:49 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -28,6 +29,7 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: mitmisc.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
+#define NEED_EVENTS
#include "X.h"
#include "Xproto.h"
#include "misc.h"
@@ -40,17 +42,28 @@ in this Software without prior written authorization from The Open Group.
extern Bool permitOldBugs;
static unsigned char MITReqCode;
-static int ProcMITDispatch(), SProcMITDispatch();
-static void MITResetProc();
+
+static void MITResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+
+static DISPATCH_PROC(ProcMITDispatch);
+static DISPATCH_PROC(ProcMITGetBugMode);
+static DISPATCH_PROC(ProcMITSetBugMode);
+static DISPATCH_PROC(SProcMITDispatch);
+static DISPATCH_PROC(SProcMITGetBugMode);
+static DISPATCH_PROC(SProcMITSetBugMode);
void
MITMiscExtensionInit()
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
- if (extEntry = AddExtension(MITMISCNAME, 0, 0,
+ if ((extEntry = AddExtension(MITMISCNAME, 0, 0,
ProcMITDispatch, SProcMITDispatch,
- MITResetProc, StandardMinorOpcode))
+ MITResetProc, StandardMinorOpcode)) != 0)
MITReqCode = (unsigned char)extEntry->base;
}
@@ -81,7 +94,6 @@ static int
ProcMITGetBugMode(client)
register ClientPtr client;
{
- REQUEST(xMITGetBugModeReq);
xMITGetBugModeReply rep;
register int n;
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 2d3eb7c42..fb0b9c541 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -23,11 +23,13 @@ shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/panoramiX.c,v 3.32 2002/08/01 00:30:34 mvojkovi Exp $ */
#define NEED_REPLIES
#include <stdio.h>
#include "X.h"
#include "Xproto.h"
+#include "Xarch.h"
#include "misc.h"
#include "cursor.h"
#include "cursorstr.h"
@@ -39,32 +41,44 @@ Equipment Corporation.
#include "window.h"
#include "windowstr.h"
#include "pixmapstr.h"
-#if 0
-#include <sys/workstation.h>
-#include <X11/Xserver/ws.h>
-#endif
#include "panoramiX.h"
#include "panoramiXproto.h"
+#include "panoramiXsrv.h"
+#include "globals.h"
+#include "servermd.h"
+#include "resource.h"
+#ifdef RENDER
+#include "picturestr.h"
+#endif
+
static unsigned char PanoramiXReqCode = 0;
/*
* PanoramiX data declarations
*/
-int PanoramiXPixWidth;
-int PanoramiXPixHeight;
-int PanoramiXNumScreens;
+int PanoramiXPixWidth = 0;
+int PanoramiXPixHeight = 0;
+int PanoramiXNumScreens = 0;
+
+PanoramiXData *panoramiXdataPtr = NULL;
-PanoramiXData *panoramiXdataPtr;
-PanoramiXWindow *PanoramiXWinRoot;
-PanoramiXGC *PanoramiXGCRoot;
-PanoramiXCmap *PanoramiXCmapRoot;
-PanoramiXPmap *PanoramiXPmapRoot;
-PanoramiXEdge panoramiXEdgePtr[MAXSCREENS];
-RegionRec PanoramiXScreenRegion[MAXSCREENS];
-PanoramiXCDT PanoramiXColorDepthTable[MAXSCREENS];
-PanoramiXDepth PanoramiXLargestScreenDepth;
+RegionRec PanoramiXScreenRegion;
+
+int PanoramiXNumDepths;
+DepthPtr PanoramiXDepths;
+int PanoramiXNumVisuals;
+VisualPtr PanoramiXVisuals;
+/* We support at most 256 visuals */
+XID *PanoramiXVisualTable = NULL;
+
+unsigned long XRC_DRAWABLE;
+unsigned long XRT_WINDOW;
+unsigned long XRT_PIXMAP;
+unsigned long XRT_GC;
+unsigned long XRT_COLORMAP;
+
int (* SavedProcVector[256]) ();
ScreenInfo *GlobalScrInfo;
@@ -75,7 +89,6 @@ static int ProcPanoramiXDispatch();
* Function prototypes
*/
-static void locate_neighbors(int);
static void PanoramiXResetProc(ExtensionEntry*);
/*
@@ -83,16 +96,9 @@ static void PanoramiXResetProc(ExtensionEntry*);
*/
extern int SProcPanoramiXDispatch();
-extern Bool noPanoramiXExtension;
-extern Bool PanoramiXVisibilityNotifySent;
-extern WindowPtr *WindowTable;
-#if 0
-extern ScreenArgsRec screenArgs[MAXSCREENS];
-#endif
-extern int defaultBackingStore;
extern char *ConnectionInfo;
extern int connBlockScreenStart;
-extern int (* ProcVector[256]) ();
+extern xConnSetupPrefix connSetupPrefix;
/*
* Server dispatcher function replacements
@@ -104,11 +110,10 @@ int PanoramiXChangeSaveSet(), PanoramiXReparentWindow();
int PanoramiXMapWindow(), PanoramiXMapSubwindows();
int PanoramiXUnmapWindow(), PanoramiXUnmapSubwindows();
int PanoramiXConfigureWindow(), PanoramiXCirculateWindow();
-int PanoramiXGetGeometry(), PanoramiXChangeProperty();
-int PanoramiXDeleteProperty(), PanoramiXSendEvent();
+int PanoramiXGetGeometry(), PanoramiXTranslateCoords();
int PanoramiXCreatePixmap(), PanoramiXFreePixmap();
int PanoramiXCreateGC(), PanoramiXChangeGC();
-int PanoramiXCopyGC();
+int PanoramiXCopyGC(), PanoramiXCopyColormapAndFree();
int PanoramiXSetDashes(), PanoramiXSetClipRectangles();
int PanoramiXFreeGC(), PanoramiXClearToBackground();
int PanoramiXCopyArea(), PanoramiXCopyPlane();
@@ -122,8 +127,326 @@ int PanoramiXImageText8(), PanoramiXImageText16();
int PanoramiXCreateColormap(), PanoramiXFreeColormap();
int PanoramiXInstallColormap(), PanoramiXUninstallColormap();
int PanoramiXAllocColor(), PanoramiXAllocNamedColor();
-int PanoramiXAllocColorCells();
+int PanoramiXAllocColorCells(), PanoramiXStoreNamedColor();
int PanoramiXFreeColors(), PanoramiXStoreColors();
+int PanoramiXAllocColorPlanes();
+
+static int PanoramiXGCIndex = -1;
+static int PanoramiXScreenIndex = -1;
+
+typedef struct {
+ DDXPointRec clipOrg;
+ DDXPointRec patOrg;
+ GCFuncs *wrapFuncs;
+} PanoramiXGCRec, *PanoramiXGCPtr;
+
+typedef struct {
+ CreateGCProcPtr CreateGC;
+ CloseScreenProcPtr CloseScreen;
+} PanoramiXScreenRec, *PanoramiXScreenPtr;
+
+RegionRec XineramaScreenRegions[MAXSCREENS];
+
+static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
+static void XineramaChangeGC(GCPtr, unsigned long);
+static void XineramaCopyGC(GCPtr, unsigned long, GCPtr);
+static void XineramaDestroyGC(GCPtr);
+static void XineramaChangeClip(GCPtr, int, pointer, int);
+static void XineramaDestroyClip(GCPtr);
+static void XineramaCopyClip(GCPtr, GCPtr);
+
+GCFuncs XineramaGCFuncs = {
+ XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC,
+ XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip
+};
+
+#define Xinerama_GC_FUNC_PROLOGUE(pGC)\
+ PanoramiXGCPtr pGCPriv = \
+ (PanoramiXGCPtr) (pGC)->devPrivates[PanoramiXGCIndex].ptr;\
+ (pGC)->funcs = pGCPriv->wrapFuncs;
+
+#define Xinerama_GC_FUNC_EPILOGUE(pGC)\
+ pGCPriv->wrapFuncs = (pGC)->funcs;\
+ (pGC)->funcs = &XineramaGCFuncs;
+
+
+static Bool
+XineramaCloseScreen (int i, ScreenPtr pScreen)
+{
+ PanoramiXScreenPtr pScreenPriv =
+ (PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr;
+
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+
+ REGION_UNINIT(pScreen, &XineramaScreenRegions[pScreen->myNum]);
+ if (pScreen->myNum == 0)
+ REGION_UNINIT(pScreen, &PanoramiXScreenRegion);
+
+ xfree ((pointer) pScreenPriv);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+Bool
+XineramaCreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ PanoramiXScreenPtr pScreenPriv =
+ (PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr;
+ Bool ret;
+
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+ if((ret = (*pScreen->CreateGC)(pGC))) {
+ PanoramiXGCPtr pGCPriv =
+ (PanoramiXGCPtr) pGC->devPrivates[PanoramiXGCIndex].ptr;
+
+ pGCPriv->wrapFuncs = pGC->funcs;
+ pGC->funcs = &XineramaGCFuncs;
+
+ pGCPriv->clipOrg.x = pGC->clipOrg.x;
+ pGCPriv->clipOrg.y = pGC->clipOrg.y;
+ pGCPriv->patOrg.x = pGC->patOrg.x;
+ pGCPriv->patOrg.y = pGC->patOrg.y;
+ }
+ pScreen->CreateGC = XineramaCreateGC;
+
+ return ret;
+}
+
+static void
+XineramaValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+){
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+
+ if((pDraw->type == DRAWABLE_WINDOW) && !(((WindowPtr)pDraw)->parent)) {
+ /* the root window */
+ int x_off = panoramiXdataPtr[pGC->pScreen->myNum].x;
+ int y_off = panoramiXdataPtr[pGC->pScreen->myNum].y;
+ int new_val;
+
+ new_val = pGCPriv->clipOrg.x - x_off;
+ if(pGC->clipOrg.x != new_val) {
+ pGC->clipOrg.x = new_val;
+ changes |= GCClipXOrigin;
+ }
+ new_val = pGCPriv->clipOrg.y - y_off;
+ if(pGC->clipOrg.y != new_val) {
+ pGC->clipOrg.y = new_val;
+ changes |= GCClipYOrigin;
+ }
+ new_val = pGCPriv->patOrg.x - x_off;
+ if(pGC->patOrg.x != new_val) {
+ pGC->patOrg.x = new_val;
+ changes |= GCTileStipXOrigin;
+ }
+ new_val = pGCPriv->patOrg.y - y_off;
+ if(pGC->patOrg.y != new_val) {
+ pGC->patOrg.y = new_val;
+ changes |= GCTileStipYOrigin;
+ }
+ } else {
+ if(pGC->clipOrg.x != pGCPriv->clipOrg.x) {
+ pGC->clipOrg.x = pGCPriv->clipOrg.x;
+ changes |= GCClipXOrigin;
+ }
+ if(pGC->clipOrg.y != pGCPriv->clipOrg.y) {
+ pGC->clipOrg.y = pGCPriv->clipOrg.y;
+ changes |= GCClipYOrigin;
+ }
+ if(pGC->patOrg.x != pGCPriv->patOrg.x) {
+ pGC->patOrg.x = pGCPriv->patOrg.x;
+ changes |= GCTileStipXOrigin;
+ }
+ if(pGC->patOrg.y != pGCPriv->patOrg.y) {
+ pGC->patOrg.y = pGCPriv->patOrg.y;
+ changes |= GCTileStipYOrigin;
+ }
+ }
+
+ (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XineramaDestroyGC(GCPtr pGC)
+{
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->DestroyGC)(pGC);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XineramaChangeGC (
+ GCPtr pGC,
+ unsigned long mask
+){
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+
+ if(mask & GCTileStipXOrigin)
+ pGCPriv->patOrg.x = pGC->patOrg.x;
+ if(mask & GCTileStipYOrigin)
+ pGCPriv->patOrg.y = pGC->patOrg.y;
+ if(mask & GCClipXOrigin)
+ pGCPriv->clipOrg.x = pGC->clipOrg.x;
+ if(mask & GCClipYOrigin)
+ pGCPriv->clipOrg.y = pGC->clipOrg.y;
+
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XineramaCopyGC (
+ GCPtr pGCSrc,
+ unsigned long mask,
+ GCPtr pGCDst
+){
+ PanoramiXGCPtr pSrcPriv =
+ (PanoramiXGCPtr) pGCSrc->devPrivates[PanoramiXGCIndex].ptr;
+ Xinerama_GC_FUNC_PROLOGUE (pGCDst);
+
+ if(mask & GCTileStipXOrigin)
+ pGCPriv->patOrg.x = pSrcPriv->patOrg.x;
+ if(mask & GCTileStipYOrigin)
+ pGCPriv->patOrg.y = pSrcPriv->patOrg.y;
+ if(mask & GCClipXOrigin)
+ pGCPriv->clipOrg.x = pSrcPriv->clipOrg.x;
+ if(mask & GCClipYOrigin)
+ pGCPriv->clipOrg.y = pSrcPriv->clipOrg.y;
+
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ Xinerama_GC_FUNC_EPILOGUE (pGCDst);
+}
+
+static void
+XineramaChangeClip (
+ GCPtr pGC,
+ int type,
+ pointer pvalue,
+ int nrects
+){
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XineramaCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ Xinerama_GC_FUNC_PROLOGUE (pgcDst);
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ Xinerama_GC_FUNC_EPILOGUE (pgcDst);
+}
+
+static void
+XineramaDestroyClip(GCPtr pGC)
+{
+ Xinerama_GC_FUNC_PROLOGUE (pGC);
+ (* pGC->funcs->DestroyClip)(pGC);
+ Xinerama_GC_FUNC_EPILOGUE (pGC);
+}
+
+
+
+int
+XineramaDeleteResource(pointer data, XID id)
+{
+ xfree(data);
+ 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)
+{
+ PanoramiXRes *res = (PanoramiXRes*)resource;
+ PanoramiXSearchData *data = (PanoramiXSearchData*)privdata;
+
+ return (res->info[data->screen].id == data->id);
+}
+
+PanoramiXRes *
+PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen)
+{
+ PanoramiXSearchData data;
+
+ if(!screen)
+ return LookupIDByType(id, type);
+
+ data.screen = screen;
+ data.id = id;
+
+ return LookupClientResourceComplex(clients[CLIENT_ID(id)], type,
+ 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;
+} XineramaConnectionCallbackList;
+
+static XineramaConnectionCallbackList *ConnectionCallbackList = NULL;
+
+Bool
+XineramaRegisterConnectionBlockCallback(void (*func)(void))
+{
+ XineramaConnectionCallbackList *newlist;
+
+ if(!(newlist = xalloc(sizeof(XineramaConnectionCallbackList))))
+ return FALSE;
+
+ newlist->next = ConnectionCallbackList;
+ newlist->func = func;
+ ConnectionCallbackList = newlist;
+
+ return TRUE;
+}
/*
* PanoramiXExtensionInit():
@@ -134,14 +457,16 @@ int PanoramiXFreeColors(), PanoramiXStoreColors();
void PanoramiXExtensionInit(int argc, char *argv[])
{
- int i, j, PhyScrNum, ArgScrNum;
- Bool success = FALSE;
- ExtensionEntry *extEntry, *AddExtension();
- PanoramiXData *panoramiXtempPtr;
- ScreenPtr pScreen;
+ int i;
+ Bool success = FALSE;
+ ExtensionEntry *extEntry;
+ ScreenPtr pScreen;
+ PanoramiXScreenPtr pScreenPriv;
+ int w, h;
- if (!noPanoramiXExtension)
- {
+ if (noPanoramiXExtension)
+ return;
+
GlobalScrInfo = &screenInfo; /* For debug visibility */
PanoramiXNumScreens = screenInfo.numScreens;
if (PanoramiXNumScreens == 1) { /* Only 1 screen */
@@ -165,13 +490,43 @@ void PanoramiXExtensionInit(int argc, char *argv[])
* run in non-PanoramiXeen mode.
*/
- panoramiXdataPtr = (PanoramiXData *) Xcalloc(PanoramiXNumScreens * sizeof(PanoramiXData));
- PanoramiXWinRoot = (PanoramiXWindow *) Xcalloc(sizeof(PanoramiXWindow));
- PanoramiXGCRoot = (PanoramiXGC *) Xcalloc(sizeof(PanoramiXGC));
- PanoramiXCmapRoot = (PanoramiXCmap *) Xcalloc(sizeof(PanoramiXCmap));
- PanoramiXPmapRoot = (PanoramiXPmap *) Xcalloc(sizeof(PanoramiXPmap));
- BREAK_IF(!(panoramiXdataPtr && PanoramiXWinRoot && PanoramiXGCRoot &&
- PanoramiXCmapRoot && PanoramiXPmapRoot));
+ panoramiXdataPtr = (PanoramiXData *)
+ xcalloc(PanoramiXNumScreens, sizeof(PanoramiXData));
+
+ BREAK_IF(!panoramiXdataPtr);
+ BREAK_IF((PanoramiXGCIndex = AllocateGCPrivateIndex()) < 0);
+ BREAK_IF((PanoramiXScreenIndex = AllocateScreenPrivateIndex()) < 0);
+
+ for (i = 0; i < PanoramiXNumScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if(!AllocateGCPrivate(pScreen, PanoramiXGCIndex,
+ sizeof(PanoramiXGCRec))) {
+ noPanoramiXExtension = TRUE;
+ return;
+ }
+
+ pScreenPriv = xalloc(sizeof(PanoramiXScreenRec));
+ pScreen->devPrivates[PanoramiXScreenIndex].ptr =
+ (pointer)pScreenPriv;
+ if(!pScreenPriv) {
+ noPanoramiXExtension = TRUE;
+ return;
+ }
+
+ pScreenPriv->CreateGC = pScreen->CreateGC;
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+
+ pScreen->CreateGC = XineramaCreateGC;
+ pScreen->CloseScreen = XineramaCloseScreen;
+ }
+
+ XRC_DRAWABLE = CreateNewResourceClass();
+ XRT_WINDOW = CreateNewResourceType(XineramaDeleteResource) |
+ XRC_DRAWABLE;
+ XRT_PIXMAP = CreateNewResourceType(XineramaDeleteResource) |
+ XRC_DRAWABLE;
+ XRT_GC = CreateNewResourceType(XineramaDeleteResource);
+ XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource);
panoramiXGeneration = serverGeneration;
success = TRUE;
@@ -182,117 +537,40 @@ void PanoramiXExtensionInit(int argc, char *argv[])
ErrorF("%s Extension failed to initialize\n", PANORAMIX_PROTOCOL_NAME);
return;
}
-
- /* Set up a default configuration base on horizontal ordering */
- for (i = PanoramiXNumScreens -1; i >= 0 ; i--) {
- panoramiXdataPtr[i].above = panoramiXdataPtr[i].below = -1;
- panoramiXdataPtr[i].left = panoramiXdataPtr[i].right = -1;
- panoramiXEdgePtr[i].no_edges = TRUE;
- }
- for (i = PanoramiXNumScreens - 1; i >= 0; i--) {
- panoramiXdataPtr[i].left = i - 1;
- panoramiXdataPtr[i].right = i + 1;
- }
- panoramiXdataPtr[PanoramiXNumScreens - 1].right = -1;
+
- /*
- * Position the screens relative to each other based on
- * command line options.
- */
+ REGION_INIT(pScreen, &PanoramiXScreenRegion, NullBox, 1);
+ for (i = 0; i < PanoramiXNumScreens; i++) {
+ BoxRec TheBox;
-#if 0
- for (PhyScrNum = PanoramiXNumScreens - 1; PhyScrNum >= 0; PhyScrNum--) {
- if (wsRemapPhysToLogScreens)
- i = wsPhysToLogScreens[PhyScrNum];
- else
- i = PhyScrNum;
- if (i < 0)
- continue;
- panoramiXdataPtr[i].width = (screenInfo.screens[i])->width;
- panoramiXdataPtr[i].height = (screenInfo.screens[i])->height;
- if (screenArgs[i].flags & ARG_EDGE_L) {
- ArgScrNum = screenArgs[PhyScrNum].edge_left;
- if (ArgScrNum < 0)
- j = -1;
- else {
- if (wsRemapPhysToLogScreens)
- j = wsPhysToLogScreens[ArgScrNum];
- else
- j = ArgScrNum;
- }
- panoramiXdataPtr[i].left = j;
- panoramiXEdgePtr[i].no_edges = FALSE;
- if ( j >= 0)
- panoramiXdataPtr[j].right = i;
- else {
- if ( i >= 1 )
- panoramiXdataPtr[i - 1].right = -1;
- }
- }
- if (screenArgs[i].flags & ARG_EDGE_R) {
- ArgScrNum = screenArgs[PhyScrNum].edge_right;
- if (ArgScrNum < 0)
- j = -1;
- else {
- if (wsRemapPhysToLogScreens)
- j = wsPhysToLogScreens[ArgScrNum];
- else
- j = ArgScrNum;
- }
- panoramiXdataPtr[i].right = j;
- panoramiXEdgePtr[i].no_edges = FALSE;
- if ( j >= 0)
- panoramiXdataPtr[j].left = i;
- }
- if (screenArgs[i].flags & ARG_EDGE_T) {
- ArgScrNum = screenArgs[PhyScrNum].edge_top;
- if (ArgScrNum < 0)
- j = -1;
- else {
- if (wsRemapPhysToLogScreens)
- j = wsPhysToLogScreens[ArgScrNum];
- else
- j = ArgScrNum;
- }
- panoramiXdataPtr[i].above = j;
- panoramiXEdgePtr[i].no_edges = FALSE;
- if ( j >= 0)
- panoramiXdataPtr[j].below = i;
- }
- if (screenArgs[i].flags & ARG_EDGE_B) {
- ArgScrNum = screenArgs[PhyScrNum].edge_bottom;
- if (ArgScrNum < 0)
- j = -1;
- else {
- if (wsRemapPhysToLogScreens)
- j = wsPhysToLogScreens[ArgScrNum];
- else
- j = ArgScrNum;
- }
- panoramiXdataPtr[i].below = j;
- panoramiXEdgePtr[i].no_edges = FALSE;
- if ( j >= 0)
- panoramiXdataPtr[j].above = i;
- }
- }
-#else
- for (PhyScrNum = PanoramiXNumScreens - 1; PhyScrNum >= 0; PhyScrNum--) {
- i = PhyScrNum;
- if (i < 0)
- continue;
+ panoramiXdataPtr[i].x = dixScreenOrigins[i].x;
+ panoramiXdataPtr[i].y = dixScreenOrigins[i].y;
panoramiXdataPtr[i].width = (screenInfo.screens[i])->width;
panoramiXdataPtr[i].height = (screenInfo.screens[i])->height;
+
+ TheBox.x1 = panoramiXdataPtr[i].x;
+ TheBox.x2 = TheBox.x1 + panoramiXdataPtr[i].width;
+ TheBox.y1 = panoramiXdataPtr[i].y;
+ TheBox.y2 = TheBox.y1 + panoramiXdataPtr[i].height;
+
+ REGION_INIT(pScreen, &XineramaScreenRegions[i], &TheBox, 1);
+ REGION_UNION(pScreen, &PanoramiXScreenRegion, &PanoramiXScreenRegion,
+ &XineramaScreenRegions[i]);
}
-#endif
- /*
- * Find the upper-left screen and then locate all the others
- */
- panoramiXtempPtr = panoramiXdataPtr;
- for (i = PanoramiXNumScreens; i; i--, panoramiXtempPtr++)
- if (panoramiXtempPtr->above == -1 && panoramiXtempPtr->left == -1)
- break;
- locate_neighbors(PanoramiXNumScreens - i);
+
+ PanoramiXPixWidth = panoramiXdataPtr[0].x + panoramiXdataPtr[0].width;
+ PanoramiXPixHeight = panoramiXdataPtr[0].y + panoramiXdataPtr[0].height;
+
+ for (i = 1; i < PanoramiXNumScreens; i++) {
+ w = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width;
+ h = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height;
+
+ if(PanoramiXPixWidth < w)
+ PanoramiXPixWidth = w;
+ if(PanoramiXPixHeight < h)
+ PanoramiXPixHeight = h;
+ }
/*
* Put our processes into the ProcVector
@@ -314,9 +592,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
ProcVector[X_ConfigureWindow] = PanoramiXConfigureWindow;
ProcVector[X_CirculateWindow] = PanoramiXCirculateWindow;
ProcVector[X_GetGeometry] = PanoramiXGetGeometry;
- ProcVector[X_ChangeProperty] = PanoramiXChangeProperty;
- ProcVector[X_DeleteProperty] = PanoramiXDeleteProperty;
- ProcVector[X_SendEvent] = PanoramiXSendEvent;
+ ProcVector[X_TranslateCoords] = PanoramiXTranslateCoords;
ProcVector[X_CreatePixmap] = PanoramiXCreatePixmap;
ProcVector[X_FreePixmap] = PanoramiXFreePixmap;
ProcVector[X_CreateGC] = PanoramiXCreateGC;
@@ -344,252 +620,262 @@ void PanoramiXExtensionInit(int argc, char *argv[])
ProcVector[X_ImageText16] = PanoramiXImageText16;
ProcVector[X_CreateColormap] = PanoramiXCreateColormap;
ProcVector[X_FreeColormap] = PanoramiXFreeColormap;
+ ProcVector[X_CopyColormapAndFree] = PanoramiXCopyColormapAndFree;
ProcVector[X_InstallColormap] = PanoramiXInstallColormap;
ProcVector[X_UninstallColormap] = PanoramiXUninstallColormap;
ProcVector[X_AllocColor] = PanoramiXAllocColor;
ProcVector[X_AllocNamedColor] = PanoramiXAllocNamedColor;
ProcVector[X_AllocColorCells] = PanoramiXAllocColorCells;
+ ProcVector[X_AllocColorPlanes] = PanoramiXAllocColorPlanes;
ProcVector[X_FreeColors] = PanoramiXFreeColors;
- ProcVector[X_StoreColors] = PanoramiXStoreColors;
+ ProcVector[X_StoreColors] = PanoramiXStoreColors;
+ ProcVector[X_StoreNamedColor] = PanoramiXStoreNamedColor;
- }
- else
- return;
+#ifdef RENDER
+ PanoramiXRenderInit ();
+#endif
}
-extern
+
+extern Bool CreateConnectionBlock(void);
+
Bool PanoramiXCreateConnectionBlock(void)
{
- int i;
+ int i, j, length;
+ Bool disableBackingStore = FALSE;
+ Bool disableSaveUnders = FALSE;
int old_width, old_height;
- int width_mult, height_mult;
+ float width_mult, height_mult;
xWindowRoot *root;
xConnSetup *setup;
+ xVisualType *visual;
+ xDepth *depth;
+ VisualPtr pVisual;
+ ScreenPtr pScreen;
/*
* Do normal CreateConnectionBlock but faking it for only one screen
*/
+ if(!PanoramiXNumDepths) {
+ ErrorF("PanoramiX error: Incompatible screens. No common visuals\n");
+ return FALSE;
+ }
+
+ for(i = 1; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if(pScreen->rootDepth != screenInfo.screens[0]->rootDepth) {
+ ErrorF("PanoramiX error: Incompatible screens. Root window depths differ\n");
+ return FALSE;
+ }
+ if(pScreen->backingStoreSupport != screenInfo.screens[0]->backingStoreSupport)
+ disableBackingStore = TRUE;
+ if(pScreen->saveUnderSupport != screenInfo.screens[0]->saveUnderSupport)
+ disableSaveUnders = TRUE;
+ }
+
+ if(disableBackingStore || disableSaveUnders) {
+ for(i = 0; i < screenInfo.numScreens; i++) {
+ pScreen = screenInfo.screens[i];
+ if(disableBackingStore)
+ pScreen->backingStoreSupport = NotUseful;
+ if(disableSaveUnders)
+ pScreen->saveUnderSupport = NotUseful;
+ }
+ }
+
+ i = screenInfo.numScreens;
+ screenInfo.numScreens = 1;
if (!CreateConnectionBlock()) {
+ screenInfo.numScreens = i;
return FALSE;
}
+ screenInfo.numScreens = i;
+
+ setup = (xConnSetup *) ConnectionInfo;
+ root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart);
+ length = connBlockScreenStart + sizeof(xWindowRoot);
+
+ /* overwrite the connection block */
+ root->nDepths = PanoramiXNumDepths;
+
+ for (i = 0; i < PanoramiXNumDepths; i++) {
+ depth = (xDepth *) (ConnectionInfo + length);
+ depth->depth = PanoramiXDepths[i].depth;
+ depth->nVisuals = PanoramiXDepths[i].numVids;
+ length += sizeof(xDepth);
+ visual = (xVisualType *)(ConnectionInfo + length);
+
+ for (j = 0; j < depth->nVisuals; j++, visual++) {
+ visual->visualID = PanoramiXDepths[i].vids[j];
+
+ for (pVisual = PanoramiXVisuals;
+ pVisual->vid != visual->visualID;
+ pVisual++)
+ ;
+
+ visual->class = pVisual->class;
+ visual->bitsPerRGB = pVisual->bitsPerRGBValue;
+ visual->colormapEntries = pVisual->ColormapEntries;
+ visual->redMask = pVisual->redMask;
+ visual->greenMask = pVisual->greenMask;
+ visual->blueMask = pVisual->blueMask;
+ }
+
+ length += (depth->nVisuals * sizeof(xVisualType));
+ }
+
+ connSetupPrefix.length = length >> 2;
+
+ xfree(PanoramiXVisuals);
+ for (i = 0; i < PanoramiXNumDepths; i++)
+ xfree(PanoramiXDepths[i].vids);
+ xfree(PanoramiXDepths);
+
/*
* OK, change some dimensions so it looks as if it were one big screen
*/
-
- setup = (xConnSetup *) ConnectionInfo;
- setup->numRoots = 1;
- root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart);
old_width = root->pixWidth;
old_height = root->pixHeight;
- for (i = PanoramiXNumScreens - 1; i >= 0; i--) {
- if (panoramiXdataPtr[i].right == -1 )
- root->pixWidth = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width;
- if (panoramiXdataPtr[i].below == -1)
- root->pixHeight = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height;
- }
- PanoramiXPixWidth = root->pixWidth;
- PanoramiXPixHeight = root->pixHeight;
- width_mult = root->pixWidth / old_width;
- height_mult = root->pixHeight / old_height;
+
+ root->pixWidth = PanoramiXPixWidth;
+ root->pixHeight = PanoramiXPixHeight;
+ width_mult = (1.0 * root->pixWidth) / old_width;
+ height_mult = (1.0 * root->pixHeight) / old_height;
root->mmWidth *= width_mult;
root->mmHeight *= height_mult;
- return TRUE;
-}
-extern
-Bool PanoramiXCreateScreenRegion(pWin)
-WindowPtr pWin;
-{
- ScreenPtr pScreen;
- BoxRec box;
- int i;
- Bool ret;
-
- pScreen = pWin->drawable.pScreen;
- for (i = 0; i < PanoramiXNumScreens; i++) {
- box.x1 = 0 - panoramiXdataPtr[i].x;
- box.x2 = box.x1 + PanoramiXPixWidth;
- box.y1 = 0 - panoramiXdataPtr[i].y;
- box.y2 = box.y1 + PanoramiXPixHeight;
- REGION_INIT(pScreen, &PanoramiXScreenRegion[i], &box, 1);
- ret = REGION_NOTEMPTY(pScreen, &PanoramiXScreenRegion[i]);
- if (!ret)
- return ret;
- }
- return ret;
-}
+ while(ConnectionCallbackList) {
+ pointer tmp;
-extern
-void PanoramiXDestroyScreenRegion(pWin)
-WindowPtr pWin;
-{
- ScreenPtr pScreen;
- int i;
- Bool ret;
+ tmp = (pointer)ConnectionCallbackList;
+ (*ConnectionCallbackList->func)();
+ ConnectionCallbackList = ConnectionCallbackList->next;
+ xfree(tmp);
+ }
- pScreen = pWin->drawable.pScreen;
- for (i = 0; i < PanoramiXNumScreens; i++)
- REGION_DESTROY(pScreen, &PanoramiXScreenRegion[i]);
+ return TRUE;
}
-/*
- * Assign the Root window and colormap ID's in the PanoramiXScreen Root
- * linked lists. Note: WindowTable gets setup in dix_main by
- * InitRootWindow, and GlobalScrInfo is screenInfo which gets setup
- * by InitOutput.
- */
extern
void PanoramiXConsolidate(void)
{
- int i,j,k,v,d,n, thisMaxDepth;
- int depthIndex;
- DepthPtr pDepth, pLargeDepth;
- VisualPtr pVisual;
- VisualID it;
- register WindowPtr pWin, pLargeWin;
- Bool SameDepth;
-
- PanoramiXLargestScreenDepth.numDepths = (screenInfo.screens[PanoramiXNumScreens -1])->numDepths;
- PanoramiXLargestScreenDepth.screenNum = PanoramiXNumScreens - 1;
- SameDepth = TRUE;
- for (i = 0; i < 2; i++)
- {
- for (j =0; j < 6; j++)
- {
- PanoramiXColorDepthTable[i].panoramiXScreenMap[j].numDepths=0;
- for (n = 0; n < 6; n++)
- {
- PanoramiXColorDepthTable[i].panoramiXScreenMap[j].listDepths[n]=0;
+ int i, j, k;
+ VisualPtr pVisual, pVisual2;
+ ScreenPtr pScreen, pScreen2;
+ PanoramiXRes *root, *defmap;
+
+ if(!PanoramiXVisualTable)
+ PanoramiXVisualTable = xcalloc(256 * MAXSCREENS, sizeof(XID));
+
+ pScreen = screenInfo.screens[0];
+ pVisual = pScreen->visuals;
+
+ PanoramiXNumDepths = 0;
+ PanoramiXDepths = xcalloc(pScreen->numDepths,sizeof(DepthRec));
+ PanoramiXNumVisuals = 0;
+ PanoramiXVisuals = xcalloc(pScreen->numVisuals,sizeof(VisualRec));
+
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ PanoramiXVisualTable[pVisual->vid * MAXSCREENS] = pVisual->vid;
+
+ /* check if the visual exists on all screens */
+ for (j = 1; j < PanoramiXNumScreens; j++) {
+ pScreen2 = screenInfo.screens[j];
+ pVisual2 = pScreen2->visuals;
+
+ for (k = 0; k < pScreen2->numVisuals; k++, pVisual2++) {
+ if ((pVisual->class == pVisual2->class) &&
+ (pVisual->ColormapEntries == pVisual2->ColormapEntries) &&
+ (pVisual->nplanes == pVisual2->nplanes) &&
+ (pVisual->redMask == pVisual2->redMask) &&
+ (pVisual->greenMask == pVisual2->greenMask) &&
+ (pVisual->blueMask == pVisual2->blueMask) &&
+ (pVisual->offsetRed == pVisual2->offsetRed) &&
+ (pVisual->offsetGreen == pVisual2->offsetGreen) &&
+ (pVisual->offsetBlue == pVisual2->offsetBlue))
+ {
+ Bool AlreadyUsed = FALSE;
+#if 0
+/* Open GL should do this reduction, not us */
+ for (l = 0; l < 256; l++) {
+ if (pVisual2->vid ==
+ PanoramiXVisualTable[(l * MAXSCREENS) + j])
+ {
+ AlreadyUsed = TRUE;
+ break;
+ }
+ }
+#endif
+ if (!AlreadyUsed) {
+ PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] =
+ pVisual2->vid;
+ break;
+ }
+ }
+ }
}
- for (k = 0; k < 33; k++)
- {
- PanoramiXColorDepthTable[i].panoramiXScreenMap[j].vmap[k].numVids=0;
- for (v = 0; v < 10; v++)
- {
- PanoramiXColorDepthTable[i].panoramiXScreenMap[j].vmap[k].vid[v]=0;
+
+ /* if it doesn't exist on all screens we can't use it */
+ for (j = 0; j < PanoramiXNumScreens; j++) {
+ if (!PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j]) {
+ PanoramiXVisualTable[pVisual->vid * MAXSCREENS] = 0;
+ break;
}
}
- }
- }
- for (i = PanoramiXNumScreens - 1; i >= 0; i--)
- {
- PanoramiXWinRoot->info[i].id = WindowTable[i]->drawable.id;
- PanoramiXCmapRoot->info[i].id = (screenInfo.screens[i])->defColormap;
-
- /* Create a Color-Depth-Table, this will help us deal
- with mixing graphics boards and visuals, of course
- given that the boards support multi-screen to begin
- with. Fill the panoramiXCDT table by screen, then
- visual type and allowable depths.
- */
- pWin = WindowTable[i];
- if ( (screenInfo.screens[i])->numDepths >
- PanoramiXLargestScreenDepth.numDepths )
- {
- PanoramiXLargestScreenDepth.numDepths = (screenInfo.screens[i])->numDepths;
- PanoramiXLargestScreenDepth.screenNum = i;
- SameDepth = FALSE;
- }
- for (v = 0, pVisual = pWin->drawable.pScreen->visuals;
- v < pWin->drawable.pScreen->numVisuals; v++, pVisual++)
- {
- PanoramiXColorDepthTable[i].panoramiXScreenMap[pVisual->class].numDepths = (screenInfo.screens[i])->numDepths;
- for ( j = 0; j < (screenInfo.screens[i])->numDepths; j++)
- {
- pDepth = (DepthPtr) &pWin->drawable.pScreen->allowedDepths[j];
- PanoramiXColorDepthTable[i].panoramiXScreenMap[pVisual->class].listDepths[j] = pDepth->depth;
- for (d = 0; d < pDepth->numVids; d++)
- {
- if (pVisual->vid == pDepth->vids[d])
- {
- PanoramiXColorDepthTable[i].
- panoramiXScreenMap[pVisual->class].vmap[pDepth->depth].
- vid[
- PanoramiXColorDepthTable[i].
- panoramiXScreenMap[pVisual->class].
- vmap[pDepth->depth].numVids++
- ]
- = pDepth->vids[d];
- }
- }
- }
- }
- PanoramiXColorDepthTable[i].numVisuals = 6;
- } /* for each screen */
- /* Fill in ColorDepthTable for mixed visuals with varying depth.
- Can't do that until we figure out how to handle mixed visuals
- and varying card visual/depth initialization. If we can decide
- how to map the relationship, then we can use this table to
- shove the information into and use for cross-referencing when
- necessary.
-
- In the meantime, check to see if the screens are the same,
- if they don't then disable panoramiX, print out a message,
- don't support this mode.
- */
-}
-/* Since locate_neighbors is recursive, a quick simple example
- is in order.This mostly so you can see what the initial values are.
-
- Given 3 screens:
- upperleft screen[0]
- panoramiXdataPtr[0].x = 0
- panoramiXdataPtr[0].y = 0
- panoramiXdataPtr[0].width = 640
- panoramiXdataPtr[0].height = 480
- panoramiXdataPtr[0].below = -1
- panoramiXdataPtr[0].right = 1
- panoramiXdataPtr[0].above = -1
- panoramiXdataPtr[0].left = -1
- middle screen[1]
- panoramiXdataPtr[1].x = 0
- panoramiXdataPtr[1].y = 0
- panoramiXdataPtr[1].width = 640
- panoramiXdataPtr[1].height = 480
- panoramiXdataPtr[1].below = -1
- panoramiXdataPtr[1].right = 2
- panoramiXdataPtr[1].above = -1
- panoramiXdataPtr[1].left = 0
- last right screen[2]
- panoramiXdataPtr[2].x = 0
- panoramiXdataPtr[2].y = 0
- panoramiXdataPtr[2].width = 640
- panoramiXdataPtr[2].height = 480
- panoramiXdataPtr[2].below = -1
- panoramiXdataPtr[2].right = -1
- panoramiXdataPtr[2].above = -1
- panoramiXdataPtr[2].left = 1
-
- Calling locate_neighbors(0) results in:
- panoramiXdataPtr[0].x = 0
- panoramiXdataPtr[0].y = 0
- panoramiXdataPtr[1].x = 640
- panoramiXdataPtr[1].y = 0
- panoramiXdataPtr[2].x = 1280
- panoramiXdataPtr[2].y = 0
-*/
-
-static void locate_neighbors(int i)
-{
- int j;
-
- j = panoramiXdataPtr[i].right;
- if ((j != -1) && !panoramiXdataPtr[j].x && !panoramiXdataPtr[j].y) {
- panoramiXdataPtr[j].x = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width;
- panoramiXdataPtr[j].y = panoramiXdataPtr[i].y;
- locate_neighbors(j);
- }
- j = panoramiXdataPtr[i].below;
- if ((j != -1) && !panoramiXdataPtr[j].x && !panoramiXdataPtr[j].y) {
- panoramiXdataPtr[j].y = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height;
- panoramiXdataPtr[j].x = panoramiXdataPtr[i].x;
- locate_neighbors(j);
+ /* if it does, make sure it's in the list of supported depths and visuals */
+ if(PanoramiXVisualTable[pVisual->vid * MAXSCREENS]) {
+ Bool GotIt = FALSE;
+
+ PanoramiXVisuals[PanoramiXNumVisuals].vid = pVisual->vid;
+ PanoramiXVisuals[PanoramiXNumVisuals].class = pVisual->class;
+ PanoramiXVisuals[PanoramiXNumVisuals].bitsPerRGBValue = pVisual->bitsPerRGBValue;
+ PanoramiXVisuals[PanoramiXNumVisuals].ColormapEntries = pVisual->ColormapEntries;
+ PanoramiXVisuals[PanoramiXNumVisuals].nplanes = pVisual->nplanes;
+ PanoramiXVisuals[PanoramiXNumVisuals].redMask = pVisual->redMask;
+ PanoramiXVisuals[PanoramiXNumVisuals].greenMask = pVisual->greenMask;
+ PanoramiXVisuals[PanoramiXNumVisuals].blueMask = pVisual->blueMask;
+ PanoramiXVisuals[PanoramiXNumVisuals].offsetRed = pVisual->offsetRed;
+ PanoramiXVisuals[PanoramiXNumVisuals].offsetGreen = pVisual->offsetGreen;
+ PanoramiXVisuals[PanoramiXNumVisuals].offsetBlue = pVisual->offsetBlue;
+ PanoramiXNumVisuals++;
+
+ for (j = 0; j < PanoramiXNumDepths; j++) {
+ if (PanoramiXDepths[j].depth == pVisual->nplanes) {
+ PanoramiXDepths[j].vids[PanoramiXDepths[j].numVids] = pVisual->vid;
+ PanoramiXDepths[j].numVids++;
+ GotIt = TRUE;
+ break;
+ }
+ }
+
+ if (!GotIt) {
+ PanoramiXDepths[PanoramiXNumDepths].depth = pVisual->nplanes;
+ PanoramiXDepths[PanoramiXNumDepths].numVids = 1;
+ PanoramiXDepths[PanoramiXNumDepths].vids = xalloc(sizeof(VisualID) * 256);
+ PanoramiXDepths[PanoramiXNumDepths].vids[0] = pVisual->vid;
+ PanoramiXNumDepths++;
+ }
+ }
+ }
+
+
+ root = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes));
+ root->type = XRT_WINDOW;
+ defmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes));
+ defmap->type = XRT_COLORMAP;
+
+ for (i = 0; i < PanoramiXNumScreens; i++) {
+ root->info[i].id = WindowTable[i]->drawable.id;
+ root->u.win.class = InputOutput;
+ defmap->info[i].id = (screenInfo.screens[i])->defColormap;
}
-}
+ AddResource(root->info[0].id, XRT_WINDOW, root);
+ AddResource(defmap->info[0].id, XRT_COLORMAP, defmap);
+}
/*
@@ -597,46 +883,25 @@ static void locate_neighbors(int i)
* Exit, deallocating as needed.
*/
-static void PanoramiXResetProc(extEntry)
- ExtensionEntry* extEntry;
+static void PanoramiXResetProc(ExtensionEntry* extEntry)
{
int i;
- PanoramiXList *pPanoramiXList;
- PanoramiXList *tempList;
- for (pPanoramiXList = PanoramiXPmapRoot; pPanoramiXList; pPanoramiXList = tempList){
- tempList = pPanoramiXList->next;
- Xfree(pPanoramiXList);
- }
- for (pPanoramiXList = PanoramiXCmapRoot; pPanoramiXList; pPanoramiXList = tempList){
- tempList = pPanoramiXList->next;
- Xfree(pPanoramiXList);
- }
- for (pPanoramiXList = PanoramiXGCRoot; pPanoramiXList; pPanoramiXList = tempList) {
- tempList = pPanoramiXList->next;
- Xfree(pPanoramiXList);
- }
- for (pPanoramiXList = PanoramiXWinRoot; pPanoramiXList; pPanoramiXList = tempList) {
- tempList = pPanoramiXList->next;
- Xfree(pPanoramiXList);
- }
+#ifdef RENDER
+ PanoramiXRenderReset ();
+#endif
screenInfo.numScreens = PanoramiXNumScreens;
for (i = 256; i--; )
ProcVector[i] = SavedProcVector[i];
- Xfree(panoramiXdataPtr);
-
+
+ Xfree(panoramiXdataPtr);
}
int
-#if NeedFunctionPrototypes
ProcPanoramiXQueryVersion (ClientPtr client)
-#else
-ProcPanoramiXQueryVersion (client)
- register ClientPtr client;
-#endif
{
- REQUEST(xPanoramiXQueryVersionReq);
+ /* REQUEST(xPanoramiXQueryVersionReq); */
xPanoramiXQueryVersionReply rep;
register int n;
@@ -649,18 +914,15 @@ ProcPanoramiXQueryVersion (client)
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
+ swaps(&rep.majorVersion, n);
+ swaps(&rep.minorVersion, n);
}
WriteToClient(client, sizeof (xPanoramiXQueryVersionReply), (char *)&rep);
return (client->noClientException);
}
int
-#if NeedFunctionPrototypes
ProcPanoramiXGetState(ClientPtr client)
-#else
-ProcPanoramiXGetState(client)
- register ClientPtr client;
-#endif
{
REQUEST(xPanoramiXGetStateReq);
WindowPtr pWin;
@@ -686,12 +948,7 @@ ProcPanoramiXGetState(client)
}
int
-#if NeedFunctionPrototypes
ProcPanoramiXGetScreenCount(ClientPtr client)
-#else
-ProcPanoramiXGetScreenCount(client)
- register ClientPtr client;
-#endif
{
REQUEST(xPanoramiXGetScreenCountReq);
WindowPtr pWin;
@@ -716,12 +973,7 @@ ProcPanoramiXGetScreenCount(client)
}
int
-#if NeedFunctionPrototypes
ProcPanoramiXGetScreenSize(ClientPtr client)
-#else
-ProcPanoramiXGetScreenSize(client)
- register ClientPtr client;
-#endif
{
REQUEST(xPanoramiXGetScreenSizeReq);
WindowPtr pWin;
@@ -741,29 +993,84 @@ ProcPanoramiXGetScreenSize(client)
if (client->swapped) {
swaps (&rep.sequenceNumber, n);
swapl (&rep.length, n);
- swaps (rep.width, n);
- swaps (rep.height, n);
+ swaps (&rep.width, n);
+ swaps (&rep.height, n);
}
WriteToClient (client, sizeof (xPanoramiXGetScreenSizeReply), (char *) &rep);
return client->noClientException;
}
-void PrintList(PanoramiXList *head)
+int
+ProcXineramaIsActive(ClientPtr client)
+{
+ /* REQUEST(xXineramaIsActiveReq); */
+ xXineramaIsActiveReply rep;
+
+ REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.state = !noPanoramiXExtension;
+ if (client->swapped) {
+ register int n;
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swapl (&rep.state, n);
+ }
+ WriteToClient (client, sizeof (xXineramaIsActiveReply), (char *) &rep);
+ return client->noClientException;
+}
+
+
+int
+ProcXineramaQueryScreens(ClientPtr client)
{
- int i = 0;
+ /* REQUEST(xXineramaQueryScreensReq); */
+ xXineramaQueryScreensReply rep;
+
+ REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
+
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
+ rep.length = rep.number * sz_XineramaScreenInfo >> 2;
+ if (client->swapped) {
+ register int n;
+ swaps (&rep.sequenceNumber, n);
+ swapl (&rep.length, n);
+ swapl (&rep.number, n);
+ }
+ WriteToClient (client, sizeof (xXineramaQueryScreensReply), (char *) &rep);
- for (; head; i++, head = head->next)
- fprintf(stderr, "%2d next = 0x%010lx, id[0] = 0x%08x, id[1] = 0x%08x\n",
- i, head->next, head->info[0].id, head->info[1].id);
+ if(!noPanoramiXExtension) {
+ xXineramaScreenInfo scratch;
+ int i;
+
+ for(i = 0; i < PanoramiXNumScreens; i++) {
+ scratch.x_org = panoramiXdataPtr[i].x;
+ scratch.y_org = panoramiXdataPtr[i].y;
+ scratch.width = panoramiXdataPtr[i].width;
+ scratch.height = panoramiXdataPtr[i].height;
+
+ if(client->swapped) {
+ register int n;
+ swaps (&scratch.x_org, n);
+ swaps (&scratch.y_org, n);
+ swaps (&scratch.width, n);
+ swaps (&scratch.height, n);
+ }
+ WriteToClient (client, sz_XineramaScreenInfo, (char *) &scratch);
+ }
+ }
+
+ return client->noClientException;
}
+
+
static int
-#if NeedFunctionPrototypes
ProcPanoramiXDispatch (ClientPtr client)
-#else
-ProcPanoramiXDispatch (client)
- ClientPtr client;
-#endif
{ REQUEST(xReq);
switch (stuff->data)
{
@@ -775,6 +1082,184 @@ ProcPanoramiXDispatch (client)
return ProcPanoramiXGetScreenCount(client);
case X_PanoramiXGetScreenSize:
return ProcPanoramiXGetScreenSize(client);
+ case X_XineramaIsActive:
+ return ProcXineramaIsActive(client);
+ case X_XineramaQueryScreens:
+ return ProcXineramaQueryScreens(client);
}
return BadRequest;
}
+
+
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+#define SHIFT_L(v,s) (v) << (s)
+#define SHIFT_R(v,s) (v) >> (s)
+#else
+#define SHIFT_L(v,s) (v) >> (s)
+#define SHIFT_R(v,s) (v) << (s)
+#endif
+
+static void
+CopyBits(char *dst, int shiftL, char *src, int bytes)
+{
+ /* Just get it to work. Worry about speed later */
+ int shiftR = 8 - shiftL;
+
+ while(bytes--) {
+ *dst |= SHIFT_L(*src, shiftL);
+ *(dst + 1) |= SHIFT_R(*src, shiftR);
+ dst++; src++;
+ }
+}
+
+
+/* Caution. This doesn't support 2 and 4 bpp formats. We expect
+ 1 bpp and planar data to be already cleared when presented
+ to this function */
+
+void
+XineramaGetImageData(
+ DrawablePtr *pDrawables,
+ int left,
+ int top,
+ int width,
+ int height,
+ unsigned int format,
+ unsigned long planemask,
+ char *data,
+ int pitch,
+ Bool isRoot
+){
+ RegionRec SrcRegion, GrabRegion;
+ BoxRec SrcBox, *pbox;
+ int x, y, w, h, i, j, nbox, size, sizeNeeded, ScratchPitch, inOut, depth;
+ DrawablePtr pDraw = pDrawables[0];
+ char *ScratchMem = NULL;
+
+ size = 0;
+
+ /* find box in logical screen space */
+ SrcBox.x1 = left;
+ SrcBox.y1 = top;
+ if(!isRoot) {
+ SrcBox.x1 += pDraw->x + panoramiXdataPtr[0].x;
+ SrcBox.y1 += pDraw->y + panoramiXdataPtr[0].y;
+ }
+ SrcBox.x2 = SrcBox.x1 + width;
+ SrcBox.y2 = SrcBox.y1 + height;
+
+ REGION_INIT(pScreen, &SrcRegion, &SrcBox, 1);
+ REGION_INIT(pScreen, &GrabRegion, NullBox, 1);
+
+ depth = (format == XYPixmap) ? 1 : pDraw->depth;
+
+ for(i = 0; i < PanoramiXNumScreens; i++) {
+ pDraw = pDrawables[i];
+
+ inOut = RECT_IN_REGION(pScreen,&XineramaScreenRegions[i],&SrcBox);
+
+ if(inOut == rgnIN) {
+ (*pDraw->pScreen->GetImage)(pDraw,
+ SrcBox.x1 - pDraw->x - panoramiXdataPtr[i].x,
+ SrcBox.y1 - pDraw->y - panoramiXdataPtr[i].y,
+ width, height, format, planemask, data);
+ break;
+ } else if (inOut == rgnOUT)
+ continue;
+
+ REGION_INTERSECT(pScreen, &GrabRegion, &SrcRegion,
+ &XineramaScreenRegions[i]);
+
+ nbox = REGION_NUM_RECTS(&GrabRegion);
+
+ if(nbox) {
+ pbox = REGION_RECTS(&GrabRegion);
+
+ while(nbox--) {
+ w = pbox->x2 - pbox->x1;
+ h = pbox->y2 - pbox->y1;
+ ScratchPitch = PixmapBytePad(w, depth);
+ sizeNeeded = ScratchPitch * h;
+
+ if(sizeNeeded > size) {
+ char *tmpdata = ScratchMem;
+ ScratchMem = xrealloc(ScratchMem, sizeNeeded);
+ if(ScratchMem)
+ size = sizeNeeded;
+ else {
+ ScratchMem = tmpdata;
+ break;
+ }
+ }
+
+ x = pbox->x1 - pDraw->x - panoramiXdataPtr[i].x;
+ y = pbox->y1 - pDraw->y - panoramiXdataPtr[i].y;
+
+ (*pDraw->pScreen->GetImage)(pDraw, x, y, w, h,
+ format, planemask, ScratchMem);
+
+ /* copy the memory over */
+
+ if(depth == 1) {
+ int k, shift, leftover, index, index2;
+
+ x = pbox->x1 - SrcBox.x1;
+ y = pbox->y1 - SrcBox.y1;
+ shift = x & 7;
+ x >>= 3;
+ leftover = w & 7;
+ w >>= 3;
+
+ /* clean up the edge */
+ if(leftover) {
+ int mask = (1 << leftover) - 1;
+ for(j = h, k = w; j--; k += ScratchPitch)
+ ScratchMem[k] &= mask;
+ }
+
+ for(j = 0, index = (pitch * y) + x, index2 = 0; j < h;
+ j++, index += pitch, index2 += ScratchPitch)
+ {
+ if(w) {
+ if(!shift)
+ memcpy(data + index, ScratchMem + index2, w);
+ else
+ CopyBits(data + index, shift,
+ ScratchMem + index2, w);
+ }
+
+ if(leftover) {
+ data[index + w] |=
+ SHIFT_L(ScratchMem[index2 + w], shift);
+ if((shift + leftover) > 8)
+ data[index + w + 1] |=
+ SHIFT_R(ScratchMem[index2 + w],(8 - shift));
+ }
+ }
+ } else {
+ j = BitsPerPixel(depth) >> 3;
+ x = (pbox->x1 - SrcBox.x1) * j;
+ y = pbox->y1 - SrcBox.y1;
+ w *= j;
+
+ for(j = 0; j < h; j++) {
+ memcpy(data + (pitch * (y + j)) + x,
+ ScratchMem + (ScratchPitch * j), w);
+ }
+ }
+ pbox++;
+ }
+
+ REGION_SUBTRACT(pScreen, &SrcRegion, &SrcRegion, &GrabRegion);
+ if(!REGION_NOTEMPTY(pScreen, &SrcRegion))
+ break;
+ }
+
+ }
+
+ if(ScratchMem)
+ xfree(ScratchMem);
+
+ REGION_UNINIT(pScreen, &SrcRegion);
+ REGION_UNINIT(pScreen, &GrabRegion);
+}
diff --git a/Xext/panoramiXSwap.c b/Xext/panoramiXSwap.c
index c6bb5071e..e78624187 100644
--- a/Xext/panoramiXSwap.c
+++ b/Xext/panoramiXSwap.c
@@ -23,6 +23,7 @@ shall not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/panoramiXSwap.c,v 3.8 2001/08/23 13:01:36 alanh Exp $ */
#include <stdio.h>
#include "X.h"
@@ -44,20 +45,16 @@ Equipment Corporation.
#endif
#include "panoramiX.h"
#include "panoramiXproto.h"
+#include "panoramiXsrv.h"
+#include "globals.h"
/*
-/*
* External references for data variables
*/
-extern Bool noPanoramiXExtension;
-extern Bool PanoramiXVisibilityNotifySent;
-extern WindowPtr *WindowTable;
-extern int defaultBackingStore;
extern char *ConnectionInfo;
extern int connBlockScreenStart;
-extern int (* ProcVector[256]) ();
#if NeedFunctionPrototypes
#define PROC_EXTERN(pfunc) extern int pfunc(ClientPtr)
@@ -68,50 +65,38 @@ extern int (* ProcVector[256]) ();
PROC_EXTERN(ProcPanoramiXQueryVersion);
PROC_EXTERN(ProcPanoramiXGetState);
PROC_EXTERN(ProcPanoramiXGetScreenCount);
-PROC_EXTERN(PropPanoramiXGetScreenSize);
+PROC_EXTERN(ProcPanoramiXGetScreenSize);
+
+PROC_EXTERN(ProcXineramaIsActive);
+PROC_EXTERN(ProcXineramaQueryScreens);
static int
-#if NeedFunctionPrototypes
SProcPanoramiXQueryVersion (ClientPtr client)
-#else
-SProcPanoramiXQueryVersion (client)
- register ClientPtr client;
-#endif
{
- register int n;
- REQUEST(xPanoramiXQueryVersionReq);
+ REQUEST(xPanoramiXQueryVersionReq);
+ register int n;
- swaps(&stuff->length,n);
- REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
- return ProcPanoramiXQueryVersion(client);
+ swaps(&stuff->length,n);
+ REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
+ return ProcPanoramiXQueryVersion(client);
}
static int
-#if NeedFunctionPrototypes
SProcPanoramiXGetState(ClientPtr client)
-#else
-SProcPanoramiXGetState(client)
- register ClientPtr client;
-#endif
{
REQUEST(xPanoramiXGetStateReq);
- register int n;
+ register int n;
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
-
+ return ProcPanoramiXGetState(client);
}
static int
-#if NeedFunctionPrototypes
SProcPanoramiXGetScreenCount(ClientPtr client)
-#else
-SProcPanoramixGetScreenCount(client)
- register ClientPtr client;
-#endif
{
REQUEST(xPanoramiXGetScreenCountReq);
- register int n;
+ register int n;
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
@@ -119,29 +104,43 @@ SProcPanoramixGetScreenCount(client)
}
static int
-#if NeedFunctionPrototypes
SProcPanoramiXGetScreenSize(ClientPtr client)
-#else
-SProcPanoramiXGetScreenSize(client)
- register ClientPtr client;
-#endif
{
REQUEST(xPanoramiXGetScreenSizeReq);
- WindowPtr pWin;
- register int n;
+ register int n;
swaps (&stuff->length, n);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
return ProcPanoramiXGetScreenSize(client);
}
+
+static int
+SProcXineramaIsActive(ClientPtr client)
+{
+ REQUEST(xXineramaIsActiveReq);
+ register int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
+ return ProcXineramaIsActive(client);
+}
+
+
+static int
+SProcXineramaQueryScreens(ClientPtr client)
+{
+ REQUEST(xXineramaQueryScreensReq);
+ register int n;
+
+ swaps (&stuff->length, n);
+ REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
+ return ProcXineramaQueryScreens(client);
+}
+
+
int
-#if NeedFunctionPrototypes
SProcPanoramiXDispatch (ClientPtr client)
-#else
-SProcPanoramiXDispatch (client)
- ClientPtr client;
-#endif
{ REQUEST(xReq);
switch (stuff->data)
{
@@ -153,6 +152,10 @@ SProcPanoramiXDispatch (client)
return SProcPanoramiXGetScreenCount(client);
case X_PanoramiXGetScreenSize:
return SProcPanoramiXGetScreenSize(client);
- return BadRequest;
+ case X_XineramaIsActive:
+ return SProcXineramaIsActive(client);
+ case X_XineramaQueryScreens:
+ return SProcXineramaQueryScreens(client);
}
+ return BadRequest;
}
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index cd54bdcb3..37b54f4bc 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -24,6 +24,10 @@ dealings in this Software without prior written authorization from Digital
Equipment Corporation.
******************************************************************/
+/* Massively rewritten by Mark Vojkovich <markv@valinux.com> */
+
+/* $XFree86: xc/programs/Xserver/Xext/panoramiXprocs.c,v 3.33 2002/04/10 21:38:53 mvojkovi Exp $ */
+
#include <stdio.h>
#include "X.h"
#define NEED_REPLIES
@@ -40,757 +44,485 @@ Equipment Corporation.
#include "misc.h"
#include "dixstruct.h"
#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#include "resource.h"
+
+#define XINERAMA_IMAGE_BUFSIZE (256*1024)
+#define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \
+ CWDontPropagate | CWOverrideRedirect | CWCursor )
-extern Bool noPanoramiXExtension;
-extern Bool PanoramiXVisibilityNotifySent;
-extern Bool PanoramiXMapped;
-extern int PanoramiXNumScreens;
-extern int PanoramiXPixWidth;
-extern int PanoramiXPixHeight;
-extern PanoramiXWindow *PanoramiXWinRoot;
-extern PanoramiXGC *PanoramiXGCRoot;
-extern PanoramiXCmap *PanoramiXCmapRoot;
-extern PanoramiXPmap *PanoramiXPmapRoot;
-extern PanoramiXData *panoramiXdataPtr;
-extern PanoramiXCDT PanoramiXColorDepthTable[MAXSCREENS];
extern ScreenInfo *GlobalScrInfo;
-extern int (* SavedProcVector[256])();
-extern void (* ReplySwapVector[256])();
-extern WindowPtr *WindowTable;
extern char *ConnectionInfo;
extern int connBlockScreenStart;
-extern XID clientErrorValue;
-
-extern void Swap32Write();
-
-extern long defaultScreenSaverTime;
-extern long defaultScreenSaverInterval;
-extern int defaultScreenSaverBlanking;
-extern int defaultScreenSaverAllowExposures;
-static ClientPtr onlyClient;
-static Bool grabbingClient = FALSE;
-#ifdef __alpha /* THIS NEEDS TO BE LONG !!!! Change driver! */
-int *checkForInput[2];
-#else
-long *checkForInput[2];
-#endif
-extern int connBlockScreenStart;
-
-extern int (* InitialVector[3]) ();
-extern int (* ProcVector[256]) ();
-extern int (* SwappedProcVector[256]) ();
+extern int (* SavedProcVector[256]) ();
extern void (* EventSwapVector[128]) ();
-extern void (* ReplySwapVector[256]) ();
extern void Swap32Write(), SLHostsExtend(), SQColorsExtend(),
WriteSConnectionInfo();
extern void WriteSConnSetupPrefix();
-extern char *ClientAuthorized();
-extern Bool InsertFakeRequest();
-static void KillAllClients();
-static void DeleteClientFromAnySelections();
-extern void ProcessWorkQueue();
-
-
-static int nextFreeClientID; /* always MIN free client ID */
-
-static int nClients; /* number active clients */
-
-char isItTimeToYield;
/* Various of the DIX function interfaces were not designed to allow
* the client->errorValue to be set on BadValue and other errors.
* Rather than changing interfaces and breaking untold code we introduce
* a new global that dispatch can use.
*/
-XID clientErrorValue; /* XXX this is a kludge */
-
-
-#define SAME_SCREENS(a, b) (\
- (a.pScreen == b.pScreen))
+extern XID clientErrorValue; /* XXX this is a kludge */
-
-
-extern int Ones();
-
-int PanoramiXCreateWindow(register ClientPtr client)
+int PanoramiXCreateWindow(ClientPtr client)
{
- register WindowPtr pParent, pWin;
+ PanoramiXRes *parent, *newWin;
+ PanoramiXRes *backPix = NULL;
+ PanoramiXRes *bordPix = NULL;
+ PanoramiXRes *cmap = NULL;
REQUEST(xCreateWindowReq);
- int result, j = 0;
- unsigned len;
- Bool FoundIt = FALSE;
- Window winID;
- Window parID;
- PanoramiXWindow *localWin;
- PanoramiXWindow *parentWin = PanoramiXWinRoot;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXCmap *pPanoramiXCmap = NULL;
- PanoramiXPmap *pBackgndPmap = NULL;
- PanoramiXPmap *pBorderPmap = NULL;
- VisualID orig_visual;
- XID orig_wid;
- int orig_x, orig_y;
- register Mask orig_mask;
- int cmap_offset = 0;
- int pback_offset = 0;
- int pbord_offset = 0;
- int class_index, this_class_index;
- int vid_index, this_vid_index;
+ int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
+ int result = 0, len, j;
+ int orig_x, orig_y;
+ XID orig_visual, tmp;
+ Bool parentIsRoot;
REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
len = client->req_len - (sizeof(xCreateWindowReq) >> 2);
- IF_RETURN((Ones((Mask)stuff->mask) != len), BadLength);
- orig_mask = stuff->mask;
- PANORAMIXFIND_ID(parentWin, stuff->parent);
- if (parentWin) {
- localWin = (PanoramiXWindow *)Xcalloc(sizeof(PanoramiXWindow));
- IF_RETURN(!localWin, BadAlloc);
- } else {
- return BadWindow;
- }
- if ((PanoramiXNumScreens - 1) && ((Mask)stuff->mask & CWBackPixmap)) {
- XID pmapID;
+ if (Ones(stuff->mask) != len)
+ return BadLength;
+
+ if (!(parent = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->parent, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ if(stuff->class == CopyFromParent)
+ stuff->class = parent->u.win.class;
+
+ if((stuff->class == InputOnly) && (stuff->mask & (~INPUTONLY_LEGAL_MASK)))
+ return BadMatch;
+ if ((Mask)stuff->mask & CWBackPixmap) {
pback_offset = Ones((Mask)stuff->mask & (CWBackPixmap - 1));
- pmapID = *((CARD32 *) &stuff[1] + pback_offset);
- if (pmapID) {
- pBackgndPmap = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pBackgndPmap, pmapID);
+ tmp = *((CARD32 *) &stuff[1] + pback_offset);
+ if ((tmp != None) && (tmp != ParentRelative)) {
+ if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
- if ((PanoramiXNumScreens - 1) && ((Mask)stuff->mask & CWBorderPixmap)) {
- XID pmapID;
-
+ if ((Mask)stuff->mask & CWBorderPixmap) {
pbord_offset = Ones((Mask)stuff->mask & (CWBorderPixmap - 1));
- pmapID = *((CARD32 *) &stuff[1] + pbord_offset);
- if (pmapID) {
- pBorderPmap = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pBorderPmap, pmapID);
+ tmp = *((CARD32 *) &stuff[1] + pbord_offset);
+ if (tmp != CopyFromParent) {
+ if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
- if ((PanoramiXNumScreens - 1) && ((Mask)stuff->mask & CWColormap)) {
- Colormap cmapID;
-
+ if ((Mask)stuff->mask & CWColormap) {
cmap_offset = Ones((Mask)stuff->mask & (CWColormap - 1));
- cmapID = *((CARD32 *) &stuff[1] + cmap_offset);
- if (cmapID) {
- pPanoramiXCmap = PanoramiXCmapRoot;
- PANORAMIXFIND_ID(pPanoramiXCmap, cmapID);
+ tmp = *((CARD32 *) &stuff[1] + cmap_offset);
+ if ((tmp != CopyFromParent) && (tmp != None)) {
+ if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_COLORMAP, SecurityReadAccess)))
+ return BadColor;
}
}
+
+ if(!(newWin = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ newWin->type = XRT_WINDOW;
+ newWin->u.win.visibility = VisibilityNotViewable;
+ newWin->u.win.class = stuff->class;
+ newWin->info[0].id = stuff->wid;
+ for(j = 1; j < PanoramiXNumScreens; j++)
+ newWin->info[j].id = FakeClientID(client->index);
+
+ if (stuff->class == InputOnly)
+ stuff->visual = CopyFromParent;
+ orig_visual = stuff->visual;
orig_x = stuff->x;
orig_y = stuff->y;
- orig_wid = stuff->wid;
- orig_visual = stuff->visual;
- for (j = 0; j <= PanoramiXNumScreens - 1; j++) {
- winID = j ? FakeClientID(client->index) : orig_wid;
- localWin->info[j].id = winID;
- }
- localWin->FreeMe = FALSE;
- localWin->visibility = VisibilityNotViewable;
- localWin->VisibilitySent = FALSE;
- PANORAMIXFIND_LAST(pPanoramiXWin, PanoramiXWinRoot);
- pPanoramiXWin->next = localWin;
- if ( (stuff->visual != CopyFromParent) && (stuff->depth != 0))
- {
- /* Find the correct visual for this screen */
- for (class_index = 0; class_index < PanoramiXColorDepthTable[0].numVisuals;
-class_index++)
- {
- for (vid_index = 0; vid_index < PanoramiXColorDepthTable[0].panoramiXScreenMap[class_index].vmap[stuff->depth].numVids; vid_index++)
- {
- if ( stuff->visual == PanoramiXColorDepthTable[0].panoramiXScreenMap[class_index].vmap[stuff->depth].vid[vid_index] )
- {
- this_class_index = class_index;
- this_vid_index = vid_index;
- FoundIt = TRUE;
- break;
- }
- }
- }
- }
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- if (parentWin == PanoramiXWinRoot) {
+ parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id);
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->wid = newWin->info[j].id;
+ stuff->parent = parent->info[j].id;
+ if (parentIsRoot) {
stuff->x = orig_x - panoramiXdataPtr[j].x;
stuff->y = orig_y - panoramiXdataPtr[j].y;
}
- stuff->wid = localWin->info[j].id;
- parID = (XID)(parentWin->info[j].id);
- pParent = (WindowPtr)SecurityLookupWindow(parID, client,SecurityReadAccess);
- IF_RETURN((!pParent),BadWindow);
- stuff->parent = parID;
- if ( (orig_visual != CopyFromParent) && (stuff->depth != 0) && FoundIt )
- {
- stuff->visual = PanoramiXColorDepthTable[j].panoramiXScreenMap[this_class_index].vmap[stuff->depth].vid[this_vid_index];
- }
- if (pBackgndPmap)
- *((CARD32 *) &stuff[1] + pback_offset) = pBackgndPmap->info[j].id;
- if (pBorderPmap)
- *((CARD32 *) &stuff[1] + pbord_offset) = pBorderPmap->info[j].id;
- if (pPanoramiXCmap)
- *((CARD32 *) &stuff[1] + cmap_offset) = pPanoramiXCmap->info[j].id;
- stuff->mask = orig_mask;
- result = (*SavedProcVector[X_CreateWindow])(client);
- BREAK_IF(result != Success);
- }
- if (result != Success) {
- pPanoramiXWin->next = NULL;
- if (localWin)
- Xfree(localWin);
- }
+ if (backPix)
+ *((CARD32 *) &stuff[1] + pback_offset) = backPix->info[j].id;
+ if (bordPix)
+ *((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[j].id;
+ if (cmap)
+ *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id;
+ if ( orig_visual != CopyFromParent )
+ stuff->visual = PanoramiXVisualTable[(orig_visual*MAXSCREENS) + j];
+ result = (*SavedProcVector[X_CreateWindow])(client);
+ if(result != Success) break;
+ }
+
+ if (result == Success)
+ AddResource(newWin->info[0].id, XRT_WINDOW, newWin);
+ else
+ xfree(newWin);
+
return (result);
}
-
-int PanoramiXChangeWindowAttributes(register ClientPtr client)
+int PanoramiXChangeWindowAttributes(ClientPtr client)
{
- register WindowPtr pWin;
+ PanoramiXRes *win;
+ PanoramiXRes *backPix = NULL;
+ PanoramiXRes *bordPix = NULL;
+ PanoramiXRes *cmap = NULL;
REQUEST(xChangeWindowAttributesReq);
- register int result;
- int len;
- int j;
- Window winID;
- Mask orig_valueMask;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXWindow *pPanoramiXWinback = NULL;
- PanoramiXCmap *pPanoramiXCmap = NULL;
- PanoramiXPmap *pBackgndPmap = NULL;
- PanoramiXPmap *pBorderPmap = NULL;
- int cmap_offset = 0;
- int pback_offset = 0;
- int pbord_offset = 0;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+ int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
+ int result = 0, len, j;
+ XID tmp;
REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
+
len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2);
- IF_RETURN((len != Ones((Mask) stuff->valueMask)), BadLength);
- orig_valueMask = stuff->valueMask;
- winID = stuff->window;
- for (; pPanoramiXWin && (pPanoramiXWin->info[0].id != stuff->window);
- pPanoramiXWin = pPanoramiXWin->next)
- pPanoramiXWinback = pPanoramiXWin;
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, winID);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- if ((PanoramiXNumScreens - 1) && ((Mask)stuff->valueMask & CWBackPixmap)) {
- XID pmapID;
+ if (Ones(stuff->valueMask) != len)
+ return BadLength;
+ if (!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ if((win->u.win.class == InputOnly) &&
+ (stuff->valueMask & (~INPUTONLY_LEGAL_MASK)))
+ return BadMatch;
+
+ if ((Mask)stuff->valueMask & CWBackPixmap) {
pback_offset = Ones((Mask)stuff->valueMask & (CWBackPixmap - 1));
- pmapID = *((CARD32 *) &stuff[1] + pback_offset);
- if (pmapID) {
- pBackgndPmap = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pBackgndPmap, pmapID);
+ tmp = *((CARD32 *) &stuff[1] + pback_offset);
+ if ((tmp != None) && (tmp != ParentRelative)) {
+ if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
- if ((PanoramiXNumScreens - 1) && ((Mask)stuff->valueMask & CWBorderPixmap)) {
- XID pmapID;
-
+ if ((Mask)stuff->valueMask & CWBorderPixmap) {
pbord_offset = Ones((Mask)stuff->valueMask & (CWBorderPixmap - 1));
- pmapID = *((CARD32 *) &stuff[1] + pbord_offset);
- if (pmapID) {
- pBorderPmap = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pBorderPmap, pmapID);
+ tmp = *((CARD32 *) &stuff[1] + pbord_offset);
+ if (tmp != CopyFromParent) {
+ if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
- if ((PanoramiXNumScreens - 1) && ((Mask)stuff->valueMask & CWColormap )) {
- Colormap cmapID;
-
+ if ((Mask)stuff->valueMask & CWColormap) {
cmap_offset = Ones((Mask)stuff->valueMask & (CWColormap - 1));
- cmapID = *((CARD32 *) &stuff[1] + cmap_offset);
- if (cmapID) {
- pPanoramiXCmap = PanoramiXCmapRoot;
- PANORAMIXFIND_ID(pPanoramiXCmap, cmapID);
+ tmp = *((CARD32 *) &stuff[1] + cmap_offset);
+ if ((tmp != CopyFromParent) && (tmp != None)) {
+ if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_COLORMAP, SecurityReadAccess)))
+ return BadColor;
}
}
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->window = pPanoramiXWin->info[j].id;
- stuff->valueMask = orig_valueMask;
- if (pBackgndPmap)
- *((CARD32 *) &stuff[1] + pback_offset) = pBackgndPmap->info[j].id;
- if (pBorderPmap)
- *((CARD32 *) &stuff[1] + pbord_offset) = pBorderPmap->info[j].id;
- if (pPanoramiXCmap)
- *((CARD32 *) &stuff[1] + cmap_offset) = pPanoramiXCmap->info[j].id;
- result = (*SavedProcVector[X_ChangeWindowAttributes])(client);
- BREAK_IF(result != Success);
- }
- if ((result == Success) && pPanoramiXWinback &&
- pPanoramiXWin && pPanoramiXWin->FreeMe) {
- pPanoramiXWinback->next = pPanoramiXWin->next;
- Xfree(pPanoramiXWin);
- }
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->window = win->info[j].id;
+ if (backPix)
+ *((CARD32 *) &stuff[1] + pback_offset) = backPix->info[j].id;
+ if (bordPix)
+ *((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[j].id;
+ if (cmap)
+ *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[j].id;
+ result = (*SavedProcVector[X_ChangeWindowAttributes])(client);
+ }
+
return (result);
}
int PanoramiXDestroyWindow(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xResourceReq);
- int j, result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXWindow *pPanoramiXWinback = NULL;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- for (; pPanoramiXWin && (pPanoramiXWin->info[0].id != stuff->id);
- pPanoramiXWin = pPanoramiXWin->next)
- pPanoramiXWinback = pPanoramiXWin;
- IF_RETURN(!pPanoramiXWin,BadWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->id = pPanoramiXWin->info[j].id;
- result = (* SavedProcVector[X_DestroyWindow])(client);
- BREAK_IF(result != Success);
- }
- if ((result == Success) && pPanoramiXWinback &&
- pPanoramiXWin && pPanoramiXWin->FreeMe) {
- pPanoramiXWinback->next = pPanoramiXWin->next;
- Xfree(pPanoramiXWin);
- }
- PANORAMIX_FREE(client);
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_WINDOW, SecurityDestroyAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->id = win->info[j].id;
+ result = (*SavedProcVector[X_DestroyWindow])(client);
+ if(result != Success) break;
+ }
+
+ /* Since ProcDestroyWindow is using FreeResource, it will free
+ our resource for us on the last pass through the loop above */
+
return (result);
}
int PanoramiXDestroySubwindows(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xResourceReq);
- int j,result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXWindow *pPanoramiXWinback = NULL;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- for (; pPanoramiXWin && (pPanoramiXWin->info[0].id != stuff->id);
- pPanoramiXWin = pPanoramiXWin->next)
- pPanoramiXWinback = pPanoramiXWin;
- IF_RETURN(!pPanoramiXWin, BadWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->id = pPanoramiXWin->info[j].id;
- result = (* SavedProcVector[X_DestroySubwindows])(client);
- }
- if ((result == Success) && pPanoramiXWinback &&
- pPanoramiXWin && pPanoramiXWin->FreeMe) {
- pPanoramiXWinback->next = pPanoramiXWin->next;
- Xfree(pPanoramiXWin);
- }
- PANORAMIX_FREE(client);
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_WINDOW, SecurityDestroyAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->id = win->info[j].id;
+ result = (*SavedProcVector[X_DestroySubwindows])(client);
+ if(result != Success) break;
+ }
+
+ /* DestroySubwindows is using FreeResource which will free
+ our resources for us on the last pass through the loop above */
+
return (result);
}
int PanoramiXChangeSaveSet(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xChangeSaveSetReq);
- int j, result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
REQUEST_SIZE_MATCH(xChangeSaveSetReq);
- if (!stuff->window)
- result = (* SavedProcVector[X_ChangeSaveSet])(client);
- else {
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->window = pPanoramiXWin->info[j].id;
- result = (* SavedProcVector[X_ChangeSaveSet])(client);
- }
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->window = win->info[j].id;
+ result = (*SavedProcVector[X_ChangeSaveSet])(client);
+ if(result != Success) break;
}
+
return (result);
}
-int PanoramiXReparentWindow(register ClientPtr client)
+int PanoramiXReparentWindow(ClientPtr client)
{
- register WindowPtr pWin, pParent;
+ PanoramiXRes *win, *parent;
+ int result = 0, j;
+ int x, y;
+ Bool parentIsRoot;
REQUEST(xReparentWindowReq);
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXWindow *pPanoramiXPar = PanoramiXWinRoot;
REQUEST_SIZE_MATCH(xReparentWindowReq);
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- PANORAMIXFIND_ID(pPanoramiXPar, stuff->parent);
- IF_RETURN(!pPanoramiXPar, BadWindow);
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXPar), j) {
- stuff->window = pPanoramiXWin->info[j].id;
- stuff->parent = pPanoramiXPar->info[j].id;
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ if(!(parent = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->parent, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ x = stuff->x;
+ y = stuff->y;
+ parentIsRoot = (stuff->parent == WindowTable[0]->drawable.id);
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->window = win->info[j].id;
+ stuff->parent = parent->info[j].id;
+ if(parentIsRoot) {
+ stuff->x = x - panoramiXdataPtr[j].x;
+ stuff->y = y - panoramiXdataPtr[j].y;
+ }
result = (*SavedProcVector[X_ReparentWindow])(client);
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
+
return (result);
}
-int PanoramiXMapWindow(register ClientPtr client)
+int PanoramiXMapWindow(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xResourceReq);
- int j,result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- register WindowPtr pWin, pChild;
- Window winID;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- /* initialize visibility */
- pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
-SecurityReadAccess);
- IF_RETURN(!pWin, BadWindow);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- PanoramiXMapped = TRUE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- for (j = 0; j <= (PanoramiXNumScreens - 1); j++)
- {
- winID = pPanoramiXWin->info[j].id;
- pWin = (WindowPtr) SecurityLookupWindow(winID,
-client,SecurityReadAccess);
- IF_RETURN((!pWin), BadWindow);
- stuff->id = winID;
- result = (*SavedProcVector[X_MapWindow])(client);
- }
- /* clean up */
- PanoramiXMapped = FALSE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->id = win->info[j].id;
+ result = (*SavedProcVector[X_MapWindow])(client);
+ if(result != Success) break;
}
+
return (result);
}
-int PanoramiXMapSubwindows(register ClientPtr client)
+int PanoramiXMapSubwindows(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xResourceReq);
- int j,result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- register WindowPtr pWin, pChild;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- /* initialize visibility values */
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- IF_RETURN(!pWin, BadWindow);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
-
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- PanoramiXMapped = TRUE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- for (j = 0; j <= (PanoramiXNumScreens - 1); j++)
- {
- stuff->id = pPanoramiXWin->info[j].id;
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->id = win->info[j].id;
result = (*SavedProcVector[X_MapSubwindows])(client);
+ if(result != Success) break;
}
- /* clean up */
- PanoramiXMapped = FALSE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
- PANORAMIX_FREE(client);
+
return (result);
}
-int PanoramiXUnmapWindow(register ClientPtr client)
+int PanoramiXUnmapWindow(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xResourceReq);
- int j, result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- register WindowPtr pWin, pChild;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- /* initialize visibility values */
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- IF_RETURN(!pWin, BadWindow);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pWin->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
-
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- PanoramiXMapped = TRUE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- for (j = 0; j <= (PanoramiXNumScreens - 1); j++)
- {
- stuff->id = pPanoramiXWin->info[j].id;
- result = (*SavedProcVector[X_UnmapWindow])(client);
- }
-
- /* clean up */
- PanoramiXMapped = FALSE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) {
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pChild->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
- PANORAMIX_FREE(client);
- return (client->noClientException);
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->id = win->info[j].id;
+ result = (*SavedProcVector[X_UnmapWindow])(client);
+ if(result != Success) break;
+ }
+
+ return (result);
}
-int PanoramiXUnmapSubwindows(register ClientPtr client)
+int PanoramiXUnmapSubwindows(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xResourceReq);
- int j, result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- register WindowPtr pWin, pChild;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- /* initialize visibility values */
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- IF_RETURN(!pWin, BadWindow);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pWin->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
-
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- PanoramiXMapped = TRUE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- for (j = 0; j <= (PanoramiXNumScreens - 1); j++)
- {
- stuff->id = pPanoramiXWin->info[j].id;
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->id = win->info[j].id;
result = (*SavedProcVector[X_UnmapSubwindows])(client);
+ if(result != Success) break;
}
- /* clean up */
- PanoramiXMapped = FALSE;
- PanoramiXVisibilityNotifySent = FALSE;
- pPanoramiXWin->VisibilitySent = FALSE;
- pWin = (WindowPtr) SecurityLookupWindow(stuff->id,
-client,SecurityReadAccess);
- for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib){
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, pWin->drawable.id);
- if (pPanoramiXWin)
- pPanoramiXWin->VisibilitySent = FALSE;
- }
- PANORAMIX_FREE(client);
- return (client->noClientException);
+ return (result);
}
-int PanoramiXConfigureWindow(register ClientPtr client)
+int PanoramiXConfigureWindow(ClientPtr client)
{
- register WindowPtr pWin;
+ PanoramiXRes *win;
+ PanoramiXRes *sib = NULL;
+ WindowPtr pWin;
+ int result = 0, j, len, sib_offset = 0, x = 0, y = 0;
+ int x_offset = -1;
+ int y_offset = -1;
REQUEST(xConfigureWindowReq);
- register int result;
- unsigned len, i, things;
- XID changes[32];
- register Mask orig_mask;
- int j, sib_position;
- Window winID;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXWindow *pPanoramiXSib = NULL;
- int x_off = 0, y_off = 0;
- XID *pStuff;
- XID *origStuff, *modStuff;
- Mask local_mask;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
+
len = client->req_len - (sizeof(xConfigureWindowReq) >> 2);
- things = Ones((Mask)stuff->mask);
- IF_RETURN((things != len), BadLength);
- orig_mask = stuff->mask;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- if (!pPanoramiXWin) {
- client->errorValue = stuff->window;
- return (BadWindow);
- }
- if (things > 0) {
- pStuff = (XID *) ALLOCATE_LOCAL(things * sizeof(XID));
- memcpy((char *) pStuff, (char *) &stuff[1], things * sizeof(XID));
- local_mask = (CWSibling | CWX | CWY) & ((Mask) stuff->mask);
- if (local_mask & CWSibling) {
- sib_position = Ones((Mask) stuff->mask & (CWSibling - 1));
- pPanoramiXSib = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXSib, *(pStuff + sib_position));
- }
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- winID = pPanoramiXWin->info[j].id;
- pWin = (WindowPtr)SecurityLookupWindow(winID, client,SecurityReadAccess);
- if (!pWin) {
- client->errorValue = pPanoramiXWin->info[0].id;
- return (BadWindow);
- }
- stuff->window = winID;
- if (pWin->parent
- && (pWin->parent->drawable.id == PanoramiXWinRoot->info[j].id)) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- modStuff = (XID *) &stuff[1];
- origStuff = pStuff;
- i = things;
- if (local_mask & CWX) {
- *modStuff++ = *origStuff++ - x_off;
- i--;
- }
- if (local_mask & CWY) {
- *modStuff++ = *origStuff++ - y_off;
- i--;
- }
- for ( ; i; i--)
- *modStuff++ = *origStuff++;
- if (pPanoramiXSib)
- *((XID *) &stuff[1] + sib_position) = pPanoramiXSib->info[j].id;
- stuff->mask = orig_mask;
- result = (*SavedProcVector[X_ConfigureWindow])(client);
- }
- DEALLOCATE_LOCAL(pStuff);
- PANORAMIX_FREE(client);
+ if (Ones(stuff->mask) != len)
+ return BadLength;
+
+ /* because we need the parent */
+ if (!(pWin = (WindowPtr)SecurityLookupIDByType(
+ client, stuff->window, RT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ if (!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ if ((Mask)stuff->mask & CWSibling) {
+ XID tmp;
+ sib_offset = Ones((Mask)stuff->mask & (CWSibling - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) {
+ if(!(sib = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+ }
+ }
+
+ if(pWin->parent && (pWin->parent == WindowTable[0])) {
+ if ((Mask)stuff->mask & CWX) {
+ x_offset = 0;
+ x = *((CARD32 *)&stuff[1]);
+ }
+ if ((Mask)stuff->mask & CWY) {
+ y_offset = (x_offset == -1) ? 0 : 1;
+ y = *((CARD32 *) &stuff[1] + y_offset);
+ }
+ }
+
+ /* have to go forward or you get expose events before
+ ConfigureNotify events */
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->window = win->info[j].id;
+ if(sib)
+ *((CARD32 *) &stuff[1] + sib_offset) = sib->info[j].id;
+ if(x_offset >= 0)
+ *((CARD32 *) &stuff[1] + x_offset) = x - panoramiXdataPtr[j].x;
+ if(y_offset >= 0)
+ *((CARD32 *) &stuff[1] + y_offset) = y - panoramiXdataPtr[j].y;
+ result = (*SavedProcVector[X_ConfigureWindow])(client);
+ if(result != Success) break;
+ }
+
return (result);
- } else
- return (client->noClientException);
}
-int PanoramiXCirculateWindow(register ClientPtr client)
+int PanoramiXCirculateWindow(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j;
REQUEST(xCirculateWindowReq);
- int j,result;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xCirculateWindowReq);
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->window = pPanoramiXWin->info[j].id;
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS_FORWARD(j) {
+ stuff->window = win->info[j].id;
result = (*SavedProcVector[X_CirculateWindow])(client);
+ if(result != Success) break;
}
+
return (result);
}
-int PanoramiXGetGeometry(register ClientPtr client)
+int PanoramiXGetGeometry(ClientPtr client)
{
xGetGeometryReply rep;
- register DrawablePtr pDraw;
+ DrawablePtr pDraw;
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
@@ -798,1883 +530,1489 @@ int PanoramiXGetGeometry(register ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
- rep.root = WindowTable[pDraw->pScreen->myNum]->drawable.id;
+ rep.root = WindowTable[0]->drawable.id;
rep.depth = pDraw->depth;
+ rep.width = pDraw->width;
+ rep.height = pDraw->height;
+ rep.x = rep.y = rep.borderWidth = 0;
- if (stuff->id == PanoramiXWinRoot->info[0].id) {
- xConnSetup *setup = (xConnSetup *) ConnectionInfo;
+ if (stuff->id == rep.root) {
xWindowRoot *root = (xWindowRoot *)
(ConnectionInfo + connBlockScreenStart);
rep.width = root->pixWidth;
rep.height = root->pixHeight;
- } else {
- rep.width = pDraw->width;
- rep.height = pDraw->height;
- }
-
- /* XXX - Because the pixmap-implementation of the multibuffer extension
- * may have the buffer-id's drawable resource value be a pointer
- * to the buffer's window instead of the buffer itself
- * (this happens if the buffer is the displayed buffer),
- * we also have to check that the id matches before we can
- * truly say that it is a DRAWABLE_WINDOW.
- */
-
- if ((pDraw->type == UNDRAWABLE_WINDOW) ||
- ((pDraw->type == DRAWABLE_WINDOW) && (stuff->id == pDraw->id))) {
- register WindowPtr pWin = (WindowPtr)pDraw;
+ } else
+ if ((pDraw->type == UNDRAWABLE_WINDOW) || (pDraw->type == DRAWABLE_WINDOW))
+ {
+ WindowPtr pWin = (WindowPtr)pDraw;
rep.x = pWin->origin.x - wBorderWidth (pWin);
rep.y = pWin->origin.y - wBorderWidth (pWin);
+ if(pWin->parent == WindowTable[0]) {
+ rep.x += panoramiXdataPtr[0].x;
+ rep.y += panoramiXdataPtr[0].y;
+ }
rep.borderWidth = pWin->borderWidth;
- } else { /* DRAWABLE_PIXMAP or DRAWABLE_BUFFER */
- rep.x = rep.y = rep.borderWidth = 0;
}
+
WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep);
return (client->noClientException);
}
+int PanoramiXTranslateCoords(ClientPtr client)
+{
+ INT16 x, y;
+ REQUEST(xTranslateCoordsReq);
-int PanoramiXChangeProperty(ClientPtr client)
-{
- int result, j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- REQUEST(xChangePropertyReq);
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
-
- REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->window = pPanoramiXWin->info[j].id;
- result = (* SavedProcVector[X_ChangeProperty])(client);
- if (result != Success) {
- stuff->window = pPanoramiXWin->info[0].id;
- break;
- }
- }
- return (result);
-}
-
-
-int PanoramiXDeleteProperty(ClientPtr client)
-{
- int result, j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- REQUEST(xDeletePropertyReq);
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
-
- REQUEST_SIZE_MATCH(xDeletePropertyReq);
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->window = pPanoramiXWin->info[j].id;
- result = (* SavedProcVector[X_DeleteProperty])(client);
- BREAK_IF(result != Success);
- }
- PANORAMIX_FREE(client);
- return (result);
-}
+ register WindowPtr pWin, pDst;
+ xTranslateCoordsReply rep;
+ REQUEST_SIZE_MATCH(xTranslateCoordsReq);
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client,
+ SecurityReadAccess);
+ if (!pWin)
+ return(BadWindow);
+ pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client,
+ SecurityReadAccess);
+ if (!pDst)
+ return(BadWindow);
+ rep.type = X_Reply;
+ rep.length = 0;
+ rep.sequenceNumber = client->sequence;
+ rep.sameScreen = xTrue;
+ rep.child = None;
-int PanoramiXSendEvent(ClientPtr client)
-{
- int result, j;
- BYTE orig_type;
- Mask orig_eventMask;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- REQUEST(xSendEventReq);
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
-
- REQUEST_SIZE_MATCH(xSendEventReq);
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->destination);
- orig_type = stuff->event.u.u.type;
- orig_eventMask = stuff->eventMask;
- if (!pPanoramiXWin) {
- noPanoramiXExtension = TRUE;
- result = (* SavedProcVector[X_SendEvent])(client);
- noPanoramiXExtension = FALSE;
+ if(pWin == WindowTable[0]) {
+ x = stuff->srcX - panoramiXdataPtr[0].x;
+ y = stuff->srcY - panoramiXdataPtr[0].y;
+ } else {
+ x = pWin->drawable.x + stuff->srcX;
+ y = pWin->drawable.y + stuff->srcY;
}
- else {
- noPanoramiXExtension = FALSE;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->destination = pPanoramiXWin->info[j].id;
- stuff->eventMask = orig_eventMask;
- stuff->event.u.u.type = orig_type;
- if (!j)
- noPanoramiXExtension = TRUE;
- result = (* SavedProcVector[X_SendEvent])(client);
- noPanoramiXExtension = FALSE;
- }
+ pWin = pDst->firstChild;
+ while (pWin) {
+#ifdef SHAPE
+ BoxRec box;
+#endif
+ if ((pWin->mapped) &&
+ (x >= pWin->drawable.x - wBorderWidth (pWin)) &&
+ (x < pWin->drawable.x + (int)pWin->drawable.width +
+ wBorderWidth (pWin)) &&
+ (y >= pWin->drawable.y - wBorderWidth (pWin)) &&
+ (y < pWin->drawable.y + (int)pWin->drawable.height +
+ wBorderWidth (pWin))
+#ifdef SHAPE
+ /* When a window is shaped, a further check
+ * is made to see if the point is inside
+ * borderSize
+ */
+ && (!wBoundingShape(pWin) ||
+ POINT_IN_REGION(pWin->drawable.pScreen,
+ wBoundingShape(pWin),
+ x - pWin->drawable.x,
+ y - pWin->drawable.y, &box))
+#endif
+ )
+ {
+ rep.child = pWin->drawable.id;
+ pWin = (WindowPtr) NULL;
+ }
+ else
+ pWin = pWin->nextSib;
+ }
+ rep.dstX = x - pDst->drawable.x;
+ rep.dstY = y - pDst->drawable.y;
+ if(pDst == WindowTable[0]) {
+ rep.dstX += panoramiXdataPtr[0].x;
+ rep.dstY += panoramiXdataPtr[0].y;
}
- return (result);
-}
+ WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep);
+ return(client->noClientException);
+}
-int PanoramiXCreatePixmap(register ClientPtr client)
+int PanoramiXCreatePixmap(ClientPtr client)
{
- PixmapPtr pMap;
- register DrawablePtr pDraw;
+ PanoramiXRes *refDraw, *newPix;
+ int result = 0, j;
REQUEST(xCreatePixmapReq);
- DepthPtr pDepth;
- int result, j;
- Pixmap pmapID;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXPmap *pPanoramiXPmap;
- PanoramiXPmap *localPmap;
- XID orig_pid;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xCreatePixmapReq);
client->errorValue = stuff->pid;
- localPmap =(PanoramiXPmap *) Xcalloc(sizeof(PanoramiXPmap));
- IF_RETURN(!localPmap, BadAlloc);
-
- pDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!pDraw, BadDrawable);
-
- pPanoramiXWin = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadWindow);
-
- orig_pid = stuff->pid;
- FOR_NSCREENS_OR_ONCE(pPanoramiXPmap, j) {
- pmapID = j ? FakeClientID(client->index) : orig_pid;
- localPmap->info[j].id = pmapID;
- }
- localPmap->FreeMe = FALSE;
- PANORAMIXFIND_LAST(pPanoramiXPmap, PanoramiXPmapRoot);
- pPanoramiXPmap->next = localPmap;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->pid = localPmap->info[j].id;
- stuff->drawable = pPanoramiXWin->info[j].id;
- result = (* SavedProcVector[X_CreatePixmap])(client);
- BREAK_IF(result != Success);
- }
- if (result != Success) {
- pPanoramiXPmap->next = NULL;
- if (localPmap)
- Xfree(localPmap);
+ if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityReadAccess)))
+ return BadDrawable;
+
+ if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ newPix->type = XRT_PIXMAP;
+ newPix->u.pix.shared = FALSE;
+ newPix->info[0].id = stuff->pid;
+ for(j = 1; j < PanoramiXNumScreens; j++)
+ newPix->info[j].id = FakeClientID(client->index);
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->pid = newPix->info[j].id;
+ stuff->drawable = refDraw->info[j].id;
+ result = (*SavedProcVector[X_CreatePixmap])(client);
+ if(result != Success) break;
}
+
+ if (result == Success)
+ AddResource(newPix->info[0].id, XRT_PIXMAP, newPix);
+ else
+ xfree(newPix);
+
return (result);
}
int PanoramiXFreePixmap(ClientPtr client)
{
- PixmapPtr pMap;
- int result, j;
- PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
- PanoramiXPmap *pPanoramiXPmapback = NULL;
+ PanoramiXRes *pix;
+ int result = 0, j;
REQUEST(xResourceReq);
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
-
REQUEST_SIZE_MATCH(xResourceReq);
- for (; pPanoramiXPmap && (pPanoramiXPmap->info[0].id != stuff->id);
- pPanoramiXPmap = pPanoramiXPmap->next)
- pPanoramiXPmapback = pPanoramiXPmap;
- if (!pPanoramiXPmap)
- result = (* SavedProcVector[X_FreePixmap])(client);
- else {
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->id = pPanoramiXPmap->info[j].id;
- result = (* SavedProcVector[X_FreePixmap])(client);
- }
- if ((result == Success) && pPanoramiXPmapback &&
- pPanoramiXPmap && pPanoramiXPmap->FreeMe ) {
- pPanoramiXPmapback->next = pPanoramiXPmap->next;
- Xfree(pPanoramiXPmap);
- }
+
+ client->errorValue = stuff->id;
+
+ if(!(pix = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_PIXMAP, SecurityDestroyAccess)))
+ return BadPixmap;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->id = pix->info[j].id;
+ result = (*SavedProcVector[X_FreePixmap])(client);
+ if(result != Success) break;
}
+
+ /* Since ProcFreePixmap is using FreeResource, it will free
+ our resource for us on the last pass through the loop above */
+
return (result);
}
-int PanoramiXCreateGC(register ClientPtr client)
+int PanoramiXCreateGC(ClientPtr client)
{
- int result, j;
- GC *pGC;
- DrawablePtr pDraw;
- unsigned len, i;
+ PanoramiXRes *refDraw;
+ PanoramiXRes *newGC;
+ PanoramiXRes *stip = NULL;
+ PanoramiXRes *tile = NULL;
+ PanoramiXRes *clip = NULL;
REQUEST(xCreateGCReq);
- GContext GCID;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *localGC;
- PanoramiXGC *pPanoramiXGC;
- PanoramiXPmap *pPanoramiXTile = NULL, *pPanoramiXStip = NULL;
- PanoramiXPmap *pPanoramiXClip = NULL;
- int tile_offset, stip_offset, clip_offset;
- XID orig_GC;
+ int tile_offset = 0, stip_offset = 0, clip_offset = 0;
+ int result = 0, len, j;
+ XID tmp;
REQUEST_AT_LEAST_SIZE(xCreateGCReq);
+
client->errorValue = stuff->gc;
- pDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!pDraw, BadDrawable);
- pPanoramiXWin = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
-
- len = client->req_len - (sizeof(xCreateGCReq) >> 2);
- IF_RETURN((len != Ones((Mask)stuff->mask)), BadLength);
- localGC = (PanoramiXGC *) Xcalloc(sizeof(PanoramiXGC));
- IF_RETURN(!localGC, BadAlloc);
- orig_GC = stuff->gc;
- if ((Mask)stuff->mask & GCTile) {
- XID tileID;
+ len = client->req_len - (sizeof(xCreateGCReq) >> 2);
+ if (Ones(stuff->mask) != len)
+ return BadLength;
+
+ if (!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityReadAccess)))
+ return BadDrawable;
+ if ((Mask)stuff->mask & GCTile) {
tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
- tileID = *((CARD32 *) &stuff[1] + tile_offset);
- if (tileID) {
- pPanoramiXTile = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXTile, tileID);
+ if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
+ if(!(tile = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
if ((Mask)stuff->mask & GCStipple) {
- XID stipID;
-
stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1));
- stipID = *((CARD32 *) &stuff[1] + stip_offset);
- if (stipID) {
- pPanoramiXStip = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXStip, stipID);
+ if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
+ if(!(stip = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
if ((Mask)stuff->mask & GCClipMask) {
- XID clipID;
-
clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1));
- clipID = *((CARD32 *) &stuff[1] + clip_offset);
- if (clipID) {
- pPanoramiXClip = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXClip, clipID);
+ if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
+ if(!(clip = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
- FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
- GCID = j ? FakeClientID(client->index) : orig_GC;
- localGC->info[j].id = GCID;
- }
- localGC->FreeMe = FALSE;
- PANORAMIXFIND_LAST(pPanoramiXGC, PanoramiXGCRoot);
- pPanoramiXGC->next = localGC;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->gc = localGC->info[j].id;
- stuff->drawable = pPanoramiXWin->info[j].id;
- if (pPanoramiXTile)
- *((CARD32 *) &stuff[1] + tile_offset) = pPanoramiXTile->info[j].id;
- if (pPanoramiXStip)
- *((CARD32 *) &stuff[1] + stip_offset) = pPanoramiXStip->info[j].id;
- if (pPanoramiXClip)
- *((CARD32 *) &stuff[1] + clip_offset) = pPanoramiXClip->info[j].id;
- result = (* SavedProcVector[X_CreateGC])(client);
- BREAK_IF(result != Success);
- }
- if (result != Success) {
- pPanoramiXGC->next = NULL;
- Xfree(localGC);
+
+ if(!(newGC = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ newGC->type = XRT_GC;
+ newGC->info[0].id = stuff->gc;
+ for(j = 1; j < PanoramiXNumScreens; j++)
+ newGC->info[j].id = FakeClientID(client->index);
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->gc = newGC->info[j].id;
+ stuff->drawable = refDraw->info[j].id;
+ if (tile)
+ *((CARD32 *) &stuff[1] + tile_offset) = tile->info[j].id;
+ if (stip)
+ *((CARD32 *) &stuff[1] + stip_offset) = stip->info[j].id;
+ if (clip)
+ *((CARD32 *) &stuff[1] + clip_offset) = clip->info[j].id;
+ result = (*SavedProcVector[X_CreateGC])(client);
+ if(result != Success) break;
}
+
+ if (result == Success)
+ AddResource(newGC->info[0].id, XRT_GC, newGC);
+ else
+ xfree(newGC);
+
return (result);
}
-
int PanoramiXChangeGC(ClientPtr client)
{
- GC *pGC;
+ PanoramiXRes *gc;
+ PanoramiXRes *stip = NULL;
+ PanoramiXRes *tile = NULL;
+ PanoramiXRes *clip = NULL;
REQUEST(xChangeGCReq);
- int result, j;
- unsigned len;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- PanoramiXPmap *pPanoramiXTile = NULL, *pPanoramiXStip = NULL;
- PanoramiXPmap *pPanoramiXClip = NULL;
- int tile_offset, stip_offset, clip_offset;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+ int tile_offset = 0, stip_offset = 0, clip_offset = 0;
+ int result = 0, len, j;
+ XID tmp;
REQUEST_AT_LEAST_SIZE(xChangeGCReq);
- VERIFY_GC(pGC, stuff->gc, client);
- len = client->req_len - (sizeof(xChangeGCReq) >> 2);
- IF_RETURN((len != Ones((Mask)stuff->mask)), BadLength);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
- if ((Mask)stuff->mask & GCTile) {
- XID tileID;
+
+ len = client->req_len - (sizeof(xChangeGCReq) >> 2);
+ if (Ones(stuff->mask) != len)
+ return BadLength;
+
+ if (!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
- tile_offset = Ones((Mask)stuff->mask & (GCTile -1) );
- tileID = *((CARD32 *) &stuff[1] + tile_offset);
- if (tileID) {
- pPanoramiXTile = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXTile, tileID);
+ if ((Mask)stuff->mask & GCTile) {
+ tile_offset = Ones((Mask)stuff->mask & (GCTile - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) {
+ if(!(tile = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
if ((Mask)stuff->mask & GCStipple) {
- XID stipID;
-
- stip_offset = Ones((Mask)stuff->mask & (GCStipple -1 ));
- stipID = *((CARD32 *) &stuff[1] + stip_offset);
- if (stipID) {
- pPanoramiXStip = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXStip, stipID);
+ stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) {
+ if(!(stip = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
if ((Mask)stuff->mask & GCClipMask) {
- XID clipID;
-
- clip_offset = Ones((Mask)stuff->mask & (GCClipMask -1));
- clipID = *((CARD32 *) &stuff[1] + clip_offset);
- if (clipID) {
- pPanoramiXClip = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXClip, clipID);
+ clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1));
+ if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) {
+ if(!(clip = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
}
}
- FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
- stuff->gc = pPanoramiXGC->info[j].id;
- if (pPanoramiXTile)
- *((CARD32 *) &stuff[1] + tile_offset) = pPanoramiXTile->info[j].id;
- if (pPanoramiXStip)
- *((CARD32 *) &stuff[1] + stip_offset) = pPanoramiXStip->info[j].id;
- if (pPanoramiXClip)
- *((CARD32 *) &stuff[1] + clip_offset) = pPanoramiXClip->info[j].id;
- result = (* SavedProcVector[X_ChangeGC])(client);
- BREAK_IF(result != Success);
- }
- PANORAMIX_FREE(client);
+
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->gc = gc->info[j].id;
+ if (tile)
+ *((CARD32 *) &stuff[1] + tile_offset) = tile->info[j].id;
+ if (stip)
+ *((CARD32 *) &stuff[1] + stip_offset) = stip->info[j].id;
+ if (clip)
+ *((CARD32 *) &stuff[1] + clip_offset) = clip->info[j].id;
+ result = (*SavedProcVector[X_ChangeGC])(client);
+ if(result != Success) break;
+ }
+
return (result);
}
int PanoramiXCopyGC(ClientPtr client)
{
- int j, result;
- PanoramiXGC *pPanoramiXGCSrc = PanoramiXGCRoot;
- PanoramiXGC *pPanoramiXGCDst = PanoramiXGCRoot;
+ PanoramiXRes *srcGC, *dstGC;
+ int result = 0, j;
REQUEST(xCopyGCReq);
REQUEST_SIZE_MATCH(xCopyGCReq);
- PANORAMIXFIND_ID(pPanoramiXGCSrc, stuff->srcGC);
- IF_RETURN(!pPanoramiXGCSrc, BadGC);
- PANORAMIXFIND_ID(pPanoramiXGCDst, stuff->dstGC);
- IF_RETURN(!pPanoramiXGCDst, BadGC);
- FOR_NSCREENS_OR_ONCE(pPanoramiXGCDst, j) {
- stuff->srcGC = pPanoramiXGCSrc->info[j].id;
- stuff->dstGC = pPanoramiXGCDst->info[j].id;
- result = (* SavedProcVector[X_CopyGC])(client);
- BREAK_IF(result != Success);
+
+ if(!(srcGC = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->srcGC, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ if(!(dstGC = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->dstGC, XRT_GC, SecurityWriteAccess)))
+ return BadGC;
+
+ FOR_NSCREENS(j) {
+ stuff->srcGC = srcGC->info[j].id;
+ stuff->dstGC = dstGC->info[j].id;
+ result = (*SavedProcVector[X_CopyGC])(client);
+ if(result != Success) break;
}
+
return (result);
}
int PanoramiXSetDashes(ClientPtr client)
{
- GC *pGC;
+ PanoramiXRes *gc;
+ int result = 0, j;
REQUEST(xSetDashesReq);
- int result, j;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes);
- VERIFY_GC(pGC, stuff->gc, client);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
- FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_SetDashes])(client);
- BREAK_IF(result != Success);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityWriteAccess)))
+ return BadGC;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->gc = gc->info[j].id;
+ result = (*SavedProcVector[X_SetDashes])(client);
+ if(result != Success) break;
}
+
return (result);
}
-int PanoramiXSetClipRectangles(register ClientPtr client)
+int PanoramiXSetClipRectangles(ClientPtr client)
{
- int result;
- register GC *pGC;
+ PanoramiXRes *gc;
+ int result = 0, j;
REQUEST(xSetClipRectanglesReq);
- int j;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
- FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_SetClipRectangles])(client);
- BREAK_IF(result != Success);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityWriteAccess)))
+ return BadGC;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->gc = gc->info[j].id;
+ result = (*SavedProcVector[X_SetClipRectangles])(client);
+ if(result != Success) break;
}
+
return (result);
}
int PanoramiXFreeGC(ClientPtr client)
{
- register GC *pGC;
+ PanoramiXRes *gc;
+ int result = 0, j;
REQUEST(xResourceReq);
- int result, j;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- PanoramiXGC *pPanoramiXGCback = NULL;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- for (; pPanoramiXGC && (pPanoramiXGC->info[0].id != stuff->id);
- pPanoramiXGC = pPanoramiXGC->next)
- pPanoramiXGCback = pPanoramiXGC;
- IF_RETURN(!pPanoramiXGC, BadGC);
- FOR_NSCREENS_OR_ONCE(pPanoramiXGC, j) {
- stuff->id = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_FreeGC])(client);
- BREAK_IF(result != Success);
- }
- if ((result == Success) && pPanoramiXGCback &&
- pPanoramiXGC && pPanoramiXGC->FreeMe) {
- pPanoramiXGCback->next = pPanoramiXGC->next;
- if (pPanoramiXGC)
- Xfree(pPanoramiXGC);
- }
- PANORAMIX_FREE(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_GC, SecurityDestroyAccess)))
+ return BadGC;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->id = gc->info[j].id;
+ result = (*SavedProcVector[X_FreeGC])(client);
+ if(result != Success) break;
+ }
+
+ /* Since ProcFreeGC is using FreeResource, it will free
+ our resource for us on the last pass through the loop above */
+
return (result);
}
-int PanoramiXClearToBackground(register ClientPtr client)
+int PanoramiXClearToBackground(ClientPtr client)
{
+ PanoramiXRes *win;
+ int result = 0, j, x, y;
+ Bool isRoot;
REQUEST(xClearAreaReq);
- register WindowPtr pWin;
- int result, j;
- Window winID;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- int orig_x, orig_y;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xClearAreaReq);
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- IF_RETURN(!pPanoramiXWin, BadWindow);
- orig_x = stuff->x;
- orig_y = stuff->y;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- winID = pPanoramiXWin->info[j].id;
- pWin = (WindowPtr) SecurityLookupWindow(winID, client, SecurityReadAccess);
- if (!pWin) {
- client->errorValue = pPanoramiXWin->info[0].id;
- return (BadWindow);
- }
- stuff->window = winID;
- if (pWin->drawable.id == PanoramiXWinRoot->info[j].id) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ x = stuff->x;
+ y = stuff->y;
+ isRoot = (stuff->window == WindowTable[0]->drawable.id);
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->window = win->info[j].id;
+ if(isRoot) {
+ stuff->x = x - panoramiXdataPtr[j].x;
+ stuff->y = y - panoramiXdataPtr[j].y;
}
result = (*SavedProcVector[X_ClearArea])(client);
+ if(result != Success) break;
}
- PANORAMIX_FREE(client);
+
return (result);
}
+/*
+ For Window to Pixmap copies you're screwed since each screen's
+ pixmap will look like what it sees on its screen. Unless the
+ screens overlap and the window lies on each, the two copies
+ will be out of sync. To remedy this we do a GetImage and PutImage
+ in place of the copy. Doing this as a single Image isn't quite
+ correct since it will include the obscured areas but we will
+ have to fix this later. (MArk).
+*/
+
int PanoramiXCopyArea(ClientPtr client)
{
- int j, result;
- Window srcID, dstID;
- DrawablePtr pSrc, pDst;
- GContext GCID;
- GC *pGC;
- PanoramiXWindow *pPanoramiXSrcRoot;
- PanoramiXWindow *pPanoramiXDstRoot;
- PanoramiXWindow *pPanoramiXSrc;
- PanoramiXWindow *pPanoramiXDst;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
+ int j, result = 0, srcx, srcy, dstx, dsty;
+ PanoramiXRes *gc, *src, *dst;
+ Bool srcIsRoot = FALSE;
+ Bool dstIsRoot = FALSE;
+ Bool srcShared, dstShared;
REQUEST(xCopyAreaReq);
- int srcx = stuff->srcX, srcy = stuff->srcY;
- int dstx = stuff->dstX, dsty = stuff->dstY;
REQUEST_SIZE_MATCH(xCopyAreaReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client);
- if (stuff->dstDrawable != stuff->srcDrawable) {
- VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client);
- if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth)) {
- client->errorValue = stuff->dstDrawable;
- return (BadMatch);
- }
+ if(!(src = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->srcDrawable, XRC_DRAWABLE, SecurityReadAccess)))
+ return BadDrawable;
+
+ srcShared = IS_SHARED_PIXMAP(src);
+
+ if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->dstDrawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ dstShared = IS_SHARED_PIXMAP(dst);
+
+ if(dstShared && srcShared)
+ return (* SavedProcVector[X_CopyArea])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ if((dst->type == XRT_WINDOW) &&
+ (stuff->dstDrawable == WindowTable[0]->drawable.id))
+ dstIsRoot = TRUE;
+ if((src->type == XRT_WINDOW) &&
+ (stuff->srcDrawable == WindowTable[0]->drawable.id))
+ srcIsRoot = TRUE;
+
+ srcx = stuff->srcX; srcy = stuff->srcY;
+ dstx = stuff->dstX; dsty = stuff->dstY;
+ if((dst->type == XRT_PIXMAP) && (src->type == XRT_WINDOW)) {
+ DrawablePtr drawables[MAXSCREENS];
+ DrawablePtr pDst;
+ GCPtr pGC;
+ char *data;
+ int pitch;
+
+ FOR_NSCREENS(j)
+ VERIFY_DRAWABLE(drawables[j], src->info[j].id, client);
+
+ pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
+ if(!(data = xcalloc(1, stuff->height * pitch)))
+ return BadAlloc;
+
+ XineramaGetImageData(drawables, srcx, srcy,
+ stuff->width, stuff->height, ZPixmap, ~0, data, pitch,
+ srcIsRoot);
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->gc = gc->info[j].id;
+ VALIDATE_DRAWABLE_AND_GC(dst->info[j].id, pDst, pGC, client);
+
+ if(drawables[0]->depth != pDst->depth) {
+ client->errorValue = stuff->dstDrawable;
+ xfree(data);
+ return (BadMatch);
+ }
+
+ (*pGC->ops->PutImage) (pDst, pGC, pDst->depth, dstx, dsty,
+ stuff->width, stuff->height,
+ 0, ZPixmap, data);
+
+ if(dstShared) break;
+ }
+
+ xfree(data);
+
+ result = Success;
} else {
- pSrc = pDst;
- }
- pPanoramiXSrcRoot = (pSrc->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXDstRoot = (pDst->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXSrc = pPanoramiXSrcRoot;
- pPanoramiXDst = pPanoramiXDstRoot;
- PANORAMIXFIND_ID(pPanoramiXSrc, stuff->srcDrawable);
- IF_RETURN(!pPanoramiXSrc, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXDst, stuff->dstDrawable);
- IF_RETURN(!pPanoramiXDst, BadDrawable);
- GCID = stuff->gc;
- PANORAMIXFIND_ID(pPanoramiXGC, GCID);
- IF_RETURN(!pPanoramiXGC, BadGC);
-
- FOR_NSCREENS_OR_ONCE(pPanoramiXSrc, j) {
- stuff->dstDrawable = pPanoramiXDst->info[j].id;
- stuff->srcDrawable = pPanoramiXSrc->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- if (pPanoramiXSrc == pPanoramiXSrcRoot) {
- stuff->srcX = srcx - panoramiXdataPtr[j].x;
- stuff->srcY = srcy - panoramiXdataPtr[j].y;
+ DrawablePtr pDst = NULL, pSrc = NULL;
+ GCPtr pGC = NULL;
+ RegionPtr pRgn[MAXSCREENS];
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->dstDrawable = dst->info[j].id;
+ stuff->srcDrawable = src->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (srcIsRoot) {
+ stuff->srcX = srcx - panoramiXdataPtr[j].x;
+ stuff->srcY = srcy - panoramiXdataPtr[j].y;
+ }
+ if (dstIsRoot) {
+ stuff->dstX = dstx - panoramiXdataPtr[j].x;
+ stuff->dstY = dsty - panoramiXdataPtr[j].y;
+ }
+
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client);
+ if (stuff->dstDrawable != stuff->srcDrawable) {
+ SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client,
+ SecurityReadAccess);
+ if ((pDst->pScreen != pSrc->pScreen) ||
+ (pDst->depth != pSrc->depth)) {
+ client->errorValue = stuff->dstDrawable;
+ return (BadMatch);
+ }
+ } else
+ pSrc = pDst;
+
+ pRgn[j] = (*pGC->ops->CopyArea)(pSrc, pDst, pGC,
+ stuff->srcX, stuff->srcY,
+ stuff->width, stuff->height,
+ stuff->dstX, stuff->dstY);
+
+ if(dstShared) {
+ while(j--) pRgn[j] = NULL;
+ break;
+ }
}
- if (pPanoramiXDst == pPanoramiXDstRoot) {
- stuff->dstX = dstx - panoramiXdataPtr[j].x;
- stuff->dstY = dsty - panoramiXdataPtr[j].y;
+
+ if(pGC->graphicsExposures) {
+ ScreenPtr pScreen = pDst->pScreen;
+ RegionRec totalReg;
+ Bool overlap;
+
+ REGION_INIT(pScreen, &totalReg, NullBox, 1);
+ FOR_NSCREENS_BACKWARD(j) {
+ if(pRgn[j]) {
+ if(srcIsRoot) {
+ REGION_TRANSLATE(pScreen, pRgn[j],
+ panoramiXdataPtr[j].x, panoramiXdataPtr[j].y);
+ }
+ REGION_APPEND(pScreen, &totalReg, pRgn[j]);
+ REGION_DESTROY(pScreen, pRgn[j]);
+ }
+ }
+ REGION_VALIDATE(pScreen, &totalReg, &overlap);
+ (*pScreen->SendGraphicsExpose)(
+ client, &totalReg, stuff->dstDrawable, X_CopyArea, 0);
+ REGION_UNINIT(pScreen, &totalReg);
}
- result = (* SavedProcVector[X_CopyArea])(client);
- BREAK_IF(result != Success);
+
+ result = client->noClientException;
}
+
return (result);
}
+
int PanoramiXCopyPlane(ClientPtr client)
{
- int SrcScr = -1, DstScr = -1;
- PixmapPtr pMap = NULL;
- Pixmap pmapID;
- PanoramiXRect SrcRect, DstRect;
- int i, j, k;
- Window srcID, dstID;
- DrawablePtr pSrc, pDst;
- GContext GCID;
- GContext GCIDbase;
- GC *pGC;
- PanoramiXWindow *pPanoramiXSrc;
- PanoramiXWindow *pPanoramiXDst;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- RegionPtr *PanoramiXRgnPtrs;
- RegionPtr *FetchRgnPtrs = NULL;
- RegionPtr pRgn;
+ int j, srcx, srcy, dstx, dsty;
+ PanoramiXRes *gc, *src, *dst;
+ Bool srcIsRoot = FALSE;
+ Bool dstIsRoot = FALSE;
+ Bool srcShared, dstShared;
+ DrawablePtr psrcDraw, pdstDraw = NULL;
+ GCPtr pGC = NULL;
+ RegionPtr pRgn[MAXSCREENS];
REQUEST(xCopyPlaneReq);
- int srcx = stuff->srcX, srcy = stuff->srcY;
- int dstx = stuff->dstX, dsty = stuff->dstY;
- int width = stuff->width, height = stuff->height;
REQUEST_SIZE_MATCH(xCopyPlaneReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client);
- if (stuff->dstDrawable != stuff->srcDrawable) {
- VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client);
- if (pDst->pScreen != pSrc->pScreen) {
- client->errorValue = stuff->dstDrawable;
- return (BadMatch);
- }
- } else {
- pSrc = pDst;
- }
+ if(!(src = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->srcDrawable, XRC_DRAWABLE, SecurityReadAccess)))
+ return BadDrawable;
- /*
- * Check to see if stuff->bitPlane has exactly ONE good bit set
- */
+ srcShared = IS_SHARED_PIXMAP(src);
+ if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->dstDrawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
- if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
- (stuff->bitPlane > (1L << (pSrc->depth - 1))))
- {
- client->errorValue = stuff->bitPlane;
- return(BadValue);
- }
-
- pPanoramiXSrc = (pSrc->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXDst = (pDst->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXSrc, stuff->srcDrawable);
- IF_RETURN(!pPanoramiXSrc, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXDst, stuff->dstDrawable);
- IF_RETURN(!pPanoramiXDst, BadDrawable);
- GCIDbase = stuff->gc;
- PANORAMIXFIND_ID(pPanoramiXGC, GCIDbase);
- IF_RETURN(!pPanoramiXGC, BadGC);
-
- /*
- * Unless both are pixmaps, need to do special things to accomodate
- * being on multiple screens, different screens, etc.
- */
-
- if (pSrc->type != DRAWABLE_PIXMAP) {
- SrcRect.x = pSrc->x + srcx;
- SrcRect.y = pSrc->y + srcy;
- SrcRect.width = width;
- SrcRect.height = height;
- for (SrcScr = PanoramiXNumScreens - 1; SrcScr>=0; SrcScr-- )
- if (RECTA_SUBSUMES_RECTB(panoramiXdataPtr[SrcScr], SrcRect))
- break;
- }
- if (pDst->type != DRAWABLE_PIXMAP) {
- DstRect.x = pDst->x + dstx;
- DstRect.y = pDst->y + dsty;
- DstRect.width = width;
- DstRect.height = height;
- for (DstScr = PanoramiXNumScreens - 1; DstScr>=0; DstScr--)
- if (RECTA_SUBSUMES_RECTB(panoramiXdataPtr[DstScr], DstRect))
- break;
- }
-
- /*
- * If source is on multiple screens, different screen from destination,
- * destination is on multiple screens, or destination is a pixmap,
- * need to get info into local pixmap for subsequent transfer.
- */
-
-
- if ((pSrc->type != DRAWABLE_PIXMAP) &&
- (SrcScr < 0 || DstScr < 0 || SrcScr != DstScr
- || pDst->type == DRAWABLE_PIXMAP)) {
- unsigned char save_alu;
- RegionRec tempReg;
- RegionPtr pCompositeClip;
- PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
-
- pMap = (PixmapPtr) (*pSrc->pScreen->CreatePixmap)(pSrc->pScreen,
- width, height, pGC->depth);
- PANORAMIXFIND_LAST(pPanoramiXPmap, PanoramiXPmapRoot);
- pPanoramiXPmap->next =
- (PanoramiXPmap *)Xcalloc(sizeof(PanoramiXPmap));
- pPanoramiXPmap = pPanoramiXPmap->next;
- pmapID = FakeClientID(0);
- AddResource(pmapID, RT_PIXMAP, (pointer)pMap);
- for (j = PanoramiXNumScreens - 1; j>=0; j--)
- pPanoramiXPmap->info[j].id = pmapID;
- tempReg.extents.x1 = 0;
- tempReg.extents.y1 = 0;
- tempReg.extents.x2 = width;
- tempReg.extents.y2 = height;
- tempReg.data = NULL;
- FetchRgnPtrs =
- (RegionPtr *) ALLOCATE_LOCAL(PanoramiXNumScreens * sizeof(RegionPtr));
- i = 0;
- FOR_NSCREENS_OR_ONCE(pPanoramiXSrc, j) {
- if ((SrcScr >= 0) && pPanoramiXSrc)
- j = SrcScr;
- srcID = pPanoramiXSrc->info[j].id;
- pSrc = (DrawablePtr) SecurityLookupIDByClass(client, srcID, RC_DRAWABLE,
- SecurityReadAccess);
- GCID = pPanoramiXGC->info[j].id;
- pGC = (GC *) LookupIDByType(GCID, RT_GC);
- pMap->drawable.pScreen = pSrc->pScreen;
- pGC->pScreen = pSrc->pScreen;
- save_alu = pGC->alu;
- pGC->alu = GXcopy;
- pCompositeClip = ((miPrivGC*)
- (pGC->devPrivates[miGCPrivateIndex].ptr))->pCompositeClip;
- ((miPrivGC*)(pGC->devPrivates[miGCPrivateIndex].ptr))->pCompositeClip =
-&tempReg;
- FetchRgnPtrs[i++] = (*pGC->ops->CopyPlane)(pSrc, (DrawablePtr) pMap,
- pGC, srcx, srcy, width, height, 0, 0, stuff->bitPlane);
- pGC->alu = save_alu;
- ((miPrivGC*) (pGC->devPrivates[miGCPrivateIndex].ptr))->pCompositeClip =
-pCompositeClip;
- if (SrcScr >= 0)
- j = 0;
- }
- }
+ dstShared = IS_SHARED_PIXMAP(dst);
- if (pMap) {
- pSrc = (DrawablePtr) pMap;
- srcx = 0;
- srcy = 0;
- }
- PanoramiXRgnPtrs =
- (RegionPtr *) ALLOCATE_LOCAL(PanoramiXNumScreens * sizeof(RegionPtr));
- k = 0;
- /* if src and dst are entirely on one screen,
- then we only need one simple transfer */
- if ((DstScr >= 0) && (pMap || (SrcScr >=0))) {
- dstID = pPanoramiXDst->info[DstScr].id;
- pDst = (DrawablePtr) SecurityLookupIDByClass(client, dstID, RC_DRAWABLE,
- SecurityReadAccess);
- GCID = pPanoramiXGC->info[DstScr].id;
- pGC = (GC *) LookupIDByType(GCID, RT_GC);
- ValidateGC(pDst, pGC);
- if (pMap) {
- pMap->drawable.pScreen = pDst->pScreen;
- } else {
- srcID = pPanoramiXSrc->info[SrcScr].id;
- if (srcID != dstID) {
- pSrc = (DrawablePtr) SecurityLookupIDByClass(client, srcID, RC_DRAWABLE,
- SecurityReadAccess);
- } else
- pSrc = pDst;
+ if(dstShared && srcShared)
+ return (* SavedProcVector[X_CopyPlane])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ if((dst->type == XRT_WINDOW) &&
+ (stuff->dstDrawable == WindowTable[0]->drawable.id))
+ dstIsRoot = TRUE;
+ if((src->type == XRT_WINDOW) &&
+ (stuff->srcDrawable == WindowTable[0]->drawable.id))
+ srcIsRoot = TRUE;
+
+ srcx = stuff->srcX; srcy = stuff->srcY;
+ dstx = stuff->dstX; dsty = stuff->dstY;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->dstDrawable = dst->info[j].id;
+ stuff->srcDrawable = src->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (srcIsRoot) {
+ stuff->srcX = srcx - panoramiXdataPtr[j].x;
+ stuff->srcY = srcy - panoramiXdataPtr[j].y;
}
- if (pMap)
- PanoramiXRgnPtrs[k++] = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC,
- srcx, srcy, width, height, dstx, dsty,
- 1);
- else
- PanoramiXRgnPtrs[k++] = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC,
- srcx, srcy, width, height, dstx, dsty,
- stuff->bitPlane);
- }else {
- FOR_NSCREENS_OR_ONCE(pPanoramiXDst, j) {
- if (DstScr >= 0) {
- dstID = pPanoramiXDst->info[DstScr].id;
- GCID = pPanoramiXGC->info[DstScr].id;
- } else {
- dstID = pPanoramiXDst->info[j].id;
- GCID = pPanoramiXGC->info[j].id;
+ if (dstIsRoot) {
+ stuff->dstX = dstx - panoramiXdataPtr[j].x;
+ stuff->dstY = dsty - panoramiXdataPtr[j].y;
}
- pDst = (DrawablePtr) SecurityLookupIDByClass(client, dstID, RC_DRAWABLE,
- SecurityReadAccess);
- pGC = (GC *) LookupIDByType(GCID, RT_GC);
- ValidateGC(pDst, pGC);
- if (pMap) {
- pMap->drawable.pScreen = pDst->pScreen;
- } else {
- srcID = pPanoramiXSrc->info[j].id;
- if (srcID != dstID) {
- pSrc = (DrawablePtr) SecurityLookupIDByClass(client, srcID, RC_DRAWABLE,
- SecurityReadAccess);
- } else {
- pSrc = pDst;
+
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client);
+ if (stuff->dstDrawable != stuff->srcDrawable) {
+ SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client,
+ SecurityReadAccess);
+ if (pdstDraw->pScreen != psrcDraw->pScreen) {
+ client->errorValue = stuff->dstDrawable;
+ return (BadMatch);
}
+ } else
+ psrcDraw = pdstDraw;
+
+ if(stuff->bitPlane == 0 || (stuff->bitPlane & (stuff->bitPlane - 1)) ||
+ (stuff->bitPlane > (1L << (psrcDraw->depth - 1)))) {
+ client->errorValue = stuff->bitPlane;
+ return(BadValue);
}
- if (pMap)
- PanoramiXRgnPtrs[k++] = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC,
- srcx, srcy, width, height, dstx, dsty,
- 1);
- else
- PanoramiXRgnPtrs[k++] = (*pGC->ops->CopyPlane)(pSrc, pDst, pGC,
- srcx, srcy, width, height, dstx, dsty,
- stuff->bitPlane);
- }
- }
-
- if (pMap) {
- for (j = PanoramiXNumScreens - 1; j>=0; j--)
- if (PanoramiXRgnPtrs[j])
- (*pDst->pScreen->RegionDestroy) (PanoramiXRgnPtrs[j]);
- DEALLOCATE_LOCAL(PanoramiXRgnPtrs);
- PanoramiXRgnPtrs = FetchRgnPtrs;
- k = i;
- }
- j = 1;
- i = 0;
- pRgn = PanoramiXRgnPtrs[i];
- while ((j < k) && pRgn && !REGION_NIL(pRgn)) {
- if (PanoramiXRgnPtrs[j]) {
- (*pGC->pScreen->Intersect)(pRgn, pRgn, PanoramiXRgnPtrs[j++]);
- } else {
- pRgn = PanoramiXRgnPtrs[i++];
+
+ pRgn[j] = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC,
+ stuff->srcX, stuff->srcY,
+ stuff->width, stuff->height,
+ stuff->dstX, stuff->dstY, stuff->bitPlane);
+
+ if(dstShared) {
+ while(j--) pRgn[j] = NULL;
+ break;
}
}
- for (j = 0 ; j < k; j++) {
- pRgn = PanoramiXRgnPtrs[j];
- GCID = pPanoramiXGC->info[j].id;
- pGC = (GC *) LookupIDByType(GCID, RT_GC);
- if (pGC && pGC->graphicsExposures)
- (*pDst->pScreen->SendGraphicsExpose) (client, pRgn,
- stuff->dstDrawable, X_CopyPlane, 0);
- if (pRgn)
- (*pDst->pScreen->RegionDestroy) (pRgn);
- }
- DEALLOCATE_LOCAL(PanoramiXRgnPtrs);
- if (pMap) {
- PanoramiXPmap *pPanoramiXPmap = PanoramiXPmapRoot;
- PanoramiXPmap *pback = PanoramiXPmapRoot;
-
- for (; pPanoramiXPmap && (pPanoramiXPmap->info[0].id != pmapID);
- pPanoramiXPmap = pPanoramiXPmap->next)
- pback = pPanoramiXPmap;
- FreeResource(pPanoramiXPmap->info[0].id, RT_NONE);
- if (pback) {
- pback->next = pPanoramiXPmap->next;
- Xfree(pPanoramiXPmap);
+
+ if(pGC->graphicsExposures) {
+ ScreenPtr pScreen = pdstDraw->pScreen;
+ RegionRec totalReg;
+ Bool overlap;
+
+ REGION_INIT(pScreen, &totalReg, NullBox, 1);
+ FOR_NSCREENS_BACKWARD(j) {
+ if(pRgn[j]) {
+ REGION_APPEND(pScreen, &totalReg, pRgn[j]);
+ REGION_DESTROY(pScreen, pRgn[j]);
+ }
}
+ REGION_VALIDATE(pScreen, &totalReg, &overlap);
+ (*pScreen->SendGraphicsExpose)(
+ client, &totalReg, stuff->dstDrawable, X_CopyPlane, 0);
+ REGION_UNINIT(pScreen, &totalReg);
}
+
return (client->noClientException);
}
int PanoramiXPolyPoint(ClientPtr client)
{
- int result, npoint, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- int x_off = 0, y_off = 0;
+ PanoramiXRes *gc, *draw;
+ int result = 0, npoint, j;
xPoint *origPts;
- xPoint *origPtr, *modPtr;
+ Bool isRoot;
REQUEST(xPolyPointReq);
REQUEST_AT_LEAST_SIZE(xPolyPointReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, locDraw->id);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyPoint])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2;
if (npoint > 0) {
origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- }
- modPtr = (xPoint *) &stuff[1];
- origPtr = origPts;
- for (i = npoint; i; i--) {
- modPtr->x = origPtr->x - x_off;
- modPtr++->y = origPtr++->y - y_off;
- }
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolyPoint])(client);
- BREAK_IF(result != Success);
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ xPoint *pnts = (xPoint*)&stuff[1];
+ int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint;
+
+ while(i--) {
+ pnts->x -= x_off;
+ pnts->y -= y_off;
+ pnts++;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolyPoint])(client);
+ if(result != Success) break;
}
DEALLOCATE_LOCAL(origPts);
return (result);
- }else
+ } else
return (client->noClientException);
-
}
int PanoramiXPolyLine(ClientPtr client)
{
- int result, npoint, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- int x_off = 0, y_off = 0;
+ PanoramiXRes *gc, *draw;
+ int result = 0, npoint, j;
xPoint *origPts;
- xPoint *origPtr, *modPtr;
+ Bool isRoot;
REQUEST(xPolyLineReq);
REQUEST_AT_LEAST_SIZE(xPolyLineReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, locDraw->id);
- /* In the case of Multibuffering, we need to make sure the drawable
- isn't really a pixmap associated to a drawable */
- if (!pPanoramiXWin && (stuff->drawable != locDraw->id)) {
- pPanoramiXWin = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- }
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyLine])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2;
if (npoint > 0){
origPts = (xPoint *) ALLOCATE_LOCAL(npoint * sizeof(xPoint));
memcpy((char *) origPts, (char *) &stuff[1], npoint * sizeof(xPoint));
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- }
- modPtr = (xPoint *) &stuff[1];
- origPtr = origPts;
- for (i = npoint; i; i--) {
- modPtr->x = origPtr->x - x_off;
- modPtr++->y = origPtr++->y - y_off;
- }
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolyLine])(client);
- BREAK_IF(result != Success);
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origPts, npoint * sizeof(xPoint));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ xPoint *pnts = (xPoint*)&stuff[1];
+ int i = (stuff->coordMode==CoordModePrevious) ? 1 : npoint;
+
+ while(i--) {
+ pnts->x -= x_off;
+ pnts->y -= y_off;
+ pnts++;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolyLine])(client);
+ if(result != Success) break;
}
DEALLOCATE_LOCAL(origPts);
return (result);
- }else
+ } else
return (client->noClientException);
}
int PanoramiXPolySegment(ClientPtr client)
{
- int result, nsegs, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- int x_off = 0, y_off = 0;
+ int result = 0, nsegs, i, j;
+ PanoramiXRes *gc, *draw;
xSegment *origSegs;
- xSegment *origPtr, *modPtr;
+ Bool isRoot;
REQUEST(xPolySegmentReq);
REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- /* In the case of Multibuffering, we need to make sure the drawable
- isn't really a pixmap associated to a drawable */
- if (!pPanoramiXWin && (stuff->drawable != locDraw->id)) {
- pPanoramiXWin = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- }
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolySegment])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
- IF_RETURN((nsegs & 4), BadLength);
+ if(nsegs & 4) return BadLength;
nsegs >>= 3;
if (nsegs > 0) {
- origSegs = (xSegment *) ALLOCATE_LOCAL(nsegs * sizeof(xSegment));
- memcpy((char *) origSegs, (char *) &stuff[1], nsegs *
-sizeof(xSegment));
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- }
- modPtr = (xSegment *) &stuff[1];
- origPtr = origSegs;
- for (i = nsegs; i; i--) {
- modPtr->x1 = origPtr->x1 - x_off;
- modPtr->y1 = origPtr->y1 - y_off;
- modPtr->x2 = origPtr->x2 - x_off;
- modPtr++->y2 = origPtr++->y2 - y_off;
- }
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolySegment])(client);
- BREAK_IF(result != Success);
+ origSegs = (xSegment *) ALLOCATE_LOCAL(nsegs * sizeof(xSegment));
+ memcpy((char *) origSegs, (char *) &stuff[1], nsegs * sizeof(xSegment));
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origSegs, nsegs * sizeof(xSegment));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ xSegment *segs = (xSegment*)&stuff[1];
+
+ for (i = nsegs; i--; segs++) {
+ segs->x1 -= x_off;
+ segs->x2 -= x_off;
+ segs->y1 -= y_off;
+ segs->y2 -= y_off;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolySegment])(client);
+ if(result != Success) break;
}
- DEALLOCATE_LOCAL(origSegs);
- return (result);
- }else
+ DEALLOCATE_LOCAL(origSegs);
+ return (result);
+ } else
return (client->noClientException);
}
int PanoramiXPolyRectangle(ClientPtr client)
{
- int result, nrects, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- int x_off = 0, y_off = 0;
+ int result = 0, nrects, i, j;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
xRectangle *origRecs;
- xRectangle *origPtr, *modPtr;
REQUEST(xPolyRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyRectangle])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
- IF_RETURN((nrects & 4), BadLength);
+ if(nrects & 4) return BadLength;
nrects >>= 3;
if (nrects > 0){
- origRecs = (xRectangle *) ALLOCATE_LOCAL(nrects * sizeof(xRectangle));
- memcpy((char *) origRecs, (char *) &stuff[1], nrects *
-sizeof(xRectangle));
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- }
- modPtr = (xRectangle *) &stuff[1];
- origPtr = origRecs;
- for (i = nrects; i; i--) {
- modPtr->x = origPtr->x - x_off;
- modPtr->y = origPtr->y - y_off;
- modPtr->width = origPtr->width - x_off;
- modPtr++->height = origPtr++->height - y_off;
+ origRecs = (xRectangle *) ALLOCATE_LOCAL(nrects * sizeof(xRectangle));
+ memcpy((char *)origRecs,(char *)&stuff[1],nrects * sizeof(xRectangle));
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origRecs, nrects * sizeof(xRectangle));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+
+ if(x_off || y_off) {
+ xRectangle *rects = (xRectangle *) &stuff[1];
+
+ for (i = nrects; i--; rects++) {
+ rects->x -= x_off;
+ rects->y -= y_off;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolyRectangle])(client);
+ if(result != Success) break;
}
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolyRectangle])(client);
- BREAK_IF(result != Success);
- }
- DEALLOCATE_LOCAL(origRecs);
- return (result);
- }else
+ DEALLOCATE_LOCAL(origRecs);
+ return (result);
+ } else
return (client->noClientException);
}
int PanoramiXPolyArc(ClientPtr client)
{
- int result, narcs, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- GCPtr locGC;
- int x_off = 0, y_off = 0;
+ int result = 0, narcs, i, j;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
xArc *origArcs;
- xArc *origPtr, *modPtr;
REQUEST(xPolyArcReq);
REQUEST_AT_LEAST_SIZE(xPolyArcReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot :
-PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyArc])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
- IF_RETURN((narcs % sizeof(xArc)), BadLength);
+ if(narcs % sizeof(xArc)) return BadLength;
narcs /= sizeof(xArc);
if (narcs > 0){
- origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc));
- memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- }
- modPtr = (xArc *) &stuff[1];
- origPtr = origArcs;
- for (i = narcs; i; i--) {
- modPtr->x = origPtr->x - x_off;
- modPtr++->y = origPtr++->y - y_off;
+ origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc));
+ memcpy((char *) origArcs, (char *) &stuff[1], narcs * sizeof(xArc));
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ xArc *arcs = (xArc *) &stuff[1];
+
+ for (i = narcs; i--; arcs++) {
+ arcs->x -= x_off;
+ arcs->y -= y_off;
+ }
+ }
+ }
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolyArc])(client);
+ if(result != Success) break;
}
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolyArc])(client);
- BREAK_IF(result != Success);
- }
- DEALLOCATE_LOCAL(origArcs);
- return (result);
- }else
+ DEALLOCATE_LOCAL(origArcs);
+ return (result);
+ } else
return (client->noClientException);
}
int PanoramiXFillPoly(ClientPtr client)
{
- int result, count, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- GCPtr locGC;
- int x_off = 0, y_off = 0;
+ int result = 0, count, j;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
DDXPointPtr locPts;
- DDXPointPtr origPts, modPts;
REQUEST(xFillPolyReq);
REQUEST_AT_LEAST_SIZE(xFillPolyReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_FillPoly])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
count = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2;
if (count > 0){
- locPts = (DDXPointPtr) ALLOCATE_LOCAL(count * sizeof(DDXPointRec));
- memcpy((char *) locPts, (char *) &stuff[1], count *
-sizeof(DDXPointRec));
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
- }
- modPts = (DDXPointPtr) &stuff[1];
- origPts = locPts;
- for (i = count; i; i--) {
- modPts->x = origPts->x - x_off;
- modPts++->y = origPts++->y - y_off;
+ locPts = (DDXPointPtr) ALLOCATE_LOCAL(count * sizeof(DDXPointRec));
+ memcpy((char *)locPts, (char *)&stuff[1], count * sizeof(DDXPointRec));
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], locPts, count * sizeof(DDXPointRec));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ DDXPointPtr pnts = (DDXPointPtr)&stuff[1];
+ int i = (stuff->coordMode==CoordModePrevious) ? 1 : count;
+
+ while(i--) {
+ pnts->x -= x_off;
+ pnts->y -= y_off;
+ pnts++;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_FillPoly])(client);
+ if(result != Success) break;
}
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_FillPoly])(client);
- BREAK_IF(result != Success);
- }
- DEALLOCATE_LOCAL(locPts);
- return (result);
- }else
+ DEALLOCATE_LOCAL(locPts);
+ return (result);
+ } else
return (client->noClientException);
}
int PanoramiXPolyFillRectangle(ClientPtr client)
{
- int result, things, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- GCPtr locGC;
- int x_off = 0, y_off = 0;
- xRectangle *origThings;
- xRectangle *origPtr, *modPtr;
+ int result = 0, things, i, j;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
+ xRectangle *origRects;
REQUEST(xPolyFillRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot :
-PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyFillRectangle])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
- IF_RETURN((things & 4), BadLength);
+ if(things & 4) return BadLength;
things >>= 3;
if (things > 0){
- origThings = (xRectangle *) ALLOCATE_LOCAL(things * sizeof(xRectangle));
- memcpy((char *) origThings, (char *)&stuff[1], things *
-sizeof(xRectangle));
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
+ origRects = (xRectangle *) ALLOCATE_LOCAL(things * sizeof(xRectangle));
+ memcpy((char*)origRects,(char*)&stuff[1], things * sizeof(xRectangle));
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origRects, things * sizeof(xRectangle));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ xRectangle *rects = (xRectangle *) &stuff[1];
+
+ for (i = things; i--; rects++) {
+ rects->x -= x_off;
+ rects->y -= y_off;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolyFillRectangle])(client);
+ if(result != Success) break;
}
- modPtr = (xRectangle *) &stuff[1];
- origPtr = origThings;
- for (i = things; i; i--) {
- modPtr->x = origPtr->x - x_off;
- modPtr++->y = origPtr++->y - y_off;
- }
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolyFillRectangle])(client);
- BREAK_IF(result != Success);
- }
- DEALLOCATE_LOCAL(origThings);
- return (result);
- }else
+ DEALLOCATE_LOCAL(origRects);
+ return (result);
+ } else
return (client->noClientException);
}
int PanoramiXPolyFillArc(ClientPtr client)
{
- int result, arcs, i, j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr locDraw;
- GCPtr locGC;
- int x_off = 0, y_off = 0;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
+ int result = 0, narcs, i, j;
xArc *origArcs;
- xArc *origPtr, *modPtr;
REQUEST(xPolyFillArcReq);
REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!locDraw, BadDrawable);
- pPanoramiXWin = (locDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot :
-PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
- arcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
- IF_RETURN((arcs % sizeof(xArc)), BadLength);
- arcs /= sizeof(xArc);
- if (arcs > 0) {
- origArcs = (xArc *) ALLOCATE_LOCAL(arcs * sizeof(xArc));
- memcpy((char *) origArcs, (char *)&stuff[1], arcs * sizeof(xArc));
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- if (pPanoramiXWin == PanoramiXWinRoot) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }else {
- if ( (locDraw->type == DRAWABLE_PIXMAP) &&
- /* add special case check for root window */
- (locDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- x_off = panoramiXdataPtr[j].x;
- y_off = panoramiXdataPtr[j].y;
- }
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyFillArc])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
+ narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
+ IF_RETURN((narcs % sizeof(xArc)), BadLength);
+ narcs /= sizeof(xArc);
+ if (narcs > 0) {
+ origArcs = (xArc *) ALLOCATE_LOCAL(narcs * sizeof(xArc));
+ memcpy((char *) origArcs, (char *)&stuff[1], narcs * sizeof(xArc));
+ FOR_NSCREENS_FORWARD(j){
+
+ if(j) memcpy(&stuff[1], origArcs, narcs * sizeof(xArc));
+
+ if (isRoot) {
+ int x_off = panoramiXdataPtr[j].x;
+ int y_off = panoramiXdataPtr[j].y;
+
+ if(x_off || y_off) {
+ xArc *arcs = (xArc *) &stuff[1];
+
+ for (i = narcs; i--; arcs++) {
+ arcs->x -= x_off;
+ arcs->y -= y_off;
+ }
+ }
+ }
+
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PolyFillArc])(client);
+ if(result != Success) break;
}
- modPtr = (xArc *) &stuff[1];
- origPtr = origArcs;
- for (i = arcs; i; i--) {
- modPtr->x = origPtr->x - x_off;
- modPtr++->y = origPtr++->y - y_off;
- }
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PolyFillArc])(client);
- BREAK_IF(result != Success);
- }
- DEALLOCATE_LOCAL(origArcs);
- return (result);
- }else
+ DEALLOCATE_LOCAL(origArcs);
+ return (result);
+ } else
return (client->noClientException);
}
-/* 64-bit server notes: the protocol restricts padding of images to
- * 8-, 16-, or 32-bits. We would like to have 64-bits for the server
- * to use internally. Removes need for internal alignment checking.
- * All of the PutImage functions could be changed individually, but
- * as currently written, they call other routines which require things
- * to be 64-bit padded on scanlines, so we changed things here.
- * If an image would be padded differently for 64- versus 32-, then
- * copy each scanline to a 64-bit padded scanline.
- * Also, we need to make sure that the image is aligned on a 64-bit
- * boundary, even if the scanlines are padded to our satisfaction.
- */
-
-int PanoramiXPutImage(register ClientPtr client)
+int PanoramiXPutImage(ClientPtr client)
{
- register GC *pGC;
- register DrawablePtr pDraw;
- long lengthProto, /* length of scanline protocl padded */
- length; /* length of scanline server padded */
- char *tmpImage;
- int j;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXWindow *pPanoramiXRoot;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- int orig_x, orig_y;
- int result;
-
-
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
+ int j, result = 0, orig_x, orig_y;
REQUEST(xPutImageReq);
REQUEST_AT_LEAST_SIZE(xPutImageReq);
- pDraw = (DrawablePtr) SecurityLookupIDByClass(client, stuff->drawable,
-RC_DRAWABLE,
- SecurityReadAccess);
- IF_RETURN(!pDraw, BadDrawable);
- pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXWin = pPanoramiXRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin,BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PutImage])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
orig_x = stuff->dstX;
orig_y = stuff->dstY;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- if (pPanoramiXWin == pPanoramiXRoot) {
+ FOR_NSCREENS_BACKWARD(j){
+ if (isRoot) {
stuff->dstX = orig_x - panoramiXdataPtr[j].x;
stuff->dstY = orig_y - panoramiXdataPtr[j].y;
- }
- if (pDraw->type == DRAWABLE_PIXMAP) {
- if (stuff->width > panoramiXdataPtr[j].width)
- stuff->dstX = orig_x - panoramiXdataPtr[j].x;
- if (stuff->height > panoramiXdataPtr[j].height)
- stuff->dstY = orig_y - panoramiXdataPtr[j].y;
- }
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- result = (* SavedProcVector[X_PutImage])(client);
- }
- return(result);
+ }
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ result = (* SavedProcVector[X_PutImage])(client);
+ if(result != Success) break;
+ }
+ return (result);
}
-typedef struct _SrcParts{
- int x1, y1, x2, y2, width, ByteWidth;
- char *buf;
-} SrcPartsRec;
-
-
-int PanoramiXGetImage(register ClientPtr client)
+int PanoramiXGetImage(ClientPtr client)
{
- register DrawablePtr pDraw;
- int nlines, linesPerBuf;
- register int height, linesDone;
- long widthBytesLine, length;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- long widthBytesLineProto, lengthProto;
- char *tmpImage;
-#endif
- Mask plane;
- char *pBuf;
+ DrawablePtr drawables[MAXSCREENS];
+ DrawablePtr pDraw;
+ PanoramiXRes *draw;
xGetImageReply xgi;
- int j, k, ScrNum;
- DrawablePtr locDraw;
- SrcPartsRec srcParts;
- BoxRec SrcBox;
- char *BufPtr, *PartPtr;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ Bool isRoot;
+ char *pBuf;
+ int i, x, y, w, h, format;
+ Mask plane = 0, planemask;
+ int linesDone, nlines, linesPerBuf;
+ long widthBytesLine, length;
REQUEST(xGetImageReq);
- height = stuff->height;
REQUEST_SIZE_MATCH(xGetImageReq);
+
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
client->errorValue = stuff->format;
return(BadValue);
}
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(draw->type == XRT_PIXMAP)
+ return (*SavedProcVector[X_GetImage])(client);
+
VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
- ScrNum = 0;
- if (stuff->drawable == PanoramiXWinRoot->info[0].id) {
- for (j = 0; j <= (PanoramiXNumScreens - 1); j++) {
- ScrNum = j;
- VERIFY_DRAWABLE(pDraw, pPanoramiXWin->info[ScrNum].id, client);
- if (stuff->x < panoramiXdataPtr[ScrNum].x &&
- stuff->y < panoramiXdataPtr[ScrNum].y )
- break;
- }
- }
- if (pDraw->type == DRAWABLE_WINDOW) {
- if (!((WindowPtr) pDraw)->realized /* Check for viewable */
- || pDraw->x + stuff->x < 0 /* Check for on screen */
- || pDraw->x + stuff->x + (int)stuff->width > PanoramiXPixWidth
- || pDraw->y + stuff->y < 0
- || pDraw->y + stuff->y + height > PanoramiXPixHeight
- || stuff->x < - wBorderWidth((WindowPtr)pDraw) /* Inside border */
- || stuff->x + (int)stuff->width >
- wBorderWidth((WindowPtr)pDraw) + (int) pDraw->width
- + panoramiXdataPtr[ScrNum].x
- || stuff->y < -wBorderWidth((WindowPtr)pDraw)
- || stuff->y + height >
- wBorderWidth ((WindowPtr)pDraw) + (int) pDraw->height
- + panoramiXdataPtr[ScrNum].y)
+
+ if(!((WindowPtr)pDraw)->realized)
+ return(BadMatch);
+
+ x = stuff->x;
+ y = stuff->y;
+ w = stuff->width;
+ h = stuff->height;
+ format = stuff->format;
+ planemask = stuff->planeMask;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
+ if(isRoot) {
+ if( /* check for being onscreen */
+ x < 0 || x + w > PanoramiXPixWidth ||
+ y < 0 || y + h > PanoramiXPixHeight )
return(BadMatch);
- VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
- xgi.visual = wVisual (((WindowPtr) pDraw));
- pPanoramiXWin = PanoramiXWinRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadWindow);
} else {
- if (stuff->x < 0 || stuff->x + (int)stuff->width > pDraw->width
- || stuff->y < 0 || stuff->y + height > pDraw->height)
+ if( /* check for being onscreen */
+ panoramiXdataPtr[0].x + pDraw->x + x < 0 ||
+ panoramiXdataPtr[0].x + pDraw->x + x + w > PanoramiXPixWidth ||
+ panoramiXdataPtr[0].y + pDraw->y + y < 0 ||
+ panoramiXdataPtr[0].y + pDraw->y + y + h > PanoramiXPixHeight ||
+ /* check for being inside of border */
+ x < - wBorderWidth((WindowPtr)pDraw) ||
+ x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
+ y < -wBorderWidth((WindowPtr)pDraw) ||
+ y + h > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height)
return(BadMatch);
- xgi.visual = None;
}
+
+ drawables[0] = pDraw;
+ for(i = 1; i < PanoramiXNumScreens; i++)
+ VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client);
+
+ xgi.visual = wVisual (((WindowPtr) pDraw));
xgi.type = X_Reply;
xgi.sequenceNumber = client->sequence;
xgi.depth = pDraw->depth;
- if (stuff->format == ZPixmap) {
- widthBytesLine = PixmapBytePad(stuff->width, pDraw->depth);
- length = widthBytesLine * height;
+ if(format == ZPixmap) {
+ widthBytesLine = PixmapBytePad(w, pDraw->depth);
+ length = widthBytesLine * h;
+
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLineProto = PixmapBytePadProto(stuff->width, pDraw->depth);
- lengthProto = widthBytesLineProto * height;
-#endif
} else {
- widthBytesLine = BitmapBytePad(stuff->width);
+ widthBytesLine = BitmapBytePad(w);
plane = ((Mask)1) << (pDraw->depth - 1);
/* only planes asked for */
- length = widthBytesLine * height *
- Ones(stuff->planeMask & (plane | (plane - 1)));
+ length = widthBytesLine * h *
+ Ones(planemask & (plane | (plane - 1)));
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLineProto = BitmapBytePadProto(stuff->width);
- lengthProto = widthBytesLineProto * height *
- Ones(stuff->planeMask & (plane | (plane - 1)));
-#endif
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- xgi.length = (lengthProto + 3) >> 2;
-#else
xgi.length = (length + 3) >> 2;
-#endif
- if (widthBytesLine == 0 || height == 0) {
+ if (widthBytesLine == 0 || h == 0)
linesPerBuf = 0;
- } else if (widthBytesLine >= IMAGE_BUFSIZE) {
+ else if (widthBytesLine >= XINERAMA_IMAGE_BUFSIZE)
linesPerBuf = 1;
- } else {
- linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
- if (linesPerBuf > height)
- linesPerBuf = height;
+ else {
+ linesPerBuf = XINERAMA_IMAGE_BUFSIZE / widthBytesLine;
+ if (linesPerBuf > h)
+ linesPerBuf = h;
}
length = linesPerBuf * widthBytesLine;
- if (linesPerBuf < height) {
-
- /*
- * Have to make sure intermediate buffers don't need padding
- */
-
- while ((linesPerBuf > 1)
- && (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1))) {
- linesPerBuf--;
- length -= widthBytesLine;
- }
- while (length & ((1 << LOG2_BYTES_PER_SCANLINE_PAD)-1)) {
- linesPerBuf++;
- length += widthBytesLine;
- }
- }
- IF_RETURN((!(pBuf = (char *) ALLOCATE_LOCAL(length))), BadAlloc);
-
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /*
- * Check for protocol/server padding differences
- */
-
- if (widthBytesLine != widthBytesLineProto)
- if (!(tmpImage = (char *) ALLOCATE_LOCAL(length))) {
- DEALLOCATE_LOCAL(pBuf);
- return (BadAlloc);
- }
-#endif
+ if(!(pBuf = xalloc(length)))
+ return (BadAlloc);
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
if (linesPerBuf == 0) {
-
- /*
- * Nothing to do
- */
-
- } else if (stuff->format == ZPixmap) {
+ /* nothing to do */
+ }
+ else if (format == ZPixmap) {
linesDone = 0;
- while (height - linesDone > 0) {
- nlines = min(linesPerBuf, height - linesDone);
- if (pDraw->type == DRAWABLE_WINDOW) {
- SrcBox.x1 = pDraw->x + stuff->x;
- SrcBox.y1 = pDraw->y + stuff->y + linesDone;
- SrcBox.x2 = SrcBox.x1 + stuff->width;
- SrcBox.y2 = SrcBox.y1 + nlines;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
-
- /*
- * If it isn't even on this screen, just continue.
- */
+ while (h - linesDone > 0) {
+ nlines = min(linesPerBuf, h - linesDone);
- if ((SrcBox.x1 >= panoramiXdataPtr[j].x + panoramiXdataPtr[j].width)
- || (SrcBox.x2 <= panoramiXdataPtr[j].x)
- || (SrcBox.y1 >= panoramiXdataPtr[j].y+panoramiXdataPtr[j].height)
- || (SrcBox.y2 <= panoramiXdataPtr[j].y))
- continue;
-
- srcParts.x1 = max(SrcBox.x1 - panoramiXdataPtr[j].x, 0);
- srcParts.x2 = min(SrcBox.x2 - panoramiXdataPtr[j].x,
- panoramiXdataPtr[j].width);
- srcParts.y1 = max(SrcBox.y1 - panoramiXdataPtr[j].y, 0);
- srcParts.y2 = min(SrcBox.y2 - panoramiXdataPtr[j].y,
- panoramiXdataPtr[j].height);
- srcParts.width = srcParts.x2 - srcParts.x1;
- srcParts.ByteWidth = PixmapBytePad(srcParts.width,pDraw->depth);
- srcParts.buf = (char *) Xalloc(nlines * srcParts.ByteWidth);
- locDraw = (DrawablePtr) SecurityLookupIDByClass(client,
- pPanoramiXWin->info[j].id,
- RC_DRAWABLE,
- SecurityReadAccess);
- (*pDraw->pScreen->GetImage)(locDraw,
- srcParts.x1 - locDraw->x,
- srcParts.y1 - locDraw->y,
- srcParts.width,
- srcParts.y2 - srcParts.y1,
- stuff->format,
- (unsigned long)stuff->planeMask,
- srcParts.buf);
- BufPtr = pBuf
- + srcParts.x1 - stuff->x - (pDraw->x - panoramiXdataPtr[j].x)
- + widthBytesLine * (srcParts.y1 - stuff->y
- - (pDraw->y + linesDone - panoramiXdataPtr[j].y));
- PartPtr = srcParts.buf;
- for (k = (srcParts.y2 - srcParts.y1); k; k--) {
- bcopy(PartPtr, BufPtr, srcParts.width);
- BufPtr += widthBytesLine;
- PartPtr += srcParts.ByteWidth;
- }
- Xfree(srcParts.buf);
- }
- } else {
- (*pDraw->pScreen->GetImage) (pDraw, stuff->x, stuff->y + linesDone,
- stuff->width, nlines, stuff->format,
- (unsigned long)stuff->planeMask, pBuf);
- }
-
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /*
- * For 64-bit server, convert image to pad to 32 bits
- */
-
- if ( widthBytesLine != widthBytesLineProto ) {
- register char * bufPtr, * protoPtr;
- register int i;
-
- bzero(tmpImage,length);
-
- for (i = 0, bufPtr = pBuf, protoPtr = tmpImage; i < nlines;
- bufPtr += widthBytesLine, protoPtr += widthBytesLineProto,
- i++)
- memmove(protoPtr,bufPtr,widthBytesLineProto);
-
- /*
- * Note this is NOT a call to WriteSwappedDataToClient,
- * as we do NOT byte swap
- */
-
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLineProto), tmpImage);
- } else
-#endif
- {
+ if(pDraw->depth == 1)
+ bzero(pBuf, nlines * widthBytesLine);
- /*
- * Note this is NOT a call to WriteSwappedDataToClient,
- * as we do NOT byte swap
- */
+ XineramaGetImageData(drawables, x, y + linesDone, w, nlines,
+ format, planemask, pBuf, widthBytesLine, isRoot);
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLine), pBuf);
- }
+ (void)WriteToClient(client,
+ (int)(nlines * widthBytesLine),
+ pBuf);
linesDone += nlines;
}
- } else { /* XYPixmap */
+ } else { /* XYPixmap */
for (; plane; plane >>= 1) {
- if (stuff->planeMask & plane) {
+ if (planemask & plane) {
linesDone = 0;
- while (height - linesDone > 0) {
- nlines = min(linesPerBuf, height - linesDone);
- (*pDraw->pScreen->GetImage) (pDraw,
- stuff->x,
- stuff->y + linesDone,
- stuff->width,
- nlines,
- stuff->format,
- (unsigned long)plane,
- pBuf);
-
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /*
- * For 64-bit server, convert image to pad to 32 bits
- */
-
- if (widthBytesLine != widthBytesLineProto) {
- register char * bufPtr, * protoPtr;
- register int i;
-
- bzero(tmpImage, length);
-
- for (i = 0,bufPtr = pBuf,protoPtr =tmpImage; i < nlines;
- bufPtr += widthBytesLine,
- protoPtr += widthBytesLineProto,
- i++)
- bcopy(bufPtr, protoPtr, widthBytesLineProto);
-
- /*
- * Note: NOT a call to WriteSwappedDataToClient,
- * as we do NOT byte swap
- */
-
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLineProto), tmpImage);
- } else
-#endif
- {
+ while (h - linesDone > 0) {
+ nlines = min(linesPerBuf, h - linesDone);
- /*
- * Note: NOT a call to WriteSwappedDataToClient,
- * as we do NOT byte swap
- */
+ bzero(pBuf, nlines * widthBytesLine);
+
+ XineramaGetImageData(drawables, x, y + linesDone, w,
+ nlines, format, plane, pBuf,
+ widthBytesLine, isRoot);
+
+ (void)WriteToClient(client,
+ (int)(nlines * widthBytesLine),
+ pBuf);
- (void)WriteToClient(client,
- (int)(nlines * widthBytesLine), pBuf);
- }
linesDone += nlines;
}
}
}
}
- DEALLOCATE_LOCAL(pBuf);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if (widthBytesLine != widthBytesLineProto)
- DEALLOCATE_LOCAL(tmpImage);
-#endif
+ xfree(pBuf);
return (client->noClientException);
}
+/* The text stuff should be rewritten so that duplication happens
+ at the GlyphBlt level. That is, loading the font and getting
+ the glyphs should only happen once */
+
int
-PanoramiXPolyText8(register ClientPtr client)
+PanoramiXPolyText8(ClientPtr client)
{
- int result, j;
-
- PanoramiXWindow *pPanoramiXRoot;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr pDraw;
- PixmapPtr pPixmap;
- GC *pGC;
- int orig_x, orig_y;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
+ int result = 0, j;
+ int orig_x, orig_y;
REQUEST(xPolyTextReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
- pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXWin = pPanoramiXRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- /* In the case of Multibuffering, we need to make sure the drawable
- isn't really a pixmap associated to a drawable */
- if (!pPanoramiXWin && (stuff->drawable != pDraw->id)) {
- pPanoramiXWin = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- }
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+ REQUEST_AT_LEAST_SIZE(xPolyTextReq);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyText8])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
orig_x = stuff->x;
orig_y = stuff->y;
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- stuff->x = orig_x;
- stuff->y = orig_y;
- if (pPanoramiXWin == pPanoramiXRoot) {
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
stuff->x = orig_x - panoramiXdataPtr[j].x;
stuff->y = orig_y - panoramiXdataPtr[j].y;
- } else {
- if ( (pDraw->type == DRAWABLE_PIXMAP) &&
- /* special case root window bitmap */
- (pDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
- }
}
- if (!j)
- noPanoramiXExtension = TRUE;
result = (*SavedProcVector[X_PolyText8])(client);
- noPanoramiXExtension = FALSE;
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
return (result);
}
int
-PanoramiXPolyText16(register ClientPtr client)
+PanoramiXPolyText16(ClientPtr client)
{
- int result, j;
-
- PanoramiXWindow *pPanoramiXRoot;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr pDraw;
- GC *pGC;
- int orig_x, orig_y;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
+ int result = 0, j;
+ int orig_x, orig_y;
REQUEST(xPolyTextReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
- pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXWin = pPanoramiXRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- /* In the case of Multibuffering, we need to make sure the drawable
- isn't really a pixmap associated to a drawable */
- if (!pPanoramiXWin && (stuff->drawable != pDraw->id)) {
- pPanoramiXWin = PanoramiXPmapRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- }
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+ REQUEST_AT_LEAST_SIZE(xPolyTextReq);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_PolyText16])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
orig_x = stuff->x;
orig_y = stuff->y;
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- stuff->x = orig_x;
- stuff->y = orig_y;
- if (pPanoramiXWin == pPanoramiXRoot) {
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
stuff->x = orig_x - panoramiXdataPtr[j].x;
stuff->y = orig_y - panoramiXdataPtr[j].y;
- } else {
- if ( (pDraw->type == DRAWABLE_PIXMAP) &&
- /* special case root window bitmap */
- (pDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
- }
}
- if (!j)
- noPanoramiXExtension = TRUE;
result = (*SavedProcVector[X_PolyText16])(client);
- noPanoramiXExtension = FALSE;
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
return (result);
}
-
int PanoramiXImageText8(ClientPtr client)
{
- int result, j;
- PanoramiXWindow *pPanoramiXRoot;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr pDraw;
- GCPtr pGC;
+ int result = 0, j;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
int orig_x, orig_y;
REQUEST(xImageTextReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
- pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXWin = pPanoramiXRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+ REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_ImageText8])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
orig_x = stuff->x;
orig_y = stuff->y;
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- if (pPanoramiXWin == pPanoramiXRoot) {
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
stuff->x = orig_x - panoramiXdataPtr[j].x;
stuff->y = orig_y - panoramiXdataPtr[j].y;
- }else {
- if ( (pDraw->type == DRAWABLE_PIXMAP) &&
- /* special case root window bitmap */
- (pDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
- }
}
result = (*SavedProcVector[X_ImageText8])(client);
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
return (result);
}
@@ -2682,249 +2020,217 @@ int PanoramiXImageText8(ClientPtr client)
int PanoramiXImageText16(ClientPtr client)
{
- int result, j;
- PanoramiXWindow *pPanoramiXRoot;
- PanoramiXWindow *pPanoramiXWin;
- PanoramiXGC *pPanoramiXGC = PanoramiXGCRoot;
- DrawablePtr pDraw;
- GCPtr pGC;
+ int result = 0, j;
+ PanoramiXRes *gc, *draw;
+ Bool isRoot;
int orig_x, orig_y;
REQUEST(xImageTextReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
- pPanoramiXRoot = (pDraw->type == DRAWABLE_PIXMAP)
- ? PanoramiXPmapRoot : PanoramiXWinRoot;
- pPanoramiXWin = pPanoramiXRoot;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->drawable);
- IF_RETURN(!pPanoramiXWin, BadDrawable);
- PANORAMIXFIND_ID(pPanoramiXGC, stuff->gc);
- IF_RETURN(!pPanoramiXGC, BadGC);
+ REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(IS_SHARED_PIXMAP(draw))
+ return (*SavedProcVector[X_ImageText16])(client);
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
orig_x = stuff->x;
orig_y = stuff->y;
- FOR_NSCREENS_OR_ONCE((pPanoramiXWin && pPanoramiXGC), j) {
- stuff->drawable = pPanoramiXWin->info[j].id;
- stuff->gc = pPanoramiXGC->info[j].id;
- if (pPanoramiXWin == pPanoramiXRoot) {
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
stuff->x = orig_x - panoramiXdataPtr[j].x;
stuff->y = orig_y - panoramiXdataPtr[j].y;
- }else {
- if ( (pDraw->type == DRAWABLE_PIXMAP) &&
- /* special case root window bitmap */
- (pDraw->width == (panoramiXdataPtr[PanoramiXNumScreens-1].x +
- panoramiXdataPtr[PanoramiXNumScreens-1].width)) ) {
- stuff->x = orig_x - panoramiXdataPtr[j].x;
- stuff->y = orig_y - panoramiXdataPtr[j].y;
- }
}
result = (*SavedProcVector[X_ImageText16])(client);
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
return (result);
}
-int PanoramiXCreateColormap(register ClientPtr client)
-{
- VisualPtr pVisual;
- ColormapPtr pmap;
- Colormap mid;
- register WindowPtr pWin;
- ScreenPtr pScreen;
- DepthPtr pDepth;
+int PanoramiXCreateColormap(ClientPtr client)
+{
+ PanoramiXRes *win, *newCmap;
+ int result = 0, j, orig_visual;
REQUEST(xCreateColormapReq);
- int i, result;
- int vid_index, class_index;
- int this_vid_index, this_class_index, this_depth;
- int j = 0;
- VisualID orig_visual;
- Colormap cmapID;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXCmap *localCmap;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
- short VisualClass;
- Bool ClassKnown;
- Bool FoundIt = FALSE;
-
REQUEST_SIZE_MATCH(xCreateColormapReq);
- mid = stuff->mid;
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->window, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ if(!stuff->visual || (stuff->visual > 255))
+ return BadValue;
+
+ if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ newCmap->type = XRT_COLORMAP;
+ newCmap->info[0].id = stuff->mid;
+ for(j = 1; j < PanoramiXNumScreens; j++)
+ newCmap->info[j].id = FakeClientID(client->index);
+
orig_visual = stuff->visual;
- j = 0;
- PANORAMIXFIND_ID(pPanoramiXWin, stuff->window);
- if (pPanoramiXWin) {
- localCmap = (PanoramiXCmap *)Xcalloc(sizeof(PanoramiXCmap));
- IF_RETURN(!localCmap, BadAlloc);
- } else {
- return BadWindow;
- }
- for (j = 0; j <= PanoramiXNumScreens - 1; j++) {
- cmapID = j ? FakeClientID(client->index) : mid;
- localCmap->info[j].id = cmapID;
- }
- localCmap->FreeMe = FALSE;
- PANORAMIXFIND_LAST(pPanoramiXCmap, PanoramiXCmapRoot);
- pPanoramiXCmap->next = localCmap;
-
- /* Use Screen 0 to get the matching Visual ID */
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- SecurityReadAccess);
- if ( stuff->visual != CopyFromParent)
- {
- /* Find the correct visual for screen 0 */
- for (class_index = 0; class_index < PanoramiXColorDepthTable[0].numVisuals;
-class_index++)
- {
- for (j = 0; j < PanoramiXColorDepthTable[0].panoramiXScreenMap[class_index
-].numDepths; j++ )
- {
- pDepth = (DepthPtr) &pWin->drawable.pScreen->allowedDepths[j];
- for (vid_index = 0; vid_index < PanoramiXColorDepthTable[0].panoramiXScreenMap[class_index].vmap[pDepth->depth].numVids; vid_index++)
- {
- if ( stuff->visual == PanoramiXColorDepthTable[0].panoramiXScreenMap[class_index].vmap[pDepth->depth].vid[vid_index] )
- {
- this_class_index = class_index;
- this_vid_index = vid_index;
- this_depth = pDepth->depth;
- FoundIt = TRUE;
- break;
- }
- }
- }
- }
- }
- if (!pWin)
- return(BadWindow);
- pScreen = pWin->drawable.pScreen;
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j) {
- stuff->mid = localCmap->info[j].id;
- stuff->window = pPanoramiXWin->info[j].id;
- /* Look for the matching visual class, and use its
- visual id for creating this colormap. */
- if ( orig_visual != CopyFromParent && FoundIt )
- {
- stuff->visual = PanoramiXColorDepthTable[j].panoramiXScreenMap[this_class_index].vmap[this_depth].vid[this_vid_index];
- }
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->mid = newCmap->info[j].id;
+ stuff->window = win->info[j].id;
+ stuff->visual = PanoramiXVisualTable[(orig_visual * MAXSCREENS) + j];
result = (* SavedProcVector[X_CreateColormap])(client);
- BREAK_IF(result != Success);
- }
- if (result != Success) {
- pPanoramiXCmap->next = NULL ;
- if (localCmap)
- Xfree(localCmap);
+ if(result != Success) break;
}
+
+ if (result == Success)
+ AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
+ else
+ xfree(newCmap);
+
return (result);
}
int PanoramiXFreeColormap(ClientPtr client)
{
- ColormapPtr pmap;
+ PanoramiXRes *cmap;
+ int result = 0, j;
REQUEST(xResourceReq);
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
- PanoramiXCmap *pPanoramiXCmapback = NULL;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
REQUEST_SIZE_MATCH(xResourceReq);
- for (; pPanoramiXCmap && (pPanoramiXCmap->info[0].id != stuff->id);
- pPanoramiXCmap = pPanoramiXCmap->next)
- pPanoramiXCmapback = pPanoramiXCmap;
- IF_RETURN(!pPanoramiXCmap, BadColor);
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->id = pPanoramiXCmap->info[j].id;
+ client->errorValue = stuff->id;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_COLORMAP, SecurityDestroyAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->id = cmap->info[j].id;
result = (* SavedProcVector[X_FreeColormap])(client);
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
- if ((result == Success) && pPanoramiXCmapback &&
- pPanoramiXCmap && pPanoramiXCmap->FreeMe) {
- pPanoramiXCmapback->next = pPanoramiXCmap->next;
- Xfree(pPanoramiXCmap);
+
+ /* Since ProcFreeColormap is using FreeResource, it will free
+ our resource for us on the last pass through the loop above */
+
+ return (result);
+}
+
+
+int
+PanoramiXCopyColormapAndFree(ClientPtr client)
+{
+ PanoramiXRes *cmap, *newCmap;
+ int result = 0, j;
+ REQUEST(xCopyColormapAndFreeReq);
+
+ REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq);
+
+ client->errorValue = stuff->srcCmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->srcCmap, XRT_COLORMAP,
+ SecurityReadAccess | SecurityWriteAccess)))
+ return BadColor;
+
+ if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ newCmap->type = XRT_COLORMAP;
+ newCmap->info[0].id = stuff->mid;
+ for(j = 1; j < PanoramiXNumScreens; j++)
+ newCmap->info[j].id = FakeClientID(client->index);
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->srcCmap = cmap->info[j].id;
+ stuff->mid = newCmap->info[j].id;
+ result = (* SavedProcVector[X_CopyColormapAndFree])(client);
+ if(result != Success) break;
}
- PANORAMIX_FREE(client);
+
+ if (result == Success)
+ AddResource(newCmap->info[0].id, XRT_COLORMAP, newCmap);
+ else
+ xfree(newCmap);
+
return (result);
}
-int PanoramiXInstallColormap(register ClientPtr client)
+int PanoramiXInstallColormap(ClientPtr client)
{
- ColormapPtr pcmp;
REQUEST(xResourceReq);
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ int result = 0, j;
+ PanoramiXRes *cmap;
REQUEST_SIZE_MATCH(xResourceReq);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->id);
- IF_RETURN(!pPanoramiXCmap, BadColor);
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->id = pPanoramiXCmap->info[j].id;
+
+ client->errorValue = stuff->id;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_COLORMAP, SecurityReadAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->id = cmap->info[j].id;
result = (* SavedProcVector[X_InstallColormap])(client);
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
return (result);
}
-int PanoramiXUninstallColormap(register ClientPtr client)
+int PanoramiXUninstallColormap(ClientPtr client)
{
- ColormapPtr pcmp;
REQUEST(xResourceReq);
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
-
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+ int result = 0, j;
+ PanoramiXRes *cmap;
REQUEST_SIZE_MATCH(xResourceReq);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->id);
- IF_RETURN(!pPanoramiXCmap, BadColor);
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->id = pPanoramiXCmap->info[j].id;
+
+ client->errorValue = stuff->id;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->id, XRT_COLORMAP, SecurityReadAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->id = cmap->info[j].id;
result = (* SavedProcVector[X_UninstallColormap])(client);
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
- PANORAMIX_FREE(client);
return (result);
}
int PanoramiXAllocColor(ClientPtr client)
{
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ int result = 0, j;
+ PanoramiXRes *cmap;
REQUEST(xAllocColorReq);
REQUEST_SIZE_MATCH(xAllocColorReq);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
- if (!pPanoramiXCmap){
- noPanoramiXExtension = TRUE;
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->cmap = cmap->info[j].id;
result = (* SavedProcVector[X_AllocColor])(client);
- noPanoramiXExtension = FALSE;
- }else {
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->cmap = pPanoramiXCmap->info[j].id;
- if (!j)
- noPanoramiXExtension = TRUE;
- result = (* SavedProcVector[X_AllocColor])(client);
- noPanoramiXExtension = FALSE;
- BREAK_IF(result != Success);
- }
+ if(result != Success) break;
}
return (result);
}
@@ -2932,20 +2238,22 @@ int PanoramiXAllocColor(ClientPtr client)
int PanoramiXAllocNamedColor(ClientPtr client)
{
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ int result = 0, j;
+ PanoramiXRes *cmap;
REQUEST(xAllocNamedColorReq);
REQUEST_FIXED_SIZE(xAllocNamedColorReq, stuff->nbytes);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
- IF_RETURN(!pPanoramiXCmap, BadColor);
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->cmap = pPanoramiXCmap->info[j].id;
- if (!j)
- noPanoramiXExtension = TRUE;
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->cmap = cmap->info[j].id;
result = (* SavedProcVector[X_AllocNamedColor])(client);
- noPanoramiXExtension = FALSE;
- BREAK_IF(result != Success);
+ if(result != Success) break;
}
return (result);
}
@@ -2953,82 +2261,114 @@ int PanoramiXAllocNamedColor(ClientPtr client)
int PanoramiXAllocColorCells(ClientPtr client)
{
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ int result = 0, j;
+ PanoramiXRes *cmap;
REQUEST(xAllocColorCellsReq);
REQUEST_SIZE_MATCH(xAllocColorCellsReq);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
- if (!pPanoramiXCmap) {
- noPanoramiXExtension = TRUE;
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->cmap = cmap->info[j].id;
result = (* SavedProcVector[X_AllocColorCells])(client);
- noPanoramiXExtension = FALSE;
- }else {
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->cmap = pPanoramiXCmap->info[j].id;
- if (!j)
- noPanoramiXExtension = TRUE;
- result = (* SavedProcVector[X_AllocColorCells])(client);
- noPanoramiXExtension = FALSE;
- /* Because id's are eventually searched for in
- some client list, we don't check for success
- on fake id's last id will be real, we really
- only care about results related to real id's
- BREAK_IF(result != Success);
- */
- }
+ if(result != Success) break;
}
return (result);
}
-int PanoramiXFreeColors(register ClientPtr client)
+int PanoramiXAllocColorPlanes(ClientPtr client)
{
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
- REQUEST(xFreeColorsReq);
+ int result = 0, j;
+ PanoramiXRes *cmap;
+ REQUEST(xAllocColorPlanesReq);
- PanoramiXGC *pPanoramiXFreeGC;
- PanoramiXGC *pPanoramiXFreeGCback = NULL;
- PanoramiXWindow *pPanoramiXFreeWin;
- PanoramiXWindow *pPanoramiXFreeWinback = NULL;
- PanoramiXCmap *pPanoramiXFreeCmap;
- PanoramiXCmap *pPanoramiXFreeCmapback = NULL;
- PanoramiXPmap *pPanoramiXFreePmap;
- PanoramiXPmap *pPanoramiXFreePmapback = NULL;
+ REQUEST_SIZE_MATCH(xAllocColorPlanesReq);
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->cmap = cmap->info[j].id;
+ result = (* SavedProcVector[X_AllocColorPlanes])(client);
+ if(result != Success) break;
+ }
+ return (result);
+}
+
+
+
+int PanoramiXFreeColors(ClientPtr client)
+{
+ int result = 0, j;
+ PanoramiXRes *cmap;
+ REQUEST(xFreeColorsReq);
REQUEST_AT_LEAST_SIZE(xFreeColorsReq);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
- IF_RETURN(!pPanoramiXCmap, BadColor);
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->cmap = pPanoramiXCmap->info[j].id;
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j) {
+ stuff->cmap = cmap->info[j].id;
result = (* SavedProcVector[X_FreeColors])(client);
- /* Because id's are eventually searched for in
- some client list, we don't check for success
- on fake id's last id will be real, we really
- only care about results related to real id's */
}
- PANORAMIX_FREE(client);
return (result);
}
int PanoramiXStoreColors(ClientPtr client)
{
- int result, j;
- PanoramiXCmap *pPanoramiXCmap = PanoramiXCmapRoot;
+ int result = 0, j;
+ PanoramiXRes *cmap;
REQUEST(xStoreColorsReq);
REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
- PANORAMIXFIND_ID(pPanoramiXCmap, stuff->cmap);
- if (!pPanoramiXCmap)
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->cmap = cmap->info[j].id;
result = (* SavedProcVector[X_StoreColors])(client);
- else {
- FOR_NSCREENS_OR_ONCE(pPanoramiXCmap, j) {
- stuff->cmap = pPanoramiXCmap->info[j].id;
- result = (* SavedProcVector[X_StoreColors])(client);
- BREAK_IF(result != Success);
- }
+ if(result != Success) break;
+ }
+ return (result);
+}
+
+
+int PanoramiXStoreNamedColor(ClientPtr client)
+{
+ int result = 0, j;
+ PanoramiXRes *cmap;
+ REQUEST(xStoreNamedColorReq);
+
+ REQUEST_FIXED_SIZE(xStoreNamedColorReq, stuff->nbytes);
+
+ client->errorValue = stuff->cmap;
+
+ if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->cmap, XRT_COLORMAP, SecurityWriteAccess)))
+ return BadColor;
+
+ FOR_NSCREENS_BACKWARD(j){
+ stuff->cmap = cmap->info[j].id;
+ result = (* SavedProcVector[X_StoreNamedColor])(client);
+ if(result != Success) break;
}
return (result);
}
diff --git a/Xext/security.c b/Xext/security.c
index c2db8f4dd..9af380dd6 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -24,6 +24,7 @@ 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/Xext/security.c,v 1.11 2002/05/31 18:45:53 dawes Exp $ */
#include "dixstruct.h"
#include "extnsionst.h"
@@ -50,7 +51,7 @@ extern unsigned char LbxReqCode;
#ifndef DEFAULTPOLICYFILE
# define DEFAULTPOLICYFILE NULL
#endif
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
#include <X11/Xos.h>
#undef index
#endif
@@ -82,9 +83,6 @@ int (*SwappedUntrustedProcVector[256])(
#endif
);
-extern int ProcBadRequest();
-
-
/* SecurityAudit
*
* Arguments:
@@ -150,7 +148,7 @@ SecurityDeleteAuthorization(value, id)
/* send revoke events */
- while (pEventClient = pAuth->eventClients)
+ while ((pEventClient = pAuth->eventClients))
{
/* send revocation event event */
ClientPtr client = rClient(pEventClient);
@@ -318,7 +316,7 @@ static int
ProcSecurityQueryVersion(client)
ClientPtr client;
{
- REQUEST(xSecurityQueryVersionReq);
+ /* REQUEST(xSecurityQueryVersionReq); */
xSecurityQueryVersionReply rep;
/* paranoia: this "can't happen" because this extension is hidden
@@ -395,7 +393,6 @@ ProcSecurityGenerateAuthorization(client)
Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
SecurityAuthorizationPtr pAuth = NULL; /* auth we are creating */
int err; /* error to return from this function */
- int status; /* return value from os functions */
XID authId; /* authorization ID assigned by os layer */
xSecurityGenerateAuthorizationReply rep; /* reply struct */
unsigned int trustLevel; /* trust level of new auth */
@@ -788,7 +785,7 @@ SecurityCheckDeviceAccess(client, dev, fromRequest)
Bool untrusted_got_event;
Bool found_event_window;
Mask eventmask;
- int reqtype;
+ int reqtype = 0;
/* trusted clients always allowed to do anything */
if (client->trustLevel == XSecurityClientTrusted)
@@ -1361,8 +1358,11 @@ SecurityFreePropertyAccessList()
}
} /* SecurityFreePropertyAccessList */
-
+#ifndef __UNIXOS2__
#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') )
+#else
+#define SecurityIsWhitespace(c) ( (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') )
+#endif
static char *
SecuritySkipWhitespace(p)
@@ -1441,7 +1441,6 @@ SecurityParsePropertyAccessRule(p)
char action = SecurityDefaultAction;
char readAction, writeAction, destroyAction;
PropertyAccessPtr pacl, prev, cur;
- ATOM atom;
char *mustHaveProperty = NULL;
char *mustHaveValue = NULL;
Bool invalid;
@@ -1641,7 +1640,11 @@ SecurityLoadPropertyAccessList()
if (!SecurityPolicyFile)
return;
+#ifndef __UNIXOS2__
f = fopen(SecurityPolicyFile, "r");
+#else
+ f = fopen((char*)__XOS2RedirRoot(SecurityPolicyFile), "r");
+#endif
if (!f)
{
ErrorF("error opening security policy file %s\n",
@@ -1969,7 +1972,7 @@ SecurityExtensionInit()
SecurityEventBase = extEntry->eventBase;
EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
- SwapSecurityAuthorizationRevokedEvent;
+ (EventSwapPtr)SwapSecurityAuthorizationRevokedEvent;
/* initialize untrusted proc vectors */
diff --git a/Xext/shape.c b/Xext/shape.c
index bff7d2502..7bd161dcc 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/shape.c,v 3.16 2001/12/14 19:58:50 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -27,7 +28,6 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: shape.c,v 1.4 2001/02/09 02:04:32 xorgcvs Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
-#include <stdio.h>
#include "X.h"
#include "Xproto.h"
#include "misc.h"
@@ -43,26 +43,101 @@ in this Software without prior written authorization from The Open Group.
#include "shapestr.h"
#include "regionstr.h"
#include "gcstruct.h"
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
+
+typedef RegionPtr (*CreateDftPtr)(
+#if NeedNestedPrototypes
+ WindowPtr /* pWin */
+#endif
+ );
+
+static int ShapeFreeClient(
+#if NeedFunctionPrototypes
+ pointer /* data */,
+ XID /* id */
+#endif
+ );
+static int ShapeFreeEvents(
+#if NeedFunctionPrototypes
+ pointer /* data */,
+ XID /* id */
+#endif
+ );
+static void SendShapeNotify(
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */,
+ int /* which */
+#endif
+ );
+static void ShapeResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+ );
+static void SShapeNotifyEvent(
+#if NeedFunctionPrototypes
+ xShapeNotifyEvent * /* from */,
+ xShapeNotifyEvent * /* to */
+#endif
+ );
+static int
+RegionOperate (
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ WindowPtr /* pWin */,
+ int /* kind */,
+ RegionPtr * /* destRgnp */,
+ RegionPtr /* srcRgn */,
+ int /* op */,
+ int /* xoff */,
+ int /* yoff */,
+ CreateDftPtr /* create */
+#endif
+ );
+
+#if NeedFunctionPrototypes
+#define CREATE_PROC(func) RegionPtr func(WindowPtr /* pWin */)
+#else
+#define CREATE_PROC(func) RegionPtr func(/* WindowPtr pWin */)
+#endif
+
+static CREATE_PROC(CreateBoundingShape);
+static CREATE_PROC(CreateClipShape);
+
+#undef CREATE_PROC
+
+static DISPATCH_PROC(ProcShapeCombine);
+static DISPATCH_PROC(ProcShapeDispatch);
+static DISPATCH_PROC(ProcShapeGetRectangles);
+static DISPATCH_PROC(ProcShapeInputSelected);
+static DISPATCH_PROC(ProcShapeMask);
+static DISPATCH_PROC(ProcShapeOffset);
+static DISPATCH_PROC(ProcShapeQueryExtents);
+static DISPATCH_PROC(ProcShapeQueryVersion);
+static DISPATCH_PROC(ProcShapeRectangles);
+static DISPATCH_PROC(ProcShapeSelectInput);
+static DISPATCH_PROC(SProcShapeCombine);
+static DISPATCH_PROC(SProcShapeDispatch);
+static DISPATCH_PROC(SProcShapeGetRectangles);
+static DISPATCH_PROC(SProcShapeInputSelected);
+static DISPATCH_PROC(SProcShapeMask);
+static DISPATCH_PROC(SProcShapeOffset);
+static DISPATCH_PROC(SProcShapeQueryExtents);
+static DISPATCH_PROC(SProcShapeQueryVersion);
+static DISPATCH_PROC(SProcShapeRectangles);
+static DISPATCH_PROC(SProcShapeSelectInput);
#ifdef PANORAMIX
#include "panoramiX.h"
+#include "panoramiXsrv.h"
#endif
-static int ShapeFreeClient(), ShapeFreeEvents();
-static void SendShapeNotify();
-static int ProcShapeDispatch(), SProcShapeDispatch();
-static void ShapeResetProc(), SShapeNotifyEvent();
-
static unsigned char ShapeReqCode = 0;
static int ShapeEventBase = 0;
static RESTYPE ClientType, EventType; /* resource types for event masks */
-#ifdef PANORAMIX
-extern int PanoramiXNumScreens;
-extern Bool noPanoramiXExtension;
-extern PanoramiXWindow *PanoramiXWinRoot;
-extern PanoramiXPmap *PanoramiXPmapRoot;
-#endif
/*
* each window has a list of clients requesting
* ShapeNotify events. Each client has a resource
@@ -91,7 +166,7 @@ typedef struct _ShapeEvent {
void
ShapeExtensionInit()
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
ClientType = CreateNewResourceType(ShapeFreeClient);
EventType = CreateNewResourceType(ShapeFreeEvents);
@@ -102,7 +177,7 @@ ShapeExtensionInit()
{
ShapeReqCode = (unsigned char)extEntry->base;
ShapeEventBase = extEntry->eventBase;
- EventSwapVector[ShapeEventBase] = SShapeNotifyEvent;
+ EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
}
}
@@ -113,7 +188,7 @@ ExtensionEntry *extEntry;
{
}
-static
+static int
RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
ClientPtr client;
WindowPtr pWin;
@@ -121,7 +196,7 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
RegionPtr *destRgnp, srcRgn;
int op;
int xoff, yoff;
- RegionPtr (*create)(); /* creates a reasonable *destRgnp */
+ CreateDftPtr create; /* creates a reasonable *destRgnp */
{
ScreenPtr pScreen = pWin->drawable.pScreen;
@@ -133,7 +208,31 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create)
REGION_DESTROY(pScreen, srcRgn);
return Success;
}
- switch (op) {
+
+ /* May/30/2001:
+ * The shape.PS specs say if src is None, existing shape is to be
+ * removed (and so the op-code has no meaning in such removal);
+ * see shape.PS, page 3, ShapeMask.
+ */
+ if (srcRgn == NULL) {
+ if (*destRgnp != NULL) {
+ REGION_DESTROY (pScreen, *destRgnp);
+ *destRgnp = 0;
+ /* go on to remove shape and generate ShapeNotify */
+ }
+ else {
+ /* May/30/2001:
+ * The target currently has no shape in effect, so nothing to
+ * do here. The specs say that ShapeNotify is generated whenever
+ * the client region is "modified"; since no modification is done
+ * here, we do not generate that event. The specs does not say
+ * "it is an error to request removal when there is no shape in
+ * effect", so we return good status.
+ */
+ return Success;
+ }
+ }
+ else switch (op) {
case ShapeSet:
if (*destRgnp)
REGION_DESTROY(pScreen, *destRgnp);
@@ -204,7 +303,6 @@ static int
ProcShapeQueryVersion (client)
register ClientPtr client;
{
- REQUEST(xShapeQueryVersionReq);
xShapeQueryVersionReply rep;
register int n;
@@ -228,42 +326,8 @@ ProcShapeQueryVersion (client)
* ProcShapeRectangles
*
*****************/
-#ifdef PANORAMIX
-static int
-ProcPanoramiXShapeRectangles (client)
- register ClientPtr client;
-{
- WindowPtr pWin;
- ScreenPtr pScreen;
- REQUEST(xShapeRectanglesReq);
- xRectangle *prects;
- int nrects, ctype;
- RegionPtr srcRgn;
- RegionPtr *destRgn;
- RegionPtr (*createDefault)();
- int destBounding;
-
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
-
- REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->dest = pPanoramiXWin->info[j].id;
- result = ProcShapeRectangles (client);
- BREAK_IF(result != Success);
- }
- return (result);
-}
-#endif
-#ifdef PANORAMIX
-int
-#else
static int
-#endif
ProcShapeRectangles (client)
register ClientPtr client;
{
@@ -274,7 +338,7 @@ ProcShapeRectangles (client)
int nrects, ctype;
RegionPtr srcRgn;
RegionPtr *destRgn;
- RegionPtr (*createDefault)();
+ CreateDftPtr createDefault;
int destBounding;
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
@@ -324,49 +388,37 @@ ProcShapeRectangles (client)
stuff->xOff, stuff->yOff, createDefault);
}
-/**************
- * ProcShapeMask
- **************/
-
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeMask (client)
+ProcPanoramiXShapeRectangles (client)
register ClientPtr client;
{
- WindowPtr pWin;
- ScreenPtr pScreen;
- REQUEST(xShapeMaskReq);
- RegionPtr srcRgn;
- RegionPtr *destRgn;
- PixmapPtr pPixmap;
- RegionPtr (*createDefault)();
- int destBounding;
+ REQUEST(xShapeRectanglesReq);
+ PanoramiXRes *win;
+ int j, result = 0;
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
- PanoramiXPmap *pPmap = PanoramiXPmapRoot;
+ REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
- REQUEST_SIZE_MATCH (xShapeMaskReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- PANORAMIXFIND_ID(pPmap, stuff->src);
- IF_RETURN(!pPmap, BadRequest);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->dest = pPanoramiXWin->info[j].id;
- stuff->src = pPmap->info[j].id;
- result = ProcShapeMask (client);
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS(j) {
+ stuff->dest = win->info[j].id;
+ result = ProcShapeRectangles (client);
BREAK_IF(result != Success);
}
return (result);
}
#endif
-#ifdef PANORAMIX
-int
-#else
+
+/**************
+ * ProcShapeMask
+ **************/
+
+
static int
-#endif
ProcShapeMask (client)
register ClientPtr client;
{
@@ -376,7 +428,7 @@ ProcShapeMask (client)
RegionPtr srcRgn;
RegionPtr *destRgn;
PixmapPtr pPixmap;
- RegionPtr (*createDefault)();
+ CreateDftPtr createDefault;
int destBounding;
REQUEST_SIZE_MATCH (xShapeMaskReq);
@@ -425,45 +477,45 @@ ProcShapeMask (client)
stuff->xOff, stuff->yOff, createDefault);
}
-/************
- * ProcShapeCombine
- ************/
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeCombine (client)
+ProcPanoramiXShapeMask (client)
register ClientPtr client;
{
- WindowPtr pSrcWin, pDestWin;
- ScreenPtr pScreen;
- REQUEST(xShapeCombineReq);
- RegionPtr srcRgn;
- RegionPtr *destRgn;
- RegionPtr (*createDefault)();
- RegionPtr (*createSrc)();
- RegionPtr tmp;
- int destBounding;
+ REQUEST(xShapeMaskReq);
+ PanoramiXRes *win, *pmap;
+ int j, result = 0;
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ REQUEST_SIZE_MATCH (xShapeMaskReq);
- REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->dest = pPanoramiXWin->info[j].id;
- result = ProcShapeCombine (client);
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ if(stuff->src != None) {
+ if(!(pmap = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->src, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
+ } else
+ pmap = NULL;
+
+ FOR_NSCREENS(j) {
+ stuff->dest = win->info[j].id;
+ if(pmap)
+ stuff->src = pmap->info[j].id;
+ result = ProcShapeMask (client);
BREAK_IF(result != Success);
}
return (result);
}
#endif
-#ifdef PANORAMIX
-int
-#else
+
+/************
+ * ProcShapeCombine
+ ************/
+
static int
-#endif
ProcShapeCombine (client)
register ClientPtr client;
{
@@ -472,8 +524,8 @@ ProcShapeCombine (client)
REQUEST(xShapeCombineReq);
RegionPtr srcRgn;
RegionPtr *destRgn;
- RegionPtr (*createDefault)();
- RegionPtr (*createSrc)();
+ CreateDftPtr createDefault;
+ CreateDftPtr createSrc;
RegionPtr tmp;
int destBounding;
@@ -539,40 +591,41 @@ ProcShapeCombine (client)
stuff->xOff, stuff->yOff, createDefault);
}
-/*************
- * ProcShapeOffset
- *************/
+
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeOffset (client)
+ProcPanoramiXShapeCombine (client)
register ClientPtr client;
{
- WindowPtr pWin;
- ScreenPtr pScreen;
- REQUEST(xShapeOffsetReq);
- RegionPtr srcRgn;
+ REQUEST(xShapeCombineReq);
+ PanoramiXRes *win, *win2;
+ int j, result = 0;
+
+ REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
- register int result;
- int j;
- PanoramiXWindow *pPanoramiXWin = PanoramiXWinRoot;
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
- REQUEST_AT_LEAST_SIZE (xShapeOffsetReq);
- PANORAMIXFIND_ID(pPanoramiXWin,stuff->dest);
- IF_RETURN(!pPanoramiXWin, BadRequest);
- FOR_NSCREENS_OR_ONCE(pPanoramiXWin , j) {
- stuff->dest = pPanoramiXWin->info[j].id;
- result = ProcShapeOffset (client);
+ if(!(win2 = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->src, XRT_WINDOW, SecurityReadAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS(j) {
+ stuff->dest = win->info[j].id;
+ stuff->src = win2->info[j].id;
+ result = ProcShapeCombine (client);
BREAK_IF(result != Success);
}
return (result);
}
#endif
-#ifdef PANORAMIX
-int
-#else
+/*************
+ * ProcShapeOffset
+ *************/
+
static int
-#endif
ProcShapeOffset (client)
register ClientPtr client;
{
@@ -607,6 +660,32 @@ ProcShapeOffset (client)
return Success;
}
+
+#ifdef PANORAMIX
+static int
+ProcPanoramiXShapeOffset (client)
+ register ClientPtr client;
+{
+ REQUEST(xShapeOffsetReq);
+ PanoramiXRes *win;
+ int j, result = 0;
+
+ REQUEST_AT_LEAST_SIZE (xShapeOffsetReq);
+
+ if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->dest, XRT_WINDOW, SecurityWriteAccess)))
+ return BadWindow;
+
+ FOR_NSCREENS(j) {
+ stuff->dest = win->info[j].id;
+ result = ProcShapeOffset (client);
+ if(result != Success) break;
+ }
+ return (result);
+}
+#endif
+
+
static int
ProcShapeQueryExtents (client)
register ClientPtr client;
@@ -616,6 +695,7 @@ ProcShapeQueryExtents (client)
xShapeQueryExtentsReply rep;
BoxRec extents, *pExtents;
register int n;
+ RegionPtr region;
REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
pWin = LookupWindow (stuff->window, client);
@@ -626,9 +706,9 @@ ProcShapeQueryExtents (client)
rep.sequenceNumber = client->sequence;
rep.boundingShaped = (wBoundingShape(pWin) != 0);
rep.clipShaped = (wClipShape(pWin) != 0);
- if (wBoundingShape(pWin)) {
+ if ((region = wBoundingShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
- pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wBoundingShape(pWin));
+ pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
extents = *pExtents;
} else {
extents.x1 = -wBorderWidth (pWin);
@@ -640,9 +720,9 @@ ProcShapeQueryExtents (client)
rep.yBoundingShape = extents.y1;
rep.widthBoundingShape = extents.x2 - extents.x1;
rep.heightBoundingShape = extents.y2 - extents.y1;
- if (wClipShape(pWin)) {
+ if ((region = wClipShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
- pExtents = REGION_EXTENTS(pWin->drawable.pScreen, wClipShape(pWin));
+ pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region);
extents = *pExtents;
} else {
extents.x1 = 0;
@@ -1001,37 +1081,29 @@ ProcShapeDispatch (client)
if ( !noPanoramiXExtension )
return ProcPanoramiXShapeRectangles (client);
else
- return ProcShapeRectangles (client);
-#else
- return ProcShapeRectangles (client);
#endif
+ return ProcShapeRectangles (client);
case X_ShapeMask:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShapeMask (client);
else
- return ProcShapeMask (client);
-#else
- return ProcShapeMask (client);
#endif
+ return ProcShapeMask (client);
case X_ShapeCombine:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShapeCombine (client);
else
- return ProcShapeCombine (client);
-#else
- return ProcShapeCombine (client);
#endif
+ return ProcShapeCombine (client);
case X_ShapeOffset:
#ifdef PANORAMIX
if ( !noPanoramiXExtension )
return ProcPanoramiXShapeOffset (client);
else
- return ProcShapeOffset (client);
-#else
- return ProcShapeOffset (client);
#endif
+ return ProcShapeOffset (client);
case X_ShapeQueryExtents:
return ProcShapeQueryExtents (client);
case X_ShapeSelectInput:
diff --git a/Xext/shm.c b/Xext/shm.c
index 0a9f3af59..3ba9ad2c1 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xext/shm.c,v 3.36 2002/04/03 19:51:11 herrb Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -29,8 +30,15 @@ in this Software without prior written authorization from The Open Group.
/* $Xorg: shm.c,v 1.4 2001/02/09 02:04:33 xorgcvs Exp $ */
#include <sys/types.h>
+#ifndef Lynx
#include <sys/ipc.h>
#include <sys/shm.h>
+#else
+#include <ipc.h>
+#include <shm.h>
+#endif
+#include <unistd.h>
+#include <sys/stat.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include "X.h"
@@ -48,6 +56,14 @@ in this Software without prior written authorization from The Open Group.
#define _XSHM_SERVER_
#include "shmstr.h"
#include "Xfuncproto.h"
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
typedef struct _ShmDesc {
struct _ShmDesc *next;
@@ -58,21 +74,57 @@ typedef struct _ShmDesc {
unsigned long size;
} ShmDescRec, *ShmDescPtr;
-static void miShmPutImage(), fbShmPutImage();
-static PixmapPtr fbShmCreatePixmap();
-static int ProcShmDispatch(), SProcShmDispatch();
-static int ShmDetachSegment();
-static void ShmResetProc(), SShmCompletionEvent();
+static void miShmPutImage(XSHM_PUT_IMAGE_ARGS);
+static void fbShmPutImage(XSHM_PUT_IMAGE_ARGS);
+static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
+static int ShmDetachSegment(
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* shmseg */
+#endif
+ );
+static void ShmResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+ );
+static void SShmCompletionEvent(
+#if NeedFunctionPrototypes
+ xShmCompletionEvent * /* from */,
+ xShmCompletionEvent * /* to */
+#endif
+ );
+
+static Bool ShmDestroyPixmap (PixmapPtr pPixmap);
+
+static DISPATCH_PROC(ProcShmAttach);
+static DISPATCH_PROC(ProcShmCreatePixmap);
+static DISPATCH_PROC(ProcShmDetach);
+static DISPATCH_PROC(ProcShmDispatch);
+static DISPATCH_PROC(ProcShmGetImage);
+static DISPATCH_PROC(ProcShmPutImage);
+static DISPATCH_PROC(ProcShmQueryVersion);
+static DISPATCH_PROC(SProcShmAttach);
+static DISPATCH_PROC(SProcShmCreatePixmap);
+static DISPATCH_PROC(SProcShmDetach);
+static DISPATCH_PROC(SProcShmDispatch);
+static DISPATCH_PROC(SProcShmGetImage);
+static DISPATCH_PROC(SProcShmPutImage);
+static DISPATCH_PROC(SProcShmQueryVersion);
static unsigned char ShmReqCode;
-static int ShmCompletionCode;
-static int BadShmSegCode;
-static RESTYPE ShmSegType, ShmPixType;
+int ShmCompletionCode;
+int BadShmSegCode;
+RESTYPE ShmSegType;
static ShmDescPtr Shmsegs;
static Bool sharedPixmaps;
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};
@@ -106,20 +158,60 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
} \
}
+
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#include <sys/signal.h>
+
+static Bool badSysCall = FALSE;
+
+static void
+SigSysHandler(signo)
+int signo;
+{
+ badSysCall = TRUE;
+}
+
+static Bool CheckForShmSyscall()
+{
+ void (*oldHandler)();
+ int shmid = -1;
+
+ /* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
+ oldHandler = signal(SIGSYS, SigSysHandler);
+
+ badSysCall = FALSE;
+ shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
+ /* Clean up */
+ if (shmid != -1)
+ {
+ shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL);
+ }
+ signal(SIGSYS, oldHandler);
+ return(!badSysCall);
+}
+#endif
+
void
ShmExtensionInit()
{
ExtensionEntry *extEntry;
int i;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+ if (!CheckForShmSyscall())
+ {
+ ErrorF("MIT-SHM extension disabled due to lack of kernel support\n");
+ return;
+ }
+#endif
+
sharedPixmaps = xFalse;
pixmapFormat = 0;
-#else
- sharedPixmaps = xTrue;
- pixmapFormat = shmPixFormat[0];
- for (i = 0; i < screenInfo.numScreens; i++)
{
+ sharedPixmaps = xTrue;
+ pixmapFormat = shmPixFormat[0];
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
if (!shmFuncs[i])
shmFuncs[i] = &miFuncs;
if (!shmFuncs[i]->CreatePixmap)
@@ -129,13 +221,29 @@ ShmExtensionInit()
sharedPixmaps = xFalse;
pixmapFormat = 0;
}
- }
- if (!pixmapFormat)
+ }
+ if (!pixmapFormat)
pixmapFormat = ZPixmap;
+ if (sharedPixmaps)
+ {
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ destroyPixmap[i] = screenInfo.screens[i]->DestroyPixmap;
+ screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
+ }
+#ifdef PIXPRIV
+ shmPixmapPrivate = AllocatePixmapPrivateIndex();
+ for (i = 0; i < screenInfo.numScreens; i++)
+ {
+ if (!AllocatePixmapPrivate(screenInfo.screens[i],
+ shmPixmapPrivate, 0))
+ return;
+ }
#endif
+ }
+ }
ShmSegType = CreateNewResourceType(ShmDetachSegment);
- ShmPixType = CreateNewResourceType(ShmDetachSegment);
- if (ShmSegType && ShmPixType &&
+ if (ShmSegType &&
(extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors,
ProcShmDispatch, SProcShmDispatch,
ShmResetProc, StandardMinorOpcode)))
@@ -143,7 +251,7 @@ ShmExtensionInit()
ShmReqCode = (unsigned char)extEntry->base;
ShmCompletionCode = extEntry->eventBase;
BadShmSegCode = extEntry->errorBase;
- EventSwapVector[ShmCompletionCode] = SShmCompletionEvent;
+ EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent;
}
}
@@ -177,6 +285,41 @@ ShmSetPixmapFormat(pScreen, format)
shmPixFormat[pScreen->myNum] = format;
}
+static Bool
+ShmDestroyPixmap (PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ Bool ret;
+ 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);
+ }
+
+ pScreen->DestroyPixmap = destroyPixmap[pScreen->myNum];
+ ret = (*pScreen->DestroyPixmap) (pPixmap);
+ destroyPixmap[pScreen->myNum] = pScreen->DestroyPixmap;
+ pScreen->DestroyPixmap = ShmDestroyPixmap;
+ return ret;
+}
+
void
ShmRegisterFbFuncs(pScreen)
ScreenPtr pScreen;
@@ -188,7 +331,6 @@ static int
ProcShmQueryVersion(client)
register ClientPtr client;
{
- REQUEST(xShmQueryVersionReq);
xShmQueryVersionReply rep;
register int n;
@@ -214,6 +356,47 @@ ProcShmQueryVersion(client)
return (client->noClientException);
}
+/*
+ * Simulate the access() system call for a shared memory segement,
+ * using the credentials from the client if available
+ */
+static int
+shm_access(ClientPtr client, struct ipc_perm *perm, int readonly)
+{
+ int uid, gid;
+ mode_t mask;
+
+ if (LocalClientCred(client, &uid, &gid) != -1) {
+
+ /* User id 0 always gets access */
+ if (uid == 0) {
+ return 0;
+ }
+ /* Check the owner */
+ if (perm->uid == uid || perm->cuid == uid) {
+ mask = S_IRUSR;
+ if (!readonly) {
+ mask |= S_IWUSR;
+ }
+ return (perm->mode & mask) == mask ? 0 : -1;
+ }
+ /* Check the group */
+ if (perm->gid == gid || perm->cgid == gid) {
+ mask = S_IRGRP;
+ if (!readonly) {
+ mask |= S_IWGRP;
+ }
+ return (perm->mode & mask) == mask ? 0 : -1;
+ }
+ }
+ /* Otherwise, check everyone else */
+ mask = S_IROTH;
+ if (!readonly) {
+ mask |= S_IWOTH;
+ }
+ return (perm->mode & mask) == mask ? 0 : -1;
+}
+
static int
ProcShmAttach(client)
register ClientPtr client;
@@ -252,6 +435,17 @@ ProcShmAttach(client)
xfree(shmdesc);
return BadAccess;
}
+
+ /* The attach was performed with root privs. We must
+ * do manual checking of access rights for the credentials
+ * of the client */
+
+ if (shm_access(client, &(buf.shm_perm), stuff->readOnly) == -1) {
+ shmdt(shmdesc->addr);
+ xfree(shmdesc);
+ return BadAccess;
+ }
+
shmdesc->shmid = stuff->shmid;
shmdesc->refcnt = 1;
shmdesc->writable = !stuff->readOnly;
@@ -342,7 +536,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
PixmapPtr pPixmap;
pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
- /*XXX*/depth, PixmapBytePad(w, depth), (pointer)data);
+ BitsPerPixel(depth), PixmapBytePad(w, depth), (pointer)data);
if (!pPixmap)
return;
if (format == XYBitmap)
@@ -358,6 +552,251 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
data);
}
+
+#ifdef PANORAMIX
+static int
+ProcPanoramiXShmPutImage(register ClientPtr client)
+{
+ int j, result = 0, orig_x, orig_y;
+ PanoramiXRes *draw, *gc;
+ Bool sendEvent, isRoot;
+
+ REQUEST(xShmPutImageReq);
+ REQUEST_SIZE_MATCH(xShmPutImageReq);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
+ client, stuff->gc, XRT_GC, SecurityReadAccess)))
+ return BadGC;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
+ orig_x = stuff->dstX;
+ orig_y = stuff->dstY;
+ sendEvent = stuff->sendEvent;
+ stuff->sendEvent = 0;
+ FOR_NSCREENS(j) {
+ if(!j) stuff->sendEvent = sendEvent;
+ stuff->drawable = draw->info[j].id;
+ stuff->gc = gc->info[j].id;
+ if (isRoot) {
+ stuff->dstX = orig_x - panoramiXdataPtr[j].x;
+ stuff->dstY = orig_y - panoramiXdataPtr[j].y;
+ }
+ result = ProcShmPutImage(client);
+ if(result != client->noClientException) break;
+ }
+ return(result);
+}
+
+static int
+ProcPanoramiXShmGetImage(ClientPtr client)
+{
+ PanoramiXRes *draw;
+ DrawablePtr drawables[MAXSCREENS];
+ DrawablePtr pDraw;
+ xShmGetImageReply xgi;
+ ShmDescPtr shmdesc;
+ int i, x, y, w, h, format;
+ Mask plane = 0, planemask;
+ long lenPer = 0, length, widthBytesLine;
+ Bool isRoot;
+
+ REQUEST(xShmGetImageReq);
+
+ REQUEST_SIZE_MATCH(xShmGetImageReq);
+
+ if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
+ client->errorValue = stuff->format;
+ return(BadValue);
+ }
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ if (draw->type == XRT_PIXMAP)
+ return ProcShmGetImage(client);
+
+ VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
+
+ VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
+
+ x = stuff->x;
+ y = stuff->y;
+ w = stuff->width;
+ h = stuff->height;
+ format = stuff->format;
+ planemask = stuff->planeMask;
+
+ isRoot = (draw->type == XRT_WINDOW) &&
+ (stuff->drawable == WindowTable[0]->drawable.id);
+
+ if(isRoot) {
+ if( /* check for being onscreen */
+ x < 0 || x + w > PanoramiXPixWidth ||
+ y < 0 || y + h > PanoramiXPixHeight )
+ return(BadMatch);
+ } else {
+ if( /* check for being onscreen */
+ panoramiXdataPtr[0].x + pDraw->x + x < 0 ||
+ panoramiXdataPtr[0].x + pDraw->x + x + w > PanoramiXPixWidth ||
+ panoramiXdataPtr[0].y + pDraw->y + y < 0 ||
+ panoramiXdataPtr[0].y + pDraw->y + y + h > PanoramiXPixHeight ||
+ /* check for being inside of border */
+ x < - wBorderWidth((WindowPtr)pDraw) ||
+ x + w > wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width ||
+ y < -wBorderWidth((WindowPtr)pDraw) ||
+ y + h > wBorderWidth ((WindowPtr)pDraw) + (int)pDraw->height)
+ return(BadMatch);
+ }
+
+ drawables[0] = pDraw;
+ for(i = 1; i < PanoramiXNumScreens; i++)
+ VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client);
+
+ xgi.visual = wVisual(((WindowPtr)pDraw));
+ xgi.type = X_Reply;
+ xgi.length = 0;
+ xgi.sequenceNumber = client->sequence;
+ xgi.depth = pDraw->depth;
+
+ if(format == ZPixmap) {
+ widthBytesLine = PixmapBytePad(w, pDraw->depth);
+ length = widthBytesLine * h;
+ } else {
+ widthBytesLine = PixmapBytePad(w, 1);
+ lenPer = widthBytesLine * h;
+ plane = ((Mask)1) << (pDraw->depth - 1);
+ length = lenPer * Ones(planemask & (plane | (plane - 1)));
+ }
+
+ VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
+ xgi.size = length;
+
+ if (length == 0) {/* nothing to do */ }
+ else if (format == ZPixmap) {
+ XineramaGetImageData(drawables, x, y, w, h, format, planemask,
+ shmdesc->addr + stuff->offset,
+ widthBytesLine, isRoot);
+ } else {
+
+ length = stuff->offset;
+ for (; plane; plane >>= 1) {
+ if (planemask & plane) {
+ XineramaGetImageData(drawables, x, y, w, h,
+ format, plane, shmdesc->addr + length,
+ widthBytesLine, isRoot);
+ length += lenPer;
+ }
+ }
+ }
+
+ if (client->swapped) {
+ register int n;
+ swaps(&xgi.sequenceNumber, n);
+ swapl(&xgi.length, n);
+ swapl(&xgi.visual, n);
+ swapl(&xgi.size, n);
+ }
+ WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi);
+
+ return(client->noClientException);
+}
+
+static int
+ProcPanoramiXShmCreatePixmap(client)
+ register ClientPtr client;
+{
+ ScreenPtr pScreen = NULL;
+ PixmapPtr pMap = NULL;
+ DrawablePtr pDraw;
+ DepthPtr pDepth;
+ int i, j, result;
+ ShmDescPtr shmdesc;
+ REQUEST(xShmCreatePixmapReq);
+ PanoramiXRes *newPix;
+
+ REQUEST_SIZE_MATCH(xShmCreatePixmapReq);
+ client->errorValue = stuff->pid;
+ if (!sharedPixmaps)
+ return BadImplementation;
+ LEGAL_NEW_RESOURCE(stuff->pid, client);
+ VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client);
+ VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
+ if (!stuff->width || !stuff->height)
+ {
+ client->errorValue = 0;
+ return BadValue;
+ }
+ if (stuff->depth != 1)
+ {
+ pDepth = pDraw->pScreen->allowedDepths;
+ for (i=0; i<pDraw->pScreen->numDepths; i++, pDepth++)
+ if (pDepth->depth == stuff->depth)
+ goto CreatePmap;
+ client->errorValue = stuff->depth;
+ return BadValue;
+ }
+CreatePmap:
+ VERIFY_SHMSIZE(shmdesc, stuff->offset,
+ PixmapBytePad(stuff->width, stuff->depth) * stuff->height,
+ client);
+
+ if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
+ return BadAlloc;
+
+ newPix->type = XRT_PIXMAP;
+ newPix->u.pix.shared = TRUE;
+ newPix->info[0].id = stuff->pid;
+ for(j = 1; j < PanoramiXNumScreens; j++)
+ newPix->info[j].id = FakeClientID(client->index);
+
+ result = (client->noClientException);
+
+ FOR_NSCREENS(j) {
+ pScreen = screenInfo.screens[j];
+
+ pMap = (*shmFuncs[j]->CreatePixmap)(pScreen,
+ stuff->width, stuff->height, stuff->depth,
+ 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;
+ if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer)pMap)) {
+ (*pScreen->DestroyPixmap)(pMap);
+ result = BadAlloc;
+ break;
+ }
+ } else {
+ result = BadAlloc;
+ break;
+ }
+ }
+
+ if(result == BadAlloc) {
+ while(j--) {
+ (*pScreen->DestroyPixmap)(pMap);
+ FreeResource(newPix->info[j].id, RT_NONE);
+ }
+ xfree(newPix);
+ } else
+ AddResource(stuff->pid, XRT_PIXMAP, newPix);
+
+ return result;
+}
+
+#endif
+
static int
ProcShmPutImage(client)
register ClientPtr client;
@@ -365,11 +804,6 @@ ProcShmPutImage(client)
register GCPtr pGC;
register DrawablePtr pDraw;
long length;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- long lengthProto;
- char *tmpImage;
- int tmpAlloced = 0;
-#endif
ShmDescPtr shmdesc;
REQUEST(xShmPutImageReq);
@@ -383,9 +817,6 @@ ProcShmPutImage(client)
if (stuff->depth != 1)
return BadMatch;
length = PixmapBytePad(stuff->totalWidth, 1);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = PixmapBytePadProto(stuff->totalWidth, 1);
-#endif
}
else if (stuff->format == XYPixmap)
{
@@ -393,19 +824,12 @@ ProcShmPutImage(client)
return BadMatch;
length = PixmapBytePad(stuff->totalWidth, 1);
length *= stuff->depth;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = PixmapBytePadProto(stuff->totalWidth, 1);
- lengthProto *= stuff->depth;
-#endif
}
else if (stuff->format == ZPixmap)
{
if (pDraw->depth != stuff->depth)
return BadMatch;
length = PixmapBytePad(stuff->totalWidth, stuff->depth);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- lengthProto = PixmapBytePadProto(stuff->totalWidth, stuff->depth);
-#endif
}
else
{
@@ -413,13 +837,8 @@ ProcShmPutImage(client)
return BadValue;
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- VERIFY_SHMSIZE(shmdesc, stuff->offset, lengthProto * stuff->totalHeight,
- client);
-#else
VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight,
client);
-#endif
if (stuff->srcX > stuff->totalWidth)
{
client->errorValue = stuff->srcX;
@@ -441,63 +860,6 @@ ProcShmPutImage(client)
return BadValue;
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* handle 64 bit case where protocol may pad to 32 and we want 64
- * In this case, length is what the server wants and lengthProto is
- * what the protocol thinks it is. If the the two are different,
- * copy the protocol version (i.e. the memory shared between the
- * server and the client) to a version with a scanline pad of 64.
- */
- if (length != lengthProto)
- {
- register int i;
- char * stuffptr, /* pointer into protocol data */
- * tmpptr; /* new location to copy to */
-
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->totalHeight)))
- return (BadAlloc);
- tmpAlloced = 1;
-
- bzero(tmpImage,length*stuff->totalHeight);
-
- if (stuff->format == XYPixmap)
- {
- int lineBytes = PixmapBytePad(stuff->totalWidth, 1);
- int lineBytesProto = PixmapBytePadProto(stuff->totalWidth, 1);
- int depth = stuff->depth;
-
- stuffptr = shmdesc->addr + stuff->offset ;
- tmpptr = tmpImage;
- for (i = 0; i < stuff->totalHeight*stuff->depth;
- stuffptr += lineBytesProto,tmpptr += lineBytes, i++)
- bcopy(stuffptr,tmpptr,lineBytesProto);
- }
- else
- {
- for (i = 0,
- stuffptr = shmdesc->addr + stuff->offset,
- tmpptr=tmpImage;
- i < stuff->totalHeight;
- stuffptr += lengthProto,tmpptr += length, i++)
- bcopy(stuffptr,tmpptr,lengthProto);
- }
- }
- /* handle 64-bit case where stuff is not 64-bit aligned
- */
- else if ((unsigned long)(shmdesc->addr+stuff->offset) &
- (sizeof(long)-1))
- {
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->totalHeight)))
- return (BadAlloc);
- tmpAlloced = 1;
- bcopy((char *)(shmdesc->addr+stuff->offset),
- tmpImage,
- length*stuff->totalHeight);
- }
- else
- tmpImage = (char *)(shmdesc->addr+stuff->offset);
-#endif
-
if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) ||
((stuff->format != ZPixmap) &&
(stuff->srcX < screenInfo.bitmapScanlinePad) &&
@@ -509,11 +871,7 @@ ProcShmPutImage(client)
stuff->dstX, stuff->dstY,
stuff->totalWidth, stuff->srcHeight,
stuff->srcX, stuff->format,
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- tmpImage +
-#else
shmdesc->addr + stuff->offset +
-#endif
(stuff->srcY * length));
else
(*shmFuncs[pDraw->pScreen->myNum]->PutImage)(
@@ -522,12 +880,7 @@ ProcShmPutImage(client)
stuff->srcX, stuff->srcY,
stuff->srcWidth, stuff->srcHeight,
stuff->dstX, stuff->dstY,
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- tmpImage);
-
-#else
shmdesc->addr + stuff->offset);
-#endif
if (stuff->sendEvent)
{
@@ -543,12 +896,7 @@ ProcShmPutImage(client)
WriteEventsToClient(client, 1, (xEvent *) &ev);
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if (tmpAlloced)
- DEALLOCATE_LOCAL(tmpImage);
-#endif
-
- return (client->noClientException);
+ return (client->noClientException);
}
@@ -558,17 +906,11 @@ ProcShmGetImage(client)
register ClientPtr client;
{
register DrawablePtr pDraw;
- long lenPer, length;
- Mask plane;
+ long lenPer = 0, length;
+ Mask plane = 0;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
int n;
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- long widthBytesLine,widthBytesLineProto;
- long lenPerProto,lengthProto;
- char *tmpImage;
- int tmpAlloced = 0;
-#endif
REQUEST(xShmGetImageReq);
@@ -616,43 +958,18 @@ ProcShmGetImage(client)
xgi.depth = pDraw->depth;
if(stuff->format == ZPixmap)
{
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLine = PixmapBytePad(stuff->width, pDraw->depth);
- length = widthBytesLine * stuff->height;
- widthBytesLineProto = PixmapBytePadProto(stuff->width, pDraw->depth);
- lengthProto = widthBytesLineProto * stuff->height;
-#else
length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
-#endif
}
else
{
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- widthBytesLine = PixmapBytePad(stuff->width, 1);
- lenPer = widthBytesLine * stuff->height;
- plane = ((Mask)1) << (pDraw->depth - 1);
- /* only planes asked for */
- length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1)));
-
- widthBytesLineProto = PixmapBytePadProto(stuff->width, 1);
- lenPerProto = widthBytesLineProto * stuff->height;
- lengthProto = lenPerProto * Ones(stuff->planeMask &
- (plane | (plane - 1)));
-#else
lenPer = PixmapBytePad(stuff->width, 1) * stuff->height;
plane = ((Mask)1) << (pDraw->depth - 1);
/* only planes asked for */
length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1)));
-#endif
}
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- VERIFY_SHMSIZE(shmdesc, stuff->offset, lengthProto, client);
- xgi.size = lengthProto;
-#else
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
xgi.size = length;
-#endif
if (length == 0)
{
@@ -660,105 +977,25 @@ ProcShmGetImage(client)
}
else if (stuff->format == ZPixmap)
{
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* check for protocol/server padding differences.
- */
- if ((widthBytesLine != widthBytesLineProto) ||
- ((unsigned long)shmdesc->addr + stuff->offset & (sizeof(long)-1)))
- {
- /* temp stuff for 64 bit alignment stuff */
- register char * bufPtr, * protoPtr;
- register int i;
-
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length)))
- return (BadAlloc);
- tmpAlloced = 1;
-
- (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y,
- stuff->width, stuff->height,
- stuff->format, stuff->planeMask,
- tmpImage);
-
- /* for 64-bit server, convert image to pad to 32 bits
- */
- bzero(shmdesc->addr + stuff->offset,lengthProto);
-
- for (i=0,bufPtr=tmpImage,protoPtr=shmdesc->addr + stuff->offset;
- i < stuff->height;
- bufPtr += widthBytesLine,protoPtr += widthBytesLineProto,
- i++)
- bcopy(bufPtr,protoPtr,widthBytesLineProto);
- }
- else
- {
- (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y,
- stuff->width, stuff->height,
- stuff->format, stuff->planeMask,
- shmdesc->addr + stuff->offset);
- }
-#else
(*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y,
stuff->width, stuff->height,
stuff->format, stuff->planeMask,
shmdesc->addr + stuff->offset);
-#endif
}
else
{
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- /* check for protocol/server padding differences.
- */
- if ((widthBytesLine != widthBytesLineProto) ||
- ((unsigned long)shmdesc->addr + stuff->offset &
- (sizeof(long)-1)))
- {
- if(!(tmpImage = (char *) ALLOCATE_LOCAL(length)))
- return (BadAlloc);
- tmpAlloced = 1;
- }
-#endif
length = stuff->offset;
for (; plane; plane >>= 1)
{
if (stuff->planeMask & plane)
{
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if ((widthBytesLine != widthBytesLineProto) ||
- ((unsigned long)shmdesc->addr + stuff->offset &
- (sizeof(long)-1)))
- {
- /* get image for each plane.
- */
- (*pDraw->pScreen->GetImage)(pDraw,
- stuff->x, stuff->y,
- stuff->width, stuff->height,
- stuff->format, plane,
- tmpImage);
-
- /* for 64-bit server, convert image to pad to 32 bits */
- bzero(shmdesc->addr+length, widthBytesLine);
- bcopy(tmpImage, shmdesc->addr+length, widthBytesLineProto);
- /* increment length */
- length += lenPerProto;
- }
- else /* no diff between protocol and server */
- {
- (*pDraw->pScreen->GetImage)(pDraw,
- stuff->x, stuff->y,
- stuff->width, stuff->height,
- stuff->format, plane,
- shmdesc->addr + length);
- length += lenPer;
- }
-#else
(*pDraw->pScreen->GetImage)(pDraw,
stuff->x, stuff->y,
stuff->width, stuff->height,
stuff->format, plane,
shmdesc->addr + length);
length += lenPer;
-#endif
}
}
}
@@ -771,11 +1008,6 @@ ProcShmGetImage(client)
}
WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi);
-#ifdef INTERNAL_VS_EXTERNAL_PADDING
- if (tmpAlloced)
- DEALLOCATE_LOCAL(tmpImage);
-#endif
-
return(client->noClientException);
}
@@ -794,8 +1026,10 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
return NullPixmap;
if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
- /*XXX*/depth, PixmapBytePad(width, depth), (pointer)addr))
+ BitsPerPixel(depth), PixmapBytePad(width, depth), (pointer)addr)) {
+ (*pScreen->DestroyPixmap)(pPixmap);
return NullPixmap;
+ }
return pPixmap;
}
@@ -841,14 +1075,15 @@ 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;
if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
{
- shmdesc->refcnt++;
- if (AddResource(stuff->pid, ShmPixType, (pointer)shmdesc))
- return(client->noClientException);
- FreeResource(stuff->pid, RT_NONE);
+ return(client->noClientException);
}
}
return (BadAlloc);
@@ -868,11 +1103,23 @@ ProcShmDispatch (client)
case X_ShmDetach:
return ProcShmDetach(client);
case X_ShmPutImage:
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXShmPutImage(client);
+#endif
return ProcShmPutImage(client);
case X_ShmGetImage:
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXShmGetImage(client);
+#endif
return ProcShmGetImage(client);
case X_ShmCreatePixmap:
- return ProcShmCreatePixmap(client);
+#ifdef PANORAMIX
+ if ( !noPanoramiXExtension )
+ return ProcPanoramiXShmCreatePixmap(client);
+#endif
+ return ProcShmCreatePixmap(client);
default:
return BadRequest;
}
diff --git a/Xext/sleepuntil.c b/Xext/sleepuntil.c
index 292924ed6..eb2b96a76 100644
--- a/Xext/sleepuntil.c
+++ b/Xext/sleepuntil.c
@@ -25,9 +25,11 @@ in this Software without prior written authorization from The Open Group.
*
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/Xext/sleepuntil.c,v 3.5 2001/12/14 19:58:51 dawes Exp $ */
/* dixsleep.c - implement millisecond timeouts for X clients */
+#include "sleepuntil.h"
#include "X.h"
#include "Xmd.h"
#include "misc.h"
@@ -41,7 +43,13 @@ typedef struct _Sertafied {
TimeStamp revive;
ClientPtr pClient;
XID id;
- void (*notifyFunc)();
+ void (*notifyFunc)(
+#if NeedNestedPrototypes
+ ClientPtr /* client */,
+ pointer /* closure */
+#endif
+ );
+
pointer closure;
} SertafiedRec, *SertafiedPtr;
@@ -49,11 +57,35 @@ static SertafiedPtr pPending;
static RESTYPE SertafiedResType;
static Bool BlockHandlerRegistered;
static int SertafiedGeneration;
-static void ClientAwaken();
-static int SertafiedDelete();
-static void SertafiedBlockHandler();
-static void SertafiedWakeupHandler();
+static void ClientAwaken(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ pointer /* closure */
+#endif
+);
+static int SertafiedDelete(
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+);
+static void SertafiedBlockHandler(
+#if NeedFunctionPrototypes
+ pointer /* data */,
+ OSTimePtr /* wt */,
+ pointer /* LastSelectMask */
+#endif
+);
+static void SertafiedWakeupHandler(
+#if NeedFunctionPrototypes
+ pointer /* data */,
+ int /* i */,
+ pointer /* LastSelectMask */
+#endif
+);
+
+int
ClientSleepUntil (client, revive, notifyFunc, closure)
ClientPtr client;
TimeStamp *revive;
@@ -152,7 +184,7 @@ SertafiedBlockHandler (data, wt, LastSelectMask)
pointer LastSelectMask;
{
SertafiedPtr pReq, pNext;
- unsigned long newdelay, olddelay;
+ unsigned long delay;
TimeStamp now;
if (!pPending)
@@ -177,8 +209,8 @@ SertafiedBlockHandler (data, wt, LastSelectMask)
pReq = pPending;
if (!pReq)
return;
- newdelay = pReq->revive.milliseconds - now.milliseconds;
- AdjustWaitForDelay (wt, newdelay);
+ delay = pReq->revive.milliseconds - now.milliseconds;
+ AdjustWaitForDelay (wt, delay);
}
static void
diff --git a/Xext/sync.c b/Xext/sync.c
index 8274d2522..079a804e3 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -50,10 +50,10 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
+/* $XFree86: xc/programs/Xserver/Xext/sync.c,v 3.11 2001/12/14 19:58:51 dawes Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
-#include <stdio.h>
#include "X.h"
#include "Xproto.h"
#include "Xmd.h"
@@ -67,6 +67,15 @@ PERFORMANCE OF THIS SOFTWARE.
#include "sync.h"
#include "syncstr.h"
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#else
+#include <stdio.h>
+#if !defined(WIN32) && !defined(Lynx)
+#include <sys/time.h>
+#endif
+#endif
+
/*
* Local Global Variables
*/
@@ -87,13 +96,254 @@ static SyncCounter **SysCounterList = NULL;
#define XSyncCAAllTrigger \
(XSyncCACounter | XSyncCAValueType | XSyncCAValue | XSyncCATestType)
+static int
+FreeAlarm(
+#if NeedFunctionPrototypes
+ pointer /* addr */,
+ XID /* id */
+#endif
+);
+
+static int
+FreeAlarmClient(
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+);
+
+static int
+FreeAwait(
+#if NeedFunctionPrototypes
+ pointer /* addr */,
+ XID /* id */
+#endif
+);
+
+static void
+ServertimeBracketValues(
+#if NeedFunctionPrototypes
+ pointer /* pCounter */,
+ CARD64 * /* pbracket_less */,
+ CARD64 * /* pbracket_greater */
+#endif
+);
+
+static void
+ServertimeQueryValue(
+#if NeedFunctionPrototypes
+ pointer /* pCounter */,
+ CARD64 * /* pValue_return */
+#endif
+);
+
+static void
+ServertimeWakeupHandler(
+#if NeedFunctionPrototypes
+ pointer /* env */,
+ int /* rc */,
+ pointer /* LastSelectMask */
+#endif
+);
+
+static int
+SyncInitTrigger(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ SyncTrigger * /* pTrigger */,
+ XSyncCounter /* counter */,
+ Mask /* changes */
+#endif
+);
+
+static void
+SAlarmNotifyEvent(
+#if NeedFunctionPrototypes
+ xSyncAlarmNotifyEvent * /* from */,
+ xSyncAlarmNotifyEvent * /* to */
+#endif
+);
+
+static void
+SCounterNotifyEvent(
+#if NeedFunctionPrototypes
+ xSyncCounterNotifyEvent * /* from */,
+ xSyncCounterNotifyEvent * /* to */
+#endif
+);
+
+static void
+ServertimeBlockHandler(
+#if NeedFunctionPrototypes
+ pointer /* env */,
+ struct timeval ** /* wt */,
+ pointer /* LastSelectMask */
+#endif
+);
+
+static int
+SyncAddTriggerToCounter(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+extern void
+SyncAlarmCounterDestroyed(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+static void
+SyncAlarmTriggerFired(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+static void
+SyncAwaitTriggerFired(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+static int
+SyncChangeAlarmAttributes(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ SyncAlarm * /* pAlarm */,
+ Mask /* mask */,
+ CARD32 * /* values */
+#endif
+);
+
+static Bool
+SyncCheckTriggerNegativeComparison(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */,
+ CARD64 /* oldval */
+#endif
+);
+
+static Bool
+SyncCheckTriggerNegativeTransition(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */,
+ CARD64 /* oldval */
+#endif
+);
+
+static Bool
+SyncCheckTriggerPositiveComparison(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */,
+ CARD64 /* oldval */
+#endif
+);
+
+static Bool
+SyncCheckTriggerPositiveTransition(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */,
+ CARD64 /* oldval */
+#endif
+);
+
+static SyncCounter *
+SyncCreateCounter(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ XSyncCounter /* id */,
+ CARD64 /* initialvalue */
+#endif
+);
+
static void SyncComputeBracketValues(
#if NeedFunctionPrototypes
- SyncCounter * /* pCounter */,
- Bool /* startOver */
+ SyncCounter * /* pCounter */,
+ Bool /* startOver */
#endif
);
+static void
+SyncDeleteTriggerFromCounter(
+#if NeedFunctionPrototypes
+ SyncTrigger * /* pTrigger */
+#endif
+);
+
+static Bool
+SyncEventSelectForAlarm(
+#if NeedFunctionPrototypes
+ SyncAlarm * /* pAlarm */,
+ ClientPtr /* client */,
+ Bool /* wantevents */
+#endif
+);
+
+static void
+SyncInitServerTime(
+#if NeedFunctionPrototypes
+ void
+#endif
+);
+
+static void
+SyncResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+
+static void
+SyncSendAlarmNotifyEvents(
+#if NeedFunctionPrototypes
+ SyncAlarm * /* pAlarm */
+#endif
+);
+
+static void
+SyncSendCounterNotifyEvents(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ SyncAwait ** /* ppAwait */,
+ int /* num_events */
+#endif
+);
+
+static DISPATCH_PROC(ProcSyncAwait);
+static DISPATCH_PROC(ProcSyncChangeAlarm);
+static DISPATCH_PROC(ProcSyncChangeCounter);
+static DISPATCH_PROC(ProcSyncCreateAlarm);
+static DISPATCH_PROC(ProcSyncCreateCounter);
+static DISPATCH_PROC(ProcSyncDestroyAlarm);
+static DISPATCH_PROC(ProcSyncDestroyCounter);
+static DISPATCH_PROC(ProcSyncDispatch);
+static DISPATCH_PROC(ProcSyncGetPriority);
+static DISPATCH_PROC(ProcSyncInitialize);
+static DISPATCH_PROC(ProcSyncListSystemCounters);
+static DISPATCH_PROC(ProcSyncQueryAlarm);
+static DISPATCH_PROC(ProcSyncQueryCounter);
+static DISPATCH_PROC(ProcSyncSetCounter);
+static DISPATCH_PROC(ProcSyncSetPriority);
+static DISPATCH_PROC(SProcSyncAwait);
+static DISPATCH_PROC(SProcSyncChangeAlarm);
+static DISPATCH_PROC(SProcSyncChangeCounter);
+static DISPATCH_PROC(SProcSyncCreateAlarm);
+static DISPATCH_PROC(SProcSyncCreateCounter);
+static DISPATCH_PROC(SProcSyncDestroyAlarm);
+static DISPATCH_PROC(SProcSyncDestroyCounter);
+static DISPATCH_PROC(SProcSyncDispatch);
+static DISPATCH_PROC(SProcSyncGetPriority);
+static DISPATCH_PROC(SProcSyncInitialize);
+static DISPATCH_PROC(SProcSyncListSystemCounters);
+static DISPATCH_PROC(SProcSyncQueryAlarm);
+static DISPATCH_PROC(SProcSyncQueryCounter);
+static DISPATCH_PROC(SProcSyncSetCounter);
+static DISPATCH_PROC(SProcSyncSetPriority);
+
/* Each counter maintains a simple linked list of triggers that are
* interested in the counter. The two functions below are used to
* delete and add triggers on this list.
@@ -462,26 +712,26 @@ SyncAlarmTriggerFired(pTrigger)
{
Bool overflow;
CARD64 oldvalue;
- SyncTrigger *pTrigger = &pAlarm->trigger;
+ SyncTrigger *paTrigger = &pAlarm->trigger;
/* "The alarm is updated by repeatedly adding delta to the
* value of the trigger and re-initializing it until it
* becomes FALSE."
*/
- oldvalue = pTrigger->test_value;
+ oldvalue = paTrigger->test_value;
/* XXX really should do something smarter here */
do
{
- XSyncValueAdd(&pTrigger->test_value, pTrigger->test_value,
+ XSyncValueAdd(&paTrigger->test_value, paTrigger->test_value,
pAlarm->delta, &overflow);
} while (!overflow &&
- (*pTrigger->CheckTrigger)(pTrigger,
- pTrigger->pCounter->value));
+ (*paTrigger->CheckTrigger)(paTrigger,
+ paTrigger->pCounter->value));
- new_test_value = pTrigger->test_value;
- pTrigger->test_value = oldvalue;
+ new_test_value = paTrigger->test_value;
+ paTrigger->test_value = oldvalue;
/* "If this update would cause value to fall outside the range
* for an INT64...no change is made to value (test-value) and
@@ -710,7 +960,6 @@ SyncChangeAlarmAttributes(client, pAlarm, mask, values)
Mask mask;
CARD32 *values;
{
- SyncAlarmClientList *pClients;
int status;
XSyncCounter counter;
Mask origmask = mask;
@@ -719,9 +968,9 @@ SyncChangeAlarmAttributes(client, pAlarm, mask, values)
while (mask)
{
- int index = lowbit(mask);
- mask &= ~index;
- switch (index)
+ int index2 = lowbit(mask);
+ mask &= ~index2;
+ switch (index2)
{
case XSyncCACounter:
mask &= ~XSyncCACounter;
@@ -998,7 +1247,6 @@ FreeAlarm(addr, id)
XID id;
{
SyncAlarm *pAlarm = (SyncAlarm *) addr;
- SyncAlarmClientList *pClient;
pAlarm->state = XSyncAlarmDestroyed;
@@ -1139,7 +1387,6 @@ static int
ProcSyncInitialize(client)
ClientPtr client;
{
- REQUEST(xSyncInitializeReq);
xSyncInitializeReply rep;
int n;
@@ -1166,10 +1413,9 @@ static int
ProcSyncListSystemCounters(client)
ClientPtr client;
{
- REQUEST(xSyncListSystemCountersReq);
xSyncListSystemCountersReply rep;
int i, len;
- xSyncSystemCounter *list, *walklist;
+ xSyncSystemCounter *list = NULL, *walklist = NULL;
REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
@@ -1318,7 +1564,6 @@ ProcSyncCreateCounter(client)
ClientPtr client;
{
REQUEST(xSyncCreateCounterReq);
- SyncCounter *pCounter;
CARD64 initial;
REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
@@ -1440,9 +1685,8 @@ ProcSyncAwait(client)
{
REQUEST(xSyncAwaitReq);
int len, items;
- int n, i;
+ int i;
xSyncWaitCondition *pProtocolWaitConds;
- int ret;
SyncAwaitUnion *pAwaitUnion;
SyncAwait *pAwait;
int status;
@@ -1606,7 +1850,6 @@ ProcSyncCreateAlarm(client)
REQUEST(xSyncCreateAlarmReq);
SyncAlarm *pAlarm;
int status;
- int i;
unsigned long len, vmask;
SyncTrigger *pTrigger;
@@ -2063,8 +2306,6 @@ static int
SProcSyncDispatch(client)
ClientPtr client;
{
- int n;
-
REQUEST(xReq);
switch (stuff->data)
@@ -2154,8 +2395,6 @@ SyncResetProc(extEntry)
}
-static void SyncInitServerTime();
-
/*
* ** Initialise the extension.
*/
@@ -2188,8 +2427,8 @@ SyncExtensionInit()
SyncReqCode = extEntry->base;
SyncEventBase = extEntry->eventBase;
SyncErrorBase = extEntry->errorBase;
- EventSwapVector[SyncEventBase + XSyncCounterNotify] = SCounterNotifyEvent;
- EventSwapVector[SyncEventBase + XSyncAlarmNotify] = SAlarmNotifyEvent;
+ EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent;
+ EventSwapVector[SyncEventBase + XSyncAlarmNotify] = (EventSwapPtr) SAlarmNotifyEvent;
/*
* Although SERVERTIME is implemented by the OS layer, we initialise it
@@ -2211,9 +2450,6 @@ SyncExtensionInit()
*/
-#ifndef WIN32
-#include <sys/time.h>
-#endif
static pointer ServertimeCounter;
static XSyncValue Now;
diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c
index 4977fdf88..1d3b416db 100644
--- a/Xext/xcmisc.c
+++ b/Xext/xcmisc.c
@@ -26,28 +26,44 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/Xext/xcmisc.c,v 3.5 2001/12/14 19:58:51 dawes Exp $ */
+#define NEED_EVENTS
+#define NEED_REPLIES
#include "X.h"
#include "Xproto.h"
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
+#include "swaprep.h"
#include "xcmiscstr.h"
static unsigned char XCMiscCode;
-static int ProcXCMiscDispatch(), SProcXCMiscDispatch();
-static void XCMiscResetProc();
-extern void Swap32Write(); /* XXX should be in header file */
+
+static void XCMiscResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+
+static DISPATCH_PROC(ProcXCMiscDispatch);
+static DISPATCH_PROC(ProcXCMiscGetVersion);
+static DISPATCH_PROC(ProcXCMiscGetXIDList);
+static DISPATCH_PROC(ProcXCMiscGetXIDRange);
+static DISPATCH_PROC(SProcXCMiscDispatch);
+static DISPATCH_PROC(SProcXCMiscGetVersion);
+static DISPATCH_PROC(SProcXCMiscGetXIDList);
+static DISPATCH_PROC(SProcXCMiscGetXIDRange);
void
XCMiscExtensionInit()
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
- if (extEntry = AddExtension(XCMiscExtensionName, 0, 0,
+ if ((extEntry = AddExtension(XCMiscExtensionName, 0, 0,
ProcXCMiscDispatch, SProcXCMiscDispatch,
- XCMiscResetProc, StandardMinorOpcode))
+ XCMiscResetProc, StandardMinorOpcode)) != 0)
XCMiscCode = (unsigned char)extEntry->base;
DeclareExtensionSecurity(XCMiscExtensionName, TRUE);
}
@@ -63,7 +79,6 @@ static int
ProcXCMiscGetVersion(client)
register ClientPtr client;
{
- REQUEST(xXCMiscGetVersionReq);
xXCMiscGetVersionReply rep;
register int n;
@@ -86,7 +101,6 @@ static int
ProcXCMiscGetXIDRange(client)
register ClientPtr client;
{
- REQUEST(xXCMiscGetXIDRangeReq);
xXCMiscGetXIDRangeReply rep;
register int n;
XID min_id, max_id;
@@ -137,7 +151,7 @@ ProcXCMiscGetXIDList(client)
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *)&rep);
if (count)
{
- client->pSwapReplyFunc = Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
}
DEALLOCATE_LOCAL(pids);
diff --git a/Xext/xprint.c b/Xext/xprint.c
index 6e2013140..db9a25135 100644
--- a/Xext/xprint.c
+++ b/Xext/xprint.c
@@ -1,4 +1,4 @@
-/* $Xorg: xprint.c,v 1.5 2001/03/05 20:42:36 pookie Exp $ */
+/* $Xorg: xprint.c,v 1.5 2001/03/05 20:42:26 pookie Exp $ */
/*
(c) Copyright 1996 Hewlett-Packard Company
(c) Copyright 1996 International Business Machines Corp.
@@ -64,8 +64,11 @@ copyright holders.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xext/xprint.c,v 1.13 2001/11/23 19:21:31 dawes Exp $ */
+#define _XP_PRINT_SERVER_
#include "X.h"
+#include "Xos.h"
#define NEED_EVENTS
#include "Xproto.h"
#undef NEED_EVENTS
@@ -76,105 +79,90 @@ copyright holders.
#include "extnsionst.h"
#include "dixstruct.h"
#include "Xatom.h"
-#define _XP_PRINT_SERVER_
#include "Print.h"
#include "Printstr.h"
-#undef _XP_PRINT_SERVER_
#include "../Xprint/DiPrint.h"
-
-extern WindowPtr *WindowTable; /* declared in dix:globals.c */
-
-extern WindowPtr XpDiValidatePrinter();
-extern char *XpDiGetDriverName();
-extern char *XpGetAttributes();
-extern char *XpGetOneAttribute();
-extern int XpRehashPrinterList();
-extern void XpSetFontResFunc();
-
-static void XpResetProc();
-
-static int ProcXpDispatch();
-static int ProcXpSwappedDispatch();
-
-static int ProcXpQueryVersion();
-static int ProcXpGetPrinterList();
-static int ProcXpCreateContext();
-static int ProcXpSetContext();
-static int ProcXpGetContext();
-static int ProcXpDestroyContext();
-static int ProcXpGetContextScreen();
-static int ProcXpStartJob();
-static int ProcXpEndJob();
-static int ProcXpStartDoc();
-static int ProcXpEndDoc();
-static int ProcXpStartPage();
-static int ProcXpEndPage();
-static int ProcXpSelectInput();
-static int ProcXpInputSelected();
-static int ProcXpPutDocumentData();
-static int ProcXpGetDocumentData();
-static int ProcXpGetAttributes();
-static int ProcXpGetOneAttribute();
-static int ProcXpSetAttributes();
-static int ProcXpRehashPrinterList();
-static int ProcXpQueryScreens();
-static int ProcXpGetPageDimensions();
-static int ProcXpSetImageResolution();
-static int ProcXpGetImageResolution();
-
-static void SwapXpNotifyEvent();
-static void SwapXpAttributeEvent();
-
-static int SProcXpGetPrinterList();
-static int SProcXpCreateContext();
-static int SProcXpSetContext();
-static int SProcXpGetContext();
-static int SProcXpDestroyContext();
-static int SProcXpGetContextScreen();
-static int SProcXpStartJob();
-static int SProcXpEndJob();
-static int SProcXpStartDoc();
-static int SProcXpEndDoc();
-static int SProcXpStartPage();
-static int SProcXpEndPage();
-static int SProcXpSelectInput();
-static int SProcXpInputSelected();
-static int SProcXpPutDocumentData();
-static int SProcXpGetDocumentData();
-static int SProcXpGetAttributes();
-static int SProcXpGetOneAttribute();
-static int SProcXpSetAttributes();
-static int SProcXpRehashPrinterList();
-static int SProcXpGetPageDimensions();
-static int SProcXpSetImageResolution();
-static int SProcXpGetImageResolution();
-
-static void SendXpNotify();
-static void SendAttributeNotify();
-static int XpFreeClient();
-static int XpFreeContext();
-static int XpFreePage();
-static int XpFreeEvents();
-static Bool XpCloseScreen();
-static CARD32 GetAllEventMasks();
-static struct _XpEvent *AddEventRec();
-static void DeleteEventRec();
-static struct _XpEvent *FindEventRec();
-static struct _XpClient *CreateXpClient();
-static void FreeXpClient();
-static void InitContextPrivates();
-static void ResetContextPrivates();
-static struct _XpClient *FindClient();
-static struct _XpClient *AcquireClient();
+#include "../Xprint/attributes.h"
+
+static void XpResetProc(ExtensionEntry *);
+
+static int ProcXpDispatch(ClientPtr);
+static int ProcXpSwappedDispatch(ClientPtr);
+
+static int ProcXpQueryVersion(ClientPtr);
+static int ProcXpGetPrinterList(ClientPtr);
+static int ProcXpCreateContext(ClientPtr);
+static int ProcXpSetContext(ClientPtr);
+static int ProcXpGetContext(ClientPtr);
+static int ProcXpDestroyContext(ClientPtr);
+static int ProcXpGetContextScreen(ClientPtr);
+static int ProcXpStartJob(ClientPtr);
+static int ProcXpEndJob(ClientPtr);
+static int ProcXpStartDoc(ClientPtr);
+static int ProcXpEndDoc(ClientPtr);
+static int ProcXpStartPage(ClientPtr);
+static int ProcXpEndPage(ClientPtr);
+static int ProcXpSelectInput(ClientPtr);
+static int ProcXpInputSelected(ClientPtr);
+static int ProcXpPutDocumentData(ClientPtr);
+static int ProcXpGetDocumentData(ClientPtr);
+static int ProcXpGetAttributes(ClientPtr);
+static int ProcXpGetOneAttribute(ClientPtr);
+static int ProcXpSetAttributes(ClientPtr);
+static int ProcXpRehashPrinterList(ClientPtr);
+static int ProcXpQueryScreens(ClientPtr);
+static int ProcXpGetPageDimensions(ClientPtr);
+static int ProcXpSetImageResolution(ClientPtr);
+static int ProcXpGetImageResolution(ClientPtr);
+
+static void SwapXpNotifyEvent(xPrintPrintEvent *, xPrintPrintEvent *);
+static void SwapXpAttributeEvent(xPrintAttributeEvent *, xPrintAttributeEvent *);
+
+static int SProcXpGetPrinterList(ClientPtr);
+static int SProcXpCreateContext(ClientPtr);
+static int SProcXpSetContext(ClientPtr);
+static int SProcXpGetContext(ClientPtr);
+static int SProcXpDestroyContext(ClientPtr);
+static int SProcXpGetContextScreen(ClientPtr);
+static int SProcXpStartJob(ClientPtr);
+static int SProcXpEndJob(ClientPtr);
+static int SProcXpStartDoc(ClientPtr);
+static int SProcXpEndDoc(ClientPtr);
+static int SProcXpStartPage(ClientPtr);
+static int SProcXpEndPage(ClientPtr);
+static int SProcXpSelectInput(ClientPtr);
+static int SProcXpInputSelected(ClientPtr);
+static int SProcXpPutDocumentData(ClientPtr);
+static int SProcXpGetDocumentData(ClientPtr);
+static int SProcXpGetAttributes(ClientPtr);
+static int SProcXpGetOneAttribute(ClientPtr);
+static int SProcXpSetAttributes(ClientPtr);
+static int SProcXpRehashPrinterList(ClientPtr);
+static int SProcXpGetPageDimensions(ClientPtr);
+static int SProcXpSetImageResolution(ClientPtr);
+static int SProcXpGetImageResolution(ClientPtr);
+
+static void SendXpNotify(XpContextPtr, int, int);
+static void SendAttributeNotify(XpContextPtr, int);
+static int XpFreeClient(pointer, XID);
+static int XpFreeContext(pointer, XID);
+static int XpFreePage(pointer, XID);
+static Bool XpCloseScreen(int, ScreenPtr);
+static CARD32 GetAllEventMasks(XpContextPtr);
+static struct _XpClient *CreateXpClient(ClientPtr);
+static void InitContextPrivates(XpContextPtr);
+static void ResetContextPrivates(void);
+static struct _XpClient *FindClient(XpContextPtr, ClientPtr);
+static struct _XpClient *AcquireClient(XpContextPtr, ClientPtr);
typedef struct _driver {
struct _driver *next;
char *name;
- int (* CreateContext)();
+ int (* CreateContext)(XpContextPtr);
} XpDriverRec, *XpDriverPtr;
typedef struct _xpScreen {
- Bool (* CloseScreen)();
+ Bool (* CloseScreen)(int, ScreenPtr);
struct _driver *drivers;
} XpScreenRec, *XpScreenPtr;
@@ -196,6 +184,8 @@ typedef struct _XpClient {
XID contextClientID; /* unneeded sanity check? */
} XpClientRec, *XpClientPtr;
+static void FreeXpClient(XpClientPtr, Bool);
+
/*
* Each StartPage request specifies a window which forms the top level
* window of the page. One of the following structs is created as a
@@ -240,8 +230,7 @@ static XpScreenPtr XpScreens[MAXSCREENS];
static unsigned char XpReqCode;
static int XpEventBase;
static int XpErrorBase;
-static int XpGeneration = 0;
-static int XpWindowPrivateIndex;
+static unsigned long XpGeneration = 0;
static int XpClientPrivateIndex;
/* Variables for the context private machinery.
@@ -293,9 +282,9 @@ static CARD32 allEvents = XPPrintMask | XPAttributeMask;
*/
void
-XpExtensionInit()
+XpExtensionInit(void)
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
int i;
RTclient = CreateNewResourceType(XpFreeClient);
@@ -309,8 +298,8 @@ XpExtensionInit()
XpReqCode = (unsigned char)extEntry->base;
XpEventBase = extEntry->eventBase;
XpErrorBase = extEntry->errorBase;
- EventSwapVector[XpEventBase] = SwapXpNotifyEvent;
- EventSwapVector[XpEventBase+1] = SwapXpAttributeEvent;
+ EventSwapVector[XpEventBase] = (EventSwapPtr) SwapXpNotifyEvent;
+ EventSwapVector[XpEventBase+1] = (EventSwapPtr) SwapXpAttributeEvent;
}
if(XpGeneration != serverGeneration)
@@ -347,15 +336,15 @@ XpExtensionInit()
}
static void
-XpResetProc(extEntry)
- ExtensionEntry extEntry;
+XpResetProc(ExtensionEntry *extEntry)
{
- int i;
-
/*
* We can't free up the XpScreens recs here, because extensions are
* closed before screens, and our CloseScreen function uses the XpScreens
* recs.
+
+ int i;
+
for(i = 0; i < MAXSCREENS; i++)
{
if(XpScreens[i] != (XpScreenPtr)NULL)
@@ -366,11 +355,9 @@ XpResetProc(extEntry)
}
static Bool
-XpCloseScreen(index, pScreen)
- int index;
- ScreenPtr pScreen;
+XpCloseScreen(int index, ScreenPtr pScreen)
{
- Bool (* CloseScreen)();
+ Bool (* CloseScreen)(int, ScreenPtr);
CloseScreen = XpScreens[index]->CloseScreen;
if(XpScreens[index] != (XpScreenPtr)NULL)
@@ -399,9 +386,9 @@ XpCloseScreen(index, pScreen)
return (*CloseScreen)(index, pScreen);
}
+#if 0 /* NOT USED */
static void
-FreeScreenEntry(pScreenEntry)
- XpScreenPtr pScreenEntry;
+FreeScreenEntry(XpScreenPtr pScreenEntry)
{
XpDriverPtr pDriver;
@@ -416,6 +403,7 @@ FreeScreenEntry(pScreenEntry)
}
xfree(pScreenEntry);
}
+#endif
/*
* XpRegisterInitFunc tells the print extension which screens
@@ -426,24 +414,20 @@ FreeScreenEntry(pScreenEntry)
* whenever a context gets created for a particular driver on this screen.
*/
void
-XpRegisterInitFunc(pScreen, driverName, initContext)
- ScreenPtr pScreen;
- char *driverName;
- int (*initContext)();
+XpRegisterInitFunc(ScreenPtr pScreen, char *driverName, int (*initContext)(struct _XpContext *))
{
XpDriverPtr pDriver;
- if(XpScreens[pScreen->myNum] == (XpScreenPtr)NULL)
+ if(XpScreens[pScreen->myNum] == 0)
{
if((XpScreens[pScreen->myNum] =
- (XpScreenPtr) Xalloc(sizeof(XpScreenRec))) == (XpScreenPtr)NULL)
+ (XpScreenPtr) Xalloc(sizeof(XpScreenRec))) == 0)
return;
- XpScreens[pScreen->myNum]->CloseScreen = (Bool(*)())NULL;
- XpScreens[pScreen->myNum]->drivers = (XpDriverPtr)NULL;
+ XpScreens[pScreen->myNum]->CloseScreen = 0;
+ XpScreens[pScreen->myNum]->drivers = 0;
}
- if((pDriver = (XpDriverPtr)Xalloc(sizeof(XpDriverRec))) ==
- (XpDriverPtr)NULL)
+ if((pDriver = (XpDriverPtr)Xalloc(sizeof(XpDriverRec))) == 0)
return;
pDriver->next = XpScreens[pScreen->myNum]->drivers;
pDriver->name = driverName;
@@ -452,8 +436,7 @@ XpRegisterInitFunc(pScreen, driverName, initContext)
}
static int
-ProcXpDispatch(client)
- ClientPtr client;
+ProcXpDispatch(ClientPtr client)
{
REQUEST(xReq);
@@ -515,8 +498,7 @@ ProcXpDispatch(client)
}
static int
-ProcXpSwappedDispatch(client)
- ClientPtr client;
+ProcXpSwappedDispatch(ClientPtr client)
{
int temp;
REQUEST(xReq);
@@ -581,10 +563,9 @@ ProcXpSwappedDispatch(client)
}
static int
-ProcXpQueryVersion(client)
- ClientPtr client;
+ProcXpQueryVersion(ClientPtr client)
{
- REQUEST(xPrintQueryVersionReq);
+ /* REQUEST(xPrintQueryVersionReq); */
xPrintQueryVersionReply rep;
register int n;
long l;
@@ -614,12 +595,12 @@ ProcXpQueryVersion(client)
******************************************************************************/
static int
-ProcXpGetPrinterList(client)
- ClientPtr client;
+ProcXpGetPrinterList(ClientPtr client)
{
REQUEST(xPrintGetPrinterListReq);
- int totalSize, numEntries;
- XpDiListEntry **pList, *pEntry;
+ int totalSize;
+ int numEntries;
+ XpDiListEntry **pList;
xPrintGetPrinterListReply *rep;
int n, i, totalBytes;
long l;
@@ -699,10 +680,9 @@ ProcXpGetPrinterList(client)
******************************************************************************/
static int
-ProcXpQueryScreens(client)
- ClientPtr client;
+ProcXpQueryScreens(ClientPtr client)
{
- REQUEST(xPrintQueryScreensReq);
+ /* REQUEST(xPrintQueryScreensReq); */
int i, numPrintScreens, totalSize;
WINDOW *pWinId;
xPrintQueryScreensReply *rep;
@@ -752,8 +732,7 @@ ProcXpQueryScreens(client)
}
static int
-ProcXpGetPageDimensions(client)
- ClientPtr client;
+ProcXpGetPageDimensions(ClientPtr client)
{
REQUEST(xPrintGetPageDimensionsReq);
CARD16 width, height;
@@ -774,12 +753,12 @@ ProcXpGetPageDimensions(client)
return XpErrorBase+XPBadContext;
}
- if(pContext->funcs.GetMediumDimensions != (int (*)())NULL)
+ if(pContext->funcs.GetMediumDimensions != 0)
result = pContext->funcs.GetMediumDimensions(pContext, &width, &height);
else
return BadImplementation;
- if(pContext->funcs.GetReproducibleArea != (int (*)())NULL)
+ if(pContext->funcs.GetReproducibleArea != 0)
result = pContext->funcs.GetReproducibleArea(pContext, &rect);
else
return BadImplementation;
@@ -814,8 +793,7 @@ ProcXpGetPageDimensions(client)
}
static int
-ProcXpSetImageResolution(client)
- ClientPtr client;
+ProcXpSetImageResolution(ClientPtr client)
{
REQUEST(xPrintSetImageResolutionReq);
xPrintSetImageResolutionReply rep;
@@ -836,7 +814,7 @@ ProcXpSetImageResolution(client)
}
rep.prevRes = pContext->imageRes;
- if(pContext->funcs.SetImageResolution != (int (*)())NULL)
+ if(pContext->funcs.SetImageResolution != 0)
result = pContext->funcs.SetImageResolution(pContext,
(int)stuff->imageRes,
&status);
@@ -863,14 +841,11 @@ ProcXpSetImageResolution(client)
}
static int
-ProcXpGetImageResolution(client)
- ClientPtr client;
+ProcXpGetImageResolution(ClientPtr client)
{
REQUEST(xPrintGetImageResolutionReq);
xPrintGetImageResolutionReply rep;
XpContextPtr pContext;
- Bool status;
- int result;
REQUEST_SIZE_MATCH(xPrintGetImageResolutionReq);
@@ -912,10 +887,9 @@ ProcXpGetImageResolution(client)
******************************************************************************/
static int
-ProcXpRehashPrinterList(client)
- ClientPtr client;
+ProcXpRehashPrinterList(ClientPtr client)
{
- REQUEST(xPrintRehashPrinterListReq);
+ /* REQUEST(xPrintRehashPrinterListReq); */
REQUEST_SIZE_MATCH(xPrintRehashPrinterListReq);
@@ -950,15 +924,13 @@ ProcXpRehashPrinterList(client)
* is then called.
*/
static int
-ProcXpCreateContext(client)
- ClientPtr client;
+ProcXpCreateContext(ClientPtr client)
{
REQUEST(xPrintCreateContextReq);
XpScreenPtr pPrintScreen;
WindowPtr pRoot;
- char *printerName, *driverName;
+ char *driverName;
XpContextPtr pContext;
- XpClientPtr pNewPrintClient;
int result = Success;
XpDriverPtr pDriver;
@@ -969,7 +941,7 @@ ProcXpCreateContext(client)
/*
* Check to see if the printer name is valid.
*/
- if((pRoot = XpDiValidatePrinter(stuff + 1, stuff->printerNameLen)) ==
+ if((pRoot = XpDiValidatePrinter((char *)(stuff + 1), stuff->printerNameLen)) ==
(WindowPtr)NULL)
return BadMatch;
@@ -998,22 +970,22 @@ ProcXpCreateContext(client)
pContext->clientSlept = (ClientPtr)NULL;
pContext->imageRes = 0;
- pContext->funcs.DestroyContext = (int (*)())NULL;
- pContext->funcs.StartJob = (int (*)())NULL;
- pContext->funcs.EndJob = (int (*)())NULL;
- pContext->funcs.StartDoc = (int (*)())NULL;
- pContext->funcs.EndDoc = (int (*)())NULL;
- pContext->funcs.StartPage = (int (*)())NULL;
- pContext->funcs.EndPage = (int (*)())NULL;
- pContext->funcs.PutDocumentData = (int (*)())NULL;
- pContext->funcs.GetDocumentData = (int (*)())NULL;
- pContext->funcs.GetAttributes = (char * (*)())NULL;
- pContext->funcs.GetOneAttribute = (char * (*)())NULL;
- pContext->funcs.SetAttributes = (int (*)())NULL;
- pContext->funcs.AugmentAttributes = (int (*)())NULL;
- pContext->funcs.GetMediumDimensions = (int (*)())NULL;
- pContext->funcs.GetReproducibleArea = (int (*)())NULL;
- pContext->funcs.SetImageResolution = (int (*)())NULL;
+ pContext->funcs.DestroyContext = 0;
+ pContext->funcs.StartJob = 0;
+ pContext->funcs.EndJob = 0;
+ pContext->funcs.StartDoc = 0;
+ pContext->funcs.EndDoc = 0;
+ pContext->funcs.StartPage = 0;
+ pContext->funcs.EndPage = 0;
+ pContext->funcs.PutDocumentData = 0;
+ pContext->funcs.GetDocumentData = 0;
+ pContext->funcs.GetAttributes = 0;
+ pContext->funcs.GetOneAttribute = 0;
+ pContext->funcs.SetAttributes = 0;
+ pContext->funcs.AugmentAttributes = 0;
+ pContext->funcs.GetMediumDimensions = 0;
+ pContext->funcs.GetReproducibleArea = 0;
+ pContext->funcs.SetImageResolution = 0;
if((pContext->printerName = (char *)xalloc(stuff->printerNameLen + 1)) ==
(char *)NULL)
@@ -1034,7 +1006,7 @@ ProcXpCreateContext(client)
{
if(!strcmp(driverName, pDriver->name))
{
- if(pDriver->CreateContext != (Bool (*)())NULL)
+ if(pDriver->CreateContext != 0)
pDriver->CreateContext(pContext);
else
return BadImplementation;
@@ -1053,8 +1025,7 @@ ProcXpCreateContext(client)
* and stashes the contextID in the client's devPrivate.
*/
static int
-ProcXpSetContext(client)
- ClientPtr client;
+ProcXpSetContext(ClientPtr client)
{
REQUEST(xPrintSetContextReq);
@@ -1111,22 +1082,18 @@ ProcXpSetContext(client)
}
XpContextPtr
-XpGetPrintContext(client)
- ClientPtr client;
+XpGetPrintContext(ClientPtr client)
{
return (client->devPrivates[XpClientPrivateIndex].ptr);
}
static int
-ProcXpGetContext(client)
- ClientPtr client;
+ProcXpGetContext(ClientPtr client)
{
- REQUEST(xPrintGetContextReq);
+ /* REQUEST(xPrintGetContextReq); */
xPrintGetContextReply rep;
XpContextPtr pContext;
- XpClientPtr pNewPrintClient;
- int result = Success;
register int n;
register long l;
@@ -1156,14 +1123,11 @@ ProcXpGetContext(client)
* to be called.
*/
static int
-ProcXpDestroyContext(client)
- ClientPtr client;
+ProcXpDestroyContext(ClientPtr client)
{
REQUEST(xPrintDestroyContextReq);
XpContextPtr pContext;
- XpClientPtr pXpClient;
- ClientPtr curClient;
REQUEST_SIZE_MATCH(xPrintDestroyContextReq);
@@ -1185,8 +1149,7 @@ ProcXpDestroyContext(client)
}
static int
-ProcXpGetContextScreen(client)
- ClientPtr client;
+ProcXpGetContextScreen(ClientPtr client)
{
REQUEST(xPrintGetContextScreenReq);
xPrintGetContextScreenReply rep;
@@ -1229,9 +1192,7 @@ ProcXpGetContextScreen(client)
* itself.
*/
static int
-XpFreeContext(data, id)
- pointer data;
- XID id;
+XpFreeContext(pointer data, XID id)
{
XpContextPtr pContext = (XpContextPtr)data;
@@ -1245,7 +1206,7 @@ XpFreeContext(data, id)
XpPagePtr pPage = (XpPagePtr)LookupIDByType(
pContext->pageWin, RTpage);
- pContext->funcs.EndPage(pContext, pWin, TRUE);
+ pContext->funcs.EndPage(pContext, pWin);
SendXpNotify(pContext, XPEndPageNotify, TRUE);
pContext->state &= ~PAGE_STARTED;
if(pPage)
@@ -1259,7 +1220,7 @@ XpFreeContext(data, id)
pContext->state &= ~DOC_RAW_STARTED;
pContext->state &= ~DOC_COOKED_STARTED;
}
- if(pContext->funcs.EndJob != (int (*)())NULL)
+ if(pContext->funcs.EndJob != 0)
{
pContext->funcs.EndJob(pContext, TRUE);
SendXpNotify(pContext, XPEndJobNotify, TRUE);
@@ -1272,7 +1233,7 @@ XpFreeContext(data, id)
* Tell the driver we're destroying the context
* This allows the driver to free and ContextPrivate data
*/
- if(pContext->funcs.DestroyContext != (int (*)())NULL)
+ if(pContext->funcs.DestroyContext != 0)
pContext->funcs.DestroyContext(pContext);
/* Free up all the XpClientRecs */
@@ -1291,11 +1252,10 @@ XpFreeContext(data, id)
* is freed. It simply calls the FreeXpClient routine to do the work.
*/
static int
-XpFreeClient(data, id)
- pointer data;
- XID id;
+XpFreeClient(pointer data, XID id)
{
FreeXpClient((XpClientPtr)data, TRUE);
+ return Success;
}
/*
@@ -1309,9 +1269,7 @@ XpFreeClient(data, id)
* XpClientRec's XID).
*/
static void
-FreeXpClient(pXpClient, freeResource)
- XpClientPtr pXpClient;
- Bool freeResource;
+FreeXpClient(XpClientPtr pXpClient, Bool freeResource)
{
XpClientPtr pCurrent, pPrev;
XpContextPtr pContext = pXpClient->context;
@@ -1355,8 +1313,7 @@ FreeXpClient(pXpClient, freeResource)
* freeing of the Rec when the client's connection is closed.
*/
static XpClientPtr
-CreateXpClient(client)
- ClientPtr client;
+CreateXpClient(ClientPtr client)
{
XpClientPtr pNewPrintClient;
XID clientResource;
@@ -1389,9 +1346,7 @@ CreateXpClient(client)
* the page resource.
*/
static int
-XpFreePage(data, id)
- pointer data;
- XID id;
+XpFreePage(pointer data, XID id)
{
XpPagePtr page = (XpPagePtr)data;
int result = Success;
@@ -1401,9 +1356,8 @@ XpFreePage(data, id)
if(page->context != (XpContextPtr)NULL &&
page->context->state & PAGE_STARTED)
{
- XpScreenPtr pPrintScreen = XpScreens[page->context->screenNum];
- if(page->context->funcs.EndPage != (int (*)())NULL)
- result = page->context->funcs.EndPage(page->context, pWin, TRUE);
+ if(page->context->funcs.EndPage != 0)
+ result = page->context->funcs.EndPage(page->context, pWin);
SendXpNotify(page->context, XPEndPageNotify, (int)TRUE);
page->context->pageWin = 0; /* None, NULL??? XXX */
}
@@ -1420,8 +1374,7 @@ XpFreePage(data, id)
*/
static void
-InitContextPrivates(context)
- XpContextPtr context;
+InitContextPrivates(XpContextPtr context)
{
register char *ptr;
DevUnion *ppriv;
@@ -1450,7 +1403,7 @@ InitContextPrivates(context)
}
static void
-ResetContextPrivates()
+ResetContextPrivates(void)
{
contextPrivateCount = 0;
contextPrivateLen = 0;
@@ -1461,15 +1414,13 @@ ResetContextPrivates()
}
int
-XpAllocateContextPrivateIndex()
+XpAllocateContextPrivateIndex(void)
{
return contextPrivateCount++;
}
Bool
-XpAllocateContextPrivate(index, amount)
- int index;
- unsigned amount;
+XpAllocateContextPrivate(int index, unsigned amount)
{
unsigned oldamount;
@@ -1497,9 +1448,7 @@ XpAllocateContextPrivate(index, amount)
}
static XpClientPtr
-AcquireClient(pContext, client)
- XpContextPtr pContext;
- ClientPtr client;
+AcquireClient(XpContextPtr pContext, ClientPtr client)
{
XpClientPtr pXpClient;
@@ -1517,9 +1466,7 @@ AcquireClient(pContext, client)
}
static XpClientPtr
-FindClient(pContext, client)
- XpContextPtr pContext;
- ClientPtr client;
+FindClient(XpContextPtr pContext, ClientPtr client)
{
XpClientPtr pXpClient;
@@ -1539,8 +1486,7 @@ FindClient(pContext, client)
******************************************************************************/
static int
-ProcXpStartJob(client)
- ClientPtr client;
+ProcXpStartJob(ClientPtr client)
{
REQUEST(xPrintStartJobReq);
XpContextPtr pContext;
@@ -1564,9 +1510,10 @@ ProcXpStartJob(client)
}
pPrintScreen = XpScreens[pContext->screenNum];
- if(pContext->funcs.StartJob != (int (*)())NULL)
+ if(pContext->funcs.StartJob != 0)
result = pContext->funcs.StartJob(pContext,
- (stuff->saveData == XPGetData)? TRUE:FALSE);
+ (stuff->saveData == XPGetData)? TRUE:FALSE,
+ client);
else
return BadImplementation;
@@ -1583,12 +1530,10 @@ ProcXpStartJob(client)
}
static int
-ProcXpEndJob(client)
- ClientPtr client;
+ProcXpEndJob(ClientPtr client)
{
REQUEST(xPrintEndJobReq);
XpScreenPtr pPrintScreen;
- WindowPtr pWin;
int result = Success;
XpContextPtr pContext;
@@ -1617,8 +1562,8 @@ ProcXpEndJob(client)
if(stuff->cancel != TRUE)
return XpErrorBase+XPBadSequence;
- if(pContext->funcs.EndPage != (int (*)())NULL)
- result = pContext->funcs.EndPage(pContext, pWin, TRUE);
+ if(pContext->funcs.EndPage != 0)
+ result = pContext->funcs.EndPage(pContext, pWin);
else
return BadImplementation;
@@ -1632,7 +1577,7 @@ ProcXpEndJob(client)
if(result != Success) return result;
}
- if(pContext->funcs.EndDoc != (int (*)())NULL)
+ if(pContext->funcs.EndDoc != 0)
result = pContext->funcs.EndDoc(pContext, stuff->cancel);
else
return BadImplementation;
@@ -1640,7 +1585,7 @@ ProcXpEndJob(client)
SendXpNotify(pContext, XPEndDocNotify, stuff->cancel);
}
- if(pContext->funcs.EndJob != (int (*)())NULL)
+ if(pContext->funcs.EndJob != 0)
result = pContext->funcs.EndJob(pContext, stuff->cancel);
else
return BadImplementation;
@@ -1656,9 +1601,7 @@ ProcXpEndJob(client)
}
static Bool
-DoStartDoc(client, c)
- ClientPtr client;
- XpStDocPtr c;
+DoStartDoc(ClientPtr client, XpStDocPtr c)
{
XpScreenPtr pPrintScreen;
int result = Success;
@@ -1670,7 +1613,7 @@ DoStartDoc(client, c)
if(!c->slept)
{
c->slept = TRUE;
- ClientSleep(client, DoStartDoc, (pointer) c);
+ ClientSleep(client, (ClientSleepProcPtr)DoStartDoc, (pointer) c);
c->pContext->clientSlept = client;
}
return TRUE;
@@ -1678,7 +1621,7 @@ DoStartDoc(client, c)
pPrintScreen = XpScreens[pContext->screenNum];
- if(pContext->funcs.StartDoc != (int (*)())NULL)
+ if(pContext->funcs.StartDoc != 0)
result = pContext->funcs.StartDoc(pContext, c->type);
else
{
@@ -1699,11 +1642,9 @@ DoStartDoc(client, c)
}
static int
-ProcXpStartDoc(client)
- ClientPtr client;
+ProcXpStartDoc(ClientPtr client)
{
REQUEST(xPrintStartDocReq);
- XpScreenPtr pPrintScreen;
int result = Success;
XpContextPtr pContext;
XpStDocPtr c;
@@ -1738,8 +1679,7 @@ ProcXpStartDoc(client)
}
static int
-ProcXpEndDoc(client)
- ClientPtr client;
+ProcXpEndDoc(ClientPtr client)
{
REQUEST(xPrintEndDocReq);
XpScreenPtr pPrintScreen;
@@ -1767,8 +1707,8 @@ ProcXpEndDoc(client)
XpPagePtr pPage = (XpPagePtr)LookupIDByType(
pContext->pageWin, RTpage);
- if(pContext->funcs.EndPage != (int (*)())NULL)
- result = pContext->funcs.EndPage(pContext, pWin, TRUE);
+ if(pContext->funcs.EndPage != 0)
+ result = pContext->funcs.EndPage(pContext, pWin);
else
return BadImplementation;
@@ -1783,7 +1723,7 @@ ProcXpEndDoc(client)
return result;
}
- if(pContext->funcs.EndDoc != (int (*)())NULL)
+ if(pContext->funcs.EndDoc != 0)
result = pContext->funcs.EndDoc(pContext, stuff->cancel);
else
return BadImplementation;
@@ -1800,9 +1740,9 @@ ProcXpEndDoc(client)
}
static Bool
-DoStartPage(client, c)
- ClientPtr client;
- XpStPagePtr c;
+DoStartPage(
+ ClientPtr client,
+ XpStPagePtr c)
{
XpScreenPtr pPrintScreen;
WindowPtr pWin = c->pWin;
@@ -1816,7 +1756,7 @@ DoStartPage(client, c)
if(!c->slept)
{
c->slept = TRUE;
- ClientSleep(client, DoStartPage, (pointer) c);
+ ClientSleep(client, (ClientSleepProcPtr)DoStartPage, (pointer) c);
c->pContext->clientSlept = client;
}
return TRUE;
@@ -1825,7 +1765,7 @@ DoStartPage(client, c)
if(!(pContext->state & DOC_COOKED_STARTED))
{
/* Implied StartDoc if it was omitted */
- if(pContext->funcs.StartDoc != (int (*)())NULL)
+ if(pContext->funcs.StartDoc != 0)
result = pContext->funcs.StartDoc(pContext, XPDocNormal);
else
{
@@ -1878,7 +1818,7 @@ DoStartPage(client, c)
pPrintScreen = XpScreens[pContext->screenNum];
- if(pContext->funcs.StartPage != (int (*)())NULL)
+ if(pContext->funcs.StartPage != 0)
result = pContext->funcs.StartPage(pContext, pWin);
else
{
@@ -1897,15 +1837,12 @@ DoStartPage(client, c)
}
static int
-ProcXpStartPage(client)
- ClientPtr client;
+ProcXpStartPage(ClientPtr client)
{
REQUEST(xPrintStartPageReq);
- XpScreenPtr pPrintScreen;
WindowPtr pWin;
int result = Success;
XpContextPtr pContext;
- XpPagePtr pPage;
XpStPagePtr c;
REQUEST_SIZE_MATCH(xPrintStartPageReq);
@@ -1944,8 +1881,7 @@ ProcXpStartPage(client)
}
static int
-ProcXpEndPage(client)
- ClientPtr client;
+ProcXpEndPage(ClientPtr client)
{
REQUEST(xPrintEndPageReq);
XpScreenPtr pPrintScreen;
@@ -1967,8 +1903,8 @@ ProcXpEndPage(client)
pWin = (WindowPtr )LookupIDByType(pContext->pageWin, RT_WINDOW);
/* Call the ddx's EndPage proc. */
- if(pContext->funcs.EndPage != (int (*)())NULL)
- result = pContext->funcs.EndPage(pContext, pWin, stuff->cancel);
+ if(pContext->funcs.EndPage != 0)
+ result = pContext->funcs.EndPage(pContext, pWin);
else
return BadImplementation;
@@ -1996,14 +1932,13 @@ ProcXpEndPage(client)
******************************************************************************/
static int
-ProcXpPutDocumentData(client)
- ClientPtr client;
+ProcXpPutDocumentData(ClientPtr client)
{
REQUEST(xPrintPutDocumentDataReq);
XpContextPtr pContext;
DrawablePtr pDraw;
int result = Success;
- int len, totalSize;
+ unsigned totalSize;
char *pData, *pDoc_fmt, *pOptions;
REQUEST_AT_LEAST_SIZE(xPrintPutDocumentDataReq);
@@ -2040,7 +1975,7 @@ ProcXpPutDocumentData(client)
if((totalSize + (sz_xPrintPutDocumentDataReq >> 2)) != client->req_len)
return BadLength;
- if(pContext->funcs.PutDocumentData != (int (*)())NULL)
+ if(pContext->funcs.PutDocumentData != 0)
{
result = (*pContext->funcs.PutDocumentData)(pContext, pDraw,
pData, stuff->len_data,
@@ -2058,12 +1993,10 @@ ProcXpPutDocumentData(client)
}
static int
-ProcXpGetDocumentData(client)
- ClientPtr client;
+ProcXpGetDocumentData(ClientPtr client)
{
REQUEST(xPrintGetDocumentDataReq);
xPrintGetDocumentDataReply rep;
- XpScreenPtr pPrintScreen;
XpContextPtr pContext;
int result = Success;
@@ -2079,7 +2012,7 @@ ProcXpGetDocumentData(client)
return XpErrorBase+XPBadContext;
}
- if(pContext->funcs.GetDocumentData == (int (*)())NULL)
+ if(pContext->funcs.GetDocumentData == 0)
return BadImplementation;
if(!(pContext->state & JOB_GET_DATA) ||
@@ -2132,8 +2065,7 @@ ProcXpGetDocumentData(client)
******************************************************************************/
static int
-ProcXpGetAttributes(client)
- ClientPtr client;
+ProcXpGetAttributes(ClientPtr client)
{
REQUEST(xPrintGetAttributesReq);
XpContextPtr pContext;
@@ -2163,7 +2095,7 @@ ProcXpGetAttributes(client)
return XpErrorBase+XPBadContext;
}
- if(pContext->funcs.GetAttributes == (char *(*)())NULL)
+ if(pContext->funcs.GetAttributes == 0)
return BadImplementation;
if((attrs = (*pContext->funcs.GetAttributes)(pContext, stuff->type)) ==
(char *)NULL)
@@ -2203,8 +2135,7 @@ ProcXpGetAttributes(client)
}
static int
-ProcXpSetAttributes(client)
- ClientPtr client;
+ProcXpSetAttributes(ClientPtr client)
{
REQUEST(xPrintSetAttributesReq);
int result = Success;
@@ -2236,7 +2167,7 @@ ProcXpSetAttributes(client)
return XpErrorBase+XPBadContext;
}
- if(pContext->funcs.SetAttributes == (int (*)())NULL)
+ if(pContext->funcs.SetAttributes == 0)
return BadImplementation;
/*
@@ -2275,14 +2206,14 @@ ProcXpSetAttributes(client)
}
static int
-ProcXpGetOneAttribute(client)
- ClientPtr client;
+ProcXpGetOneAttribute(ClientPtr client)
{
REQUEST(xPrintGetOneAttributeReq);
XpContextPtr pContext;
char *value, *attrName;
xPrintGetOneAttributeReply *pRep;
- int totalSize, n;
+ int totalSize;
+ int n;
unsigned long l;
REQUEST_AT_LEAST_SIZE(xPrintGetOneAttributeReq);
@@ -2316,7 +2247,7 @@ ProcXpGetOneAttribute(client)
return XpErrorBase+XPBadContext;
}
- if(pContext->funcs.GetOneAttribute == (char *(*)())NULL)
+ if(pContext->funcs.GetOneAttribute == 0)
return BadImplementation;
if((value = (*pContext->funcs.GetOneAttribute)(pContext, stuff->type,
attrName)) == (char *)NULL)
@@ -2364,8 +2295,7 @@ ProcXpGetOneAttribute(client)
static int
-ProcXpSelectInput(client)
- ClientPtr client;
+ProcXpSelectInput(ClientPtr client)
{
REQUEST(xPrintSelectInputReq);
int result = Success;
@@ -2403,14 +2333,12 @@ ProcXpSelectInput(client)
}
static int
-ProcXpInputSelected(client)
- ClientPtr client;
+ProcXpInputSelected(ClientPtr client)
{
REQUEST(xPrintInputSelectedReq);
xPrintInputSelectedReply rep;
register int n;
- long l, allMask;
- WindowPtr pWin;
+ long l;
XpClientPtr pXpClient;
XpContextPtr pContext;
@@ -2446,9 +2374,7 @@ ProcXpInputSelected(client)
}
static void
-SendAttributeNotify(pContext, which)
- XpContextPtr pContext;
- int which;
+SendAttributeNotify(XpContextPtr pContext, int which)
{
XpClientPtr pXpClient;
xPrintAttributeEvent ae;
@@ -2473,11 +2399,9 @@ SendAttributeNotify(pContext, which)
WriteEventsToClient (client, 1, (xEvent *) &ae);
}
}
+
static void
-SendXpNotify(pContext, which, val)
- XpContextPtr pContext;
- int which;
- int val;
+SendXpNotify(XpContextPtr pContext, int which, int val)
{
XpClientPtr pXpClient;
xPrintPrintEvent pe;
@@ -2505,8 +2429,7 @@ SendXpNotify(pContext, which, val)
}
static CARD32
-GetAllEventMasks(pContext)
- XpContextPtr pContext;
+GetAllEventMasks(XpContextPtr pContext)
{
XpClientPtr pPrintClient;
CARD32 totalMask = (CARD32)0;
@@ -2526,11 +2449,8 @@ GetAllEventMasks(pContext)
* does not currently have a context set.
*/
XpContextPtr
-XpContextOfClient(client)
- ClientPtr client;
+XpContextOfClient(ClientPtr client)
{
- XpContextPtr pContext;
-
return (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr;
}
@@ -2542,8 +2462,7 @@ XpContextOfClient(client)
******************************************************************************/
static int
-SProcXpCreateContext(client)
- ClientPtr client;
+SProcXpCreateContext(ClientPtr client)
{
int i;
long n;
@@ -2558,8 +2477,7 @@ SProcXpCreateContext(client)
}
static int
-SProcXpGetPrinterList(client)
- ClientPtr client;
+SProcXpGetPrinterList(ClientPtr client)
{
int i;
long n;
@@ -2573,11 +2491,9 @@ SProcXpGetPrinterList(client)
}
static int
-SProcXpRehashPrinterList(client)
- ClientPtr client;
+SProcXpRehashPrinterList(ClientPtr client)
{
int i;
- long n;
REQUEST(xPrintRehashPrinterListReq);
swaps(&stuff->length, i);
@@ -2585,11 +2501,9 @@ SProcXpRehashPrinterList(client)
}
static int
-SProcXpSetContext(client)
- ClientPtr client;
+SProcXpSetContext(ClientPtr client)
{
int i;
- long n;
REQUEST(xPrintSetContextReq);
swaps(&stuff->length, i);
@@ -2598,8 +2512,7 @@ SProcXpSetContext(client)
}
static int
-SProcXpGetContext(client)
- ClientPtr client;
+SProcXpGetContext(ClientPtr client)
{
int i;
@@ -2609,8 +2522,7 @@ SProcXpGetContext(client)
}
static int
-SProcXpDestroyContext(client)
- ClientPtr client;
+SProcXpDestroyContext(ClientPtr client)
{
int i;
long n;
@@ -2622,8 +2534,7 @@ SProcXpDestroyContext(client)
}
static int
-SProcXpGetContextScreen(client)
- ClientPtr client;
+SProcXpGetContextScreen(ClientPtr client)
{
int i;
long n;
@@ -2635,8 +2546,7 @@ SProcXpGetContextScreen(client)
}
static int
-SProcXpInputSelected(client)
- ClientPtr client;
+SProcXpInputSelected(ClientPtr client)
{
int i;
long n;
@@ -2648,8 +2558,7 @@ SProcXpInputSelected(client)
}
static int
-SProcXpStartJob(client)
- ClientPtr client;
+SProcXpStartJob(ClientPtr client)
{
int i;
@@ -2659,8 +2568,7 @@ SProcXpStartJob(client)
}
static int
-SProcXpEndJob(client)
- ClientPtr client;
+SProcXpEndJob(ClientPtr client)
{
int i;
@@ -2670,8 +2578,7 @@ SProcXpEndJob(client)
}
static int
-SProcXpStartDoc(client)
- ClientPtr client;
+SProcXpStartDoc(ClientPtr client)
{
int i;
@@ -2681,8 +2588,7 @@ SProcXpStartDoc(client)
}
static int
-SProcXpEndDoc(client)
- ClientPtr client;
+SProcXpEndDoc(ClientPtr client)
{
int i;
@@ -2692,8 +2598,7 @@ SProcXpEndDoc(client)
}
static int
-SProcXpStartPage(client)
- ClientPtr client;
+SProcXpStartPage(ClientPtr client)
{
int i;
long n;
@@ -2705,8 +2610,7 @@ SProcXpStartPage(client)
}
static int
-SProcXpEndPage(client)
- ClientPtr client;
+SProcXpEndPage(ClientPtr client)
{
int i;
@@ -2716,8 +2620,7 @@ SProcXpEndPage(client)
}
static int
-SProcXpPutDocumentData(client)
- ClientPtr client;
+SProcXpPutDocumentData(ClientPtr client)
{
long n;
int i;
@@ -2732,8 +2635,7 @@ SProcXpPutDocumentData(client)
}
static int
-SProcXpGetDocumentData(client)
- ClientPtr client;
+SProcXpGetDocumentData(ClientPtr client)
{
long n;
int i;
@@ -2746,8 +2648,7 @@ SProcXpGetDocumentData(client)
}
static int
-SProcXpGetAttributes(client)
- ClientPtr client;
+SProcXpGetAttributes(ClientPtr client)
{
long n;
int i;
@@ -2759,8 +2660,7 @@ SProcXpGetAttributes(client)
}
static int
-SProcXpSetAttributes(client)
- ClientPtr client;
+SProcXpSetAttributes(ClientPtr client)
{
long n;
int i;
@@ -2773,8 +2673,7 @@ SProcXpSetAttributes(client)
}
static int
-SProcXpGetOneAttribute(client)
- ClientPtr client;
+SProcXpGetOneAttribute(ClientPtr client)
{
long n;
int i;
@@ -2787,8 +2686,7 @@ SProcXpGetOneAttribute(client)
}
static int
-SProcXpSelectInput(client)
- ClientPtr client;
+SProcXpSelectInput(ClientPtr client)
{
long n;
int i;
@@ -2799,9 +2697,9 @@ SProcXpSelectInput(client)
swapl(&stuff->printContext, n);
return ProcXpSelectInput(client);
}
+
static int
-SProcXpGetPageDimensions(client)
- ClientPtr client;
+SProcXpGetPageDimensions(ClientPtr client)
{
long n;
int i;
@@ -2811,9 +2709,9 @@ SProcXpGetPageDimensions(client)
swapl(&stuff->printContext, n);
return ProcXpGetPageDimensions(client);
}
+
static int
-SProcXpSetImageResolution(client)
- ClientPtr client;
+SProcXpSetImageResolution(ClientPtr client)
{
long n;
int i;
@@ -2824,9 +2722,9 @@ SProcXpSetImageResolution(client)
swaps(&stuff->imageRes, i);
return ProcXpSetImageResolution(client);
}
+
static int
-SProcXpGetImageResolution(client)
- ClientPtr client;
+SProcXpGetImageResolution(ClientPtr client)
{
long n;
int i;
@@ -2838,8 +2736,7 @@ SProcXpGetImageResolution(client)
}
static void
-SwapXpNotifyEvent(src, dst)
- xPrintPrintEvent *src, *dst;
+SwapXpNotifyEvent(xPrintPrintEvent *src, xPrintPrintEvent *dst)
{
/*
* Swap the sequence number and context fields.
@@ -2856,8 +2753,7 @@ SwapXpNotifyEvent(src, dst)
}
static void
-SwapXpAttributeEvent(src, dst)
- xPrintAttributeEvent *src, *dst;
+SwapXpAttributeEvent(xPrintAttributeEvent *src, xPrintAttributeEvent *dst)
{
/*
* Swap the sequence number and context fields.
diff --git a/Xext/xtest.c b/Xext/xtest.c
index a07cf6186..47e7418d8 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/Xext/xtest.c,v 3.7 2001/12/14 19:58:51 dawes Exp $ */
#include "X.h"
#define NEED_EVENTS
@@ -37,6 +38,8 @@ from The Open Group.
#include "windowstr.h"
#include "inputstr.h"
#include "scrnintstr.h"
+#include "dixevents.h"
+#include "sleepuntil.h"
#define _XTEST_SERVER_
#include "XTest.h"
#include "xteststr.h"
@@ -44,27 +47,49 @@ from The Open Group.
#include "XI.h"
#include "XIproto.h"
#define EXTENSION_EVENT_BASE 64
+#include "extinit.h" /* LookupDeviceIntRec */
#endif /* XINPUT */
+#ifdef EXTMODULE
+#include "xf86_ansic.h"
+#endif
static unsigned char XTestReqCode;
-static int ProcXTestDispatch(), SProcXTestDispatch();
-static void XTestResetProc();
-static int XTestSwapFakeInput();
-CursorPtr GetSpriteCursor();
-WindowPtr GetCurrentRootWindow();
+
#ifdef XINPUT
extern int DeviceValuator;
-DeviceIntPtr LookupDeviceIntRec();
#endif /* XINPUT */
+static void XTestResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* extEntry */
+#endif
+);
+static int XTestSwapFakeInput(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */,
+ xReq * /* req */
+#endif
+);
+
+static DISPATCH_PROC(ProcXTestCompareCursor);
+static DISPATCH_PROC(ProcXTestDispatch);
+static DISPATCH_PROC(ProcXTestFakeInput);
+static DISPATCH_PROC(ProcXTestGetVersion);
+static DISPATCH_PROC(ProcXTestGrabControl);
+static DISPATCH_PROC(SProcXTestCompareCursor);
+static DISPATCH_PROC(SProcXTestDispatch);
+static DISPATCH_PROC(SProcXTestFakeInput);
+static DISPATCH_PROC(SProcXTestGetVersion);
+static DISPATCH_PROC(SProcXTestGrabControl);
+
void
XTestExtensionInit()
{
- ExtensionEntry *extEntry, *AddExtension();
+ ExtensionEntry *extEntry;
- if (extEntry = AddExtension(XTestExtensionName, 0, 0,
+ if ((extEntry = AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,
- XTestResetProc, StandardMinorOpcode))
+ XTestResetProc, StandardMinorOpcode)) != 0)
XTestReqCode = (unsigned char)extEntry->base;
}
@@ -79,7 +104,6 @@ static int
ProcXTestGetVersion(client)
register ClientPtr client;
{
- REQUEST(xXTestGetVersionReq);
xXTestGetVersionReply rep;
register int n;
@@ -142,12 +166,12 @@ ProcXTestFakeInput(client)
int nev;
int n;
xEvent *ev;
- DeviceIntPtr dev;
+ DeviceIntPtr dev = NULL;
WindowPtr root;
int type;
#ifdef XINPUT
Bool extension = FALSE;
- deviceValuator *dv;
+ deviceValuator *dv = NULL;
int base;
int *values;
#endif /* XINPUT */
@@ -468,7 +492,7 @@ XTestSwapFakeInput(client, req)
register int nev;
register xEvent *ev;
xEvent sev;
- void (*proc)(), NotImplemented();
+ EventSwapPtr proc;
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
for (ev = (xEvent *)&req[1]; --nev >= 0; ev++)
@@ -476,7 +500,7 @@ XTestSwapFakeInput(client, req)
/* Swap event */
proc = EventSwapVector[ev->u.u.type & 0177];
/* no swapping proc; invalid event type? */
- if (!proc || (int (*)()) proc == (int (*)()) NotImplemented) {
+ if (!proc || proc == NotImplemented) {
client->errorValue = ev->u.u.type;
return BadValue;
}
diff --git a/Xext/xtest1dd.c b/Xext/xtest1dd.c
index 38c977557..8a2b779be 100644
--- a/Xext/xtest1dd.c
+++ b/Xext/xtest1dd.c
@@ -52,6 +52,7 @@ Telephone and Telegraph Company or of the Regents of the
University of California.
*/
+/* $XFree86: xc/programs/Xserver/Xext/xtest1dd.c,v 3.5 2001/12/14 19:58:52 dawes Exp $ */
/***************************************************************
* include files
@@ -70,6 +71,8 @@ University of California.
#define XTestSERVER_SIDE
#include "xtestext1.h"
+#include "xtest1dd.h"
+
/***************************************************************
* defines
***************************************************************/
@@ -96,8 +99,6 @@ extern int XTestFakeAckType;
/*
* used in the WriteReplyToClient macro
*/
-extern void (* ReplySwapVector[256]) ();
-
extern int exclusive_steal;
/***************************************************************
@@ -286,24 +287,62 @@ KeyCode xtest_command_key = 0;
* function declarations
***************************************************************/
-void flush_input_actions();
-void XTestStealJumpData();
-void XTestGenerateEvent();
-void XTestGetPointerPos();
-void XTestJumpPointer();
-
-static void parse_key_fake();
-static void parse_motion_fake();
-static void parse_jump_fake();
-static void parse_delay_fake();
-static void send_ack();
-static void start_play_clock();
-static void compute_action_time();
-static int find_residual_time();
+static void parse_key_fake(
+#if NeedFunctionPrototypes
+ XTestKeyInfo * /* fkey */
+#endif
+ );
+static void parse_motion_fake(
+#if NeedFunctionPrototypes
+ XTestMotionInfo * /* fmotion */
+#endif
+ );
+static void parse_jump_fake(
+#if NeedFunctionPrototypes
+ XTestJumpInfo * /* fjump */
+#endif
+ );
+static void parse_delay_fake(
+#if NeedFunctionPrototypes
+ XTestDelayInfo * /* tevent */
+#endif
+ );
+static void send_ack(
+#if NeedFunctionPrototypes
+ ClientPtr /* client */
+#endif
+ );
+static void start_play_clock(
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
+static void compute_action_time(
+#if NeedFunctionPrototypes
+ struct timeval * /* rtime */
+#endif
+ );
+static int find_residual_time(
+#if NeedFunctionPrototypes
+ struct timeval * /* rtime */
+#endif
+ );
-static CARD16 check_time_event();
-static CARD32 current_ms();
-static int there_is_room();
+static CARD16 check_time_event(
+#if NeedFunctionPrototypes
+ void
+#endif
+ );
+static CARD32 current_ms(
+#if NeedFunctionPrototypes
+ struct timeval * /* otime */
+#endif
+ );
+static int there_is_room(
+#if NeedFunctionPrototypes
+ int /* actsize */
+#endif
+ );
/******************************************************************************
*
@@ -450,8 +489,8 @@ XTestStealJumpData(jx, jy, dev_type)
/*
* the x and y coordinates to jump to
*/
-short jx;
-short jy;
+int jx;
+int jy;
/*
* which device caused the jump
*/
@@ -527,7 +566,7 @@ current_ms(otime)
struct timeval *otime;
{
struct timeval tval;
- unsigned long ctime;
+ unsigned long the_ms;
unsigned long sec;
unsigned long usec;
@@ -556,8 +595,8 @@ struct timeval *otime;
* compute the number of milliseconds contained in
* 'sec' seconds and 'usec' microseconds
*/
- ctime = (sec * 1000000 + usec) / 1000;
- return (ctime);
+ the_ms = (sec * 1000000L + usec) / 1000L;
+ return (the_ms);
}
/******************************************************************************
@@ -673,8 +712,8 @@ XTestStealMotionData(dx, dy, dev_type, mx, my)
/*
* the x and y delta motion of the locator
*/
-short dx;
-short dy;
+int dx;
+int dy;
/*
* which locator did the moving
*/
@@ -682,8 +721,8 @@ int dev_type;
/*
* the x and y position of the locator before the delta motion
*/
-short mx;
-short my;
+int mx;
+int my;
{
/*
* pointer to a XTestMOTION_ACTION input action
@@ -791,20 +830,20 @@ XTestStealKeyData(keycode, keystate, dev_type, locx, locy)
/*
* which key/button moved
*/
-CARD8 keycode;
+unsigned keycode;
/*
* whether the key/button was pressed or released
*/
-char keystate;
+int keystate;
/*
* which device caused the input action
*/
-int dev_type;
+int dev_type;
/*
* the x and y coordinates of the locator when the action happenned
*/
-short locx;
-short locy;
+int locx;
+int locy;
{
/*
* pointer to key/button motion input action
@@ -814,7 +853,7 @@ short locy;
* time delta from previous event
*/
CARD16 tchar;
- char keytrans;
+ char keytrans = 0;
/*
* update the logical position of the locator if the physical position
@@ -1445,8 +1484,8 @@ struct timeval *rtime;
* the current time.
*/
static int
-find_residual_time(rtime)
-struct timeval *rtime;
+find_residual_time(the_residual)
+struct timeval *the_residual;
{
/*
* if > 0, there is time to wait. If < 0, then don't wait
@@ -1507,8 +1546,8 @@ struct timeval *rtime;
}
else
{
- rtime->tv_usec = pusec - busec;
- rtime->tv_sec = 0;
+ the_residual->tv_usec = pusec - busec;
+ the_residual->tv_sec = 0;
}
}
else
@@ -1519,14 +1558,14 @@ struct timeval *rtime;
* 'borrow' a second's worth of microseconds
* from the seconds left to wait
*/
- rtime->tv_usec = 1000000 - busec + pusec;
+ the_residual->tv_usec = 1000000 - busec + pusec;
psec--;
- rtime->tv_sec = psec - bsec;
+ the_residual->tv_sec = psec - bsec;
}
else
{
- rtime->tv_sec = psec - bsec;
- rtime->tv_usec = pusec - busec;
+ the_residual->tv_sec = psec - bsec;
+ the_residual->tv_usec = pusec - busec;
}
}
}
@@ -1540,8 +1579,8 @@ struct timeval *rtime;
/*
* set the time to wait to 0
*/
- rtime->tv_sec = 0;
- rtime->tv_usec = 0;
+ the_residual->tv_sec = 0;
+ the_residual->tv_usec = 0;
}
return(wait);
}
diff --git a/Xext/xtest1di.c b/Xext/xtest1di.c
index cd8f5e727..43c1d58d1 100644
--- a/Xext/xtest1di.c
+++ b/Xext/xtest1di.c
@@ -52,6 +52,7 @@ Telephone and Telegraph Company or of the Regents of the
University of California.
*/
+/* $XFree86: xc/programs/Xserver/Xext/xtest1di.c,v 3.3 2001/12/14 19:58:52 dawes Exp $ */
/*****************************************************************************
* include files
@@ -72,6 +73,8 @@ University of California.
#define XTestSERVER_SIDE
#include "xtestext1.h"
+#include "xtest1dd.h"
+
/*****************************************************************************
* defines
****************************************************************************/
@@ -81,10 +84,6 @@ University of California.
****************************************************************************/
/*
- * holds the addresses of the routines that handle byte-swapping of replys
- */
-extern void (* ReplySwapVector[256]) ();
-/*
* id of client using XTestGetInput
*
* defined in xtest1dd.c
@@ -137,31 +136,44 @@ static XID current_client_id;
* function declarations
****************************************************************************/
-static int ProcXTestDispatch();
-static int SProcXTestDispatch();
-static void XTestResetProc();
-static int ProcTestFakeInput();
-static int SProcTestFakeInput();
-static int ProcTestGetInput();
-static int SProcTestGetInput();
-static int ProcTestStopInput();
-static int SProcTestStopInput();
-static int ProcTestReset();
-static int SProcTestReset();
-static int ProcTestQueryInputSize();
-static int SProcTestQueryInputSize();
-static void SReplyXTestDispatch();
-static void SEventXTestDispatch();
-void NotImplemented();
-
-void abort_play_back();
-void return_input_array_size();
-void steal_input();
-void stop_stealing_input();
-void flush_input_actions();
-void parse_fake_input();
-
-static int XTestCurrentClientGone();
+static DISPATCH_PROC(ProcXTestDispatch);
+static DISPATCH_PROC(SProcXTestDispatch);
+static DISPATCH_PROC(ProcTestFakeInput);
+static DISPATCH_PROC(SProcTestFakeInput);
+static DISPATCH_PROC(ProcTestGetInput);
+static DISPATCH_PROC(SProcTestGetInput);
+static DISPATCH_PROC(ProcTestStopInput);
+static DISPATCH_PROC(SProcTestStopInput);
+static DISPATCH_PROC(ProcTestReset);
+static DISPATCH_PROC(SProcTestReset);
+static DISPATCH_PROC(ProcTestQueryInputSize);
+static DISPATCH_PROC(SProcTestQueryInputSize);
+
+static void XTestResetProc(
+#if NeedFunctionPrototypes
+ ExtensionEntry * /* unused */
+#endif
+ );
+static void SReplyXTestDispatch(
+#if NeedFunctionPrototypes
+ ClientPtr /* client_ptr */,
+ int /* size */,
+ char * /* reply_ptr */
+#endif
+ );
+static void SEventXTestDispatch(
+#if NeedFunctionPrototypes
+ xEvent * /* from */,
+ xEvent * /* to */
+#endif
+ );
+
+static int XTestCurrentClientGone(
+#if NeedFunctionPrototypes
+ pointer /* value */,
+ XID /* id */
+#endif
+ );
/*****************************************************************************
*
@@ -180,10 +192,6 @@ XTestExtension1Init()
* holds the pointer to the extension entry structure
*/
ExtensionEntry *extEntry;
- /*
- * This routine adds the extension to the server extension table.
- */
- ExtensionEntry *AddExtension();
extEntry = AddExtension(XTestEXTENSION_NAME,
XTestEVENT_COUNT,
@@ -213,7 +221,7 @@ XTestExtension1Init()
* install the routine to handle byte-swapping the replies
* for this extension in the ReplySwapVector table
*/
- ReplySwapVector[XTestReqCode] = SReplyXTestDispatch;
+ ReplySwapVector[XTestReqCode] = (ReplySwapPtr) SReplyXTestDispatch;
/*
* install the routine to handle byte-swapping the events
* for this extension in the EventSwapVector table
@@ -647,7 +655,6 @@ static int
ProcTestStopInput(client)
register ClientPtr client;
{
- REQUEST(xTestStopInputReq);
REQUEST_SIZE_MATCH(xTestStopInputReq);
if (on_steal_input && (current_xtest_client == client))
{
@@ -686,7 +693,6 @@ static int
ProcTestReset(client)
register ClientPtr client;
{
- REQUEST(xTestResetReq);
REQUEST_SIZE_MATCH(xTestResetReq);
on_steal_input = FALSE;
exclusive_steal = FALSE;
@@ -711,7 +717,6 @@ static int
ProcTestQueryInputSize(client)
register ClientPtr client;
{
- REQUEST(xTestQueryInputSizeReq);
REQUEST_SIZE_MATCH(xTestQueryInputSizeReq);
/*
* defined in xtest1dd.c
@@ -728,14 +733,16 @@ ProcTestQueryInputSize(client)
* connected to it. It must put eveything back the way it was before
* this extension was installed.
*/
+/*ARGSUSED*/
static void
-XTestResetProc()
+XTestResetProc(unused)
+ ExtensionEntry * unused;
{
/*
* remove the routine to handle byte-swapping the replies
* for this extension in the ReplySwapVector table
*/
- ReplySwapVector[XTestReqCode] = NotImplemented;
+ ReplySwapVector[XTestReqCode] = ReplyNotSwappd;
/*
* remove the routine to handle byte-swapping the events
* for this extension in the EventSwapVector table
@@ -755,7 +762,7 @@ XTestResetProc()
/*****************************************************************************
*
- * ProcTestQueryInputSize
+ * PXTestCurrentClientGone
*
* This routine is called when a client that has asked for input actions
* to be sent to it "goes away". This routine must clean up the
diff --git a/Xi/allowev.c b/Xi/allowev.c
index db98d8c93..2eb463d41 100644
--- a/Xi/allowev.c
+++ b/Xi/allowev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/allowev.c,v 3.4 2001/12/14 19:58:54 dawes Exp $ */
/***********************************************************************
*
@@ -60,10 +61,12 @@ SOFTWARE.
#include "XI.h"
#include "XIproto.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "allowev.h"
+#include "dixevents.h"
/***********************************************************************
*
@@ -96,7 +99,6 @@ ProcXAllowDeviceEvents(client)
{
TimeStamp time;
DeviceIntPtr thisdev;
- void AllowSome ();
REQUEST(xAllowDeviceEventsReq);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c
index e5dab66c1..f5988d76b 100644
--- a/Xi/chgdctl.c
+++ b/Xi/chgdctl.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgdctl.c,v 3.4 2001/12/14 19:58:54 dawes Exp $ */
/********************************************************************
*
@@ -59,11 +60,13 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h" /* control constants */
+#include "XIstubs.h"
-extern int IReqCode;
-extern int BadDevice, DeviceBusy;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "chgdctl.h"
/***********************************************************************
*
@@ -91,10 +94,12 @@ SProcXChangeDeviceControl(client)
*
*/
+int
ProcXChangeDeviceControl(client)
ClientPtr client;
{
- int i, len, status;
+ unsigned len;
+ int i, status;
DeviceIntPtr dev;
xDeviceResolutionCtl *r;
xChangeDeviceControlReply rep;
@@ -150,7 +155,7 @@ ProcXChangeDeviceControl(client)
BadValue);
return Success;
}
- status = ChangeDeviceControl(client, dev, r);
+ status = ChangeDeviceControl(client, dev, (xDeviceCtl*) r);
if (status == Success)
{
a = &dev->valuator->axes[r->first_valuator];
@@ -195,6 +200,7 @@ ProcXChangeDeviceControl(client)
*
*/
+void
SRepXChangeDeviceControl (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c
index 0b945de23..213fc7bf5 100644
--- a/Xi/chgfctl.c
+++ b/Xi/chgfctl.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgfctl.c,v 3.4 2001/12/14 19:58:54 dawes Exp $ */
/********************************************************************
*
@@ -60,11 +61,13 @@ SOFTWARE.
#include "XI.h"
#include "XIproto.h" /* control constants */
-#define DO_ALL (-1)
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "chgfctl.h"
-extern int IReqCode;
-extern int BadDevice;
-DeviceIntPtr LookupDeviceIntRec();
+#define DO_ALL (-1)
/***********************************************************************
*
@@ -92,10 +95,11 @@ SProcXChangeFeedbackControl(client)
*
*/
+int
ProcXChangeFeedbackControl(client)
ClientPtr client;
{
- int len;
+ unsigned len;
DeviceIntPtr dev;
KbdFeedbackPtr k;
PtrFeedbackPtr p;
@@ -128,7 +132,7 @@ ProcXChangeFeedbackControl(client)
for (k=dev->kbdfeed; k; k=k->next)
if (k->ctrl.id == ((xKbdFeedbackCtl *) &stuff[1])->id)
{
- ChangeKbdFeedback (client, dev, stuff->mask, k, &stuff[1]);
+ ChangeKbdFeedback (client, dev, stuff->mask, k, (xKbdFeedbackCtl *)&stuff[1]);
return Success;
}
break;
@@ -142,7 +146,7 @@ ProcXChangeFeedbackControl(client)
for (p=dev->ptrfeed; p; p=p->next)
if (p->ctrl.id == ((xPtrFeedbackCtl *) &stuff[1])->id)
{
- ChangePtrFeedback (client, dev, stuff->mask, p, &stuff[1]);
+ ChangePtrFeedback (client, dev, stuff->mask, p, (xPtrFeedbackCtl *)&stuff[1]);
return Success;
}
break;
@@ -163,7 +167,7 @@ ProcXChangeFeedbackControl(client)
for (s=dev->stringfeed; s; s=s->next)
if (s->ctrl.id == ((xStringFeedbackCtl *) &stuff[1])->id)
{
- ChangeStringFeedback (client, dev, stuff->mask,s,&stuff[1]);
+ ChangeStringFeedback (client, dev, stuff->mask,s,(xStringFeedbackCtl *)&stuff[1]);
return Success;
}
break;
@@ -178,7 +182,7 @@ ProcXChangeFeedbackControl(client)
for (i=dev->intfeed; i; i=i->next)
if (i->ctrl.id == ((xIntegerFeedbackCtl *) &stuff[1])->id)
{
- ChangeIntegerFeedback (client, dev,stuff->mask,i,&stuff[1]);
+ ChangeIntegerFeedback (client, dev,stuff->mask,i,(xIntegerFeedbackCtl *)&stuff[1]);
return Success;
}
break;
@@ -192,7 +196,7 @@ ProcXChangeFeedbackControl(client)
for (l=dev->leds; l; l=l->next)
if (l->ctrl.id == ((xLedFeedbackCtl *) &stuff[1])->id)
{
- ChangeLedFeedback (client, dev, stuff->mask, l, &stuff[1]);
+ ChangeLedFeedback (client, dev, stuff->mask, l, (xLedFeedbackCtl *)&stuff[1]);
return Success;
}
break;
@@ -206,7 +210,7 @@ ProcXChangeFeedbackControl(client)
for (b=dev->bell; b; b=b->next)
if (b->ctrl.id == ((xBellFeedbackCtl *) &stuff[1])->id)
{
- ChangeBellFeedback (client, dev, stuff->mask, b, &stuff[1]);
+ ChangeBellFeedback (client, dev, stuff->mask, b, (xBellFeedbackCtl *)&stuff[1]);
return Success;
}
break;
@@ -224,6 +228,7 @@ ProcXChangeFeedbackControl(client)
*
*/
+int
ChangeKbdFeedback (client, dev, mask, k, f)
ClientPtr client;
DeviceIntPtr dev;
@@ -332,7 +337,7 @@ ChangeKbdFeedback (client, dev, mask, k, f)
if (mask & DvAutoRepeatMode)
{
- int index = (key >> 3);
+ int inx = (key >> 3);
int kmask = (1 << (key & 7));
t = (CARD8) f->auto_repeat_mode;
if (t == AutoRepeatModeOff)
@@ -340,24 +345,24 @@ ChangeKbdFeedback (client, dev, mask, k, f)
if (key == DO_ALL)
kctrl.autoRepeat = FALSE;
else
- kctrl.autoRepeats[index] &= ~kmask;
+ kctrl.autoRepeats[inx] &= ~kmask;
}
else if (t == AutoRepeatModeOn)
{
if (key == DO_ALL)
kctrl.autoRepeat = TRUE;
else
- kctrl.autoRepeats[index] |= kmask;
+ kctrl.autoRepeats[inx] |= kmask;
}
else if (t == AutoRepeatModeDefault)
{
if (key == DO_ALL)
kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
else
- kctrl.autoRepeats[index] &= ~kmask;
- kctrl.autoRepeats[index] =
- (kctrl.autoRepeats[index] & ~kmask) |
- (defaultKeyboardControl.autoRepeats[index] & kmask);
+ kctrl.autoRepeats[inx] &= ~kmask;
+ kctrl.autoRepeats[inx] =
+ (kctrl.autoRepeats[inx] & ~kmask) |
+ (defaultKeyboardControl.autoRepeats[inx] & kmask);
}
else
{
@@ -379,6 +384,7 @@ ChangeKbdFeedback (client, dev, mask, k, f)
*
*/
+int
ChangePtrFeedback (client, dev, mask, p, f)
ClientPtr client;
DeviceIntPtr dev;
@@ -460,6 +466,7 @@ ChangePtrFeedback (client, dev, mask, p, f)
*
*/
+int
ChangeIntegerFeedback (client, dev, mask, i, f)
ClientPtr client;
DeviceIntPtr dev;
@@ -486,6 +493,7 @@ ChangeIntegerFeedback (client, dev, mask, i, f)
*
*/
+int
ChangeStringFeedback (client, dev, mask, s, f)
ClientPtr client;
DeviceIntPtr dev;
@@ -495,7 +503,7 @@ ChangeStringFeedback (client, dev, mask, s, f)
{
register char n;
register long *p;
- int i, j, len;
+ int i, j;
KeySym *syms, *sup_syms;
syms = (KeySym *) (f+1);
@@ -543,6 +551,7 @@ ChangeStringFeedback (client, dev, mask, s, f)
*
*/
+int
ChangeBellFeedback (client, dev, mask, b, f)
ClientPtr client;
DeviceIntPtr dev;
@@ -617,6 +626,7 @@ ChangeBellFeedback (client, dev, mask, b, f)
*
*/
+int
ChangeLedFeedback (client, dev, mask, l, f)
ClientPtr client;
DeviceIntPtr dev;
diff --git a/Xi/chgkbd.c b/Xi/chgkbd.c
index f48b4682b..b0b82ee6d 100644
--- a/Xi/chgkbd.c
+++ b/Xi/chgkbd.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgkbd.c,v 3.6 2001/12/14 19:58:54 dawes Exp $ */
/***********************************************************************
*
@@ -59,14 +60,16 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "XIstubs.h"
+#include "globals.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
-extern int IReqCode;
-extern int BadDevice;
-extern int ChangeDeviceNotify;
-extern Mask ChangeDeviceNotifyMask;
-extern InputInfo inputInfo;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "chgkbd.h"
+#include "chgptr.h"
/***********************************************************************
*
@@ -93,6 +96,7 @@ SProcXChangeKeyboardDevice(client)
*
*/
+int
ProcXChangeKeyboardDevice (client)
register ClientPtr client;
{
@@ -104,7 +108,6 @@ ProcXChangeKeyboardDevice (client)
KeyClassPtr k;
xChangeKeyboardDeviceReply rep;
changeDeviceNotify ev;
- extern Bool Must_have_memory;
REQUEST(xChangeKeyboardDeviceReq);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
@@ -169,14 +172,14 @@ ProcXChangeKeyboardDevice (client)
for (i=0; i<df->traceSize; i++)
df->trace[i] = xf->trace[i];
RegisterOtherDevice (xkbd);
- RegisterKeyboardDevice ((DevicePtr)dev);
+ RegisterKeyboardDevice (dev);
ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds;
ev.request = NewKeyboard;
- SendEventToAllWindows (dev, ChangeDeviceNotifyMask, &ev, 1);
+ SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1);
SendMappingNotify (MappingKeyboard, k->curKeySyms.minKeyCode,
k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1,client);
@@ -195,6 +198,7 @@ ProcXChangeKeyboardDevice (client)
*
*/
+void
SRepXChangeKeyboardDevice (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/chgkmap.c b/Xi/chgkmap.c
index 3e70f2dcf..2b638252f 100644
--- a/Xi/chgkmap.c
+++ b/Xi/chgkmap.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgkmap.c,v 3.3 2001/12/14 19:58:55 dawes Exp $ */
/********************************************************************
*
@@ -59,11 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern int DeviceMappingNotify;
-DeviceIntPtr LookupDeviceIntRec();
+#include "chgkmap.h"
/***********************************************************************
*
@@ -99,6 +101,7 @@ SProcXChangeDeviceKeyMapping(client)
*
*/
+int
ProcXChangeDeviceKeyMapping(client)
register ClientPtr client;
{
@@ -120,7 +123,7 @@ ProcXChangeDeviceKeyMapping(client)
ret = ChangeKeyMapping (client, dev, len, DeviceMappingNotify,
stuff->firstKeyCode, stuff->keyCodes, stuff->keySymsPerKeyCode,
- &stuff[1]);
+ (KeySym *)&stuff[1]);
if (ret != Success)
SendErrorToClient (client, IReqCode, X_ChangeDeviceKeyMapping, 0,
diff --git a/Xi/chgprop.c b/Xi/chgprop.c
index 769bcbbb9..96ce0bebe 100644
--- a/Xi/chgprop.c
+++ b/Xi/chgprop.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgprop.c,v 3.3 2001/12/14 19:58:55 dawes Exp $ */
/***********************************************************************
*
@@ -60,11 +61,14 @@ SOFTWARE.
#include "windowstr.h"
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
-extern int BadMode;
-extern int BadClass;
-extern int IReqCode;
-DeviceIntPtr LookupDeviceIntRec();
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "chgprop.h"
+#include "grabdev.h"
/***********************************************************************
*
@@ -100,6 +104,7 @@ SProcXChangeDeviceDontPropagateList(client)
*
*/
+int
ProcXChangeDeviceDontPropagateList (client)
register ClientPtr client;
{
diff --git a/Xi/chgptr.c b/Xi/chgptr.c
index 8c65c6ec2..c6ece1d65 100644
--- a/Xi/chgptr.c
+++ b/Xi/chgptr.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/chgptr.c,v 3.7 2001/12/14 19:58:55 dawes Exp $ */
/***********************************************************************
*
@@ -56,21 +57,21 @@ SOFTWARE.
#define NEED_REPLIES
#include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
-#include "inputstr.h" /* DeviceIntPtr */
+#include "XIstubs.h"
#include "windowstr.h" /* window structure */
#include "scrnintstr.h" /* screen structure */
-extern int IReqCode;
-extern int BadDevice;
-extern int ChangeDeviceNotify;
-extern Mask ChangeDeviceNotifyMask;
-extern InputInfo inputInfo;
-extern ScreenInfo screenInfo;
-extern WindowPtr *WindowTable;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+
+#include "dixevents.h"
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "chgptr.h"
/***********************************************************************
*
@@ -97,6 +98,7 @@ SProcXChangePointerDevice(client)
*
*/
+int
ProcXChangePointerDevice (client)
register ClientPtr client;
{
@@ -157,14 +159,14 @@ ProcXChangePointerDevice (client)
if (!dev->ptrfeed)
InitPtrFeedbackClassDeviceStruct(dev, (PtrCtrlProcPtr)NoopDDA);
RegisterOtherDevice (xptr);
- RegisterPointerDevice ((DevicePtr)dev);
+ RegisterPointerDevice (dev);
ev.type = ChangeDeviceNotify;
ev.deviceid = stuff->deviceid;
ev.time = currentTime.milliseconds;
ev.request = NewPointer;
- SendEventToAllWindows (dev, ChangeDeviceNotifyMask, &ev, 1);
+ SendEventToAllWindows (dev, ChangeDeviceNotifyMask, (xEvent *)&ev, 1);
SendMappingNotify (MappingPointer, 0, 0, client);
rep.status = 0;
@@ -175,6 +177,7 @@ ProcXChangePointerDevice (client)
return Success;
}
+void
DeleteFocusClassDeviceStruct(dev)
DeviceIntPtr dev;
{
@@ -189,6 +192,7 @@ DeleteFocusClassDeviceStruct(dev)
*
*/
+void
SendEventToAllWindows (dev, mask, ev, count)
DeviceIntPtr dev;
Mask mask;
@@ -214,6 +218,7 @@ SendEventToAllWindows (dev, mask, ev, count)
*
*/
+void
FindInterestedChildren (dev, p1, mask, ev, count)
DeviceIntPtr dev;
WindowPtr p1;
@@ -239,6 +244,7 @@ FindInterestedChildren (dev, p1, mask, ev, count)
*
*/
+void
SRepXChangePointerDevice (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/closedev.c b/Xi/closedev.c
index 66fb185cb..1f7e7dbd2 100644
--- a/Xi/closedev.c
+++ b/Xi/closedev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/closedev.c,v 3.4 2001/12/14 19:58:55 dawes Exp $ */
/***********************************************************************
*
@@ -61,13 +62,12 @@ SOFTWARE.
#include "scrnintstr.h" /* screen structure */
#include "XI.h"
#include "XIproto.h"
+#include "XIstubs.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern ScreenInfo screenInfo;
-extern WindowPtr *WindowTable;
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "closedev.h"
/***********************************************************************
*
@@ -137,6 +137,7 @@ ProcXCloseDevice(client)
*
*/
+void
DeleteEventsFromChildren(dev, p1, client)
DeviceIntPtr dev;
WindowPtr p1;
@@ -160,6 +161,7 @@ DeleteEventsFromChildren(dev, p1, client)
*
*/
+void
DeleteDeviceEvents (dev, pWin, client)
DeviceIntPtr dev;
WindowPtr pWin;
@@ -169,7 +171,7 @@ DeleteDeviceEvents (dev, pWin, client)
OtherInputMasks *pOthers;
GrabPtr grab, next;
- if (pOthers=wOtherInputMasks(pWin))
+ if ((pOthers = wOtherInputMasks(pWin)) != 0)
for (others=pOthers->inputClients; others;
others = others->next)
if (SameClient(others,client))
diff --git a/Xi/devbell.c b/Xi/devbell.c
index 60e58e147..98520ec1c 100644
--- a/Xi/devbell.c
+++ b/Xi/devbell.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/devbell.c,v 3.3 2001/12/14 19:58:55 dawes Exp $ */
/***********************************************************************
*
@@ -59,11 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "devbell.h"
/***********************************************************************
*
@@ -89,6 +90,7 @@ SProcXDeviceBell(client)
*
*/
+int
ProcXDeviceBell (client)
register ClientPtr client;
{
@@ -99,7 +101,7 @@ ProcXDeviceBell (client)
int newpercent;
CARD8 class;
pointer ctrl;
- void (*proc)();
+ BellProcPtr proc;
REQUEST(xDeviceBellReq);
REQUEST_SIZE_MATCH(xDeviceBellReq);
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 7131b3c7a..76a693e6c 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -44,6 +44,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/exevents.c,v 3.10 2001/12/14 19:58:55 dawes Exp $ */
/********************************************************************
*
@@ -62,6 +63,14 @@ SOFTWARE.
#include "windowstr.h"
#include "miscstruct.h"
#include "region.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "dixevents.h" /* DeliverFocusedEvent */
+#include "dixgrabs.h" /* CreateGrab() */
+
+#include "chgptr.h"
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
#define AllModifiersMask ( \
@@ -72,24 +81,17 @@ SOFTWARE.
#define Motion_Filter(class) (DevicePointerMotionMask | \
(class)->state | (class)->motionMask)
-void ActivateKeyboardGrab();
-void DeactivateKeyboardGrab();
-void ProcessOtherEvent();
-void RecalculateDeviceDeliverableEvents();
-static Bool ShouldFreeInputMasks();
-static Bool MakeInputMasks ();
-extern int DeviceKeyPress;
-extern int DeviceButtonPress;
-extern int DeviceValuator;
-extern Mask DevicePointerMotionMask;
-extern Mask DeviceMappingNotifyMask;
-extern Mask DeviceButtonMotionMask;
-extern Mask DeviceButtonGrabMask;
-extern Mask DeviceOwnerGrabButtonMask;
-extern Mask PropagateMask[];
-extern WindowPtr GetSpriteWindow();
-extern InputInfo inputInfo;
-extern int RT_INPUTCLIENT;
+static Bool ShouldFreeInputMasks(
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */,
+ Bool /* ignoreSelectedEvents */
+#endif
+ );
+static Bool MakeInputMasks (
+#if NeedFunctionPrototypes
+ WindowPtr /* pWin */
+#endif
+ );
/**************************************************************************
*
@@ -99,47 +101,40 @@ extern int RT_INPUTCLIENT;
void
RegisterOtherDevice (device)
- DevicePtr device;
+ DeviceIntPtr device;
{
- device->processInputProc = ProcessOtherEvent;
- device->realInputProc = ProcessOtherEvent;
- ((DeviceIntPtr)device)->ActivateGrab = ActivateKeyboardGrab;
- ((DeviceIntPtr)device)->DeactivateGrab = DeactivateKeyboardGrab;
+ device->public.processInputProc = ProcessOtherEvent;
+ device->public.realInputProc = ProcessOtherEvent;
+ (device)->ActivateGrab = ActivateKeyboardGrab;
+ (device)->DeactivateGrab = DeactivateKeyboardGrab;
}
-extern int DeviceMotionNotify;
-
/*ARGSUSED*/
void
ProcessOtherEvent (xE, other, count)
- deviceKeyButtonPointer *xE;
+ xEventPtr xE;
register DeviceIntPtr other;
int count;
{
- extern int DeviceKeyRelease;
- extern int DeviceButtonRelease;
- extern int ProximityIn;
- extern int ProximityOut;
register BYTE *kptr;
register int i;
register CARD16 modifiers;
register CARD16 mask;
GrabPtr grab = other->grab;
Bool deactivateDeviceGrab = FALSE;
- int key, bit, rootX, rootY;
+ int key = 0, bit = 0, rootX, rootY;
ButtonClassPtr b = other->button;
KeyClassPtr k = other->key;
ValuatorClassPtr v = other->valuator;
- void NoticeEventTime();
deviceValuator *xV = (deviceValuator *) xE;
- if (xE->type != DeviceValuator) {
+ if (xE->u.u.type != DeviceValuator) {
GetSpritePosition(&rootX, &rootY);
- xE->root_x = rootX;
- xE->root_y = rootY;
- key = xE->detail;
+ xE->u.keyButtonPointer.rootX = rootX;
+ xE->u.keyButtonPointer.rootY = rootY;
+ key = xE->u.u.detail;
NoticeEventTime(xE);
- xE->state = inputInfo.keyboard->key->state |
+ xE->u.keyButtonPointer.state = inputInfo.keyboard->key->state |
inputInfo.pointer->button->state;
bit = 1 << (key & 7);
}
@@ -186,7 +181,7 @@ ProcessOtherEvent (xE, other, count)
}
}
- if (xE->type == DeviceKeyPress)
+ if (xE->u.u.type == DeviceKeyPress)
{
modifiers = k->modifierMap[key];
kptr = &k->down[key >> 3];
@@ -194,9 +189,9 @@ ProcessOtherEvent (xE, other, count)
{
if (!modifiers)
{
- xE->type = DeviceKeyRelease;
+ xE->u.u.type = DeviceKeyRelease;
ProcessOtherEvent(xE, other, count);
- xE->type = DeviceKeyPress;
+ xE->u.u.type = DeviceKeyPress;
/* release can have side effects, don't fall through */
ProcessOtherEvent(xE, other, count);
}
@@ -222,7 +217,7 @@ ProcessOtherEvent (xE, other, count)
return;
}
}
- else if (xE->type == DeviceKeyRelease)
+ else if (xE->u.u.type == DeviceKeyRelease)
{
kptr = &k->down[key >> 3];
if (!(*kptr & bit)) /* guard against duplicates */
@@ -249,7 +244,7 @@ ProcessOtherEvent (xE, other, count)
if (other->fromPassiveGrab && (key == other->activatingKey))
deactivateDeviceGrab = TRUE;
}
- else if (xE->type == DeviceButtonPress)
+ else if (xE->u.u.type == DeviceButtonPress)
{
kptr = &b->down[key >> 3];
*kptr |= bit;
@@ -257,18 +252,18 @@ ProcessOtherEvent (xE, other, count)
other->valuator->motionHintWindow = NullWindow;
b->buttonsDown++;
b->motionMask = DeviceButtonMotionMask;
- xE->detail = b->map[key];
- if (xE->detail == 0)
+ xE->u.u.detail = b->map[key];
+ if (xE->u.u.detail == 0)
return;
- if (xE->detail <= 5)
- b->state |= (Button1Mask >> 1) << xE->detail;
+ if (xE->u.u.detail <= 5)
+ b->state |= (Button1Mask >> 1) << xE->u.u.detail;
SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify);
if (!grab)
if (CheckDeviceGrabs(other, xE, 0, count))
return;
}
- else if (xE->type == DeviceButtonRelease)
+ else if (xE->u.u.type == DeviceButtonRelease)
{
kptr = &b->down[key >> 3];
*kptr &= ~bit;
@@ -276,18 +271,18 @@ ProcessOtherEvent (xE, other, count)
other->valuator->motionHintWindow = NullWindow;
if (!--b->buttonsDown)
b->motionMask = 0;
- xE->detail = b->map[key];
- if (xE->detail == 0)
+ xE->u.u.detail = b->map[key];
+ if (xE->u.u.detail == 0)
return;
- if (xE->detail <= 5)
- b->state &= ~((Button1Mask >> 1) << xE->detail);
+ if (xE->u.u.detail <= 5)
+ b->state &= ~((Button1Mask >> 1) << xE->u.u.detail);
SetMaskForEvent(Motion_Filter(b),DeviceMotionNotify);
if (!b->state && other->fromPassiveGrab)
deactivateDeviceGrab = TRUE;
}
- else if (xE->type == ProximityIn)
+ else if (xE->u.u.type == ProximityIn)
other->valuator->mode &= ~OutOfProximity;
- else if (xE->type == ProximityOut)
+ else if (xE->u.u.type == ProximityOut)
other->valuator->mode |= OutOfProximity;
if (grab)
@@ -302,9 +297,9 @@ ProcessOtherEvent (xE, other, count)
(*other->DeactivateGrab)(other);
}
-InitProximityClassDeviceStruct(dev)
- DeviceIntPtr dev;
- {
+int
+InitProximityClassDeviceStruct( DeviceIntPtr dev)
+{
register ProximityClassPtr proxc;
proxc = (ProximityClassPtr)xalloc(sizeof(ProximityClassRec));
@@ -312,15 +307,17 @@ InitProximityClassDeviceStruct(dev)
return FALSE;
dev->proximity = proxc;
return TRUE;
- }
+}
-InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res, max_res)
- DeviceIntPtr dev;
- int axnum;
- int minval;
- int maxval;
- int resolution;
- {
+void
+InitValuatorAxisStruct( DeviceIntPtr dev,
+ int axnum,
+ int minval,
+ int maxval,
+ int resolution,
+ int min_res,
+ int max_res )
+{
register AxisInfoPtr ax = dev->valuator->axes + axnum;
ax->min_value = minval;
@@ -328,18 +325,27 @@ InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution, min_res, max_res)
ax->resolution = resolution;
ax->min_resolution = min_res;
ax->max_resolution = max_res;
- }
+}
-static void FixDeviceStateNotify (dev, ev, k, b, v, first)
+static void
+#if NeedFunctionPrototypes
+FixDeviceStateNotify (
+ DeviceIntPtr dev,
+ deviceStateNotify *ev,
+ KeyClassPtr k,
+ ButtonClassPtr b,
+ ValuatorClassPtr v,
+ int first)
+#else
+FixDeviceStateNotify (dev, ev, k, b, v, first)
DeviceIntPtr dev;
deviceStateNotify *ev;
KeyClassPtr k;
ButtonClassPtr b;
ValuatorClassPtr v;
int first;
- {
- extern int DeviceStateNotify;
-
+#endif
+{
ev->type = DeviceStateNotify;
ev->deviceid = dev->id;
ev->time = currentTime.milliseconds;
@@ -376,12 +382,21 @@ static void FixDeviceStateNotify (dev, ev, k, b, v, first)
}
}
-static void FixDeviceValuator (dev, ev, v, first)
+static void
+#if NeedFunctionPrototypes
+FixDeviceValuator (
+ DeviceIntPtr dev,
+ deviceValuator *ev,
+ ValuatorClassPtr v,
+ int first)
+#else
+FixDeviceValuator (dev, ev, v, first)
DeviceIntPtr dev;
deviceValuator *ev;
ValuatorClassPtr v;
int first;
- {
+#endif
+{
int nval = v->numAxes - first;
ev->type = DeviceValuator;
@@ -400,18 +415,12 @@ static void FixDeviceValuator (dev, ev, v, first)
first += ev->num_valuators;
}
+void
DeviceFocusEvent(dev, type, mode, detail, pWin)
DeviceIntPtr dev;
int type, mode, detail;
register WindowPtr pWin;
{
- extern int DeviceFocusIn;
- extern int DeviceFocusOut;
- extern int DeviceKeyStateNotify;
- extern int DeviceButtonStateNotify;
- extern int DeviceValuatorStateNotify;
- extern Mask DeviceStateNotifyMask;
- extern Mask DeviceFocusChangeMask;
deviceFocus event;
if (type == FocusIn)
@@ -426,15 +435,13 @@ DeviceFocusEvent(dev, type, mode, detail, pWin)
event.window = pWin->drawable.id;
event.time = currentTime.milliseconds;
- (void)
- DeliverEventsToWindow(pWin, &event, 1, DeviceFocusChangeMask, NullGrab,
- dev->id);
+ (void) DeliverEventsToWindow(pWin, (xEvent *)&event, 1,
+ DeviceFocusChangeMask, NullGrab, dev->id);
if ((type == DeviceFocusIn) &&
(wOtherInputMasks(pWin)) &&
(wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask))
{
- int i,j;
int evcount = 1;
deviceStateNotify *ev, *sev;
deviceKeyStateNotify *kev;
@@ -518,19 +525,34 @@ DeviceFocusEvent(dev, type, mode, detail, pWin)
nval -= 3;
if (nval > 0) {
(ev-1)->deviceid |= MORE_EVENTS;
- FixDeviceValuator (dev, ev++, v, first);
+ FixDeviceValuator (dev, (deviceValuator *) ev++, v, first);
first += 3;
nval -= 3;
}
}
- (void) DeliverEventsToWindow(pWin, sev, evcount, DeviceStateNotifyMask,
- NullGrab, dev->id);
+ (void) DeliverEventsToWindow(pWin, (xEvent *)sev, evcount,
+ DeviceStateNotifyMask, NullGrab, dev->id);
xfree (sev);
}
}
int
+#if NeedFunctionPrototypes
+GrabButton(
+ ClientPtr client,
+ DeviceIntPtr dev,
+ BYTE this_device_mode,
+ BYTE other_devices_mode,
+ CARD16 modifiers,
+ DeviceIntPtr modifier_device,
+ CARD8 button,
+ Window grabWindow,
+ BOOL ownerEvents,
+ Cursor rcursor,
+ Window rconfineTo,
+ Mask eventMask)
+#else
GrabButton(client, dev, this_device_mode, other_devices_mode, modifiers,
modifier_device, button, grabWindow, ownerEvents, rcursor, rconfineTo,
eventMask)
@@ -546,11 +568,10 @@ GrabButton(client, dev, this_device_mode, other_devices_mode, modifiers,
Cursor rcursor;
Window rconfineTo;
Mask eventMask;
-
+#endif
{
WindowPtr pWin, confineTo;
CursorPtr cursor;
- GrabPtr CreateGrab();
GrabPtr grab;
if ((this_device_mode != GrabModeSync) &&
@@ -609,6 +630,19 @@ GrabButton(client, dev, this_device_mode, other_devices_mode, modifiers,
}
int
+#if NeedFunctionPrototypes
+GrabKey(
+ ClientPtr client,
+ DeviceIntPtr dev,
+ BYTE this_device_mode,
+ BYTE other_devices_mode,
+ CARD16 modifiers,
+ DeviceIntPtr modifier_device,
+ CARD8 key,
+ Window grabWindow,
+ BOOL ownerEvents,
+ Mask mask)
+#else
GrabKey(client, dev, this_device_mode, other_devices_mode, modifiers,
modifier_device, key, grabWindow, ownerEvents, mask)
ClientPtr client;
@@ -621,10 +655,9 @@ GrabKey(client, dev, this_device_mode, other_devices_mode, modifiers,
Window grabWindow;
BOOL ownerEvents;
Mask mask;
-
+#endif
{
WindowPtr pWin;
- GrabPtr CreateGrab();
GrabPtr grab;
KeyClassPtr k = dev->key;
@@ -673,8 +706,6 @@ GrabKey(client, dev, this_device_mode, other_devices_mode, modifiers,
return AddPassiveGrabToList(grab);
}
-extern Mask DevicePointerMotionHintMask;
-
int
SelectForWindow(dev, pWin, client, mask, exclusivemasks, validmasks)
DeviceIntPtr dev;
@@ -803,7 +834,7 @@ RecalculateDeviceDeliverableEvents(pWin)
pChild = pWin;
while (1)
{
- if (inputMasks = wOtherInputMasks(pChild))
+ if ((inputMasks = wOtherInputMasks(pChild)) != 0)
{
for (others = inputMasks->inputClients; others;
others = others->next)
@@ -892,10 +923,10 @@ SendEvent (client, d, dest, propagate, ev, mask, count)
Bool propagate;
xEvent *ev;
Mask mask;
+ int count;
{
WindowPtr pWin;
WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
- WindowPtr GetCurrentRootWindow();
WindowPtr spriteWin=GetSpriteWindow();
if (dest == PointerWindow)
@@ -996,7 +1027,7 @@ SetModifierMapping(client, dev, len, rlen, numKeyPerModifier, inputMap, k)
KeyCode *inputMap;
KeyClassPtr *k;
{
- KeyCode *map;
+ KeyCode *map = NULL;
int inputMapLen;
register int i;
@@ -1070,15 +1101,22 @@ SetModifierMapping(client, dev, len, rlen, numKeyPerModifier, inputMap, k)
return(MappingSuccess);
}
-int
+void
+#if NeedFunctionPrototypes
+SendDeviceMappingNotify(
+ CARD8 request,
+ KeyCode firstKeyCode,
+ CARD8 count,
+ DeviceIntPtr dev)
+#else
SendDeviceMappingNotify(request, firstKeyCode, count, dev)
CARD8 request, count;
KeyCode firstKeyCode;
DeviceIntPtr dev;
- {
+#endif
+{
xEvent event;
deviceMappingNotify *ev = (deviceMappingNotify *) &event;
- extern int DeviceMappingNotify;
ev->type = DeviceMappingNotify;
ev->request = request;
@@ -1090,10 +1128,21 @@ SendDeviceMappingNotify(request, firstKeyCode, count, dev)
ev->count = count;
}
- SendEventToAllWindows (dev, DeviceMappingNotifyMask, ev, 1);
+ SendEventToAllWindows (dev, DeviceMappingNotifyMask, (xEvent *)ev, 1);
}
int
+#if NeedFunctionPrototypes
+ChangeKeyMapping(
+ ClientPtr client,
+ DeviceIntPtr dev,
+ unsigned len,
+ int type,
+ KeyCode firstKeyCode,
+ CARD8 keyCodes,
+ CARD8 keySymsPerKeyCode,
+ KeySym *map)
+#else
ChangeKeyMapping(client, dev, len, type, firstKeyCode, keyCodes,
keySymsPerKeyCode, map)
ClientPtr client;
@@ -1104,6 +1153,7 @@ ChangeKeyMapping(client, dev, len, type, firstKeyCode, keyCodes,
CARD8 keyCodes;
CARD8 keySymsPerKeyCode;
KeySym *map;
+#endif
{
KeySymsRec keysyms;
KeyClassPtr k = dev->key;
@@ -1158,7 +1208,7 @@ DeleteWindowFromAnyExtEvents(pWin, freeResources)
DeleteDeviceFromAnyExtEvents(pWin, dev);
if (freeResources)
- while (inputMasks = wOtherInputMasks(pWin))
+ while ((inputMasks = wOtherInputMasks(pWin)) != 0)
{
ic = inputMasks->inputClients;
for (i=0; i<EMASKSIZE; i++)
@@ -1167,6 +1217,7 @@ DeleteWindowFromAnyExtEvents(pWin, freeResources)
}
}
+void
DeleteDeviceFromAnyExtEvents(pWin, dev)
WindowPtr pWin;
DeviceIntPtr dev;
@@ -1241,7 +1292,6 @@ MaybeSendDeviceMotionNotifyHint (pEvents, mask)
Mask mask;
{
DeviceIntPtr dev;
- DeviceIntPtr LookupDeviceIntRec ();
dev = LookupDeviceIntRec (pEvents->deviceid & DEVICE_BITS);
if (pEvents->type == DeviceMotionNotify)
@@ -1262,7 +1312,7 @@ MaybeSendDeviceMotionNotifyHint (pEvents, mask)
return (0);
}
-int
+void
CheckDeviceGrabAndHintWindow (pWin, type, xE, grab, client, deliveryMask)
WindowPtr pWin;
int type;
@@ -1272,7 +1322,6 @@ CheckDeviceGrabAndHintWindow (pWin, type, xE, grab, client, deliveryMask)
Mask deliveryMask;
{
DeviceIntPtr dev;
- DeviceIntPtr LookupDeviceIntRec ();
dev = LookupDeviceIntRec (xE->deviceid & DEVICE_BITS);
if (type == DeviceMotionNotify)
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 37148ebd2..ce5d96c8a 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/extinit.c,v 3.6 2001/12/14 19:58:55 dawes Exp $ */
/********************************************************************
*
@@ -55,6 +56,7 @@ SOFTWARE.
#define NUMTYPES 15
#define NEED_EVENTS
+#define NEED_REPLIES
#include "X.h"
#include "Xproto.h"
#include "inputstr.h"
@@ -63,6 +65,51 @@ SOFTWARE.
#include "XI.h"
#include "XIproto.h"
+#include "dixevents.h"
+#include "exevents.h"
+#include "extinit.h"
+#include "exglobals.h"
+#include "swaprep.h"
+
+/* modules local to Xi */
+#include "allowev.h"
+#include "chgdctl.h"
+#include "chgfctl.h"
+#include "chgkbd.h"
+#include "chgprop.h"
+#include "chgptr.h"
+#include "closedev.h"
+#include "devbell.h"
+#include "getbmap.h"
+#include "getbmap.h"
+#include "getdctl.h"
+#include "getfctl.h"
+#include "getfocus.h"
+#include "getkmap.h"
+#include "getmmap.h"
+#include "getprop.h"
+#include "getselev.h"
+#include "getvers.h"
+#include "getvers.h"
+#include "grabdev.h"
+#include "grabdevb.h"
+#include "grabdevk.h"
+#include "gtmotion.h"
+#include "listdev.h"
+#include "opendev.h"
+#include "queryst.h"
+#include "selectev.h"
+#include "sendexev.h"
+#include "chgkmap.h"
+#include "setbmap.h"
+#include "setdval.h"
+#include "setfocus.h"
+#include "setmmap.h"
+#include "setmode.h"
+#include "ungrdev.h"
+#include "ungrdevb.h"
+#include "ungrdevk.h"
+
static Mask lastExtEventMask = 1;
int ExtEventIndex;
Mask ExtValidMasks[EMASKSIZE];
@@ -141,10 +188,8 @@ int RT_INPUTCLIENT;
*
*/
-extern void (* ReplySwapVector[256]) ();
-extern void (* EventSwapVector[128]) ();
extern XExtensionVersion AllExtensionVersions[];
-extern InputInfo inputInfo;
+
Mask PropagateMask[MAX_DEVICES];
/*****************************************************************
@@ -153,12 +198,6 @@ Mask PropagateMask[MAX_DEVICES];
*
*/
-int ProcIDispatch();
-int SProcIDispatch();
-void SReplyIDispatch();
-void IResetProc();
-void SEventIDispatch();
-void NotImplemented();
static XExtensionVersion thisversion =
{XI_Present,
XI_Add_XChangeDeviceControl_Major,
@@ -177,10 +216,8 @@ static XExtensionVersion thisversion =
void
XInputExtensionInit()
- {
- ExtensionEntry *extEntry, *AddExtension();
- int XShutDownDevice();
- int InputClientGone();
+{
+ ExtensionEntry *extEntry;
extEntry = AddExtension(INAME, IEVENTS, IERRORS, ProcIDispatch,
SProcIDispatch, IResetProc, StandardMinorOpcode);
@@ -189,9 +226,9 @@ XInputExtensionInit()
IReqCode = extEntry->base;
AllExtensionVersions[IReqCode-128] = thisversion;
MakeDeviceTypeAtoms ();
- RT_INPUTCLIENT = CreateNewResourceType(InputClientGone);
+ RT_INPUTCLIENT = CreateNewResourceType((DeleteType)InputClientGone);
FixExtensionEvents (extEntry);
- ReplySwapVector[IReqCode] = SReplyIDispatch;
+ ReplySwapVector[IReqCode] = (ReplySwapPtr)SReplyIDispatch;
EventSwapVector[DeviceValuator] = SEventIDispatch;
EventSwapVector[DeviceKeyPress] = SEventIDispatch;
EventSwapVector[DeviceKeyRelease] = SEventIDispatch;
@@ -224,7 +261,7 @@ XInputExtensionInit()
int
ProcIDispatch (client)
register ClientPtr client;
- {
+{
REQUEST(xReq);
if (stuff->data == X_GetExtensionVersion)
return(ProcXGetExtensionVersion(client));
@@ -315,7 +352,7 @@ ProcIDispatch (client)
int
SProcIDispatch(client)
register ClientPtr client;
- {
+{
REQUEST(xReq);
if (stuff->data == X_GetExtensionVersion)
return(SProcXGetExtensionVersion(client));
@@ -401,54 +438,59 @@ SProcIDispatch(client)
*
*/
+/* FIXME: this would be more concise and readable in ANSI C */
+#define DISPATCH(code) \
+ if (rep->RepType == X_##code) \
+ SRepX##code (client, len, (x##code##Reply *) rep)
+
void
SReplyIDispatch (client, len, rep)
ClientPtr client;
int len;
xGrabDeviceReply *rep; /* All we look at is the type field */
- { /* This is common to all replies */
+{ /* This is common to all replies */
if (rep->RepType == X_GetExtensionVersion)
- SRepXGetExtensionVersion (client, len, rep);
+ SRepXGetExtensionVersion (client, len, (xGetExtensionVersionReply *)rep);
else if (rep->RepType == X_ListInputDevices)
- SRepXListInputDevices (client, len, rep);
+ SRepXListInputDevices (client, len, (xListInputDevicesReply *)rep);
else if (rep->RepType == X_OpenDevice)
- SRepXOpenDevice (client, len, rep);
+ SRepXOpenDevice (client, len, (xOpenDeviceReply *)rep);
else if (rep->RepType == X_SetDeviceMode)
- SRepXSetDeviceMode (client, len, rep);
+ SRepXSetDeviceMode (client, len, (xSetDeviceModeReply *) rep);
else if (rep->RepType == X_GetSelectedExtensionEvents)
- SRepXGetSelectedExtensionEvents (client, len, rep);
+ SRepXGetSelectedExtensionEvents (client, len, (xGetSelectedExtensionEventsReply *) rep);
else if (rep->RepType == X_GetDeviceDontPropagateList)
- SRepXGetDeviceDontPropagateList (client, len, rep);
+ SRepXGetDeviceDontPropagateList (client, len, (xGetDeviceDontPropagateListReply *)rep);
else if (rep->RepType == X_GetDeviceMotionEvents)
- SRepXGetDeviceMotionEvents (client, len, rep);
+ SRepXGetDeviceMotionEvents (client, len, (xGetDeviceMotionEventsReply *) rep);
else if (rep->RepType == X_ChangeKeyboardDevice)
- SRepXChangeKeyboardDevice (client, len, rep);
+ SRepXChangeKeyboardDevice (client, len, (xChangeKeyboardDeviceReply *) rep);
else if (rep->RepType == X_ChangePointerDevice)
- SRepXChangePointerDevice (client, len, rep);
+ SRepXChangePointerDevice (client, len, (xChangePointerDeviceReply *)rep);
else if (rep->RepType == X_GrabDevice)
- SRepXGrabDevice (client, len, rep);
+ SRepXGrabDevice (client, len, (xGrabDeviceReply *)rep);
else if (rep->RepType == X_GetDeviceFocus)
- SRepXGetDeviceFocus (client, len, rep);
+ SRepXGetDeviceFocus (client, len, (xGetDeviceFocusReply *)rep);
else if (rep->RepType == X_GetFeedbackControl)
- SRepXGetFeedbackControl (client, len, rep);
+ SRepXGetFeedbackControl (client, len, (xGetFeedbackControlReply *)rep);
else if (rep->RepType == X_GetDeviceKeyMapping)
- SRepXGetDeviceKeyMapping (client, len, rep);
+ SRepXGetDeviceKeyMapping (client, len, (xGetDeviceKeyMappingReply *)rep);
else if (rep->RepType == X_GetDeviceModifierMapping)
- SRepXGetDeviceModifierMapping (client, len, rep);
+ SRepXGetDeviceModifierMapping (client, len, (xGetDeviceModifierMappingReply *)rep);
else if (rep->RepType == X_SetDeviceModifierMapping)
- SRepXSetDeviceModifierMapping (client, len, rep);
+ SRepXSetDeviceModifierMapping (client, len, (xSetDeviceModifierMappingReply *)rep);
else if (rep->RepType == X_GetDeviceButtonMapping)
- SRepXGetDeviceButtonMapping (client, len, rep);
+ SRepXGetDeviceButtonMapping (client, len, (xGetDeviceButtonMappingReply *)rep);
else if (rep->RepType == X_SetDeviceButtonMapping)
- SRepXSetDeviceButtonMapping (client, len, rep);
+ SRepXSetDeviceButtonMapping (client, len, (xSetDeviceButtonMappingReply *)rep);
else if (rep->RepType == X_QueryDeviceState)
- SRepXQueryDeviceState (client, len, rep);
+ SRepXQueryDeviceState (client, len, (xQueryDeviceStateReply *)rep);
else if (rep->RepType == X_SetDeviceValuators)
- SRepXSetDeviceValuators (client, len, rep);
+ SRepXSetDeviceValuators (client, len, (xSetDeviceValuatorsReply *)rep);
else if (rep->RepType == X_GetDeviceControl)
- SRepXGetDeviceControl (client, len, rep);
+ SRepXGetDeviceControl (client, len, (xGetDeviceControlReply *)rep);
else if (rep->RepType == X_ChangeDeviceControl)
- SRepXChangeDeviceControl (client, len, rep);
+ SRepXChangeDeviceControl (client, len, (xChangeDeviceControlReply *)rep);
else
{
FatalError("XINPUT confused sending swapped reply");
@@ -461,15 +503,17 @@ SReplyIDispatch (client, len, rep)
*
* Swap any events defined in this extension.
*/
+#define DO_SWAP(func,type) func ((type *)from, (type *)to)
+
void
SEventIDispatch (from, to)
xEvent *from;
xEvent *to;
- {
+{
int type = from->u.u.type & 0177;
if (type == DeviceValuator)
- SEventDeviceValuator (from, to);
+ DO_SWAP(SEventDeviceValuator, deviceValuator);
else if (type == DeviceKeyPress)
{
SKeyButtonPtrEvent (from, to);
@@ -496,9 +540,9 @@ SEventIDispatch (from, to)
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
}
else if (type == DeviceFocusIn)
- SEventFocus (from, to);
+ DO_SWAP(SEventFocus, deviceFocus);
else if (type == DeviceFocusOut)
- SEventFocus (from, to);
+ DO_SWAP(SEventFocus, deviceFocus);
else if (type == ProximityIn)
{
SKeyButtonPtrEvent (from, to);
@@ -510,15 +554,15 @@ SEventIDispatch (from, to)
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
}
else if (type == DeviceStateNotify)
- SDeviceStateNotifyEvent (from, to);
+ DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
else if (type == DeviceKeyStateNotify)
- SDeviceKeyStateNotifyEvent (from, to);
+ DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
else if (type == DeviceButtonStateNotify)
- SDeviceButtonStateNotifyEvent (from, to);
+ DO_SWAP(SDeviceButtonStateNotifyEvent, deviceButtonStateNotify);
else if (type == DeviceMappingNotify)
- SDeviceMappingNotifyEvent (from, to);
+ DO_SWAP(SDeviceMappingNotifyEvent, deviceMappingNotify);
else if (type == ChangeDeviceNotify)
- SChangeDeviceNotifyEvent (from, to);
+ DO_SWAP(SChangeDeviceNotifyEvent, changeDeviceNotify);
else
{
FatalError("XInputExtension: Impossible event!\n");
@@ -531,6 +575,7 @@ SEventIDispatch (from, to)
*
*/
+void
SEventDeviceValuator (from, to)
deviceValuator *from;
deviceValuator *to;
@@ -549,10 +594,11 @@ SEventDeviceValuator (from, to)
}
}
+void
SEventFocus (from, to)
deviceFocus *from;
deviceFocus *to;
- {
+{
register char n;
*to = *from;
@@ -561,10 +607,11 @@ SEventFocus (from, to)
swapl(&to->window, n);
}
+void
SDeviceStateNotifyEvent (from, to)
deviceStateNotify *from;
deviceStateNotify *to;
- {
+{
register int i;
register char n;
INT32 *ip B32;
@@ -579,30 +626,33 @@ SDeviceStateNotifyEvent (from, to)
}
}
+void
SDeviceKeyStateNotifyEvent (from, to)
deviceKeyStateNotify *from;
deviceKeyStateNotify *to;
- {
+{
register char n;
*to = *from;
swaps(&to->sequenceNumber,n);
}
+void
SDeviceButtonStateNotifyEvent (from, to)
deviceButtonStateNotify *from;
deviceButtonStateNotify *to;
- {
+{
register char n;
*to = *from;
swaps(&to->sequenceNumber,n);
}
+void
SChangeDeviceNotifyEvent (from, to)
changeDeviceNotify *from;
changeDeviceNotify *to;
- {
+{
register char n;
*to = *from;
@@ -610,10 +660,11 @@ SChangeDeviceNotifyEvent (from, to)
swapl(&to->time, n);
}
+void
SDeviceMappingNotifyEvent (from, to)
deviceMappingNotify *from;
deviceMappingNotify *to;
- {
+{
register char n;
*to = *from;
@@ -627,14 +678,11 @@ SDeviceMappingNotifyEvent (from, to)
*
*/
+void
FixExtensionEvents (extEntry)
ExtensionEntry *extEntry;
- {
- Mask mask, GetNextExtEventMask();
- void SetMaskForExtEvent();
- void SetEventInfo();
- void AllowPropagateSuppress();
- void SetExclusiveAccess();
+{
+ Mask mask;
DeviceValuator = extEntry->eventBase;
DeviceKeyPress = DeviceValuator + 1;
@@ -733,8 +781,9 @@ FixExtensionEvents (extEntry)
*
*/
+void
RestoreExtensionEvents ()
- {
+{
int i;
IReqCode = 0;
@@ -781,10 +830,11 @@ RestoreExtensionEvents ()
*/
void
-IResetProc()
+IResetProc(unused)
+ ExtensionEntry *unused;
{
- ReplySwapVector[IReqCode] = NotImplemented;
+ ReplySwapVector[IReqCode] = ReplyNotSwappd;
EventSwapVector[DeviceValuator] = NotImplemented;
EventSwapVector[DeviceKeyPress] = NotImplemented;
EventSwapVector[DeviceKeyRelease] = NotImplemented;
@@ -809,12 +859,12 @@ IResetProc()
*
*/
-int
+void
AssignTypeAndName (dev, type, name)
DeviceIntPtr dev;
Atom type;
char *name;
- {
+{
dev->type = type;
dev->name = (char *) xalloc(strlen(name)+1);
strcpy (dev->name, name);
@@ -826,7 +876,7 @@ AssignTypeAndName (dev, type, name)
*
*/
-int
+void
MakeDeviceTypeAtoms ()
{
int i;
@@ -844,9 +894,14 @@ MakeDeviceTypeAtoms ()
*/
DeviceIntPtr
+#if NeedFunctionPrototypes
+LookupDeviceIntRec (
+ CARD8 id)
+#else
LookupDeviceIntRec (id)
CARD8 id;
- {
+#endif
+{
DeviceIntPtr dev;
for (dev=inputInfo.devices; dev; dev=dev->next)
diff --git a/Xi/getbmap.c b/Xi/getbmap.c
index 35c2d5c7d..fb22a1422 100644
--- a/Xi/getbmap.c
+++ b/Xi/getbmap.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getbmap.c,v 3.3 2001/12/14 19:58:56 dawes Exp $ */
/***********************************************************************
*
@@ -59,11 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "getbmap.h"
/***********************************************************************
*
@@ -88,6 +89,7 @@ SProcXGetDeviceButtonMapping(client)
*
*/
+int
ProcXGetDeviceButtonMapping (client)
register ClientPtr client;
{
@@ -134,6 +136,7 @@ ProcXGetDeviceButtonMapping (client)
*
*/
+void
SRepXGetDeviceButtonMapping (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 684160706..5b24bffbe 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getdctl.c,v 3.4 2001/12/14 19:58:56 dawes Exp $ */
/********************************************************************
*
@@ -59,12 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
-void CopySwapDeviceResolution();
+#include "getdctl.h"
/***********************************************************************
*
@@ -92,6 +92,7 @@ SProcXGetDeviceControl(client)
*
*/
+int
ProcXGetDeviceControl(client)
ClientPtr client;
{
@@ -134,7 +135,7 @@ ProcXGetDeviceControl(client)
return Success;
}
- buf = (char *) Xalloc (total_length);
+ buf = (char *) xalloc (total_length);
if (!buf)
{
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
@@ -156,7 +157,7 @@ ProcXGetDeviceControl(client)
rep.length = (total_length+3) >> 2;
WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
WriteToClient(client, total_length, savbuf);
- Xfree (savbuf);
+ xfree (savbuf);
return Success;
}
@@ -210,6 +211,7 @@ CopySwapDeviceResolution (client, v, buf, length)
*
*/
+void
SRepXGetDeviceControl (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getfctl.c b/Xi/getfctl.c
index e06470fbc..59c2c122b 100644
--- a/Xi/getfctl.c
+++ b/Xi/getfctl.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getfctl.c,v 3.4 2001/12/14 19:58:56 dawes Exp $ */
/********************************************************************
*
@@ -59,17 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
-void CopySwapKbdFeedback();
-void CopySwapPtrFeedback();
-void CopySwapIntegerFeedback();
-void CopySwapStringFeedback();
-void CopySwapLedFeedback();
-void CopySwapBellFeedback();
+#include "getfctl.h"
/***********************************************************************
*
@@ -95,6 +90,7 @@ SProcXGetFeedbackControl(client)
*
*/
+int
ProcXGetFeedbackControl(client)
ClientPtr client;
{
@@ -165,7 +161,7 @@ ProcXGetFeedbackControl(client)
return Success;
}
- buf = (char *) Xalloc (total_length);
+ buf = (char *) xalloc (total_length);
if (!buf)
{
SendErrorToClient(client, IReqCode, X_GetFeedbackControl, 0,
@@ -190,7 +186,7 @@ ProcXGetFeedbackControl(client)
rep.length = (total_length+3) >> 2;
WriteReplyToClient(client, sizeof(xGetFeedbackControlReply), &rep);
WriteToClient(client, total_length, savbuf);
- Xfree (savbuf);
+ xfree (savbuf);
return Success;
}
@@ -407,6 +403,7 @@ CopySwapBellFeedback (client, b, buf)
*
*/
+void
SRepXGetFeedbackControl (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getfocus.c b/Xi/getfocus.c
index 1e34df413..2b916da11 100644
--- a/Xi/getfocus.c
+++ b/Xi/getfocus.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getfocus.c,v 3.3 2001/12/14 19:58:56 dawes Exp $ */
/***********************************************************************
*
@@ -60,11 +61,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "getfocus.h"
/***********************************************************************
*
@@ -136,6 +137,7 @@ ProcXGetDeviceFocus(client)
*
*/
+void
SRepXGetDeviceFocus (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getkmap.c b/Xi/getkmap.c
index 783dc5506..4a7a7e296 100644
--- a/Xi/getkmap.c
+++ b/Xi/getkmap.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getkmap.c,v 3.4 2001/12/14 19:58:56 dawes Exp $ */
/********************************************************************
*
@@ -59,11 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "swaprep.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "getkmap.h"
/***********************************************************************
*
@@ -89,10 +91,10 @@ SProcXGetDeviceKeyMapping(client)
*
*/
+int
ProcXGetDeviceKeyMapping(client)
register ClientPtr client;
{
- extern void CopySwap32Write();
xGetDeviceKeyMappingReply rep;
DeviceIntPtr dev;
KeySymsPtr k;
@@ -140,7 +142,7 @@ ProcXGetDeviceKeyMapping(client)
rep.length = (k->mapWidth * stuff->count); /* KeySyms are 4 bytes */
WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep);
- client->pSwapReplyFunc = CopySwap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write;
WriteSwappedDataToClient(
client,
k->mapWidth * stuff->count * sizeof(KeySym),
@@ -157,6 +159,7 @@ ProcXGetDeviceKeyMapping(client)
*
*/
+void
SRepXGetDeviceKeyMapping (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getmmap.c b/Xi/getmmap.c
index 93b5748c0..67e36b442 100644
--- a/Xi/getmmap.c
+++ b/Xi/getmmap.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getmmap.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/********************************************************************
*
@@ -59,11 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h" /* Request macro */
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "getmmap.h"
/***********************************************************************
*
@@ -89,6 +90,7 @@ SProcXGetDeviceModifierMapping(client)
*
*/
+int
ProcXGetDeviceModifierMapping(client)
ClientPtr client;
{
@@ -138,6 +140,7 @@ ProcXGetDeviceModifierMapping(client)
*
*/
+void
SRepXGetDeviceModifierMapping (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getprop.c b/Xi/getprop.c
index ee53b87cb..a3f3226ea 100644
--- a/Xi/getprop.c
+++ b/Xi/getprop.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getprop.c,v 3.6 2001/12/14 19:58:57 dawes Exp $ */
/***********************************************************************
*
@@ -60,11 +61,15 @@ SOFTWARE.
#include "windowstr.h" /* window structs */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "swaprep.h"
+
+#include "getprop.h"
-extern int IReqCode;
-extern void (* ReplySwapVector[256]) ();
extern XExtEventInfo EventInfo[];
-DeviceIntPtr LookupDeviceIntRec();
+extern int ExtEventIndex;
/***********************************************************************
*
@@ -91,16 +96,15 @@ SProcXGetDeviceDontPropagateList(client)
*
*/
+int
ProcXGetDeviceDontPropagateList (client)
register ClientPtr client;
{
CARD16 count = 0;
int i;
- XEventClass *buf, *tbuf;
+ XEventClass *buf = NULL, *tbuf;
WindowPtr pWin;
xGetDeviceDontPropagateListReply rep;
- XEventClass *ClassFromMask ();
- void Swap32Write();
OtherInputMasks *others;
REQUEST(xGetDeviceDontPropagateListReq);
@@ -121,7 +125,7 @@ ProcXGetDeviceDontPropagateList (client)
return Success;
}
- if (others = wOtherInputMasks(pWin))
+ if ((others = wOtherInputMasks(pWin)) != 0)
{
for (i=0; i<EMASKSIZE; i++)
tbuf = ClassFromMask (NULL, others->dontPropagateMask[i], i,
@@ -129,7 +133,7 @@ ProcXGetDeviceDontPropagateList (client)
if (count)
{
rep.count = count;
- buf = (XEventClass *) Xalloc (rep.count * sizeof(XEventClass));
+ buf = (XEventClass *) xalloc (rep.count * sizeof(XEventClass));
rep.length = (rep.count * sizeof (XEventClass) + 3) >> 2;
tbuf = buf;
@@ -144,9 +148,9 @@ ProcXGetDeviceDontPropagateList (client)
if (count)
{
- client->pSwapReplyFunc = Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient( client, count * sizeof(XEventClass), buf);
- Xfree (buf);
+ xfree (buf);
}
return Success;
}
@@ -169,7 +173,6 @@ XEventClass
int i,j;
int id = maskndx;
Mask tmask = 0x80000000;
- extern int ExtEventIndex;
for (i=0; i<32; i++,tmask>>=1)
if (tmask & mask)
@@ -193,6 +196,7 @@ XEventClass
*
*/
+void
SRepXGetDeviceDontPropagateList (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getselev.c b/Xi/getselev.c
index 8ac16d1d0..75b9137a6 100644
--- a/Xi/getselev.c
+++ b/Xi/getselev.c
@@ -1,3 +1,4 @@
+/* $XFree86: xc/programs/Xserver/Xi/getselev.c,v 3.6 2001/12/14 19:58:57 dawes Exp $ */
/************************************************************
Copyright 1989, 1998 The Open Group
@@ -60,10 +61,13 @@ SOFTWARE.
#include "XIproto.h"
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window struct */
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "swaprep.h"
-extern int IReqCode;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "getprop.h"
+#include "getselev.h"
/***********************************************************************
*
@@ -99,11 +103,9 @@ ProcXGetSelectedExtensionEvents(client)
int total_length = 0;
xGetSelectedExtensionEventsReply rep;
WindowPtr pWin;
- XEventClass *buf;
+ XEventClass *buf = NULL;
XEventClass *tclient;
XEventClass *aclient;
- XEventClass *ClassFromMask ();
- void Swap32Write();
OtherInputMasks *pOthers;
InputClientsPtr others;
@@ -124,7 +126,7 @@ ProcXGetSelectedExtensionEvents(client)
return Success;
}
- if (pOthers=wOtherInputMasks(pWin))
+ if ((pOthers = wOtherInputMasks(pWin)) != 0)
{
for (others = pOthers->inputClients; others; others=others->next)
for (i=0; i<EMASKSIZE; i++)
@@ -143,7 +145,7 @@ ProcXGetSelectedExtensionEvents(client)
total_length = (rep.all_clients_count + rep.this_client_count) *
sizeof (XEventClass);
rep.length = (total_length + 3) >> 2;
- buf = (XEventClass *) Xalloc (total_length);
+ buf = (XEventClass *) xalloc (total_length);
tclient = buf;
aclient = buf + rep.this_client_count;
@@ -160,9 +162,9 @@ ProcXGetSelectedExtensionEvents(client)
if (total_length)
{
- client->pSwapReplyFunc = Swap32Write;
+ client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient( client, total_length, buf);
- Xfree (buf);
+ xfree (buf);
}
return Success;
}
@@ -174,6 +176,7 @@ ProcXGetSelectedExtensionEvents(client)
*
*/
+void
SRepXGetSelectedExtensionEvents (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/getvers.c b/Xi/getvers.c
index 8628a2851..c220b5a81 100644
--- a/Xi/getvers.c
+++ b/Xi/getvers.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/getvers.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/***********************************************************************
*
@@ -59,10 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "getvers.h"
-extern int IReqCode;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
XExtensionVersion AllExtensionVersions[128];
/***********************************************************************
@@ -90,6 +93,7 @@ SProcXGetExtensionVersion(client)
*
*/
+int
ProcXGetExtensionVersion (client)
register ClientPtr client;
{
@@ -133,6 +137,7 @@ ProcXGetExtensionVersion (client)
*
*/
+void
SRepXGetExtensionVersion (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/grabdev.c b/Xi/grabdev.c
index cb2370adf..80f948de5 100644
--- a/Xi/grabdev.c
+++ b/Xi/grabdev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/grabdev.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/***********************************************************************
*
@@ -61,13 +62,15 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "dixevents.h" /* GrabDevice */
+
+#include "grabdev.h"
-extern int IReqCode;
-extern int BadDevice;
-extern int BadClass;
extern XExtEventInfo EventInfo[];
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+extern int ExtEventIndex;
/***********************************************************************
*
@@ -171,7 +174,6 @@ CreateMaskFromList (client, list, count, mask, dev, req)
int i,j;
int device;
DeviceIntPtr tdev;
- extern int ExtEventIndex;
for (i=0; i<EMASKSIZE; i++)
{
@@ -212,6 +214,7 @@ CreateMaskFromList (client, list, count, mask, dev, req)
*
*/
+void
SRepXGrabDevice (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c
index ddc44c12d..cbc4fd8bd 100644
--- a/Xi/grabdevb.c
+++ b/Xi/grabdevb.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/grabdevb.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/***********************************************************************
*
@@ -60,11 +61,13 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "grabdev.h"
+#include "grabdevb.h"
/***********************************************************************
*
@@ -154,7 +157,7 @@ ProcXGrabDeviceButton(client)
return Success;
ret = GrabButton(client, dev, stuff->this_device_mode,
stuff->other_devices_mode, stuff->modifiers, mdev, stuff->button,
- stuff->grabWindow, stuff->ownerEvents, NullCursor, NullWindow,
+ stuff->grabWindow, stuff->ownerEvents, (Cursor)0, (Window)0,
tmp[stuff->grabbed_device].mask);
if (ret != Success)
diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c
index 6db6b8d09..d7481801b 100644
--- a/Xi/grabdevk.c
+++ b/Xi/grabdevk.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/grabdevk.c,v 3.3 2001/12/14 19:58:57 dawes Exp $ */
/***********************************************************************
*
@@ -60,13 +61,13 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadClass;
-extern int BadDevice;
-extern InputInfo inputInfo;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "grabdev.h"
+#include "grabdevk.h"
/***********************************************************************
*
diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c
index 65a4e0a19..1ddcca3ae 100644
--- a/Xi/gtmotion.c
+++ b/Xi/gtmotion.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/gtmotion.c,v 3.7 2001/12/14 19:58:57 dawes Exp $ */
/***********************************************************************
*
@@ -59,11 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "gtmotion.h"
/***********************************************************************
*
@@ -97,11 +99,11 @@ ProcXGetDeviceMotionEvents(client)
{
INT32 *coords = NULL, *bufptr;
xGetDeviceMotionEventsReply rep;
- int i, j, num_events, axes, size, tsize;
+ unsigned long i;
+ int num_events, axes, size = 0, tsize;
unsigned long nEvents;
DeviceIntPtr dev;
TimeStamp start, stop;
- void XSwapTimeCoordWrite();
int length = 0;
ValuatorClassPtr v;
@@ -192,6 +194,7 @@ ProcXGetDeviceMotionEvents(client)
*
*/
+void
SRepXGetDeviceMotionEvents (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/listdev.c b/Xi/listdev.c
index ff6155f19..ac4c875a1 100644
--- a/Xi/listdev.c
+++ b/Xi/listdev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/listdev.c,v 3.4 2001/12/14 19:58:58 dawes Exp $ */
/***********************************************************************
*
@@ -59,22 +60,14 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "XIstubs.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h" /* FIXME */
+
+#include "listdev.h"
#define VPC 20 /* Max # valuators per chunk */
-extern InputInfo inputInfo;
-extern int IReqCode;
-extern int BadDevice;
-extern void (*ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
-
-void CopySwapKeyClass ();
-void CopySwapButtonClass ();
-int CopySwapValuatorClass ();
-void SizeDeviceInfo ();
-void ListDeviceInfo ();
-void AddOtherInputDevices ();
-void CopyDeviceName ();
-void CopySwapDevice ();
/***********************************************************************
*
@@ -99,6 +92,7 @@ SProcXListInputDevices(client)
*
*/
+int
ProcXListInputDevices (client)
register ClientPtr client;
{
@@ -114,7 +108,6 @@ ProcXListInputDevices (client)
xDeviceInfo *dev;
DeviceIntPtr d;
- REQUEST(xListInputDevicesReq);
REQUEST_SIZE_MATCH(xListInputDevicesReq);
rep.repType = X_Reply;
@@ -131,7 +124,7 @@ ProcXListInputDevices (client)
SizeDeviceInfo (d, &namesize, &size);
total_length = numdevs * sizeof (xDeviceInfo) + size + namesize;
- devbuf = (char *) Xalloc (total_length);
+ devbuf = (char *) xalloc (total_length);
classbuf = devbuf + (numdevs * sizeof (xDeviceInfo));
namebuf = classbuf + size;
savbuf = devbuf;
@@ -146,7 +139,7 @@ ProcXListInputDevices (client)
rep.length = (total_length + 3) >> 2;
WriteReplyToClient (client, sizeof (xListInputDevicesReply), &rep);
WriteToClient(client, total_length, savbuf);
- Xfree (savbuf);
+ xfree (savbuf);
return Success;
}
@@ -396,6 +389,7 @@ CopySwapValuatorClass (client, v, buf)
*
*/
+void
SRepXListInputDevices (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/opendev.c b/Xi/opendev.c
index 30d6293f0..26210fa86 100644
--- a/Xi/opendev.c
+++ b/Xi/opendev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/opendev.c,v 3.3 2001/12/14 19:58:58 dawes Exp $ */
/***********************************************************************
*
@@ -56,17 +57,18 @@ SOFTWARE.
#define NEED_REPLIES
#include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
-#include "inputstr.h" /* DeviceIntPtr */
+#include "XIstubs.h"
#include "windowstr.h" /* window structure */
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "opendev.h"
-extern int IReqCode;
-extern int BadDevice;
extern CARD8 event_base [];
-extern InputInfo inputInfo;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
/***********************************************************************
*
@@ -102,7 +104,6 @@ ProcXOpenDevice(client)
int status = Success;
xOpenDeviceReply rep;
DeviceIntPtr dev;
- void OpenInputDevice();
REQUEST(xOpenDeviceReq);
REQUEST_SIZE_MATCH(xOpenDeviceReq);
@@ -186,6 +187,7 @@ ProcXOpenDevice(client)
*
*/
+void
SRepXOpenDevice (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/queryst.c b/Xi/queryst.c
index 66319b2f3..598ab85ae 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/programs/Xserver/Xi/queryst.c,v 3.5 2001/12/14 19:58:58 dawes Exp $ */
/***********************************************************************
*
@@ -41,11 +42,12 @@ from The Open Group.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "queryst.h"
/***********************************************************************
*
@@ -129,7 +131,7 @@ ProcXQueryDeviceState(client)
(v->numAxes * sizeof(int)));
num_classes++;
}
- buf = (char *) Xalloc (total_length);
+ buf = (char *) xalloc (total_length);
if (!buf)
{
SendErrorToClient(client, IReqCode, X_QueryDeviceState, 0,
@@ -184,7 +186,7 @@ ProcXQueryDeviceState(client)
WriteReplyToClient (client, sizeof(xQueryDeviceStateReply), &rep);
if (total_length > 0)
WriteToClient (client, total_length, savbuf);
- Xfree (savbuf);
+ xfree (savbuf);
return Success;
}
@@ -195,6 +197,7 @@ ProcXQueryDeviceState(client)
*
*/
+void
SRepXQueryDeviceState (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/selectev.c b/Xi/selectev.c
index 510062993..a46a02928 100644
--- a/Xi/selectev.c
+++ b/Xi/selectev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/selectev.c,v 3.3 2001/12/14 19:58:58 dawes Exp $ */
/***********************************************************************
*
@@ -61,12 +62,16 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
+
+#include "grabdev.h"
+#include "selectev.h"
-extern int IReqCode;
extern Mask ExtExclusiveMasks[];
extern Mask ExtValidMasks[];
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
/***********************************************************************
*
@@ -137,7 +142,7 @@ ProcXSelectExtensionEvent (client)
for (i=0; i<EMASKSIZE; i++)
if (tmp[i].dev != NULL)
{
- if ((ret = SelectForWindow(tmp[i].dev, pWin, client, tmp[i].mask,
+ if ((ret = SelectForWindow((DeviceIntPtr)tmp[i].dev, pWin, client, tmp[i].mask,
ExtExclusiveMasks[i], ExtValidMasks[i])) != Success)
{
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
diff --git a/Xi/sendexev.c b/Xi/sendexev.c
index 36a1ad326..ae6f8cdc6 100644
--- a/Xi/sendexev.c
+++ b/Xi/sendexev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/sendexev.c,v 3.3 2001/12/14 19:58:58 dawes Exp $ */
/***********************************************************************
*
@@ -61,12 +62,15 @@ SOFTWARE.
#include "windowstr.h" /* Window */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exevents.h"
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-extern void (* EventSwapVector[128]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "grabdev.h"
+#include "sendexev.h"
+
+extern int lastEvent; /* Defined in extension.c */
/***********************************************************************
*
@@ -83,7 +87,7 @@ SProcXSendExtensionEvent(client)
register int i;
xEvent eventT;
xEvent *eventP;
- void (*proc)(), NotImplemented();
+ EventSwapPtr proc;
REQUEST(xSendExtensionEventReq);
swaps(&stuff->length, n);
@@ -116,11 +120,11 @@ SProcXSendExtensionEvent(client)
*
*/
+int
ProcXSendExtensionEvent (client)
register ClientPtr client;
{
int ret;
- extern int lastEvent; /* Defined in extension.c */
DeviceIntPtr dev;
xEvent *first;
XEventClass *list;
@@ -163,7 +167,7 @@ ProcXSendExtensionEvent (client)
return Success;
ret = (SendEvent (client, dev, stuff->destination,
- stuff->propagate, &stuff[1], tmp[stuff->deviceid].mask,
+ stuff->propagate, (xEvent *)&stuff[1], tmp[stuff->deviceid].mask,
stuff->num_events));
if (ret != Success)
diff --git a/Xi/setbmap.c b/Xi/setbmap.c
index b5335de05..52553948d 100644
--- a/Xi/setbmap.c
+++ b/Xi/setbmap.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setbmap.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/***********************************************************************
*
@@ -62,12 +63,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern int DeviceMappingNotify;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "setbmap.h"
/***********************************************************************
*
@@ -92,6 +93,7 @@ SProcXSetDeviceButtonMapping(client)
*
*/
+int
ProcXSetDeviceButtonMapping (client)
register ClientPtr client;
{
@@ -124,7 +126,7 @@ ProcXSetDeviceButtonMapping (client)
return Success;
}
- ret = SetButtonMapping (client, dev, stuff->map_length, &stuff[1]);
+ ret = SetButtonMapping (client, dev, stuff->map_length, (BYTE *)&stuff[1]);
if (ret == BadValue || ret == BadMatch)
{
@@ -150,6 +152,7 @@ ProcXSetDeviceButtonMapping (client)
*
*/
+void
SRepXSetDeviceButtonMapping (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/setdval.c b/Xi/setdval.c
index 533b1ef5b..fe2e13853 100644
--- a/Xi/setdval.c
+++ b/Xi/setdval.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setdval.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/***********************************************************************
*
@@ -56,14 +57,15 @@ SOFTWARE.
#define NEED_REPLIES
#include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
-#include "inputstr.h" /* DeviceIntPtr */
+#include "XIstubs.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "setdval.h"
/***********************************************************************
*
@@ -154,6 +156,7 @@ ProcXSetDeviceValuators(client)
*
*/
+void
SRepXSetDeviceValuators (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/setfocus.c b/Xi/setfocus.c
index afa5de15b..599934549 100644
--- a/Xi/setfocus.c
+++ b/Xi/setfocus.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setfocus.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/***********************************************************************
*
@@ -61,11 +62,13 @@ SOFTWARE.
#include "XI.h"
#include "XIproto.h"
-extern int IReqCode;
-extern int BadDevice;
-extern InputInfo inputInfo;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "dixevents.h"
+
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+
+#include "setfocus.h"
/***********************************************************************
*
diff --git a/Xi/setmmap.c b/Xi/setmmap.c
index 16f3373a8..4c4d19c8b 100644
--- a/Xi/setmmap.c
+++ b/Xi/setmmap.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setmmap.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/********************************************************************
*
@@ -59,12 +60,12 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
+#include "exevents.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern int DeviceMappingNotify;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "setmmap.h"
/***********************************************************************
*
@@ -90,6 +91,7 @@ SProcXSetDeviceModifierMapping(client)
*
*/
+int
ProcXSetDeviceModifierMapping(client)
ClientPtr client;
{
@@ -116,7 +118,7 @@ ProcXSetDeviceModifierMapping(client)
ret = SetModifierMapping(client, dev, stuff->length,
(sizeof (xSetDeviceModifierMappingReq)>>2), stuff->numKeyPerModifier,
- &stuff[1], &kp);
+ (BYTE *)&stuff[1], &kp);
if (ret==MappingSuccess || ret==MappingBusy || ret==MappingFailed)
{
@@ -143,6 +145,7 @@ ProcXSetDeviceModifierMapping(client)
*
*/
+void
SRepXSetDeviceModifierMapping (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/setmode.c b/Xi/setmode.c
index f2458f4e6..9c3feb4db 100644
--- a/Xi/setmode.c
+++ b/Xi/setmode.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/setmode.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/***********************************************************************
*
@@ -56,14 +57,15 @@ SOFTWARE.
#define NEED_REPLIES
#include "X.h" /* for inputstr.h */
#include "Xproto.h" /* Request macro */
+#include "inputstr.h" /* DeviceIntPtr */
#include "XI.h"
#include "XIproto.h"
-#include "inputstr.h" /* DeviceIntPtr */
+#include "XIstubs.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "setmode.h"
/***********************************************************************
*
@@ -138,6 +140,7 @@ ProcXSetDeviceMode(client)
*
*/
+void
SRepXSetDeviceMode (client, size, rep)
ClientPtr client;
int size;
diff --git a/Xi/stubs.c b/Xi/stubs.c
index 9c9269719..991f8b433 100644
--- a/Xi/stubs.c
+++ b/Xi/stubs.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/stubs.c,v 3.4 2001/12/14 19:58:59 dawes Exp $ */
/*
* stubs.c -- stub routines for the X server side of the XINPUT
@@ -62,6 +63,7 @@ SOFTWARE.
#include "inputstr.h"
#include "XI.h"
#include "XIproto.h"
+#include "XIstubs.h"
/***********************************************************************
*
@@ -95,6 +97,7 @@ ChangeKeyboardDevice (old_dev, new_dev)
/***********************************************************************
DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
**********************************************************************/
+ return BadMatch;
}
@@ -129,9 +132,17 @@ ChangeKeyboardDevice (old_dev, new_dev)
*/
int
+#if NeedFunctionPrototypes
+ChangePointerDevice (
+ DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev,
+ unsigned char x,
+ unsigned char y)
+#else
ChangePointerDevice (old_dev, new_dev, x, y)
DeviceIntPtr old_dev, new_dev;
unsigned char x, y;
+#endif
{
/***********************************************************************
InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
@@ -143,6 +154,7 @@ ChangePointerDevice (old_dev, new_dev, x, y)
else
axes_changed = FALSE;
*************************************************************************/
+ return BadMatch;
}
/***********************************************************************
@@ -194,13 +206,13 @@ CloseInputDevice (d, client)
void
AddOtherInputDevices ()
{
+ /**********************************************************************
+ for each uninitialized device, do something like:
+
DeviceIntPtr dev;
DeviceProc deviceProc;
pointer private;
- /**********************************************************************
- for each uninitialized device, do something like:
-
dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE);
dev->public.devicePrivate = private;
RegisterOtherDevice(dev);
diff --git a/Xi/ungrdev.c b/Xi/ungrdev.c
index 90a01a4bc..a1ab911fe 100644
--- a/Xi/ungrdev.c
+++ b/Xi/ungrdev.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/ungrdev.c,v 3.3 2001/12/14 19:58:59 dawes Exp $ */
/***********************************************************************
*
@@ -59,11 +60,11 @@ SOFTWARE.
#include "inputstr.h" /* DeviceIntPtr */
#include "windowstr.h" /* window structure */
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
+#include "ungrdev.h"
/***********************************************************************
*
diff --git a/Xi/ungrdevb.c b/Xi/ungrdevb.c
index 917efda9c..66ccc72af 100644
--- a/Xi/ungrdevb.c
+++ b/Xi/ungrdevb.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/ungrdevb.c,v 3.4 2001/12/14 19:59:00 dawes Exp $ */
/***********************************************************************
*
@@ -60,15 +61,16 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "dixgrabs.h"
+
+#include "ungrdevb.h"
#define AllModifiersMask ( \
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
Mod3Mask | Mod4Mask | Mod5Mask )
-extern int IReqCode;
-extern int BadDevice;
-extern int DeviceButtonPress;
-extern void (* ReplySwapVector[256]) ();
-DeviceIntPtr LookupDeviceIntRec();
/***********************************************************************
*
diff --git a/Xi/ungrdevk.c b/Xi/ungrdevk.c
index 26c75f365..d7632db2a 100644
--- a/Xi/ungrdevk.c
+++ b/Xi/ungrdevk.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
********************************************************/
+/* $XFree86: xc/programs/Xserver/Xi/ungrdevk.c,v 3.4 2001/12/14 19:59:00 dawes Exp $ */
/***********************************************************************
*
@@ -60,15 +61,16 @@ SOFTWARE.
#include "windowstr.h" /* window structure */
#include "XI.h"
#include "XIproto.h"
+#include "extnsionst.h"
+#include "extinit.h" /* LookupDeviceIntRec */
+#include "exglobals.h"
+#include "dixgrabs.h"
+
+#include "ungrdevk.h"
#define AllModifiersMask ( \
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
Mod3Mask | Mod4Mask | Mod5Mask )
-extern int IReqCode;
-extern int BadDevice;
-extern void (* ReplySwapVector[256]) ();
-extern int DeviceKeyPress;
-DeviceIntPtr LookupDeviceIntRec();
/***********************************************************************
*
diff --git a/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias b/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias
index e69de29bb..1499aa845 100644
--- a/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias
+++ b/XpConfig/C/print/models/HPDJ1600C/fonts/fonts.alias
@@ -0,0 +1 @@
+! So the file isn't empty
diff --git a/XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias b/XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias
index e69de29bb..1499aa845 100644
--- a/XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias
+++ b/XpConfig/C/print/models/HPLJ4family/fonts/fonts.alias
@@ -0,0 +1 @@
+! So the file isn't empty
diff --git a/Xprint/AttrValid.c b/Xprint/AttrValid.c
index 1303701af..83d6b9674 100644
--- a/Xprint/AttrValid.c
+++ b/Xprint/AttrValid.c
@@ -30,13 +30,11 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
-#include <scrnintstr.h>
+/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.c,v 1.5 2001/12/21 21:02:04 dawes Exp $ */
-#define _XP_PRINT_SERVER_
-#include "extensions/Printstr.h"
-#undef _XP_PRINT_SERVER_
+#include <scrnintstr.h>
-#include "AttrValid.h"
+#include "attributes.h"
/*
* default medium-source-sizes supported = na-letter w/.25" margins
@@ -48,7 +46,7 @@ static XpOidMediumDiscreteSizeList DefaultMediumSizeList = {
&DefaultMediumSize, 1
};
static XpOidMediumSourceSize DefaultMediumSourceSize = {
- xpoid_unspecified, XpOidMediumSS_DISCRETE, &DefaultMediumSizeList
+ xpoid_unspecified, XpOidMediumSS_DISCRETE, { &DefaultMediumSizeList }
};
static XpOidMediumSS DefaultMediumSS = {
&DefaultMediumSourceSize, 1
@@ -300,7 +298,7 @@ XpPutMediumSSAttr(XpContextPtr pContext,
}
const XpOidMediumSS*
-XpGetDefaultMediumSS()
+XpGetDefaultMediumSS(void)
{
return &DefaultMediumSS;
}
diff --git a/Xprint/AttrValid.h b/Xprint/AttrValid.h
index dab3c2def..87ab48b69 100644
--- a/Xprint/AttrValid.h
+++ b/Xprint/AttrValid.h
@@ -30,12 +30,13 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.h,v 1.7 2001/12/21 21:02:04 dawes Exp $ */
#ifndef _Xp_AttrValid_h
#define _Xp_AttrValid_h
+#include <X11/extensions/Printstr.h>
#include "Oid.h"
-#include "attributes.h"
#define XpNumber(a) (sizeof(a) / sizeof(*(a)))
@@ -83,6 +84,9 @@ typedef struct
(const char*)XpGetOneAttribute(pContext, pool, (char*)XpOidString(oid))
#define XpPutStringAttr(pContext, pool, oid, value) \
XpPutOneAttribute(pContext, pool, XpOidString(oid), value)
+
+#ifdef _XP_PRINT_SERVER_ /* needed for XpContextPtr in Printstr.h */
+
/*
* XpOid-valued attribute access
*/
@@ -175,7 +179,7 @@ void XpPutMediumSSAttr(XpContextPtr pContext,
XPAttributes pool,
XpOid oid,
const XpOidMediumSS* msss);
-const XpOidMediumSS* XpGetDefaultMediumSS();
+const XpOidMediumSS* XpGetDefaultMediumSS(void);
/*
* XpOidTrayMediumList-valued attribute access
@@ -189,12 +193,15 @@ void XpPutTrayMediumListAttr(XpContextPtr pContext,
XPAttributes pool,
XpOid oid,
const XpOidTrayMediumList* tm);
+BOOL XpOidTrayMediumListHasTray(const XpOidTrayMediumList* list, XpOid tray);
+
/*
* Attribute pool validation
*/
void XpValidateAttributePool(XpContextPtr pContext,
XPAttributes pool,
const XpValidatePoolsRec* vpr);
+void XpValidateNotificationProfile(XpContextPtr pContext);
void XpValidatePrinterPool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr);
void XpValidateJobPool(XpContextPtr pContext,
@@ -203,6 +210,10 @@ void XpValidateDocumentPool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr);
void XpValidatePagePool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr);
+void XpValidatePrinterMediaAttrs(XpContextPtr pContext,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_sizes);
+#endif /* _XP_PRINT_SERVER_ */
#endif /* _Xp_AttrValid_h - don't add anything after this line */
diff --git a/Xprint/DiPrint.h b/Xprint/DiPrint.h
index a4b969141..3830c20d2 100644
--- a/Xprint/DiPrint.h
+++ b/Xprint/DiPrint.h
@@ -30,6 +30,8 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/DiPrint.h,v 1.4 2001/01/17 22:36:28 dawes Exp $ */
+
/*
* The XpDiListEntry struct is the type of each element of the array
* handed back to the extension code to handle a GetPrinterList request.
@@ -38,6 +40,11 @@ copyright holders.
* request will allow us to build it with the description in the locale of
* the requesting client.
*/
+#ifndef _XpDiPrint_H_
+#define _XpDiPrint_H_ 1
+
+#include "scrnintstr.h"
+
typedef struct _diListEntry {
char *name;
char *description;
@@ -52,3 +59,17 @@ extern XpDiListEntry **XpDiGetPrinterList(
char *name,
int localeLen,
char *locale);
+
+extern char * XpDiGetDriverName(int index, char *printerName);
+
+extern WindowPtr XpDiValidatePrinter(char *printerName, int printerNameLen);
+
+extern int XprintOptions(int argc, char **argv, int i);
+
+extern void PrinterInitOutput(ScreenInfo *pScreenInfo, int argc, char **argv);
+
+extern void _XpVoidNoop(void);
+
+extern Bool _XpBoolNoop(void);
+
+#endif /* _XpDiPrint_H_ */
diff --git a/Xprint/Init.c b/Xprint/Init.c
index 06757fa77..a022c31c7 100644
--- a/Xprint/Init.c
+++ b/Xprint/Init.c
@@ -50,6 +50,7 @@ copyright holders.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/Init.c,v 1.13 2001/12/21 21:02:04 dawes Exp $ */
#include <unistd.h>
#include <stdlib.h>
@@ -74,53 +75,23 @@ copyright holders.
#include "cursor.h"
#include "misc.h"
#include "windowstr.h"
-#include "scrnintstr.h"
#include "inputstr.h"
#include "gcstruct.h"
#include "fonts/fontstruct.h"
#include "errno.h"
-#define _XP_PRINT_SERVER_
-#include "Printstr.h"
-#undef _XP_PRINT_SERVER_
-
typedef char *XPointer;
+#define HAVE_XPointer 1
+
#define Status int
#include <Xresource.h>
#include "DiPrint.h"
-#include "AttrValid.h"
#include "attributes.h"
-extern char *display; /* display number as a string */
-
-#if 0
-/* extern char *Xalloc(); */
-extern void Xfree();
-/* extern char *Xrealloc(); */
-#else
#include "os.h"
-#endif
-
-extern char *getenv();
-extern void XpAddPrinterAttribute();
-extern char *XpGetConfigDir();
-extern XpContextPtr XpContextOfClient();
-
-/*
-extern int GiveUp();
-*/
-
-extern WindowPtr *WindowTable; /* declared in dix:globals.c */
-
-#if NeedFunctionPrototypes
-
-static void GetDriverFromPrinterName(
- char *printerName,
- char **driverName,
- Bool (**initScreenFunc)());
static void GenericScreenInit(
int index,
ScreenPtr pScreen,
@@ -132,15 +103,6 @@ static Bool InitPrintDrivers(
int argc,
char **argv);
-#else
-
-static void GetDriverFromPrinterName();
-static void GenericScreenInit();
-static Bool InitPrintDrivers();
-
-#endif
-
-
/*
* The following two defines are used to build the name "X*printers", where
* the "*" is replaced by the display number. This is used to construct
@@ -188,7 +150,7 @@ const char *LIST_QUEUES = "LANG=C lpstat -v | "
" print substr($5, 1, x-1)"
" }' | sort";
#else
-#if defined(CSRG_BASED) || defined(linux)
+#if defined(CSRG_BASED) || defined(linux) || defined(ISC) || defined(__GNUC__)
const char *LIST_QUEUES = "LANG=C lpc status | grep -v '^\t' | "
"sed -e /:/s/// | sort";
#else
@@ -209,12 +171,11 @@ const char *LIST_QUEUES = "LANG=C lpstat -v | "
static
PixmapFormatRec RasterPixmapFormats[] = {
- 1, 1, BITMAP_SCANLINE_PAD
+ { 1, 1, BITMAP_SCANLINE_PAD }
};
#define NUMRASTFORMATS (sizeof RasterPixmapFormats)/(sizeof RasterPixmapFormats[0])
-extern Bool InitializeRasterDriver();
-extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
+#include "raster/Raster.h"
#endif
@@ -222,51 +183,45 @@ extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
static
PixmapFormatRec ColorPclPixmapFormats[] = {
- 1, 1, BITMAP_SCANLINE_PAD,
- 8, 8, BITMAP_SCANLINE_PAD,
- 24,32, BITMAP_SCANLINE_PAD
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 24,32, BITMAP_SCANLINE_PAD }
};
#define NUMCPCLFORMATS (sizeof ColorPclPixmapFormats)/(sizeof ColorPclPixmapFormats[0])
-extern Bool InitializeColorPclDriver();
-extern XpValidatePoolsRec PclValidatePoolsRec;
-
#endif
#ifdef XPMONOPCLDDX
static
PixmapFormatRec MonoPclPixmapFormats[] = {
- 1, 1, BITMAP_SCANLINE_PAD
+ { 1, 1, BITMAP_SCANLINE_PAD }
};
#define NUMMPCLFORMATS (sizeof MonoPclPixmapFormats)/(sizeof MonoPclPixmapFormats[0])
-extern Bool InitializeMonoPclDriver();
-extern XpValidatePoolsRec PclValidatePoolsRec;
+#endif
+#if defined(XPPCLDDX) || defined(XPMONOPCLDDX)
+#include "pcl/Pcl.h"
#endif
#ifdef XPPSDDX
static
PixmapFormatRec PSPixmapFormats[] = {
- 1, 1, BITMAP_SCANLINE_PAD,
- 8, 8, BITMAP_SCANLINE_PAD,
- 24,32, BITMAP_SCANLINE_PAD
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 24,32, BITMAP_SCANLINE_PAD }
};
#define NUMPSFORMATS (sizeof PSPixmapFormats)/(sizeof PSPixmapFormats[0])
-extern Bool InitializePsDriver();
-extern XpValidatePoolsRec PsValidatePoolsRec;
+#include "ps/Ps.h"
#endif
-
-typedef Bool (*pBFunc)();
-typedef void (*pVFunc)();
/*
* The driverInitArray contains an entry for each driver the
* server knows about. Each element contains pointers to pixmap formats, the
@@ -375,10 +330,6 @@ static const char configFilePath[] =
static const char printServerConfigDir[] = "XPSERVERCONFIGDIR";
-static int printScreenPrivIndex,
- printWindowPrivIndex,
- printGCPrivIndex;
-static unsigned long printGeneration = 0;
static char *configFileName = (char *)NULL;
static Bool freeDefaultFontPath = FALSE;
static char *origFontPath = (char *)NULL;
@@ -389,12 +340,11 @@ static char *origFontPath = (char *)NULL;
* of the next option to process.
*/
int
-XprintOptions(argc, argv, i)
- int argc;
- char **argv;
- int i;
+XprintOptions(
+ int argc,
+ char **argv,
+ int i)
{
- extern void ddxUseMsg();
if(strcmp(argv[i], "-XpFile") == 0)
{
if ((i + 1) >= argc) {
@@ -427,9 +377,7 @@ static pIFunc
GetInitFunc(driverName)
*/
-static Bool (*
-GetInitFunc(driverName))()
- char *driverName;
+static pBFunc GetInitFunc(char *driverName)
{
driverInitRec *pInitRec;
int numDrivers = sizeof(driverInits)/sizeof(driverInitRec);
@@ -441,7 +389,7 @@ GetInitFunc(driverName))()
return pInitRec->initFunc;
}
- return (Bool(*)())NULL;
+ return 0;
}
static void
@@ -464,17 +412,17 @@ GetDimFuncAndRec(
}
}
- *dimensionsFunc = (pVFunc)NULL;
- *pValRec = (XpValidatePoolsRec *)NULL;
+ *dimensionsFunc = 0;
+ *pValRec = 0;
return;
}
static void
-FreePrinterDb()
+FreePrinterDb(void)
{
PrinterDbPtr pCurEntry, pNextEntry;
- for(pCurEntry = printerDb, pNextEntry = (PrinterDbPtr)NULL;
+ for(pCurEntry = printerDb, pNextEntry = 0;
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pNextEntry)
{
pNextEntry = pCurEntry->next;
@@ -486,7 +434,7 @@ FreePrinterDb()
*/
xfree(pCurEntry);
}
- printerDb = (PrinterDbPtr)NULL;
+ printerDb = 0;
}
/*
@@ -496,8 +444,7 @@ FreePrinterDb()
* XXX AddPrinterDbName needs to check for (and not add) duplicate names.
*/
static Bool
-AddPrinterDbName(name)
- char *name;
+AddPrinterDbName(char *name)
{
PrinterDbPtr pEntry = (PrinterDbPtr)xalloc(sizeof(PrinterDbEntry));
@@ -519,8 +466,7 @@ AddPrinterDbName(name)
}
static void
-AugmentPrinterDb(command)
- char *command;
+AugmentPrinterDb(const char *command)
{
FILE *fp;
char name[256];
@@ -539,7 +485,7 @@ AugmentPrinterDb(command)
* FreeNameMap frees all remaining memory associated with the nameMap.
*/
static void
-FreeNameMap()
+FreeNameMap(void)
{
NameMapPtr pEntry, pTmp;
@@ -561,9 +507,7 @@ FreeNameMap()
* AddNameMap adds an element to the nameMap linked list.
*/
static Bool
-AddNameMap(name, qualifier)
- char *name;
- char *qualifier;
+AddNameMap(char *name, char *qualifier)
{
NameMapPtr pEntry;
@@ -585,7 +529,7 @@ AddNameMap(name, qualifier)
* is NULLed out.
*/
static void
-MergeNameMap()
+MergeNameMap(void)
{
NameMapPtr pMap;
PrinterDbPtr pDb;
@@ -608,7 +552,7 @@ MergeNameMap()
* each printer in the printerDb.
*/
static void
-CreatePrinterAttrs()
+CreatePrinterAttrs(void)
{
PrinterDbPtr pDb;
@@ -642,7 +586,7 @@ CreatePrinterAttrs()
* the screens.
*/
static void
-StoreDriverNames()
+StoreDriverNames(void)
{
PrinterDbPtr pEntry;
@@ -653,7 +597,7 @@ StoreDriverNames()
"xp-ddx-identifier");
if(pEntry->driverName == (char *)NULL ||